/* =========================================================================
   yatay geçiş field guide — stylesheet
   Design concept: an official Turkish transfer directive, annotated by a real
   student. Two registers (informal / formal) switch from the topbar and carry
   two accent colours. Teal is the "official" brand; red is the "informal" hand.
   Callout hues (note/tip/warning/important/tl;dr) are fixed and independent of
   the register accent so they never collide.
   Type: Newsreader (serif display) · Public Sans (body) · Space Mono (labels).
   ========================================================================= */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;

  --bg:            oklch(0.985 0.004 220);
  --surface:       oklch(1 0 0);
  --surface-2:     oklch(0.965 0.006 225);
  --ink:           oklch(0.26 0.03 255);
  --ink-soft:      oklch(0.42 0.025 255);
  --muted:         oklch(0.53 0.02 250);
  --border:        oklch(0.905 0.008 235);
  --border-strong: oklch(0.82 0.012 235);

  --teal:          oklch(0.52 0.10 205);
  --teal-strong:   oklch(0.44 0.11 205);
  --teal-soft:     oklch(0.95 0.03 205);

  --red:           oklch(0.55 0.19 25);
  --red-strong:    oklch(0.48 0.20 25);
  --red-soft:      oklch(0.96 0.035 30);

  --amber:         oklch(0.62 0.14 70);
  --amber-soft:    oklch(0.95 0.05 80);

  /* fixed, register-independent callout hues */
  --info:          oklch(0.53 0.13 250);
  --info-strong:   oklch(0.46 0.14 250);
  --info-soft:     oklch(0.95 0.03 250);

  --violet:        oklch(0.53 0.16 300);
  --violet-strong: oklch(0.46 0.17 300);
  --violet-soft:   oklch(0.95 0.035 305);

  --accent:        var(--teal);
  --accent-strong: var(--teal-strong);
  --accent-soft:   var(--teal-soft);

  --shadow-sm: 0 1px 2px oklch(0.4 0.03 255 / 0.06), 0 1px 1px oklch(0.4 0.03 255 / 0.04);
  --shadow-md: 0 4px 16px oklch(0.35 0.04 255 / 0.10), 0 2px 6px oklch(0.35 0.04 255 / 0.06);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Public Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono:  "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 68ch;
  --topbar-h: 60px;
  --sidebar-w: 288px;
  --toc-w: 232px;

  --radius: 10px;
  --radius-sm: 7px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);        /* ease-out-quint-ish */
  --z-scrim: 40;
  --z-sidebar: 50;
  --z-topbar: 60;
  --z-progress: 70;

  /* semantic z-scale, referenced above */
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            oklch(0.185 0.022 255);
  --surface:       oklch(0.225 0.024 255);
  --surface-2:     oklch(0.265 0.026 255);
  --ink:           oklch(0.945 0.008 220);
  --ink-soft:      oklch(0.80 0.014 225);
  --muted:         oklch(0.68 0.02 240);
  --border:        oklch(0.33 0.02 255);
  --border-strong: oklch(0.42 0.022 255);

  --teal:          oklch(0.74 0.10 200);
  --teal-strong:   oklch(0.82 0.09 200);
  --teal-soft:     oklch(0.30 0.045 205);

  --red:           oklch(0.71 0.16 28);
  --red-strong:    oklch(0.78 0.15 28);
  --red-soft:      oklch(0.31 0.06 28);

  --amber:         oklch(0.78 0.13 78);
  --amber-soft:    oklch(0.32 0.05 78);

  --info:          oklch(0.74 0.11 250);
  --info-strong:   oklch(0.82 0.10 250);
  --info-soft:     oklch(0.31 0.05 255);

  --violet:        oklch(0.76 0.13 300);
  --violet-strong: oklch(0.83 0.11 300);
  --violet-soft:   oklch(0.32 0.06 305);

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4);
  --shadow-md: 0 8px 28px oklch(0 0 0 / 0.5);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input { font: inherit; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- reading progress ---------- */
.progress {
  position: fixed;
  inset: 0 auto auto 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: var(--z-progress);
  transition: width 0.1s linear;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: color-mix(in oklch, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.brand-logo {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  color: var(--teal);
}
.brand-logo svg { width: 23px; height: 23px; }
.brand-mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--teal);
  padding: 4px 7px;
  border-radius: 5px;
  white-space: nowrap;
  text-decoration: none;
}
.brand-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.12rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-name em { font-style: italic; color: var(--teal); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  color: var(--ink-soft);
  border: 1px solid transparent;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--border); }
