/* ============================================================== *
 *  base.css — design tokens, reset, typography, global chrome
 *  Aesthetic: cinematic "dark museum at night". OLED-dark surfaces,
 *  semantic color tokens, an accent that morphs per era / brand.
 * ============================================================== */

:root {
  /* ---- type ---- */
  --font-display: 'Fraunces', 'Times New Roman', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* ---- ink / surfaces (warm-tinted, museum dark) ---- */
  --ink-950: #07070a;
  --ink-900: #0c0c10;
  --ink-850: #121218;
  --ink-800: #181820;
  --ink-700: #21212b;
  --surface: rgba(243, 238, 228, 0.035);
  --surface-2: rgba(243, 238, 228, 0.06);
  --line: rgba(243, 238, 228, 0.12);
  --line-strong: rgba(243, 238, 228, 0.24);
  --grid-line: rgba(243, 238, 228, 0.045);

  /* ---- text (warm archival cream, not stark white) ---- */
  --paper: #f3eee4;
  --text-hi: rgba(243, 238, 228, 0.95);
  --text-mid: rgba(235, 230, 220, 0.62);
  --text-lo: rgba(235, 230, 220, 0.55);

  /* ---- accent (dynamic; overwritten by each view) ---- */
  --accent: #d8a566;
  --accent-2: #efc78c;
  --bg-top: #14110c;
  --bg-bottom: #07070a;
  --glow: #5a3f20;

  /* ---- metrics ---- */
  --maxw: 1200px;
  --topbar-h: 64px;
  --radius: 7px;
  --radius-lg: 11px;
  --radius-sm: 4px;

  /* ---- motion ---- */
  --t-fast: 140ms;
  --t-med: 280ms;
  --t-slow: 620ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

* { margin: 0; }

[hidden] { display: none !important; }

/* ---- themed scrollbars ---- */
* { scrollbar-width: thin; scrollbar-color: rgba(243, 238, 228, 0.22) transparent; }
::-webkit-scrollbar { width: 13px; height: 13px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(243, 238, 228, 0.18);
  border-radius: 999px;
  border: 3px solid var(--ink-950);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(243, 238, 228, 0.34); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.62;
  color: var(--text-hi);
  background: var(--ink-950);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* `clip` keeps horizontal overflow hidden WITHOUT turning <body> into a
     scroll container (which `hidden` does, breaking window.scrollTo). */
  overflow-x: clip;
}

/* A whisper of film grain for analogue warmth — texture only, no glow. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- signature motifs (technical-drawing language) ---- */

/* corner registration marks — drawn on framed exhibits + the modal */
.crop { position: relative; }
.crop::before,
.crop::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 3;
  pointer-events: none;
  border: 1.5px solid var(--accent);
}
.crop::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.crop::after { right: 10px; bottom: 10px; border-left: 0; border-top: 0; }

/* a measuring-ruler tick strip, used as a section divider */
.tick-rule {
  height: 11px;
  background-image: repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px 13px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  opacity: 0.6;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button, a, .chip { touch-action: manipulation; }

ul { list-style: none; padding: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.0;
  letter-spacing: -0.012em;
  font-optical-sizing: auto;
  color: var(--paper);
}

::selection { background: var(--accent); color: #07080a; }

/* ---- focus ---- */
:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- skip link ---- */
.skip-link {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 2000;
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: #07080a;
  font-weight: 600;
  border-radius: 999px;
  transition: transform var(--t-fast) var(--ease-out);
  transform: translate(-50%, -160%);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* ---- view shell ---- */
.view { position: relative; z-index: 2; outline: none; min-height: 100dvh; }

/* ============================================================== *
 *  Top bar
 * ============================================================== */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  /* Own transition name so the router's root cross-fade doesn't flicker the
     bar on every navigation — it stays put as persistent chrome. */
  view-transition-name: topbar;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-inline: max(clamp(1rem, 4vw, 2.4rem), env(safe-area-inset-left), env(safe-area-inset-right));
  background: color-mix(in srgb, var(--ink-950) 72%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.topbar__home {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-hi);
}
.topbar__mark { width: 26px; height: 26px; color: var(--text-mid); transition: transform var(--t-slow) var(--ease-out), color var(--t-med); }
.topbar__home:hover .topbar__mark { transform: rotate(120deg); color: var(--text-hi); }
.topbar__title { font-size: 0.98rem; }

.topbar__nav { display: flex; gap: clamp(0.6rem, 2vw, 1.6rem); }
.topbar__nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.3rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-mid);
  transition: color var(--t-fast);
}
.topbar__nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 9px;
  height: 2px;
  background: var(--text-hi);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-med) var(--ease-out);
}
.topbar__nav a:hover { color: var(--text-hi); }
.topbar__nav a.is-active { color: var(--text-hi); }
.topbar__nav a.is-active::after { transform: scaleX(1); }

