/* cup.mn «Нээлттэй» site stylesheet (F4c, 04 §3.1). Source of truth: DESIGN.md; ported from docs/design/f1/a/
   (tokens.css + site.css). Holds tokens, the base reset and the shared components only; each page group keeps its own
   css/pages/*.css. No CSS framework or icon font (F4h dropped Bootstrap, slick, the icon kit and legacy.css).
   One blue only: the logo blue #0a63b5 (no navy, no darker hover blue). Gold is a fill, never text. */

:root {
  /* Palette (contrast measured on the ground named after each colour) */
  --bg: #ffffff;
  --surface: #f3f6fa;        /* soft section / card ground */
  --surface-2: #e8eef5;      /* pressed, selected */
  --ink: #16191d;            /* 17.6:1 on bg */
  --ink-2: #44515f;          /* secondary text: 8.1:1 on bg */
  --line: #dfe5ec;           /* hairlines; decoration only */
  --blue: #0a63b5;           /* logo blue: 6.1:1 on bg, white on it 6.1:1 */
  --blue-tint: #e6f0fa;      /* selected nav, chips, icon wells; blue on it 5.3:1 */
  --blue-tint-2: #d6e6f7;    /* tint hover; blue on it 4.8:1 */
  --blue-soft: #c9dcf0;      /* the second series in figures and bars */
  --gold: #d4ac61;           /* FILL ONLY; ink on gold 8.3:1 */
  --ok: #17663a;
  --ok-tint: #e3f3e8;
  --focus: #0a63b5;

  /* Type: Onest, one family; rank from size + weight */
  --font: "Onest", system-ui, sans-serif;
  --fs-display: clamp(2.75rem, 1.2rem + 5.2vw, 5.5rem);  /* 44 → 88 */
  --fs-h1: clamp(2.25rem, 1.4rem + 3vw, 4rem);           /* 36 → 64 */
  --fs-h2: clamp(1.75rem, 1.2rem + 1.8vw, 2.75rem);      /* 28 → 44 */
  --fs-h3: clamp(1.25rem, 1.05rem + .6vw, 1.625rem);     /* 20 → 26 */
  --fs-lead: clamp(1.1875rem, 1.1rem + .35vw, 1.375rem); /* 19 → 22 */
  --fs-body: 1.125rem;   /* 18 */
  --fs-meta: 1rem;       /* 16: dates, sizes, captions; never smaller */
  --lh-tight: 1.04;
  --lh-head: 1.15;
  --lh-body: 1.6;
  --track-display: -0.035em;
  --track-head: -0.02em;

  /* Space (4-based) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 144px;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1280px;
  --measure: 66ch;

  /* Radius */
  --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-xl: 32px; --r-pill: 999px;

  /* Elevation: surfaces first, shadow only for things that float */
  --e1: 0 1px 2px rgb(22 25 29 / .06), 0 2px 8px rgb(22 25 29 / .05);
  --e2: 0 4px 12px rgb(22 25 29 / .08), 0 16px 40px rgb(22 25 29 / .08);

  /* Motion (DESIGN.md «Motion»): entrances decelerate hard, state changes use the softer --ease */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: 150ms;     /* press, hover */
  --t-med: 250ms;      /* menus, chips, indicators, accordion */
  --t-reveal: 800ms;   /* scroll reveals (transform; opacity is 600 ms) */
  --t-hero: 900ms;     /* the hero headline words */
  --stagger: 60ms;     /* list siblings; capped at 8 items */

  /* Sizes */
  --tap: 48px;
  --header-h: 76px;
}

/* ---------- Reset (F4h) ----------
   The pages were built and checked with Bootstrap 5.1's reboot underneath, so when Bootstrap left, the parts of its
   reboot that touch our markup moved here with the same values: nothing shifts on screen. Element selectors only
   ((0,0,1)); the base rules, components and page CSS below override them. */