.icon-btn svg { width: 19px; height: 19px; }
.menu-btn { display: inline-grid; }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }

/* ---------- register switch (topbar) ---------- */
.reg-toggle { display: flex; align-items: center; gap: 9px; }
.reg-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
  transition: color 0.2s var(--ease);
}
.reg-toggle:has([aria-checked="false"]) .reg-label-informal { color: var(--red-strong); }
.reg-toggle:has([aria-checked="true"])  .reg-label-formal   { color: var(--teal-strong); }
:root[data-theme="dark"] .reg-toggle:has([aria-checked="false"]) .reg-label-informal { color: var(--red); }
:root[data-theme="dark"] .reg-toggle:has([aria-checked="true"])  .reg-label-formal   { color: var(--teal); }

.reg-switch {
  --sw-accent: var(--red);
  position: relative;
  width: 46px;
  height: 25px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  flex: none;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.reg-switch:hover { border-color: var(--muted); }
.reg-knob {
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--sw-accent);
  box-shadow: var(--shadow-sm);
  transition: left 0.28s var(--ease), background 0.25s var(--ease);
}
.reg-switch[aria-checked="true"] {
  --sw-accent: var(--teal);
  border-color: color-mix(in oklch, var(--teal) 45%, var(--border-strong));
}
.reg-switch[aria-checked="true"] .reg-knob { left: 26px; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
}

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100dvh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidebar-head { padding: 20px 18px 12px; }
.sidebar-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg {
  position: absolute;
  left: 11px;
  width: 15px; height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 9px 12px 9px 33px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.search input::placeholder { color: var(--muted); }
.search input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent);
}

.guide-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.guide-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.guide-item:hover { background: var(--surface-2); }
.guide-item[aria-current="true"] {
  background: color-mix(in oklch, var(--teal-soft) 60%, var(--surface));
  border-color: color-mix(in oklch, var(--teal) 35%, var(--border));
}
.guide-item-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 0.94rem;
  line-height: 1.35;
  letter-spacing: -0.005em;
}
.guide-item[aria-current="true"] .guide-item-title { color: var(--teal-strong); }
.guide-item-desc {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wip-dot {
  flex: none;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}
.list-empty {
  padding: 18px 14px;
  color: var(--muted);
  font-size: 0.88rem;
}
.sidebar-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--muted);
  font-family: var(--mono);
}
.sidebar-foot a { color: var(--teal); text-decoration: none; }
.sidebar-foot a:hover { text-decoration: underline; }

/* ---------- reader ---------- */
.reader {
  min-width: 0;
  padding: 40px clamp(20px, 5vw, 68px) 96px;
}
.reader-head { margin-bottom: 30px; }
.kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.kicker::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--accent);
}

.updated {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}
.updated:empty { display: none; }

.wip-banner {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border-radius: var(--radius);
  background: var(--amber-soft);
  border: 1px solid color-mix(in oklch, var(--amber) 45%, var(--border));
  color: color-mix(in oklch, var(--amber) 78%, var(--ink));
  font-size: 0.88rem;
}
:root[data-theme="dark"] .wip-banner { color: var(--amber); }
.wip-banner svg { width: 17px; height: 17px; flex: none; }

