/* WaO Field Guide — styles
   Dark "war room" theme by default with a parchment light theme.
   Layout: sidebar (≥1100px), reading column, "On this page" rail (≥1320px). */

@font-face { font-family: "Inter"; src: url("../fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-var-latin-ext.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-var-cyrillic.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Cinzel"; src: url("../fonts/cinzel-600.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Cinzel"; src: url("../fonts/cinzel-700.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Cinzel"; src: url("../fonts/cinzel-600-latin-ext.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Cinzel"; src: url("../fonts/cinzel-700-latin-ext.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
/* Cinzel has no Cyrillic; Forum is a Roman-capital display face that does. */
@font-face { font-family: "Forum"; src: url("../fonts/forum-cyrillic.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }

/* ------------------------------------------------------------ tokens */
:root {
  color-scheme: dark;
  --bg: #0e1014;
  --bg-2: #11141a;
  --surface: #161a21;
  --surface-2: #1c2129;
  --surface-3: #232933;
  --border: #262c36;
  --border-strong: #353d4b;
  --text: #ece7dd;
  --text-2: #b5b0a5;
  --text-3: #858277;
  --gold: #e3b65c;
  --gold-2: #c8913a;
  --gold-soft: rgba(227, 182, 92, .12);
  --gold-line: rgba(227, 182, 92, .35);
  --link: #f0c878;
  --azure: #63c6ea;
  --azure-soft: rgba(99, 198, 234, .12);
  --emerald: #58c492;
  --emerald-soft: rgba(88, 196, 146, .12);
  --crimson: #ec6b62;
  --crimson-soft: rgba(236, 107, 98, .12);
  --violet: #ae92f4;
  --violet-soft: rgba(174, 146, 244, .13);
  --mark: rgba(227, 182, 92, .32);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.55);
  --topbar-bg: rgba(14, 16, 20, .82);
  --hero-glow: radial-gradient(1200px 500px at 85% -10%, rgba(227,182,92,.18), transparent 60%), radial-gradient(800px 400px at -10% 110%, rgba(99,198,234,.08), transparent 60%);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Cinzel", "Forum", "Trajan Pro", Georgia, serif;
  --topbar-h: 60px;
  --sidebar-w: 276px;
  --toc-w: 216px;
  --radius: 12px;
  --radius-sm: 8px;
  --gutter: 16px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5efe3; --bg-2: #efe7d6; --surface: #fffaf0; --surface-2: #f8f0e0; --surface-3: #f0e6d2;
    --border: #e3d7c0; --border-strong: #cfbe9f;
    --text: #29231b; --text-2: #5c5345; --text-3: #85796a;
    --gold: #9b6514; --gold-2: #7e4f0b; --gold-soft: rgba(155,101,20,.1); --gold-line: rgba(155,101,20,.35);
    --link: #8b560b;
    --azure: #1d7aa3; --azure-soft: rgba(29,122,163,.1);
    --emerald: #2c8659; --emerald-soft: rgba(44,134,89,.1);
    --crimson: #b5403a; --crimson-soft: rgba(181,64,58,.09);
    --violet: #6a4dc2; --violet-soft: rgba(106,77,194,.1);
    --mark: rgba(214, 160, 50, .35);
    --shadow: 0 1px 2px rgba(60,40,10,.08), 0 8px 24px rgba(60,40,10,.08);
    --shadow-lg: 0 24px 64px rgba(60,40,10,.2);
    --topbar-bg: rgba(245, 239, 227, .85);
    --hero-glow: radial-gradient(1200px 500px at 85% -10%, rgba(214,160,50,.2), transparent 60%), radial-gradient(800px 400px at -10% 110%, rgba(29,122,163,.07), transparent 60%);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5efe3; --bg-2: #efe7d6; --surface: #fffaf0; --surface-2: #f8f0e0; --surface-3: #f0e6d2;
  --border: #e3d7c0; --border-strong: #cfbe9f;
  --text: #29231b; --text-2: #5c5345; --text-3: #85796a;
  --gold: #9b6514; --gold-2: #7e4f0b; --gold-soft: rgba(155,101,20,.1); --gold-line: rgba(155,101,20,.35);
  --link: #8b560b;
  --azure: #1d7aa3; --azure-soft: rgba(29,122,163,.1);
  --emerald: #2c8659; --emerald-soft: rgba(44,134,89,.1);
  --crimson: #b5403a; --crimson-soft: rgba(181,64,58,.09);
  --violet: #6a4dc2; --violet-soft: rgba(106,77,194,.1);
  --mark: rgba(214, 160, 50, .35);
  --shadow: 0 1px 2px rgba(60,40,10,.08), 0 8px 24px rgba(60,40,10,.08);
  --shadow-lg: 0 24px 64px rgba(60,40,10,.2);
  --topbar-bg: rgba(245, 239, 227, .85);
  --hero-glow: radial-gradient(1200px 500px at 85% -10%, rgba(214,160,50,.2), transparent 60%), radial-gradient(800px 400px at -10% 110%, rgba(29,122,163,.07), transparent 60%);
}
:root[data-theme="dark"] { color-scheme: dark; }

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 20px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.7 var(--font-body);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; }
kbd {
  font: 600 .75rem/1 var(--font-body);
  padding: .25em .45em;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--surface-2);
  color: var(--text-2);
}
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 .1em; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.icon--ext { width: .8em; height: .8em; margin-left: .2em; vertical-align: 0; opacity: .7; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--gold); color: #111; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.skip-link:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  height: 100%; max-width: 1480px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--gutter);
}
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  border-radius: 10px; border: 1px solid transparent;
  background: none; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn .icon { width: 20px; height: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; flex: none; }
.brand__crest svg { width: 32px; height: 35px; display: block; filter: drop-shadow(0 2px 6px rgba(227,182,92,.25)); }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand__name { font: 700 1.05rem/1.1 var(--font-display); letter-spacing: .02em; white-space: nowrap; }
.brand__sub { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.search-trigger {
  margin-left: auto; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  height: 40px; width: min(420px, 100%);
  padding: 0 10px 0 12px;
  border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-3);
  cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
}
.search-trigger:hover { border-color: var(--gold-line); color: var(--text-2); }
.search-trigger .icon { width: 18px; height: 18px; }
.search-trigger__label { flex: 1; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-icon { display: inline-grid; }
.theme-icon--light { display: none; }
:root[data-theme="light"] .theme-icon--light { display: inline-grid; }
:root[data-theme="light"] .theme-icon--dark { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-icon--light { display: inline-grid; }
  :root:not([data-theme="dark"]) .theme-icon--dark { display: none; }
}

/* ------------------------------------------------------------ layout */
.layout { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); }
.main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; padding: 28px var(--gutter) 64px; outline: none; }
.article { min-width: 0; width: 100%; max-width: 800px; margin: 0 auto; }
.page--home .article { max-width: 1140px; }

.sidebar {
  position: fixed; z-index: 50; top: 0; left: 0; bottom: 0;
  width: min(86vw, 320px);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  transform: translateX(-102%);
  transition: transform .25s ease;
  box-shadow: var(--shadow-lg);
}
.sidebar.is-open { transform: none; }
.sidebar__scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 18px 12px 40px; }
.sidebar__head { display: flex; align-items: center; justify-content: space-between; margin: -6px 0 10px 10px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
@media (min-width: 1100px) { .sidebar__head { display: none; } }
.scrim { position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }

@media (min-width: 1100px) {
  :root { --gutter: 32px; }
  .topbar__menu { display: none; }
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: var(--topbar-h); z-index: 1;
    height: calc(100vh - var(--topbar-h));
    width: auto; transform: none; box-shadow: none;
    background: transparent;
  }
  .scrim { display: none !important; }
  .main { padding-top: 36px; }
}
@media (min-width: 1320px) {
  .main:has(.toc) { grid-template-columns: minmax(0, 1fr) var(--toc-w); }
  .toc { display: block !important; }
  .toc-mobile { display: none; }
}

/* ------------------------------------------------------------ sidebar nav */
.sidenav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin: 1px 0;
  border-radius: 8px;
  color: var(--text-2); text-decoration: none;
  font-size: .9rem; line-height: 1.3;
  border: 1px solid transparent;
}
.sidenav a .icon { width: 17px; height: 17px; color: var(--text-3); }
.sidenav a:hover { background: var(--surface-2); color: var(--text); }
.sidenav a:hover .icon { color: var(--gold); }
.sidenav a.is-active {
  background: linear-gradient(90deg, var(--gold-soft), transparent);
  border-color: var(--gold-line);
  color: var(--text); font-weight: 600;
}
.sidenav a.is-active .icon { color: var(--gold); }
.sidenav__home { margin-bottom: 8px !important; }
.sidenav__group { margin-top: 18px; }
.sidenav__group ul { list-style: none; margin: 0; padding: 0; }
.sidenav__label {
  margin: 0 10px 6px;
  font: 700 .7rem/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold);
}

