/* Monochrome retro desktop — shared world for all three layouts.
   Load Google Fonts in the page: Rubik 400;500;700;800;900 + Martian Mono 400;600 (wdth 87.5 ok). */

:root {
  color-scheme: light;
  --ink: #0b0b0b;
  --ink-2: #2b2b2b;          /* secondary text, 12.6:1 on paper */
  --ink-3: #555555;          /* tertiary / meta, 7.4:1 on paper */
  --paper: #fafafa;
  --white: #ffffff;
  --chrome: #e8e8e8;         /* title bars, control fills */
  --chrome-2: #c8c8c8;       /* pressed / inactive bars */
  --rule: 2px;
  --rule-thin: 1.5px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --shadow-lg: 8px 8px 0 var(--ink);

  --font-sans: "Rubik", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Martian Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* type ladder (hero ≈ 3x body at desktop) */
  --t-hero: clamp(2.6rem, 1.4rem + 4.6vw, 5.6rem);
  --t-h1: clamp(2rem, 1.3rem + 2.4vw, 3.4rem);
  --t-h2: clamp(1.45rem, 1.15rem + 1vw, 2rem);
  --t-h3: 1.15rem;
  --t-body: 0.975rem;
  --t-small: 0.84rem;
  --t-micro: 0.72rem;

  --gutter: clamp(16px, 3vw, 40px);
  --radius: 0;

  /* Kalkbrenner signature motion */
  --ease-signature: cubic-bezier(0.625, 0.05, 0, 1);
  --ease-settle: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.7s;
  --dur-half: 0.35s;

  /* halftone / photocopy grain, used once per page as a band */
  --halftone: radial-gradient(circle at center, var(--ink) 0.9px, transparent 1.3px) 0 0 / 6px 6px;
  --halftone-fine: radial-gradient(circle at center, var(--ink) 0.6px, transparent 1px) 0 0 / 4px 4px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-body)/1.45 var(--font-sans);
  font-feature-settings: "kern", "tnum" 0;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--white); }
:focus { outline: none; }
:focus-visible {
  outline: var(--rule) solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--white), 0 0 0 7px var(--ink);
}
* { scrollbar-width: thin; scrollbar-color: var(--ink) var(--chrome); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--chrome); border-left: var(--rule) solid var(--ink); }
::-webkit-scrollbar-thumb { background: var(--ink); border: 3px solid var(--chrome); }

h1, h2, h3, h4 { margin: 0; font-weight: 800; line-height: 1.02; letter-spacing: -0.025em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2.5px; }
.num, time, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.meta { font-size: var(--t-small); color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1em; height: 1em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; vertical-align: -0.12em; }

/* ---------- Window chrome ---------- */
.win {
  background: var(--white);
  border: var(--rule) solid var(--ink);
  box-shadow: var(--shadow);
  min-width: 0;
}
.win__bar {
  display: flex; align-items: center; gap: 10px;
  height: 30px; padding: 0 10px;
  background: var(--chrome);
  border-bottom: var(--rule) solid var(--ink);
  font: 500 var(--t-micro)/1 var(--font-mono);
  user-select: none;
}
.win__dots { display: flex; gap: 6px; flex: none; }
.win__dots i { width: 11px; height: 11px; border: var(--rule) solid var(--ink); border-radius: 50%; background: var(--white); }
.win__title { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 34px; }
.win__body { padding: 18px 20px 20px; }
.win--inactive .win__bar { background: var(--chrome-2); }

/* ---------- Buttons & cells ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px;
  background: var(--chrome); color: var(--ink);
  border: var(--rule) solid var(--ink);
  font: 700 var(--t-small)/1 var(--font-sans);
  text-decoration: none; cursor: pointer;
  transition: transform var(--dur-half) var(--ease-signature), box-shadow var(--dur-half) var(--ease-signature), background-color .15s;
}
.btn:hover { background: var(--white); box-shadow: var(--shadow-sm); transform: translate(-2px, -2px); }
.btn:active { transform: translate(1px, 1px); box-shadow: none; background: var(--chrome-2); }
.btn[aria-pressed="true"], .btn.is-on { background: var(--ink); color: var(--white); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* contiguous link cells (toolbar / tab strip) */
.cells { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: var(--rule) solid var(--ink); background: var(--chrome); }
.cell {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 46px; padding: 0 14px;
  font: 700 var(--t-small)/1.1 var(--font-sans); color: var(--ink); text-decoration: none;
  background: transparent; border: 0; border-left: var(--rule) solid var(--ink); cursor: pointer; text-align: left;
  overflow: hidden; isolation: isolate;
}
.cell:first-child { border-left: 0; }
.cell .icon { font-size: 0.9em; }
.cell[aria-selected="true"], .cell[aria-current="page"] { background: var(--ink); color: var(--white); }

/* directional hover wipe (Kalkbrenner) — add <span class="wipe"></span> as first child */
.has-wipe { position: relative; overflow: hidden; isolation: isolate; }
.wipe { position: absolute; inset: 0; background: var(--ink); transform: translateY(-101%); transition: transform .5s var(--ease-settle); z-index: -1; pointer-events: none; }
.has-wipe:hover { color: var(--white); }

/* wipe underline link (Kalkbrenner) */
.u-link { position: relative; text-decoration: none; }
.u-link::after { content: ""; position: absolute; left: 0; right: 0; bottom: -0.08em; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .55s var(--ease-signature); }
.u-link:hover::after, .u-link:focus-visible::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Status & caution ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 7px;
  border: var(--rule-thin) solid var(--ink); background: var(--white);
  font: 600 var(--t-micro)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.tag--solid { background: var(--ink); color: var(--white); }
.tag--open::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.tag--closed { color: var(--ink-3); border-style: dashed; }
/* caution marker: dashed-underlined text + small striped flag. Never drop provenance. */
.caution {
  display: inline-flex; align-items: center; gap: 5px;
  font: 500 var(--t-small)/1.3 var(--font-sans);
  padding: 2px 6px; border: var(--rule-thin) dashed var(--ink);
  background: repeating-linear-gradient(-45deg, var(--white) 0 4px, var(--chrome) 4px 8px);
}
.is-uncertain { text-decoration: underline dashed 1.5px; text-underline-offset: 0.2em; }

/* halftone band — one per page */
.halftone { background: var(--halftone), var(--white); opacity: 1; }
.halftone--soft { background: var(--halftone-fine), var(--white); }

/* ---------- Motion base ---------- */
.reveal { animation: reveal-up var(--dur) var(--ease-signature) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes reveal-up { from { transform: translateY(14px); opacity: .001; } to { transform: none; opacity: 1; } }
.iris-in { animation: iris var(--dur) var(--ease-signature) both; }
@keyframes iris { from { clip-path: inset(50% 0); } to { clip-path: inset(0 0); } }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: .45s; animation-timing-function: var(--ease-signature); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