/* ---------- prose ---------- */
.prose {
  max-width: var(--measure);
  animation: enter 0.4s var(--ease);
}
@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.prose > * + * { margin-top: 1.05em; }
.prose h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: 0.3em;
  padding-bottom: 0.35em;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  transition: border-color 0.34s var(--ease);
}
.prose h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.62rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin-top: 2.2em;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
.prose h2:empty { display: none; }
.prose h3 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.16rem;
  letter-spacing: -0.01em;
  margin-top: 1.9em;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
.prose h2 .anchor, .prose h3 .anchor {
  font-family: var(--mono);
  font-weight: 400;
  color: var(--accent);
  text-decoration: none;
  opacity: 0;
  margin-left: 0.4em;
  font-size: 0.7em;
  transition: opacity 0.15s var(--ease);
}
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 0.7; }

.prose p { text-wrap: pretty; }
.prose a:not(.anchor) {
  color: var(--teal-strong);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklch, var(--teal) 40%, transparent);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.16s var(--ease);
}
:root[data-theme="dark"] .prose a:not(.anchor) { color: var(--teal); }
.prose a:not(.anchor):hover { text-decoration-color: currentColor; }
.prose strong { font-weight: 700; color: var(--ink); }
.prose em { font-style: italic; }

.prose ul, .prose ol { padding-left: 1.5em; }
.prose li { margin-top: 0.4em; }
.prose li::marker { color: var(--accent); }
.prose ol > li::marker { font-family: var(--mono); font-size: 0.9em; }
.prose ul ul, .prose ol ol, .prose ul ol, .prose ol ul { margin-top: 0.4em; }

.prose blockquote {
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--border-strong);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
}
.prose hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.4em 0;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 5px;
}
.prose pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
}
.prose pre code { background: none; border: none; padding: 0; font-size: 0.85rem; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.prose thead { background: var(--surface-2); }
.prose th, .prose td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.prose th { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.prose tbody tr:last-child td { border-bottom: none; }
.prose td strong { color: var(--accent-strong); }

/* ---------- callouts ---------- */
.callout {
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  padding: 15px 18px;
  box-shadow: var(--shadow-sm);
}
.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 8px;
}
.callout-title svg { width: 16px; height: 16px; flex: none; }
.callout-body > * + * { margin-top: 0.7em; }
.callout-body > :first-child { margin-top: 0; }

/* Each callout type has its own fixed hue, independent of the informal/formal
   register accent — so note, tip, important, warning and tl;dr always stay
   visually distinct in both versions and both themes. */
.callout-tldr {
  background: color-mix(in oklch, var(--violet-soft) 55%, var(--surface));
  border-color: color-mix(in oklch, var(--violet) 35%, var(--border));
}
.callout-tldr .callout-title { color: var(--violet-strong); }
:root[data-theme="dark"] .callout-tldr .callout-title { color: var(--violet); }

.callout-note {
  background: color-mix(in oklch, var(--info-soft) 55%, var(--surface));
  border-color: color-mix(in oklch, var(--info) 35%, var(--border));
}
.callout-note .callout-title { color: var(--info-strong); }
:root[data-theme="dark"] .callout-note .callout-title { color: var(--info); }

.callout-tip {
  background: color-mix(in oklch, var(--teal-soft) 45%, var(--surface));
  border-color: color-mix(in oklch, var(--teal) 32%, var(--border));
}
.callout-tip .callout-title { color: var(--teal-strong); }

.callout-important {
  background: color-mix(in oklch, var(--red-soft) 45%, var(--surface));
  border-color: color-mix(in oklch, var(--red) 34%, var(--border));
}
.callout-important .callout-title { color: var(--red-strong); }
:root[data-theme="dark"] .callout-important .callout-title { color: var(--red); }

.callout-warning {
  background: color-mix(in oklch, var(--amber-soft) 55%, var(--surface));
  border-color: color-mix(in oklch, var(--amber) 40%, var(--border));
}
.callout-warning .callout-title { color: color-mix(in oklch, var(--amber) 72%, var(--ink)); }
:root[data-theme="dark"] .callout-warning .callout-title { color: var(--amber); }

.postscript {
  font-size: 0.92rem;
  color: var(--ink-soft);
  padding-left: 16px;
  border-left: 2px solid var(--border-strong);
}
.postscript .ps-mark {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ---------- toc ---------- */
.toc {
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100dvh - var(--topbar-h));
  overflow-y: auto;
  padding: 44px 24px 40px 8px;
}
.toc-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.toc-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; 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(--muted);
  text-decoration: none;
  font-size: 0.83rem;
  line-height: 1.4;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.toc-list a:hover { color: var(--ink); }
.toc-list a.sub { padding-left: 26px; font-size: 0.79rem; }
.toc-list a.active {
  color: var(--accent-strong);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ---------- register accents ---------- */
.reader[data-version="informal"] { --accent: var(--red); --accent-strong: var(--red-strong); --accent-soft: var(--red-soft); }
.reader[data-version="formal"]   { --accent: var(--teal); --accent-strong: var(--teal-strong); --accent-soft: var(--teal-soft); }

/* ---------- google translate bar (toggled from the topbar) ---------- */
.translate-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 7px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}
div#translateBar.translate-bar[hidden] {
   display: none;
}
/* translate button on-state */
#translateBtn[aria-expanded="true"] {
  background: color-mix(in oklch, var(--teal) 14%, transparent);
  color: var(--teal);
  border-color: color-mix(in oklch, var(--teal) 30%, var(--border));
}
.translate-label {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.translate-note { margin-left: auto; opacity: 0.7; }
#google_translate_element { display: inline-flex; align-items: center; }
/* tame the widget's default chrome so it fits the design */
#google_translate_element .goog-te-gadget { font-size: 0 !important; color: transparent !important; }
#google_translate_element .goog-te-gadget > span { display: none; }
#google_translate_element select.goog-te-combo {
  margin: 0 !important;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
}
/* Google injects a fixed top banner + shifts the body; suppress both so our
   own bar is the single translate control. Translation still works. */