/* ------------------------------------------------------------ page head */
.page-head { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); position: relative; }
.page-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 96px; height: 2px; background: linear-gradient(90deg, var(--gold), transparent); }
.page-head__group { margin: 0 0 10px; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.page-head__title {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 12px;
  font: 700 clamp(1.7rem, 1.2rem + 2.2vw, 2.6rem)/1.15 var(--font-display);
  letter-spacing: .01em;
  text-wrap: balance;
}
.page-head__icon {
  display: inline-grid; place-items: center; flex: none;
  width: 1.55em; height: 1.55em; border-radius: 12px;
  background: linear-gradient(160deg, var(--surface-3), var(--surface));
  border: 1px solid var(--gold-line);
  color: var(--gold);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 4px 18px var(--gold-soft);
}
.page-head__icon .icon { width: .78em; height: .78em; vertical-align: 0; }
.page-head__summary { margin: 0 0 14px; font-size: 1.12rem; line-height: 1.55; color: var(--text-2); max-width: 62ch; }
.page-head__meta { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-3); }
.page-head__meta .icon { width: 15px; height: 15px; margin-right: 2px; }

/* ------------------------------------------------------------ prose */
.prose { font-size: 1.02rem; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1em; }
.prose .lead { font-size: 1.12rem; color: var(--text); }
.prose h2 {
  position: relative;
  margin: 2.6em 0 .8em;
  font: 700 clamp(1.3rem, 1.1rem + .9vw, 1.65rem)/1.25 var(--font-display);
  letter-spacing: .01em;
  color: var(--text);
  text-wrap: balance;
}
.prose h2::before {
  content: ""; display: block; width: 100%; height: 1px; margin-bottom: 1.1em;
  background: linear-gradient(90deg, var(--gold-line), var(--border) 30%, transparent);
}
.prose h3 { margin: 2em 0 .6em; font-size: 1.12rem; font-weight: 700; line-height: 1.35; color: var(--gold); }
.prose h4 { margin: 1.6em 0 .5em; font-size: 1rem; font-weight: 700; }
.prose h2 .anchor, .prose h3 .anchor {
  display: inline-grid; place-items: center; vertical-align: middle;
  margin-left: .35em; width: 1.4em; height: 1.4em; border-radius: 6px;
  color: var(--text-3); opacity: 0; transition: opacity .15s;
}
.prose h2 .anchor .icon, .prose h3 .anchor .icon { width: .7em; height: .7em; vertical-align: 0; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus-visible { opacity: 1; }
.prose .anchor:hover { color: var(--gold); background: var(--gold-soft); }
.prose strong { color: var(--text); font-weight: 650; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.6em; }
.prose li { margin: .35em 0; padding-left: .2em; }
.prose ul { list-style: none; padding-left: 1.4em; }
.prose ul > li { position: relative; }
.prose ul > li::before {
  content: ""; position: absolute; left: -1.05em; top: .72em;
  width: 6px; height: 6px; transform: rotate(45deg);
  background: var(--gold); border-radius: 1px; opacity: .85;
}
.prose ol { list-style: none; counter-reset: step; padding-left: 2.2em; }
.prose ol > li { position: relative; counter-increment: step; }
.prose ol > li::before {
  content: counter(step);
  position: absolute; left: -2.2em; top: .12em;
  width: 1.6em; height: 1.6em; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .78rem; font-weight: 700; color: var(--gold);
  background: var(--gold-soft); border: 1px solid var(--gold-line);
}
.prose ol ol > li::before, .prose ul ol > li::before { content: counter(step, lower-alpha); }
.prose hr { border: 0; height: 1px; background: var(--border); margin: 2.5em 0; }
.prose blockquote { margin: 1.4em 0; padding: .2em 0 .2em 1.2em; border-left: 3px solid var(--gold-line); color: var(--text-2); font-style: italic; }
.prose code { font-size: .9em; padding: .1em .35em; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); }
.num { font-variant-numeric: tabular-nums; }

