/* =========================================================
   THE WURSTER ARCHIVE — CORE STYLESHEET (v2)
   Top navigation · reduced type scale · tighter layouts.
   ========================================================= */

:root {
  --paper: #f2ede1;
  --paper-2: #e8e1d1;
  --ink: #12110f;
  --ink-2: #2a2725;
  --ink-soft: #555049;
  --mist: #c9c2b2;
  --brass: #b6945a;
  --brass-deep: #8a6a38;
  --ember: #c2461a;
  --slate: #0c2a3d;
  --slate-2: #153c56;

  --edge: 1px solid rgba(18, 17, 15, 0.14);
  --edge-soft: 1px solid rgba(18, 17, 15, 0.08);

  --topbar-h: 64px;
  --gutter: clamp(16px, 2.2vw, 36px);
  --section-pad: clamp(48px, 6vw, 96px);

  --font-display: "Fraunces", "Cormorant Garamond", "Times New Roman", serif;
  --font-serif-alt: "Instrument Serif", "Fraunces", serif;
  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;

  /* Reduced type scale */
  --step--2: 10px;
  --step--1: 11.5px;
  --step-0: 14px;
  --step-1: clamp(15px, 1vw, 16.5px);
  --step-2: clamp(17px, 1.3vw, 20px);
  --step-3: clamp(20px, 1.7vw, 26px);
  --step-4: clamp(26px, 2.4vw, 36px);
  --step-5: clamp(32px, 3.4vw, 52px);
  --step-6: clamp(40px, 4.4vw, 68px);
  --step-7: clamp(48px, 5.6vw, 86px);

  --transition: 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-slow: 1000ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

html[data-chapter="01"] { --accent: var(--slate); --accent-2: var(--slate-2); }
html[data-chapter="02"] { --accent: #3a1e12; --accent-2: #6c3a22; }
html[data-chapter="03"] { --accent: #213a1e; --accent-2: #406837; }
html[data-chapter="04"] { --accent: #3a1e3a; --accent-2: #6c2e72; }
html[data-chapter="05"] { --accent: #3a2e1e; --accent-2: #8a6a38; }
html[data-chapter="06"] { --accent: var(--slate-2); --accent-2: #1f5a82; }
html[data-chapter="07"] { --accent: #1e3a3a; --accent-2: #307272; }
html[data-chapter="08"] { --accent: #12110f; --accent-2: #3a342a; }
html[data-chapter="00"] { --accent: #12110f; --accent-2: #2a2725; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(1000px 600px at 85% -10%, rgba(12, 42, 61, 0.05), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(182, 148, 90, 0.06), transparent 60%);
}

::selection { background: var(--ink); color: var(--paper); }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { background: none; border: none; cursor: pointer; font: inherit; color: inherit; }

.mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; font-size: var(--step--1); }
.serif { font-family: var(--font-display); }
.serif-alt { font-family: var(--font-serif-alt); }

/* =========================================================
   TOP NAV BAR
   ========================================================= */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(242, 237, 225, 0.82);
  backdrop-filter: saturate(1.2) blur(14px);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
  border-bottom: var(--edge);
  z-index: 50;
}

.topbar__inner {
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(16px, 2.4vw, 40px);
}

.topbar__logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--ink);
}
.topbar__mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.topbar__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.topbar__name em { font-style: italic; color: var(--brass-deep); }

.topbar__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: clamp(6px, 0.8vw, 14px);
  flex-wrap: nowrap;
  width: 100%;
  overflow: hidden;
}
.topbar__nav a {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.topbar__nav a i {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--brass-deep);
}
.topbar__nav a:hover { background: var(--ink); color: var(--paper); }
.topbar__nav a:hover i { color: var(--brass); }
.topbar__nav a.is-active { background: var(--ink); color: var(--paper); }
.topbar__nav a.is-active i { color: var(--brass); }

.topbar__menu {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  transition: background var(--transition), color var(--transition);
}
.topbar__menu:hover { background: var(--ink); color: var(--paper); }
.topbar__menu-icon { display: inline-flex; flex-direction: column; gap: 3px; }
.topbar__menu-icon i { display: block; width: 14px; height: 1.25px; background: currentColor; }

@media (max-width: 1100px) {
  .topbar__nav { display: none; }
  .topbar__menu { display: inline-flex; }
}
@media (max-width: 560px) {
  .topbar__name { display: none; }
}

/* Page spacer for fixed topbar */
main { padding-top: var(--topbar-h); }

/* =========================================================
   OVERLAY MENU (full-screen chapter index)
   ========================================================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}
.overlay__veil {
  position: absolute; inset: 0;
  background: var(--ink);
  clip-path: inset(0 0 100% 0);
  transition: clip-path var(--transition-slow);
}
.overlay__body {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: clamp(24px, 5vw, 72px) clamp(20px, 4vw, 56px);
  color: var(--paper);
  opacity: 0;
  transition: opacity 400ms ease 80ms;
  pointer-events: none;
}
body.menu-open { overflow: hidden; }
body.menu-open .overlay { pointer-events: auto; }
body.menu-open .overlay__veil { clip-path: inset(0 0 0 0); }
body.menu-open .overlay__body { opacity: 1; pointer-events: auto; }

.overlay__nav { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.overlay__nav a {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: baseline;
  gap: 20px;
  padding: 12px 0;
  border-top: 1px solid rgba(242, 237, 225, 0.14);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 3.6vw, 52px);
  line-height: 1;
  letter-spacing: -0.02em;
  transition: color var(--transition);
}
.overlay__nav a:last-of-type { border-bottom: 1px solid rgba(242, 237, 225, 0.14); }
.overlay__nav a .idx { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.5; }
.overlay__nav a .meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.5; }
.overlay__nav a:hover { color: var(--brass); font-style: italic; }
.overlay__nav a.is-active { color: var(--brass); }

.overlay__aside {
  align-self: end;
  justify-self: end;
  max-width: 300px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.8;
  opacity: 0.72;
}
.overlay__aside p + p { margin-top: 14px; }

.overlay__close {
  position: absolute;
  top: clamp(18px, 2.6vw, 28px);
  right: clamp(18px, 2.6vw, 28px);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.overlay__close::after {
  content: ""; width: 12px; height: 12px;
  background-image: linear-gradient(45deg, transparent calc(50% - 1px), var(--paper) 50%, transparent calc(50% + 1px)),
                    linear-gradient(-45deg, transparent calc(50% - 1px), var(--paper) 50%, transparent calc(50% + 1px));
}

@media (max-width: 900px) {
  .overlay__body { grid-template-columns: 1fr; }
  .overlay__aside { text-align: left; justify-self: start; margin-top: 20px; }
}

/* =========================================================
   PAGE ENTER TRANSITION
   ========================================================= */
.page-curtain {
  position: fixed; inset: 0; z-index: 200;
  background: var(--ink);
  transform-origin: center top;
  transform: scaleY(1);
  transition: transform 800ms cubic-bezier(0.76, 0, 0.24, 1);
}
.page-curtain.is-out { transform-origin: center bottom; transform: scaleY(0); }

/* =========================================================
   CUSTOM CURSOR
   ========================================================= */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 300;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  transition: transform 120ms ease-out, width 260ms ease, height 260ms ease, opacity 260ms ease;
}
.cursor-dot { width: 6px; height: 6px; background: #fff; border-radius: 50%; }
.cursor-ring { width: 28px; height: 28px; border: 1px solid rgba(255,255,255,0.6); border-radius: 50%; transition: transform 460ms cubic-bezier(0.2,0.8,0.2,1), width 260ms ease, height 260ms ease; }
body.cursor-hover .cursor-ring { width: 56px; height: 56px; }
body.cursor-label .cursor-ring { width: 84px; height: 84px; background: var(--ember); border-color: transparent; }
body.cursor-label .cursor-ring::after {
  content: attr(data-label);
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #fff;
}
@media (hover: none) { .cursor-dot, .cursor-ring { display: none; } }

/* =========================================================
   TICKER
   ========================================================= */
.ticker {
  overflow: hidden;
  border-top: var(--edge);
  border-bottom: var(--edge);
  padding: 12px 0;
  background: transparent;
}
.ticker__track {
  display: flex;
  gap: 50px;
  animation: ticker 56s linear infinite;
  will-change: transform;
  width: max-content;
}
.ticker__track span {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(16px, 1.6vw, 24px);
  white-space: nowrap;
  color: var(--ink-2);
}
.ticker__track span b {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-right: 16px;
  color: var(--brass-deep);
  vertical-align: middle;
}
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* =========================================================
   FOOTER
   ========================================================= */
.colophon {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  padding: clamp(36px, 5vw, 72px) var(--gutter) 24px;
  margin-top: clamp(40px, 6vw, 96px);
}
.colophon__grid {
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: clamp(24px, 3vw, 56px);
  align-items: start;
  padding-bottom: clamp(32px, 4vw, 56px);
  border-bottom: 1px solid rgba(242, 237, 225, 0.18);
}
.colophon__brand {
  display: flex; flex-direction: column; gap: 16px;
}
.colophon__brand h3 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.2vw, 32px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.colophon__brand h3 em { font-style: italic; color: var(--brass); }
.colophon__brand p {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
  max-width: 340px;
  line-height: 1.7;
}
.colophon__col h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 16px;
  opacity: 0.55;
}
.colophon__col ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.colophon__col a {
  font-family: var(--font-display);
  font-size: 16px;
  transition: color var(--transition);
}
.colophon__col a:hover { color: var(--brass); font-style: italic; }

.colophon__contact address {
  font-style: normal;
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
}
.colophon__contact address a { transition: color var(--transition); }
.colophon__contact address a:hover { color: var(--brass); }

.colophon__social { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.colophon__social a {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid rgba(242, 237, 225, 0.2);
  border-radius: 50%;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.colophon__social a:hover { background: var(--brass); color: var(--ink); border-color: transparent; }
.colophon__social svg { width: 12px; height: 12px; fill: currentColor; }

.colophon__meta {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(242, 237, 225, 0.6);
  gap: 16px;
  flex-wrap: wrap;
}
.colophon__meta a:hover { color: var(--brass); }

/* =========================================================
   PAGE HEAD CHROME
   ========================================================= */
.page-head {
  max-width: 1600px;
  margin: 0 auto;
  padding: clamp(36px, 4.5vw, 72px) var(--gutter) clamp(32px, 4vw, 56px);
  position: relative;
}
.page-head__meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-bottom: 18px;
  border-bottom: var(--edge);
  flex-wrap: wrap;
  gap: 10px;
}
.page-head__title {
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 0.96;
  letter-spacing: -0.025em;
  font-size: var(--step-6);
  margin-top: 28px;
}
.page-head__title em { font-style: italic; color: var(--brass-deep); font-weight: 300; }
.page-head__lede {
  margin-top: clamp(18px, 2.4vw, 30px);
  max-width: 720px;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-2);
  line-height: 1.45;
  color: var(--ink-2);
}

/* Container */
.container { max-width: 1600px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.hairline { border-top: var(--edge); }

/* Reveal utilities */
[data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 800ms ease, transform 800ms cubic-bezier(0.2, 0.8, 0.2, 1); }
[data-reveal].is-in { opacity: 1; transform: none; }
[data-reveal="lift"] { transform: translateY(48px); }
[data-reveal="fade"] { transform: none; }

/* Split letters */
.split-char { display: inline-block; transform: translateY(110%); opacity: 0; transition: transform 800ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 800ms ease; }
[data-split].is-in .split-char { transform: none; opacity: 1; }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
