/* ---------- Tokens ---------- */
:root {
  --paper: #faf7f0;
  --paper-2: #f3eee2;
  --ink: #161b29;
  --ink-2: #3a4358;
  --ink-3: #6c7689;
  --ink-4: #a7afbf;
  --rule: rgba(22, 27, 41, 0.12);
  --rule-strong: rgba(22, 27, 41, 0.28);
  --accent: #9c2b25;
  --accent-soft: #c76f65;
  --accent-tint: rgba(156, 43, 37, 0.08);

  --font-display: "Fraunces", "Iowan Old Style", "Apple Garamond", Georgia, serif;
  --font-body: "Geist", -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
  --font-mono: "Geist Mono", "SF Mono", ui-monospace, monospace;

  --measure: 64ch;
  --gutter: clamp(20px, 4.5vw, 56px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11131a;
    --paper-2: #181b25;
    --ink: #f1ece0;
    --ink-2: #c4ccdc;
    --ink-3: #8893a8;
    --ink-4: #525c70;
    --rule: rgba(241, 236, 224, 0.12);
    --rule-strong: rgba(241, 236, 224, 0.28);
    --accent: #d97c75;
    --accent-soft: #e8a59f;
    --accent-tint: rgba(217, 124, 117, 0.1);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "ss01", "ss02", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  min-height: 100vh;
}

/* paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.04 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
}
@media (prefers-color-scheme: dark) {
  body::before { mix-blend-mode: screen; opacity: 0.35; }
}

::selection { background: var(--accent); color: var(--paper); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }

/* ---------- Layout ---------- */
.shell {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(20px, 3vw, 36px) 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(48px, 8vw, 96px);
}
.brand {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.brand em {
  font-style: italic;
  color: var(--accent);
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.topnav {
  display: flex;
  gap: clamp(14px, 2.5vw, 28px);
  font-size: 14px;
  letter-spacing: 0.02em;
}
.topnav a {
  color: var(--ink-2);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  transition: color 0.18s ease;
}
.topnav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.topnav a:hover { color: var(--ink); }
.topnav a:hover::after { transform: scaleX(1); }
.topnav a.active { color: var(--accent); }
.topnav a.active::after { transform: scaleX(1); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding-bottom: clamp(48px, 8vw, 96px);
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(48px, 7vw, 80px);
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--accent);
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(44px, 8vw, 96px);
  line-height: 0.96;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--ink);
  font-variation-settings: "SOFT" 80, "WONK" 1, "opsz" 144;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.hero p.lede {
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1.4;
  color: var(--ink-2);
  max-width: 56ch;
  margin: 16px 0 0;
  font-variation-settings: "SOFT" 100, "opsz" 144;
}
.hero .meta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-top: 32px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.hero .meta span { white-space: nowrap; }

/* ---------- Article ---------- */
.article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(40px, 6vw, 72px);
  padding-bottom: clamp(64px, 10vw, 120px);
}
@media (min-width: 880px) {
  .article { grid-template-columns: 200px minmax(0, 1fr); }
}

/* sticky table of contents */
.toc {
  position: sticky;
  top: 32px;
  align-self: start;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  border-top: 1px solid var(--rule-strong);
  padding-top: 14px;
  display: none;
}
@media (min-width: 880px) { .toc { display: block; } }
.toc-label {
  text-transform: uppercase;
  color: var(--ink-3);
  letter-spacing: 0.18em;
  margin-bottom: 14px;
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: toc;
}
.toc li {
  counter-increment: toc;
  display: flex;
  gap: 10px;
}
.toc li::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--ink-4);
  flex-shrink: 0;
}
.toc a {
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.16s ease;
}
.toc a:hover { color: var(--accent); }

/* prose */
.prose { max-width: var(--measure); }
.prose section + section { margin-top: clamp(40px, 6vw, 72px); }

.prose h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.018em;
  margin: 0 0 8px;
  color: var(--ink);
  font-variation-settings: "SOFT" 70, "opsz" 144;
  display: flex;
  align-items: baseline;
  gap: 18px;
}
.prose h2::before {
  content: attr(data-num);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-variation-settings: normal;
  flex-shrink: 0;
  position: relative;
  top: -4px;
}
.prose h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.005em;
  margin: 28px 0 6px;
  color: var(--ink);
}
.prose p {
  margin: 0 0 18px;
  color: var(--ink-2);
}
.prose section > p:first-of-type::first-letter,
.prose .leadcap::first-letter {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 4.6em;
  float: left;
  line-height: 0.85;
  padding: 6px 12px 0 0;
  color: var(--accent);
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.prose ul {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}
.prose ul li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 8px;
  color: var(--ink-2);
}
.prose ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 12px;
  height: 1px;
  background: var(--accent);
}
.prose a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
  transition: background 0.16s ease, color 0.16s ease;
}
.prose a:hover { background: var(--accent-tint); color: var(--accent); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-style: italic; color: var(--ink); }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  background: var(--paper-2);
  border-radius: 3px;
}