/* stat / key value pills */
.pill {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .1em .55em; border-radius: 999px;
  font-size: .82em; font-weight: 600; line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-2);
  white-space: nowrap;
}
.pill--gold { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold); }
.pill--azure { background: var(--azure-soft); border-color: color-mix(in srgb, var(--azure) 35%, transparent); color: var(--azure); }
.pill--emerald { background: var(--emerald-soft); border-color: color-mix(in srgb, var(--emerald) 35%, transparent); color: var(--emerald); }
.pill--crimson { background: var(--crimson-soft); border-color: color-mix(in srgb, var(--crimson) 35%, transparent); color: var(--crimson); }
.pill--violet { background: var(--violet-soft); border-color: color-mix(in srgb, var(--violet) 35%, transparent); color: var(--violet); }

/* ------------------------------------------------------------ tables */
.table-wrap {
  margin: 1.4em 0 1.8em;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}
.table-wrap:focus-visible { outline-offset: -2px; }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; line-height: 1.5; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose th {
  background: var(--surface-2);
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-2); white-space: nowrap;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.prose tbody tr:hover td { background: var(--gold-soft); }
.prose td.num, .prose th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prose td.dim { color: var(--text-3); }
.prose td:first-child { font-weight: 600; color: var(--text); }
.prose table.plain td:first-child { font-weight: inherit; }
@media (max-width: 640px) {
  .table-wrap:has(table.stack) { background: none; border: 0; box-shadow: none; overflow: visible; }
  .prose table.stack, .prose table.stack tbody { display: block; }
  .prose table.stack thead { display: none; }
  .prose table.stack tr { display: block; margin-bottom: 10px; padding: 10px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
  .prose table.stack td { display: block; padding: 4px 14px; border: 0; background: none !important; text-align: left; white-space: normal; }
  .prose table.stack td:first-child { font-size: 1rem; padding-bottom: 6px; }
  .prose table.stack td:not(:first-child)[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 1px;
    font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
  }
  .prose table.stack td.num { text-align: left; }
  .hero__search kbd { display: none; }
}
.prose table.compact { font-size: .86rem; }
.prose table.compact th, .prose table.compact td { padding: 8px 9px; }
.prose table.compact th { letter-spacing: .04em; }
.prose table.compact td:first-child { white-space: nowrap; }
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--gold-line); transform: translateY(-1px); }
.table-caption { margin: -1em 0 1.6em; font-size: .82rem; color: var(--text-3); }

