/* cleoanka — shared design system for the main site and every /lab/ page.
   Neutral, quiet surfaces; Geist (variable) for text, mono for labels,
   figures on panels. All text colours clear WCAG AA (4.5:1) on bg and panel. Light + dark; follows the device unless the visitor
   picks one with the theme button (stored in localStorage "theme"). */

@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/geist-latin.woff2) format("woff2"); 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: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/geist-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #fcfcfc;
  --panel: #f4f5f7;
  --panel-2: #ebeef2;
  --edge: #d6dae1;
  --edge-soft: #e7e9ee;
  --text: #374151;
  --bright: #111827;
  --dim: #5b6170;
  --faint: #696e76;
  --gold: #846836;
  --blue: #4f46e5;
  --rust: #be123c;
  --heal: #017e58;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 12px 32px -18px rgba(17, 24, 39, 0.18);
  --serif: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; /* body face (name kept for compatibility) */
  --display: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --measure: 42rem;
  --wide: 60rem;
  --max: 72rem;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --panel: #16191f; --panel-2: #1c2026; --edge: #2d333b; --edge-soft: #242930;
    --text: #d1d5db; --bright: #f3f4f6; --dim: #9aa1ab; --faint: #818892;
    --gold: #d4af37; --blue: #8b8df3; --rust: #fb7185; --heal: #34d399;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 16px 36px -18px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --panel: #16191f; --panel-2: #1c2026; --edge: #2d333b; --edge-soft: #242930;
    --text: #d1d5db; --bright: #f3f4f6; --dim: #9aa1ab; --faint: #818892;
    --gold: #d4af37; --blue: #8b8df3; --rust: #fb7185; --heal: #34d399;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 16px 36px -18px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

html[data-lang="tr"] body [lang="en"],
html[data-lang="en"] body [lang="tr"] { display: none !important; }