@media (prefers-reduced-motion: no-preference) {
  :root { scroll-behavior: smooth; }
}
h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: .5rem; font-weight: 500; line-height: 1.2; }
h1 { font-size: calc(1.375rem + 1.5vw); }
h2 { font-size: calc(1.325rem + .9vw); }
h3 { font-size: calc(1.3rem + .6vw); }
h4 { font-size: calc(1.275rem + .3vw); }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }
@media (min-width: 1200px) { h1 { font-size: 2.5rem; } h2 { font-size: 2rem; } h3 { font-size: 1.75rem; } h4 { font-size: 1.5rem; } }
p { margin-top: 0; margin-bottom: 1rem; }
address { margin-bottom: 1rem; font-style: normal; line-height: inherit; }
ol, ul { padding-left: 2rem; }
ol, ul, dl { margin-top: 0; margin-bottom: 1rem; }
ol ol, ul ul, ol ul, ul ol { margin-bottom: 0; }
dt { font-weight: 700; }
dd { margin-bottom: .5rem; margin-left: 0; }
blockquote, figure { margin: 0 0 1rem; }
hr { margin: 1rem 0; color: inherit; background-color: currentColor; border: 0; opacity: .25; }
hr:not([size]) { height: 1px; }
b, strong { font-weight: bolder; }
small { font-size: .875em; }
sub, sup { position: relative; font-size: .75em; line-height: 0; vertical-align: baseline; }
sub { bottom: -.25em; }
sup { top: -.5em; }
a:not([href]):not([class]), a:not([href]):not([class]):hover { color: inherit; text-decoration: none; }
img, svg { vertical-align: middle; }
table { caption-side: bottom; border-collapse: collapse; }
th { text-align: inherit; text-align: -webkit-match-parent; }
thead, tbody, tfoot, tr, td, th { border-color: inherit; border-style: solid; border-width: 0; }
label { display: inline-block; }
input, button, select, optgroup, textarea { margin: 0; font-family: inherit; font-size: inherit; line-height: inherit; }
button { border-radius: 0; }
button:focus:not(:focus-visible) { outline: 0; }
button, select { text-transform: none; }
button, [type=button], [type=reset], [type=submit] { -webkit-appearance: button; }
button:not(:disabled), [type=button]:not(:disabled), [type=reset]:not(:disabled), [type=submit]:not(:disabled), [role=button] { cursor: pointer; }
::-moz-focus-inner { padding: 0; border-style: none; }
textarea { resize: vertical; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
[type=search] { outline-offset: -2px; -webkit-appearance: textfield; }
::-webkit-search-decoration { -webkit-appearance: none; }
::file-selector-button { font: inherit; }
iframe { border: 0; }
summary { display: list-item; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-body)/var(--lh-body) var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-weight: 650; letter-spacing: var(--track-head); line-height: var(--lh-head); text-wrap: balance; }
p, li, figcaption, dd { text-wrap: pretty; }
a { color: var(--blue); text-decoration-thickness: 1.5px; text-underline-offset: .2em; }
a:hover { color: var(--blue); text-decoration-thickness: 2.5px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--blue-tint); color: var(--ink); }
time { white-space: nowrap; }
.ic { width: 24px; height: 24px; flex: none; stroke-width: 1.75; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.meta { font-size: var(--fs-meta); color: var(--ink-2); }
.meta b { color: var(--ink); font-weight: 600; }
.lead { font-size: var(--fs-lead); font-weight: 400; line-height: 1.5; color: var(--ink-2); }
/* The layout's own blocks start from zero (the reset's margins, list padding; block images). */
:where(.hdr, .ftr) :is(ul, h2, p) { margin: 0; padding: 0; list-style: none; }   /* (0,0,1): beats the reset, loses to any class */
:where(.hdr, .ftr) img { display: block; }
.skip { position: absolute; left: var(--s4); top: -100px; z-index: 30; padding: 12px 20px; border-radius: var(--r-pill); background: var(--blue); color: #fff; font-weight: 600; text-decoration: none; }
.skip:focus { top: var(--s3); color: #fff; }

/* ---------- Header: white, light, sticky ---------- */
.hdr { position: sticky; top: 0; z-index: 10; background: rgb(255 255 255 / .96); box-shadow: 0 1px 0 var(--line); transition: box-shadow var(--t-med) var(--ease), transform var(--t-med) var(--ease-out); }
.hdr.is-scrolled { box-shadow: 0 1px 0 var(--line), var(--e1); }
.hdr .wrap { height: var(--header-h); display: flex; align-items: center; gap: var(--s5); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand:hover { color: var(--ink); }
.brand .tile { width: 44px; height: 44px; overflow: hidden; border-radius: 10px; flex: none; }
.brand .tile img { height: 44px; width: auto; max-width: none; }
.brand b { display: block; font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.brand small { display: block; font-size: .875rem; font-weight: 500; color: var(--ink-2); letter-spacing: 0; line-height: 1.3; }

/* Nav (F4b, client 2026-11-19): links in logo blue, never solid buttons. Always .hdr .nav (page CSS never styles a bare .nav). One blue-tint pill marks the current page
   and slides under the hovered/focused link (motion.js); without JS each link tints itself. */
.hdr .nav { position: relative; display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; }
.hdr .nav > a, .dd-btn { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 14px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--blue); font: 500 1.0625rem/1 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.hdr .nav > a:hover, .dd-btn:hover, .hdr .nav > a[aria-current], .dd-btn.is-current { background: var(--blue-tint); color: var(--blue); }
.hdr .nav > a[aria-current], .dd-btn.is-current { font-weight: 600; }
.hdr .nav > a[aria-current]::after, .dd-btn.is-current::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--gold); }
.hdr .nav > a:active, .dd-btn:active { transform: scale(.97); }
.dd-btn .ic { width: 18px; height: 18px; transform: rotate(90deg); transition: transform var(--t-med) var(--ease); }
.dd-btn[aria-expanded="true"] .ic { transform: rotate(-90deg); }
.nav-pill { position: absolute; left: 0; top: 0; z-index: 0; width: 0; height: var(--tap); border-radius: var(--r-pill); background: var(--blue-tint); opacity: 0; pointer-events: none; }
.dd { position: relative; }
.dd-panel { position: absolute; top: calc(100% + 10px); left: 0; z-index: 20; display: grid; gap: 2px; min-width: 290px; padding: 8px; border-radius: var(--r-lg); background: #fff; box-shadow: var(--e2); }
.dd-panel a { display: flex; align-items: center; min-height: var(--tap); padding: 0 16px; border-radius: var(--r-md); color: var(--ink); font-weight: 500; text-decoration: none; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.dd-panel a:hover { background: var(--surface); color: var(--blue); }
.dd-panel a[aria-current] { background: var(--blue-tint); color: var(--blue); font-weight: 600; }
.dd:not(.is-open) .dd-panel { display: none; }
.dd:focus-within .dd-panel { display: grid; }
/* Without JS (or if motion.js failed) the panel also opens on hover; the bridge keeps it open across the 10 px gap. */
html:not(.js) .dd:hover .dd-panel { display: grid; }
html:not(.js) .dd-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.hdr .search { display: flex; align-items: center; gap: 8px; height: var(--tap); padding: 0 18px 0 14px; border-radius: var(--r-pill); background: var(--surface); color: var(--ink-2); font: 500 1rem var(--font); border: 0; cursor: pointer; text-decoration: none; transition: background var(--t-fast) var(--ease); }
.hdr .search:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn { display: none; width: var(--tap); height: var(--tap); padding: 0; border-radius: 50%; place-items: center; background: var(--surface); color: var(--ink); border: 0; cursor: pointer; transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn:active { transform: scale(.94); }
.bars { display: grid; gap: 6px; width: 20px; }
.bars i { display: block; height: 2px; border-radius: 2px; background: currentColor; transition: transform var(--t-med) var(--ease-out); }
.burger[aria-expanded="true"] .bars i:first-child { transform: translateY(4px) rotate(45deg); }
.burger[aria-expanded="true"] .bars i:last-child { transform: translateY(-4px) rotate(-45deg); }
.mnav, .mclose { display: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink); font: 600 1.0625rem/1 var(--font); text-align: center; text-decoration: none; vertical-align: middle; cursor: pointer; -webkit-user-select: none; user-select: none; transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.btn:focus { box-shadow: none; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.btn .ic { transition: transform var(--t-fast) var(--ease); }
.btn:hover .ic.dl { transform: translateY(2px); }
.btn-primary, .btn-primary:focus, .btn-primary:active { background: var(--blue); color: #fff; border-color: transparent; }
.btn-primary:hover { background: var(--blue); color: #fff; box-shadow: var(--e2); transform: translateY(-1px); }
.btn-soft { background: var(--surface); color: var(--ink); }
.btn-soft:hover { background: var(--surface-2); color: var(--ink); }
.btn-tint { background: var(--blue-tint); color: var(--blue); }
.btn-tint:hover { background: var(--blue-tint-2); color: var(--blue); }
/* «Нэвтрэх» (client 2026-11-19): the site's gold with ink text (8.3:1). Hover keeps the gold, lifts, one light sweep. */
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover, .btn-gold:focus { background: var(--gold); color: var(--ink); }
.btn-gold:hover { box-shadow: var(--e2); transform: translateY(-1px); }
.btn:active, .btn:active:focus { transform: scale(.97); box-shadow: none; }
.btn-sm { min-height: var(--tap); padding: 0 20px; font-size: 1rem; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-weight: 600; text-decoration: none; }
.link-arrow .ic { transition: transform var(--t-fast) var(--ease); }
.link-arrow:hover .ic { transform: translateX(3px); }

/* ---------- Sections and page heads ---------- */
.sec { padding-block: var(--s9); }
.sec-tint { background: var(--surface); }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s5); margin-bottom: var(--s7); }
.sec-head h2 { margin: 0; font-size: var(--fs-h2); }
.sec-head p { color: var(--ink-2); margin: var(--s3) 0 0; max-width: 52ch; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; padding: 0; list-style: none; font-size: var(--fs-meta); color: var(--ink-2); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--blue); text-decoration: underline; }
.page-head { padding-block: var(--s7); }
.page-head h1 { margin: var(--s4) 0 0; font-size: var(--fs-h1); letter-spacing: var(--track-display); line-height: 1.05; font-weight: 700; }
.page-head .lead { margin: var(--s4) 0 0; max-width: 52ch; }
.empty-note { color: var(--ink-2); padding: var(--s5); border-radius: var(--r-lg); background: var(--surface); }

/* ---------- Chips (filters) with an optional sliding indicator ---------- */
.chips { position: relative; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-ind { position: absolute; left: 0; top: 0; z-index: 0; width: 0; height: 0; border-radius: var(--r-pill); background: var(--blue); opacity: 0; pointer-events: none; }
.chips .chip { position: relative; z-index: 1; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border: 0; border-radius: var(--r-pill); background: var(--surface); color: var(--ink); font: 500 1rem var(--font); text-decoration: none; cursor: pointer; transition: background var(--t-fast) var(--ease), color var(--t-med) var(--ease), transform var(--t-fast) var(--ease); }
.chip:active { transform: scale(.97); }
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip[aria-pressed="true"], .chip[aria-current] { background: var(--blue); color: #fff; }
.chip .count { font-size: .9375rem; color: var(--ink-2); }
.chip[aria-pressed="true"] .count, .chip[aria-current] .count { color: #fff; }

/* ---------- Fields ---------- */
.field { display: flex; align-items: center; gap: 12px; height: 60px; margin: 0; padding: 0 8px 0 20px; border-radius: var(--r-pill); background: var(--surface); box-shadow: inset 0 0 0 1px transparent; transition: box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.field:focus-within { background: #fff; box-shadow: inset 0 0 0 2px var(--blue); }
.field input { flex: 1; min-width: 0; border: 0; background: transparent; font: 400 1.125rem var(--font); color: var(--ink); outline: none; }
.field input::placeholder { color: var(--ink-2); }
.field .ic { color: var(--ink-2); transition: color var(--t-fast) var(--ease); }
.field:focus-within .ic { color: var(--blue); }

/* ---------- Pager ---------- */
.pager { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: var(--s8); }
.pager a, .pager span { min-width: var(--tap); min-height: var(--tap); padding: 0 16px; display: inline-grid; place-items: center; border-radius: var(--r-pill); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 500; }
.pager [aria-current] { background: var(--blue); color: #fff; }
.pager a:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- File rows (home latest files, the library, search) ---------- */
.docs { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.well { width: 56px; height: 56px; border-radius: var(--r-md); background: #fff; color: var(--blue); display: grid; place-items: center; }
.doc { display: grid; grid-template-columns: 56px 1fr auto; gap: var(--s5); align-items: center; padding: 20px 20px 20px 16px; border-radius: var(--r-lg); background: #fff; box-shadow: 0 1px 0 var(--line); transition: background var(--t-fast) var(--ease); }
.doc:hover { background: var(--surface); }
.doc .well { background: var(--blue-tint); }
.doc h3 { margin: 0; font-size: 1.25rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.doc h3 a { color: var(--ink); text-decoration: none; }
.doc h3 a:hover { color: var(--blue); text-decoration: underline; }
.doc .meta { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.doc .approved { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.doc .approved::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.doc .acts { display: flex; gap: 8px; }

/* ---------- Post card (F4e partials/post-card: /news, a post's «Бусад мэдээ», /training; F4h moved it here) ---------- */
.news-card { position: relative; display: grid; align-content: start; gap: var(--s3); min-width: 0; color: var(--ink); }
.news-card .ph { overflow: hidden; border-radius: var(--r-lg); background: var(--surface); }
.news-card .ph img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; transition: opacity 400ms var(--ease), transform var(--t-med) var(--ease); }
.news-card:hover .ph img { transform: scale(1.04); }
/* News without a picture: the logo tile on a surface (DESIGN.md «Cards»). */
.news-card .noimg, .feature .noimg { display: grid; place-items: center; aspect-ratio: 16 / 10; border-radius: var(--r-lg); background: var(--surface); }
.news-card .noimg img, .feature .noimg img { display: block; width: 64px; height: 64px; border-radius: var(--r-sm); }
.news-card .meta { margin: var(--s1) 0 0; }
.news-card h3 { margin: 0; font-size: 1.375rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.news-card h3 a { color: var(--ink); text-decoration: none; transition: color var(--t-fast) var(--ease); }
/* the title's link covers the whole card: one tab stop, the card is the target */
.news-card h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--r-lg); }
.news-card h3 a:focus-visible { outline: 0; }
.news-card h3 a:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 6px; }
.news-card:hover h3 a { color: var(--blue); }
.news-card .sum { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Footer ---------- */
/* Bottom padding clears the fixed .totop button (52 px + 16 px offset), so it never covers the last footer row. */
.ftr { margin-top: var(--s9); padding-block: var(--s8) 88px; background: var(--surface); }
.ftr .cols { display: grid; grid-template-columns: 1.6fr 1.2fr 1fr 1.2fr; gap: var(--s7); }
.ftr h2 { font-size: 1.125rem; font-weight: 650; margin-bottom: var(--s4); letter-spacing: 0; }
.ftr li { display: flex; gap: 10px; align-items: flex-start; padding-block: 6px; color: var(--ink-2); overflow-wrap: anywhere; }
.ftr li .ic { color: var(--ink-2); margin-top: 3px; }
.ftr a { color: var(--ink); text-decoration-color: var(--line); }
.ftr a:hover { color: var(--ink); text-decoration-color: currentColor; }
.ftr .brand { margin: 0 0 var(--s4); text-decoration: none; }
.ftr .stores { display: flex; flex-wrap: wrap; gap: 12px; margin-top: var(--s4); }
.ftr .stores a { display: block; border-radius: 10px; }
.ftr .stores img { height: 48px; width: auto; }
.ftr .base { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s3) var(--s5); margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--line); }
.ftr .social { display: flex; flex-wrap: wrap; gap: var(--s5); }

/* ---------- Back to top ---------- */
.totop { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 9; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--blue); box-shadow: var(--e2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease-out); }
.totop:hover { color: var(--blue); }
.totop .ic { transform: rotate(-90deg); }
.totop.is-shown { opacity: 1; transform: none; pointer-events: auto; }
.totop:active { transform: scale(.94); }

/* Narrow desktops: the full party name gives way so the nav, search and «Нэвтрэх» fit on one line. */
@media (max-width: 1280px) { .brand small { display: none; } .hdr .wrap { gap: var(--s4); } }

/* ---------- Phones and tablets (≤ 1080 px; checked at 360 px) ---------- */
@media (max-width: 1080px) {
  :root { --header-h: 64px; }
  .hdr .nav, .hdr .search, .hdr .wrap > .btn { display: none; }
  .hdr.is-hidden { transform: translateY(-100%); }
  .hdr .wrap { gap: 8px; }
  .iconbtn { display: grid; }
  /* No JS: the button can't open the menu, so a #mnav link does (the menu is its :target); back or a link closes it. */
  html.js .menu-link, html:not(.js) .burger { display: none; }
  html:not(.js) .mnav:target { visibility: visible; clip-path: inset(0 0 0 0); }
  .mclose { display: inline-flex; align-items: center; justify-self: end; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); color: var(--blue); font-weight: 500; text-decoration: none; }
  .mclose:hover { background: var(--surface); }
  html.js .mclose { display: none; }
  .brand .tile, .brand .tile img { width: auto; height: 40px; }
  .brand .tile { width: 40px; }
  .brand small { display: none; }
  .mnav { display: grid; align-content: start; gap: var(--s4); position: fixed; left: 0; right: 0; top: var(--header-h); bottom: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s4) var(--gutter) var(--s7); background: #fff; visibility: hidden; clip-path: inset(0 0 100% 0); transition: clip-path var(--t-med) var(--ease), visibility 0s linear var(--t-med); }
  .mnav.is-open { visibility: visible; clip-path: inset(0 0 0 0); transition: clip-path var(--t-reveal) var(--ease-out), visibility 0s; }
  .mlinks { display: grid; gap: 2px; }
  .mlinks a { position: relative; display: flex; align-items: center; min-height: 56px; padding: 0 20px 0 36px; border-radius: var(--r-pill); color: var(--blue); font-size: 1.1875rem; font-weight: 500; text-decoration: none; transition: background var(--t-fast) var(--ease); }
  .mlinks a:hover { background: var(--surface); color: var(--blue); }
  .mlinks a[aria-current] { background: var(--blue-tint); font-weight: 600; }
  .mlinks a[aria-current]::before { content: ""; position: absolute; left: 18px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--gold); }
  .mgroup { padding: var(--s4) 20px 0; font-size: var(--fs-meta); font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
  .mnav .btn-gold { margin-top: var(--s4); }
  .sec { padding-block: var(--s8); }
  .sec-head { margin-bottom: var(--s5); flex-wrap: wrap; align-items: baseline; }
  .link-arrow { white-space: nowrap; }
  .page-head { padding-block: var(--s5); }
  .doc { grid-template-columns: 48px 1fr; gap: var(--s4); padding: 16px; background: var(--surface); align-items: start; box-shadow: none; }
  .doc .well { width: 48px; height: 48px; background: #fff; }
  .doc .acts { grid-column: 1 / -1; }
  .doc .acts .btn { flex: 1; }
  .ftr { padding-block: var(--s7) 88px; }
  .ftr .cols { grid-template-columns: 1fr 1fr; gap: var(--s6); }
  .ftr .cols > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .ftr .cols { grid-template-columns: 1fr; }
  .ftr .base { flex-direction: column; }
}
@media (min-width: 1081px) { .only-m { display: none !important; } }
@media (max-width: 1080px) { .only-d { display: none !important; } }