/* ------------------------------------------------------------ screenshots */
.shot { margin: 1.6em 0; }
.shot__link {
  position: relative; display: inline-block; max-width: 100%;
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: zoom-in; line-height: 0;
  transition: transform .2s ease, border-color .2s, box-shadow .2s;
}
.shot__link:hover { border-color: var(--gold-line); box-shadow: var(--shadow), 0 0 0 4px var(--gold-soft); }
.shot__link img { display: block; }
.shot--tall .shot__link { width: min(100%, 320px); }
.shot--md .shot__link { width: min(100%, 440px); }
.shot--tall .shot__link img, .shot--md .shot__link img { width: 100%; }
.shot--wide .shot__link, .shot--wide .shot__link img { width: 100%; }
.shot__zoom {
  position: absolute; right: 8px; bottom: 8px;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: rgba(10,12,16,.75); color: #fff;
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s;
}
.shot__zoom .icon { width: 17px; height: 17px; }
.shot__link:hover .shot__zoom, .shot__link:focus-visible .shot__zoom { opacity: 1; transform: none; }
.shot figcaption { margin-top: .6em; font-size: .86rem; line-height: 1.5; color: var(--text-2); max-width: 62ch; }
.shots {
  display: grid; gap: 18px; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  margin: 1.6em 0;
}
.shots .shot { margin: 0; }
.shots .shot__link, .shots .shot__link img { width: 100%; }
.shots--2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }

/* ------------------------------------------------------------ callouts */
.callout {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px;
  margin: 1.6em 0; padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--c, var(--gold));
  background: linear-gradient(100deg, var(--c-soft, var(--gold-soft)), transparent 70%), var(--surface);
}
.callout--tip { --c: var(--emerald); --c-soft: var(--emerald-soft); }
.callout--warn { --c: var(--crimson); --c-soft: var(--crimson-soft); }
.callout--note { --c: var(--azure); --c-soft: var(--azure-soft); }
.callout--money { --c: var(--gold); --c-soft: var(--gold-soft); }
.callout__icon { color: var(--c); padding-top: 2px; }
.callout__icon .icon { width: 20px; height: 20px; }
.callout__title { margin: 0 0 .25em !important; font-weight: 700; color: var(--c); font-size: .92rem; letter-spacing: .02em; }
.callout__body { font-size: .96rem; }
.callout__body > :last-child { margin-bottom: 0; }

/* ------------------------------------------------------------ cards & grids used in content */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); margin: 1.4em 0 1.8em; }
.card {
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card h4 { margin: 0 0 .35em; font-size: 1rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card h4 .icon { color: var(--gold); }
.card p { margin: 0; font-size: .92rem; color: var(--text-2); }
.card p + p { margin-top: .5em; }
.card--accent { border-color: var(--gold-line); background: linear-gradient(160deg, var(--gold-soft), transparent 60%), var(--surface); }

.stat-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); margin: 1.4em 0; }
.stat {
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.stat__value { display: block; font: 700 1.5rem/1.2 var(--font-display); color: var(--gold); font-variant-numeric: tabular-nums; }
.stat__label { display: block; margin-top: 4px; font-size: .8rem; color: var(--text-2); line-height: 1.4; }

.steps-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: .2em 0; }
.steps-flow .pill { font-size: .8rem; }
.steps-flow .arrow { color: var(--text-3); font-size: .85rem; }