* , *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01" 0;
  overflow-x: hidden;
  transition: background-color .35s ease, color .35s ease;
}
::selection { background: var(--gold); color: var(--bg); }
a { color: var(--gold); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); transition: color .15s, border-color .15s; }
a:hover { color: var(--bright); border-bottom-color: var(--bright); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
strong { font-weight: 600; color: var(--bright); }
em { font-style: italic; }
code, .mono-chip {
  font-family: var(--mono); font-size: 0.8em; color: var(--dim);
  background: var(--panel-2); border: 1px solid var(--edge-soft); border-radius: 4px; padding: 0.1em 0.38em;
}
h1, h2, h3 { font-family: var(--display); color: var(--bright); font-weight: 600; letter-spacing: -0.02em; }

/* ---------- top bar ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px var(--gutter);
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.08em;
}
.topbar a { border: 0; color: var(--dim); }
.topbar a:hover { color: var(--gold); }
.topbar .brand { font-family: var(--display); font-weight: 600; font-size: 1.15rem; letter-spacing: -0.02em; color: var(--bright); }
.topbar nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 24px); }
.tbtn {
  font: inherit; color: var(--dim); background: transparent; cursor: pointer;
  border: 1px solid var(--edge); border-radius: 999px; height: 30px; min-width: 30px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: border-color .15s, color .15s;
}
.tbtn:hover { border-color: var(--gold); color: var(--gold); }
.tbtn svg { width: 15px; height: 15px; }
.tbtn .i-sun { display: none; }
.is-dark .tbtn .i-sun { display: block; }
.is-dark .tbtn .i-moon { display: none; }
@media (max-width: 560px) { .topbar .hide-sm { display: none; } }

/* ---------- masthead (lab pages) ---------- */
header.masthead {
  max-width: var(--measure); margin: 0 auto; text-align: center;
  padding: clamp(5.5rem, 13vh, 8rem) 1.25rem 0;
}
.kicker { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.32em; text-transform: uppercase; color: var(--faint); margin: 0; }
.masthead h1 { font-size: clamp(2.4rem, 6.4vw, 4rem); line-height: 1.04; letter-spacing: -0.035em; margin: 0.55rem 0 0.8rem; }
.subtitle { color: var(--dim); font-size: 1.15rem; margin: 0 auto 0.4rem; max-width: 36rem; line-height: 1.55; }
.byline { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.04em; color: var(--faint); margin-top: 1.4rem; }
.byline a { border: 0; color: var(--faint); }
.byline a:hover { color: var(--gold); }
.rule { width: 5rem; height: 1px; border: 0; margin: 2.6rem auto; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

/* dynamic type: variable weight that responds (see CL.liveType) */
/* the variable wght axis drives the effect; font-weight stays 'normal' so it isn't double-applied */
.live-type { font-variation-settings: "wght" var(--w, 500); font-weight: normal; }
.live-type .lt-word { display: inline-block; white-space: nowrap; }
.live-type .lt-word > span { display: inline-block; font-variation-settings: "wght" var(--w, 500); }
.wake { font-variation-settings: "wght" 300; transition: font-variation-settings .6s cubic-bezier(.2, .7, .2, 1), opacity .4s ease, transform .4s ease; }
.wake.in { font-variation-settings: "wght" 600; }

/* ---------- essay ---------- */
.essay { max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem; }
.chapter { margin-top: clamp(4rem, 10vh, 6.5rem); }
.chapter-head { display: flex; align-items: baseline; gap: 1.1rem; margin-bottom: 1.1rem; }
.chapter-head .no {
  font-family: var(--mono); font-size: clamp(2.4rem, 6vw, 3.4rem); font-weight: 200; line-height: 1;
  color: var(--edge); -webkit-text-stroke: 1px var(--faint); user-select: none;
}
.chapter-head h2 { font-size: clamp(1.45rem, 3.2vw, 1.85rem); margin: 0; letter-spacing: -0.025em; line-height: 1.2; }
.chapter p { margin: 1.05rem 0; }
.aside { border-left: 2px solid var(--edge); padding-left: 1rem; color: var(--dim); font-size: 0.98rem; }

/* ---------- figures ---------- */
figure.fig {
  margin: 2.2rem 0;
  width: min(calc(100vw - 2.5rem), var(--wide));
  position: relative; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--edge); border-radius: 10px;
  padding: 0.9rem; box-shadow: var(--shadow);
}
.fig-body { position: relative; }
.fig-body canvas { display: block; width: 100%; border-radius: 6px; background: var(--bg); }
.fig-body canvas:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
figcaption { font-family: var(--mono); font-size: 0.74rem; line-height: 1.55; color: var(--faint); padding: 0.7rem 0.2rem 0.1rem; letter-spacing: 0.02em; }
figcaption .fig-no { color: var(--gold); }

.fig-ui { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem 1.1rem; padding: 0.75rem 0.2rem 0.15rem; font-family: var(--mono); font-size: 0.78rem; color: var(--dim); }
.fig-ui .spacer { flex: 1; }
.fig-btn {
  font: inherit; font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.05em;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--edge); border-radius: 6px;
  padding: 0.42em 0.95em; cursor: pointer; transition: border-color 120ms, color 120ms, background 120ms;
}
.fig-btn:hover { border-color: var(--gold); color: var(--bright); }
.fig-btn:active { transform: translateY(1px); }
.fig-btn.primary { border-color: color-mix(in srgb, var(--heal) 55%, var(--edge)); color: var(--heal); }
.fig-btn.primary:hover { background: color-mix(in srgb, var(--heal) 12%, var(--panel-2)); }
.fig-btn.danger { border-color: color-mix(in srgb, var(--rust) 45%, var(--edge)); color: var(--rust); }
.fig-btn[disabled] { opacity: .45; cursor: default; }
.fig-field { display: inline-flex; align-items: center; gap: 0.55rem; }
.fig-field .lbl, .fig-ui .lbl { color: var(--faint); letter-spacing: 0.05em; }
.fig-field .val { color: var(--gold); min-width: 3.4ch; text-align: right; font-variant-numeric: tabular-nums lining-nums; }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 9rem; height: 2px; border-radius: 1px; background: var(--edge); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--faint); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--faint); }
.seg { display: inline-flex; border: 1px solid var(--edge); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; font-family: var(--mono); font-size: 0.74rem; color: var(--dim); background: transparent; border: 0; padding: 0.4em 0.85em; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--edge); }
.seg button.on { background: var(--panel-2); color: var(--gold); }
.fig-note { font-family: var(--mono); font-size: 0.76rem; color: var(--faint); font-variant-numeric: tabular-nums lining-nums; }
.fig-note.heal { color: var(--heal); }
.fig-note.rust { color: var(--rust); }
.fig-note.gold { color: var(--gold); }
.fig-text {
  font: inherit; font-family: var(--mono); font-size: 0.8rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--edge); border-radius: 6px; padding: 0.45em 0.7em; min-width: 12rem;
}
textarea.fig-text { width: 100%; min-height: 9rem; line-height: 1.55; resize: vertical; }

/* ---------- closing map + footer ---------- */
.map { margin-top: 1.6rem; border-top: 1px solid var(--edge-soft); }
.map dl { margin: 0; }
.map .row { display: grid; grid-template-columns: 10rem 1fr; gap: 1rem; padding: 0.85rem 0.15rem; border-bottom: 1px solid var(--edge-soft); }
.map dt { font-family: var(--mono); font-size: 0.8rem; color: var(--gold); letter-spacing: 0.04em; padding-top: 0.2rem; }
.map dd { margin: 0; color: var(--dim); font-size: 0.99rem; }
@media (max-width: 34rem) { .map .row { grid-template-columns: 1fr; gap: 0.15rem; } }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.06em; }
.pager a { border: 0; color: var(--dim); }
.pager a:hover { color: var(--gold); }
.pager b { display: block; font-family: var(--display); font-size: 1.2rem; font-weight: 600; letter-spacing: -0.02em; color: var(--bright); margin-top: .2rem; }
.pager .next { text-align: right; margin-left: auto; }

footer.colophon {
  max-width: var(--measure); margin: 5rem auto 0; padding: 2.2rem 1.25rem 4rem;
  border-top: 1px solid var(--edge-soft);
  font-family: var(--mono); font-size: 0.76rem; line-height: 2; color: var(--faint); text-align: center;
}
footer.colophon a { border: 0; color: var(--dim); }
footer.colophon a:hover { color: var(--gold); }

/* ---------- reveal ---------- */
html.reveal [data-reveal] { opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; transition-delay: var(--d, 0s); }
html.reveal [data-reveal].in { opacity: 1; transform: none; }

@media print {
  .topbar, .fig-ui { display: none; }
}