.goog-te-banner-frame.skiptranslate,
.goog-te-gadget-icon { display: none !important; }
body { top: 0 !important; }
.goog-tooltip, .goog-tooltip * { display: none !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }

/* ---------- coming soon ---------- */
.coming-soon {
  max-width: var(--measure);
  padding: 40px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}
.coming-soon strong { display: block; font-family: var(--serif); font-size: 1.3rem; color: var(--ink); margin-bottom: 8px; font-weight: 500; }

/* ---------- mobile drawer bits ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: oklch(0.2 0.03 255 / 0.5);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s var(--ease);
  z-index: var(--z-scrim);
}

/* ---------- responsive ---------- */
@media (max-width: 1160px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}

/* desktop: hide/show the sidebar with the topbar button */
@media (min-width: 861px) {
  .layout { transition: grid-template-columns 0.28s var(--ease); }
  body.sidebar-collapsed .sidebar { display: none; }
  body.sidebar-collapsed .layout { grid-template-columns: minmax(0, 1fr) var(--toc-w); }
}
@media (min-width: 861px) and (max-width: 1160px) {
  body.sidebar-collapsed .layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .reg-label { display: none; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: min(86vw, var(--sidebar-w));
    z-index: var(--z-sidebar);
    transform: translateX(-102%);
    transition: transform 0.3s var(--ease);
    box-shadow: var(--shadow-md);
    padding-top: 8px;
  }
  body.nav-open .sidebar { transform: translateX(0); padding-top: var(--topbar-h); }
  body.nav-open .scrim { opacity: 1; visibility: visible; }
  .reader { padding: 30px clamp(18px, 6vw, 40px) 80px; }
}

@media (max-width: 460px) {
  .brand-name { display: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .prose { animation: none; }
}