/* glossary */
.glossary-tools { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 5; margin: 0 0 20px; }
.filter-input {
  width: 100%; height: 46px; padding: 0 14px 0 42px;
  border-radius: 11px; border: 1px solid var(--border-strong);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 14px center / 18px;
  color: var(--text); font: inherit; font-size: .98rem;
  box-shadow: var(--shadow);
}
.filter-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.filter-empty { color: var(--text-3); font-style: italic; }
.glossary { display: grid; gap: 10px; margin: 1em 0 2em; }
.term {
  display: grid; grid-template-columns: minmax(84px, 140px) minmax(0, 1fr); gap: 4px 18px;
  padding: 12px 16px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
}
.term dt { font: 700 1rem/1.4 var(--font-body); color: var(--gold); }
.term dd { margin: 0; color: var(--text); }
.term dd .full { display: block; font-weight: 650; }
.term dd .more { display: block; margin-top: 2px; font-size: .92rem; color: var(--text-2); }
.term[hidden] { display: none; }
@media (max-width: 520px) { .term { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ TOC */
.toc { display: none; position: sticky; top: calc(var(--topbar-h) + 32px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 64px); overflow-y: auto; font-size: .83rem; }
.toc__title { margin: 0 0 10px; font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.toc__list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc__list a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-3); text-decoration: none; line-height: 1.35; }
.toc__list a:hover { color: var(--text); }
.toc__list a.is-active { color: var(--gold); border-left-color: var(--gold); font-weight: 600; }
.toc__l3 a { padding-left: 26px; font-size: .95em; }
.toc-mobile { margin: 0 0 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.toc-mobile summary { cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: .92rem; display: flex; align-items: center; gap: 8px; list-style: none; color: var(--text-2); }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; }
.toc-mobile[open] summary::after { transform: rotate(-135deg); }
.toc-mobile .toc__list { margin: 0 16px 14px; }

/* ------------------------------------------------------------ pager */
.pager { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--border); }
.pager__link {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  text-decoration: none; color: var(--text);
  transition: border-color .15s, transform .15s;
}
.pager__link:hover { border-color: var(--gold-line); transform: translateY(-1px); }
.pager__link--next { text-align: right; align-items: flex-end; grid-column: -2; }
.pager__dir { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.pager__dir .icon { width: 15px; height: 15px; }
.pager__title { font: 700 1.05rem/1.3 var(--font-display); }

/* ------------------------------------------------------------ footer */
.footer { border-top: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font-size: .88rem; }
.footer__inner { max-width: 1480px; margin: 0 auto; padding: 40px var(--gutter) calc(48px + env(safe-area-inset-bottom)); display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .footer__inner { grid-template-columns: 2fr 1fr 1fr; } }
.footer__brand { margin: 0 0 8px; font: 700 1.05rem var(--font-display); color: var(--text); }
.footer__head { margin: 0 0 10px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.footer p { margin: 0 0 8px; max-width: 60ch; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin: 6px 0; }
.footer a { color: var(--text-2); }
.footer a:hover { color: var(--gold); }
.footer__email { overflow-wrap: anywhere; }

/* language menu */
.lang { position: relative; flex: none; }
.lang__btn { width: auto; padding: 0 8px; gap: 5px; display: inline-flex; align-items: center; }
.lang__current { font-size: .74rem; font-weight: 700; letter-spacing: .06em; }
.lang__menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 190px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.lang__menu a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); text-decoration: none; font-size: .92rem;
}
.lang__menu a:hover, .lang__menu a:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }
.lang__menu a[aria-current] { color: var(--gold); font-weight: 650; background: var(--gold-soft); }
.lang__menu .lang__code { width: 26px; font-size: .7rem; font-weight: 700; letter-spacing: .06em; color: var(--text-3); }
.lang__menu a[aria-current] .lang__code { color: var(--gold); }
@media (max-width: 640px) { .lang__current { display: none; } .lang__btn { width: 40px; padding: 0; justify-content: center; } }

/* Cyrillic headings: Forum only ships one weight, so use synthesized small caps instead of fake bold. */
:lang(ru) .page-head__title, :lang(ru) .prose h2, :lang(ru) .hero__title, :lang(ru) .section-title,
:lang(ru) .pager__title, :lang(ru) .widget__head, :lang(ru) .clock__time, :lang(ru) .stat__value {
  font-synthesis-weight: none; font-variant-caps: small-caps; letter-spacing: .02em;
}
/* The site name keeps the synthesized bold so it matches the weight of "WaO" beside it. */
:lang(ru) .brand__name, :lang(ru) .footer__brand { font-variant-caps: small-caps; }

.to-top {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 30;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-2);
  box-shadow: var(--shadow); cursor: pointer;
}
.to-top:hover { color: var(--gold); border-color: var(--gold-line); }

/* ------------------------------------------------------------ search */
.search { position: fixed; inset: 0; z-index: 90; }
.search__backdrop { position: absolute; inset: 0; background: rgba(4,5,8,.62); backdrop-filter: blur(4px); }
.search__panel {
  position: relative; margin: 9vh auto 0;
  width: min(720px, calc(100% - 32px));
  max-height: min(680px, 80vh);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.search__bar { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--border); color: var(--gold); }
.search__bar > .icon { width: 20px; height: 20px; }
.search__input { flex: 1; min-width: 0; height: 58px; border: 0; background: none; color: var(--text); font: inherit; font-size: 1.05rem; outline: none; }
.search__input::-webkit-search-cancel-button { display: none; }
.search__close { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); cursor: pointer; font-size: .75rem; font-weight: 600; }
.search__close .icon { display: none; width: 18px; height: 18px; }
.search__results { overflow-y: auto; overscroll-behavior: contain; padding: 8px; }
.search__group { margin: 10px 10px 6px; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.search__item {
  display: block; padding: 10px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; border: 1px solid transparent;
}
.search__item[aria-selected="true"] { background: var(--gold-soft); border-color: var(--gold-line); }
.search__crumb { display: flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600; color: var(--gold); letter-spacing: .02em; }
.search__crumb .icon { width: 13px; height: 13px; }
.search__title { display: block; font-weight: 650; font-size: .98rem; margin-top: 2px; }
.search__snippet { display: block; margin-top: 3px; font-size: .86rem; color: var(--text-2); line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search__empty { padding: 28px 16px; text-align: center; color: var(--text-3); }
.search__empty strong { color: var(--text-2); }
.search__hints { padding: 8px 10px 14px; }
.search__hints p { margin: 4px 4px 10px; font-size: .78rem; color: var(--text-3); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.search__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text-2); font-size: .86rem; text-decoration: none; cursor: pointer;
}
.chip:hover { border-color: var(--gold-line); color: var(--gold); }
.chip .icon { width: 15px; height: 15px; }
.search__foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: .75rem; color: var(--text-3); }
.search__foot kbd { margin-right: 3px; }
@media (max-width: 640px) {
  .search__panel { margin: 0; width: 100%; max-height: none; height: 100%; border-radius: 0; border: 0; }
  .search__foot { display: none; }
  .search__esc { display: none; }
  .search__close { border: 0; background: none; }
  .search__close .icon { display: block; }
}