.pullquote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.3;
  color: var(--ink);
  margin: 36px 0;
  padding: 0 0 0 28px;
  border-left: 2px solid var(--accent);
  font-variation-settings: "SOFT" 100, "opsz" 144;
}

.callout {
  margin: 32px 0;
  padding: 22px 26px;
  background: var(--paper-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font-size: 15.5px;
  line-height: 1.55;
}
.callout strong { color: var(--accent); letter-spacing: 0.02em; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--rule);
  padding: 40px 0 64px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
@media (min-width: 720px) {
  .footer { grid-template-columns: 1fr auto; align-items: center; }
}
.footer .colophon {
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--ink-2);
  line-height: 1.55;
  font-style: italic;
}
.footer nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.footer nav a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.16s ease;
}
.footer nav a:hover { color: var(--accent); }

/* ---------- Index hero variant ---------- */
.landing {
  min-height: 70vh;
  display: grid;
  align-content: center;
  padding: clamp(64px, 10vw, 120px) 0;
  border-bottom: none;
  margin-bottom: 0;
}
.landing h1 {
  font-size: clamp(56px, 12vw, 144px);
  line-height: 0.92;
}
.landing-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--rule-strong);
  margin-top: 64px;
}
@media (min-width: 720px) {
  .landing-cards { grid-template-columns: repeat(3, 1fr); border-top: none; }
}
.landing-card {
  display: block;
  padding: 36px 28px 40px;
  border-bottom: 1px solid var(--rule);
  border-right: none;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: background 0.2s ease;
}
@media (min-width: 720px) {
  .landing-card { border-bottom: none; border-right: 1px solid var(--rule); border-top: 1px solid var(--rule-strong); }
  .landing-card:last-child { border-right: none; }
}
.landing-card:hover { background: var(--accent-tint); }
.landing-card .num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent);
  display: block;
  margin-bottom: 16px;
}
.landing-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.018em;
  margin: 0 0 8px;
  color: var(--ink);
  font-variation-settings: "SOFT" 80, "opsz" 144;
}
.landing-card h3 em { font-style: italic; color: var(--accent); }
.landing-card p {
  font-size: 14px;
  color: var(--ink-3);
  margin: 0;
  line-height: 1.55;
}
.landing-card .arrow {
  margin-top: 22px;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink-4);
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), color 0.18s ease;
  display: inline-block;
}
.landing-card:hover .arrow { transform: translateX(8px); color: var(--accent); }

/* ---------- Contact-specific ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
@media (min-width: 880px) {
  .contact-grid { grid-template-columns: 1.2fr 1fr; gap: 48px; }
}
.contact-card {
  border: 1px solid var(--rule-strong);
  background: var(--paper-2);
  padding: 32px 28px;
  border-radius: 4px;
  position: relative;
}
.contact-card .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
  display: block;
}
.contact-card .email {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 400;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  display: inline-block;
  font-variation-settings: "SOFT" 80, "opsz" 144;
  word-break: break-all;
}
.contact-card .email:hover { color: var(--accent); }
.contact-card p { font-size: 14px; color: var(--ink-2); margin: 18px 0 0; }
.faq-list { list-style: none; padding: 0; margin: 0; }
.faq-item {
  border-bottom: 1px solid var(--rule);
  padding: 20px 0;
}
.faq-item:first-child { border-top: 1px solid var(--rule-strong); padding-top: 22px; }
.faq-q {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  margin: 0 0 6px;
  color: var(--ink);
  letter-spacing: -0.005em;
  font-variation-settings: "SOFT" 60, "opsz" 144;
}
.faq-a {
  font-size: 15px;
  color: var(--ink-2);
  margin: 0;
  line-height: 1.55;
}
.faq-a a { color: var(--ink); border-bottom: 1px solid var(--accent); }

/* ---------- Animations ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.prose section { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.prose section:nth-of-type(1) { animation-delay: 0.05s; }
.prose section:nth-of-type(2) { animation-delay: 0.10s; }
.prose section:nth-of-type(3) { animation-delay: 0.15s; }
.prose section:nth-of-type(4) { animation-delay: 0.20s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