.topbar__search {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-mid);
  background: var(--surface);
  transition: color var(--t-fast), border-color var(--t-fast);
}
.topbar__search svg { width: 17px; height: 17px; }
.topbar__search kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-lo);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
}
.topbar__search:hover { color: var(--text-hi); border-color: var(--line-strong); }

@media (max-width: 540px) { .topbar__title { display: none; } }
@media (max-width: 600px) { .topbar__search kbd { display: none; } }

/* ============================================================== *
 *  Footer
 * ============================================================== */

.site-footer {
  position: relative;
  z-index: 2;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.2rem, 5vw, 3rem);
  border-top: 1px solid var(--line);
  background: var(--ink-950);
  color: var(--text-lo);
  text-align: center;
}
.site-footer__line { font-family: var(--font-display); font-size: 1.05rem; color: var(--text-mid); }
.site-footer__mark {
  display: inline-block;
  margin-right: 0.6rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-hi);
}
.site-footer__credit { margin-top: 0.8rem; font-size: 0.85rem; }
.site-footer__credit a { color: var(--text-mid); text-decoration: underline; text-underline-offset: 3px; }
.site-footer__credit a:hover { color: var(--text-hi); }

/* ---- about / colophon view ---- */
.about {
  position: relative;
  z-index: 2;
  width: min(100% - 2.4rem, 760px);
  margin-inline: auto;
  padding-top: calc(var(--topbar-h) + clamp(2.5rem, 8vh, 5rem));
  padding-bottom: clamp(4rem, 10vh, 7rem);
}
.about__kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}
.about__title { font-size: clamp(2.4rem, 7vw, 4rem); color: var(--paper); margin-bottom: 1.8rem; }
.about__body p { color: var(--text-mid); margin-bottom: 1.2rem; font-size: 1.05rem; line-height: 1.7; }
.about__body p strong { color: var(--text-hi); font-weight: 600; }
.about__body h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); color: var(--paper); margin: 2rem 0 0.8rem; }
.about__body a:not(.btn) { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.about__body a:not(.btn):hover { color: var(--accent-2); }
.about__body .btn { margin-top: 1.6rem; }

/* ============================================================== *
 *  Buttons
 * ============================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-med), background var(--t-med);
  min-height: 48px;
}
.btn svg { width: 18px; height: 18px; }
.btn--accent {
  background: var(--accent);
  color: #0c0a06;
  box-shadow: 0 12px 40px -16px var(--accent);
}
.btn--accent:hover { transform: translateY(-2px); box-shadow: 0 18px 50px -16px var(--accent); }
.btn--accent:hover svg { transform: translateX(4px); }
.btn--accent svg { transition: transform var(--t-med) var(--ease-out); }
.btn--accent:active { transform: translateY(0); }
.btn--ghost {
  border: 1px solid var(--line-strong);
  color: var(--text-hi);
  background: var(--surface);
}
.btn--ghost:hover { background: var(--surface-2); transform: translateY(-2px); }

/* shared container */
.container { width: min(100% - 2.4rem, var(--maxw)); margin-inline: auto; }