/* ------------------------------------------------------------ lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5,6,9,.94); display: grid; grid-template-rows: 1fr auto; touch-action: pan-y; }
.lightbox__stage { display: grid; place-items: center; padding: 56px 64px 8px; min-height: 0; }
.lightbox__img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 8px; box-shadow: 0 20px 80px rgba(0,0,0,.6); background: #111; }
.lightbox__caption { margin: 0 auto; padding: 10px 20px calc(18px + env(safe-area-inset-bottom)); max-width: 760px; text-align: center; color: #ddd8cc; font-size: .92rem; }
.lightbox__count { position: absolute; top: 18px; left: 20px; color: #aaa; font-size: .82rem; font-weight: 600; letter-spacing: .06em; }
.lightbox__btn { position: absolute; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.15); background: rgba(20,22,28,.8); color: #fff; cursor: pointer; }
.lightbox__btn:hover { background: rgba(227,182,92,.25); border-color: rgba(227,182,92,.6); }
.lightbox__btn .icon { width: 22px; height: 22px; }
.lightbox__close { top: 10px; right: 12px; }
.lightbox__prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 12px; top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
  .lightbox__stage { padding: 56px 8px 8px; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: calc(14px + env(safe-area-inset-bottom)); transform: none; }
  .lightbox__caption { padding-left: 64px; padding-right: 64px; }
}

/* ------------------------------------------------------------ home */
.hero {
  position: relative; overflow: hidden;
  margin: -4px 0 40px; padding: clamp(28px, 5vw, 56px);
  border-radius: 22px; border: 1px solid var(--border);
  background: var(--hero-glow), linear-gradient(160deg, var(--surface-2), var(--surface) 60%);
  display: grid; gap: 32px; align-items: center;
  grid-template-columns: minmax(0, 1fr);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 80% 20%, #000 0%, transparent 65%);
  -webkit-mask-image: radial-gradient(ellipse at 80% 20%, #000 0%, transparent 65%);
}
.hero > * { position: relative; }
.hero__eyebrow { margin: 0 0 14px; display: inline-flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.hero__eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--gold); }
.hero__title { margin: 0 0 16px; font: 700 clamp(2.1rem, 1.4rem + 3.4vw, 3.6rem)/1.05 var(--font-display); letter-spacing: .01em; text-wrap: balance; }
.hero__title span { background: linear-gradient(180deg, #f6dc98, var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="light"] .hero__title span { background: linear-gradient(180deg, #b57a1c, #6f4308); -webkit-background-clip: text; background-clip: text; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .hero__title span { background: linear-gradient(180deg, #b57a1c, #6f4308); -webkit-background-clip: text; background-clip: text; } }
.hero__lead { margin: 0 0 24px; font-size: 1.1rem; line-height: 1.6; color: var(--text-2); max-width: 56ch; }
.hero__search {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 520px; height: 56px; padding: 0 14px 0 18px;
  border-radius: 14px; border: 1px solid var(--gold-line);
  background: var(--bg); color: var(--text-3); cursor: pointer; font-size: 1rem; text-align: left;
  box-shadow: 0 0 0 5px var(--gold-soft), var(--shadow);
}
.hero__search .icon { width: 20px; height: 20px; color: var(--gold); }
.hero__search span { flex: 1; }
.hero__search:hover { color: var(--text-2); }
.hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero__art { display: none; }
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .hero__art { display: block; position: relative; height: 380px; }
}
.phone {
  position: absolute; width: 168px; aspect-ratio: 430 / 765;
  border-radius: 20px; padding: 6px; background: #0a0b0e;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 30px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(227,182,92,.15);
}
.phone img { width: 100%; height: 100%; object-fit: cover; border-radius: 15px; display: block; }
.phone--1 { left: 4%; top: 46px; transform: rotate(-8deg); }
.phone--2 { left: 34%; top: 0; z-index: 2; transform: rotate(2deg); width: 182px; }
.phone--3 { left: 64%; top: 52px; transform: rotate(9deg); }

.prose h2.section-title::before { display: none; }
.prose h2.section-title { margin: 48px 0 18px; }
.section-title { display: flex; align-items: center; gap: 12px; margin: 48px 0 18px; font: 700 1.35rem/1.2 var(--font-display); }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-line), transparent); }
.tool-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 18px; border-radius: 14px; text-decoration: none; color: var(--text);
  border: 1px solid var(--gold-line);
  background: linear-gradient(160deg, var(--gold-soft), transparent 55%), var(--surface);
  transition: transform .15s, box-shadow .15s;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow), 0 0 0 4px var(--gold-soft); }
.tool-card .icon { width: 26px; height: 26px; color: var(--gold); margin-bottom: 6px; }
.tool-card strong { font-size: 1rem; }
.tool-card span { font-size: .86rem; color: var(--text-2); line-height: 1.45; }
.topic-group { margin-top: 40px; }
.prose .topic-group__title { margin: 0 0 16px; font: 700 .78rem/1 var(--font-body); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.prose .topic-group__title::before, .prose .topic-group__title .anchor { display: none; }
.topic-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.topic-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: start; gap: 3px 14px;
  padding: 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: var(--text);
  transition: border-color .15s, transform .15s, background .15s;
}
.topic-card:hover { border-color: var(--gold-line); transform: translateY(-2px); background: var(--surface-2); }
.topic-card__icon { grid-row: span 2; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--gold); }
.topic-card__icon .icon { width: 21px; height: 21px; }
.topic-card__title { font-weight: 700; font-size: .98rem; line-height: 1.3; align-self: start; padding-top: 1px; }
.topic-card__text { font-size: .84rem; line-height: 1.45; color: var(--text-2); }
.about { margin-top: 48px; display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .about { grid-template-columns: 1.4fr 1fr; } }

/* ------------------------------------------------------------ widgets: shared */
.widget {
  margin: 1.6em 0 2em; padding: clamp(16px, 3vw, 24px);
  border-radius: 16px; border: 1px solid var(--gold-line);
  background: linear-gradient(170deg, var(--gold-soft), transparent 40%), var(--surface);
  box-shadow: var(--shadow);
}
.widget__head { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font: 700 1.05rem/1.3 var(--font-display); }
.widget__head .icon { color: var(--gold); width: 22px; height: 22px; }
.widget .table-wrap { box-shadow: none; margin: 1em 0 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field__label { font-size: .78rem; font-weight: 600; color: var(--text-2); letter-spacing: .02em; }
.field input, .field select {
  height: 42px; padding: 0 12px; min-width: 0; width: 100%;
  border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text); font: inherit; font-size: .95rem;
  font-variant-numeric: tabular-nums;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.seg button {
  border: 0; background: none; cursor: pointer;
  padding: 7px 12px; border-radius: 8px;
  font-size: .86rem; font-weight: 600; color: var(--text-2);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface-3); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold-line); }

/* event clock */
.clocks { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.clock { padding: 14px 16px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.clock__label { font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.clock__time { display: block; margin-top: 4px; font: 700 1.9rem/1.1 var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; }
.clock__date { font-size: .82rem; color: var(--text-2); }
.clock--next .clock__time { color: var(--gold); font-size: 1.35rem; }
.tz-row { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 16px 0 0; }
.tz-row .field { flex: 1 1 240px; }
.event-time-cell { white-space: nowrap; }
.event-time-cell .t { display: inline-block; margin: 2px 6px 2px 0; padding: 1px 8px; border-radius: 6px; background: var(--azure-soft); color: var(--azure); font-weight: 650; font-variant-numeric: tabular-nums; font-size: .88rem; }
.event-time-cell .t--next { background: var(--gold-soft); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold-line); }
.event-time-cell .t small { font-weight: 500; opacity: .8; margin-left: 3px; }
/* event schedule: let time slots wrap so Event and Notes get room */
.prose table.schedule { table-layout: fixed; }
.prose table.schedule th:nth-child(1) { width: 22%; }
.prose table.schedule th:nth-child(2) { width: 17%; }
.prose table.schedule th:nth-child(3) { width: 19%; }
.prose table.schedule th:nth-child(4) { width: 42%; }
.prose table.schedule th { white-space: normal; }
.prose table.schedule td.num { white-space: normal; text-align: left; }
.prose table.schedule .event-time-cell { white-space: normal; }
.event-time-cell .t { white-space: nowrap; }
.hours-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); margin-top: 14px; }
.hour { display: flex; justify-content: space-between; gap: 6px; padding: 6px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); font-size: .84rem; font-variant-numeric: tabular-nums; }
.hour b { color: var(--text-3); font-weight: 600; }
.hour span { color: var(--text); font-weight: 650; }
.hour.is-now { border-color: var(--gold-line); background: var(--gold-soft); }
.hour.is-now span { color: var(--gold); }

/* castle calculator */
.calc-out { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); margin-top: 16px; }
.calc-out .stat { background: var(--bg); }
.calc-out .stat__value { font-size: 1.25rem; }
.calc-note { margin: 12px 0 0 !important; font-size: .82rem; color: var(--text-3); }

/* formations */
.formation-picker { margin-bottom: 18px; }
.formation-picker .seg { margin-top: 6px; }
.formation-board {
  position: relative; padding: 18px 14px; border-radius: 14px;
  background: radial-gradient(ellipse at 50% 0%, rgba(88,196,146,.12), transparent 70%), var(--bg);
  border: 1px solid var(--border);
}
.formation-board__enemy { text-align: center; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--crimson); margin-bottom: 12px; }
.formation-board__enemy::before, .formation-board__enemy::after { content: " ▲ "; opacity: .6; }
.f-row { display: grid; grid-template-columns: 92px repeat(4, minmax(0, 1fr)); gap: 8px; align-items: stretch; margin-bottom: 8px; }
.f-row__label { align-self: center; overflow-wrap: normal; word-break: keep-all; font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.f-slot {
  min-height: 58px; padding: 8px 6px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-align: center; font-size: .78rem; font-weight: 650; line-height: 1.2;
  border: 1px solid var(--c, var(--border-strong));
  background: color-mix(in srgb, var(--c, var(--border)) 16%, transparent);
  color: var(--text);
  transition: opacity .2s, transform .2s;
}
.f-slot small { font-weight: 600; font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--c, var(--text-3)); }
.f-slot--inf { --c: #d9a441; }
.f-slot--cav { --c: #e27a52; }
.f-slot--arch { --c: #58c492; }
.f-slot--mage { --c: #ae92f4; }
.f-slot--angel { --c: #f2dc8c; }
.f-slot--titan { --c: #63c6ea; }
.f-slot--beast { --c: #ec6b62; }
.f-slot--empty { --c: var(--border-strong); background: transparent; border-style: dashed; color: var(--text-3); opacity: .55; }
.f-slot--empty small { color: var(--text-3); }
.f-slot--empty small, .f-slot--empty span { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.f-slot small, .f-slot span { display: block; max-width: 100%; overflow-wrap: anywhere; hyphens: auto; }
.f-slot--gap { visibility: hidden; }
.formation-caption { margin: 14px 0 0 !important; font-size: .9rem; color: var(--text-2); }
@media (max-width: 520px) {
  .formation-board { padding: 14px 8px; }
  .f-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .f-row__label { grid-column: 1 / -1; margin-top: 4px; }
  .f-slot { min-height: 52px; font-size: .7rem; padding: 6px 2px; }
  .f-slot small { font-size: .62rem; letter-spacing: 0; text-transform: none; }
}

/* goals tabs */
.tier-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.tier-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: .9rem; font-weight: 650; color: var(--text-2);
}
.tier-tab .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.tier-tab[aria-selected="true"] { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.tier--none { --c: var(--emerald); }
.tier--low { --c: var(--azure); }
.tier--mid { --c: var(--violet); }
.tier--high { --c: var(--gold); }
.goal-list { display: grid; gap: 12px; }
.goal {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px;
  padding: 16px 18px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--c);
}
.goal h4 { margin: 0; font-size: 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.goal__inherit { font-size: .72rem; font-weight: 600; color: var(--text-3); padding: 1px 8px; border-radius: 999px; border: 1px dashed var(--border-strong); }
.goal__body p { margin: 0 0 .5em; font-size: .94rem; color: var(--text-2); }
.goal__body p:last-child { margin-bottom: 0; }
.goals-table[hidden] { display: none; }

/* gem calc */
.gem-result { margin-top: 18px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.gem-result .stat { background: var(--bg); }
.gem-result .stat--bad .stat__value { color: var(--crimson); }
.gem-result .stat--good .stat__value { color: var(--emerald); }
.gem-verdict { margin: 14px 0 0 !important; padding: 12px 14px; border-radius: 10px; font-size: .92rem; background: var(--bg); border: 1px solid var(--border); }

/* ------------------------------------------------------------ misc */
.highlight-flash { animation: flash 2.4s ease-out 1; }
@keyframes flash { 0%, 30% { background: var(--mark); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 1099px) {
  .brand__sub { display: none; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 56px; }
  .topbar__inner { gap: 6px; padding: 0 10px; }
  /* The search box is just an icon here, so a long translated name wraps instead. */
  .brand { flex: 0 1 auto; }
  .brand__name { font-size: .98rem; white-space: normal; text-wrap: balance; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; border-color: transparent; background: none; color: var(--text-2); flex: none; }
  .search-trigger__label, .search-trigger__kbd { display: none; }
  .search-trigger .icon { width: 20px; height: 20px; }
  .main { padding-top: 22px; }
  .prose { font-size: 1rem; }
  .prose th, .prose td { padding: 9px 11px; }
  .shot--tall .shot__link { width: min(100%, 300px); }
  .hero { border-radius: 16px; }
}
@media (max-width: 380px) {
  .brand__text { display: none; }
}
@media print {
  .topbar, .sidebar, .toc, .toc-mobile, .pager, .to-top, .footer, .search, .lightbox, .anchor { display: none !important; }
  .layout, .main { display: block; padding: 0; }
  body { background: #fff; color: #000; }
}
