:root {
  --paper: #f1ede4;
  --paper-2: #e8e2d5;
  --ink: #161a1f;
  --ink-soft: #4a4f56;
  --rule: #c9c1b0;
  --signal: #c2361f;
  --inv-bg: #161a1f;
  --inv-ink: #f1ede4;
  --inv-soft: #9aa0a8;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", "Helvetica Neue", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1240px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101317;
    --paper-2: #171b20;
    --ink: #ece7dc;
    --ink-soft: #9ea3aa;
    --rule: #2c3138;
    --signal: #e2553b;
    --inv-bg: #ece7dc;
    --inv-ink: #101317;
    --inv-soft: #5a5f66;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #101317;
  --paper-2: #171b20;
  --ink: #ece7dc;
  --ink-soft: #9ea3aa;
  --rule: #2c3138;
  --signal: #e2553b;
  --inv-bg: #ece7dc;
  --inv-ink: #101317;
  --inv-soft: #5a5f66;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .4s, color .4s;
}
::selection { background: var(--signal); color: #fff; }
a { color: inherit; }
em { font-style: italic; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .07; mix-blend-mode: multiply;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: .05; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .grain { mix-blend-mode: screen; opacity: .05; } }

/* ---------- Mark ---------- */
.mark { width: 72px; height: 26px; flex: none; overflow: visible; }
.mark .ink { stroke: currentColor; stroke-width: 3; }
.mark .meridian { stroke: currentColor; stroke-width: 1.2; opacity: .45; }
.mark .sig { stroke: var(--signal); stroke-width: 3; }
.mark .sup { stroke-width: 2.1; }
.mark .sig { stroke-dasharray: 88; }
/* Lockup: "40th" mark + geometric-sans wordmark */
.wordmark {
  font-family: "Jost", "Futura", "Century Gothic", sans-serif; font-weight: 400;
  font-size: 15px; letter-spacing: .24em; text-transform: uppercase; line-height: 1;
  padding-top: 2px;
}
.brand:hover .mark .sig { animation: redraw .7s cubic-bezier(.65,0,.35,1); }
@keyframes redraw { from { stroke-dashoffset: 88; } to { stroke-dashoffset: 0; } }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 18px var(--gutter);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.scrolled { border-bottom-color: var(--rule); }
.brand {
  display: flex; align-items: center; gap: 14px; text-decoration: none;
}
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 28px; font-size: 14px; }
.nav-links a { text-decoration: none; color: var(--ink-soft); transition: color .2s; }
.nav-links a:hover { color: var(--ink); }
.nav-links .nav-cta {
  color: var(--ink); padding: 8px 16px; border: 1px solid var(--ink); border-radius: 999px;
  transition: background .2s, color .2s;
}
.nav-links .nav-cta:hover { background: var(--ink); color: var(--paper); }
.theme-toggle {
  background: none; border: 1px solid var(--rule); color: var(--ink); width: 34px; height: 34px;
  border-radius: 50%; cursor: pointer; font-size: 15px; line-height: 1;
}
.theme-toggle:hover { border-color: var(--ink); }

/* ---------- Shared ---------- */
section { padding: 0 var(--gutter); max-width: var(--max); margin: 0 auto; }
.label, .coord {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
}
.label { padding-top: 22px; border-top: 1px solid var(--ink); margin-bottom: 48px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 300; letter-spacing: -.02em; line-height: 1.02; }
h2 { font-size: clamp(38px, 5.6vw, 76px); margin-bottom: 56px; }
h1 em, h2 em { color: var(--signal); }


/* ---------- Hero ---------- */
.hero { padding-top: clamp(64px, 12vh, 140px); padding-bottom: 24px; }
.hero h1 { font-size: clamp(52px, 10vw, 148px); margin: 28px 0 36px; }
.lede { max-width: 620px; font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-soft); }

.reveal { opacity: 0; transform: translateY(18px); animation: rise .9s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--d) * 120ms + 100ms); }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Channels ---------- */
.channels { padding-top: clamp(64px, 9vh, 104px); }
.channels ul {
  list-style: none; display: grid; grid-template-columns: repeat(6, 1fr);
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule);
}
.channels li {
  position: relative; padding: 22px 16px 22px 0;
  font: italic 300 clamp(19px, 1.7vw, 24px)/1.15 var(--serif);
}
.channels li + li { padding-left: 16px; border-left: 1px solid var(--rule); }
.channels li::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--signal);
  transform: scaleX(0); transform-origin: left; transition: transform .5s cubic-bezier(.2,.7,.2,1);
}
.channels li:hover::before { transform: scaleX(1); }

/* ---------- Contact ---------- */
.contact { padding-top: clamp(96px, 14vh, 160px); padding-bottom: clamp(80px, 12vh, 140px); }
.contact h2 { margin-bottom: 40px; }
.email {
  display: inline-flex; align-items: baseline; gap: 14px; text-decoration: none;
  font: 400 clamp(20px, 2.6vw, 34px) var(--mono); letter-spacing: -.02em;
  padding-bottom: 6px; border-bottom: 2px solid var(--signal); word-break: break-all;
}
.email span { color: var(--signal); transition: transform .25s; }
.email:hover span { transform: translateX(6px); }
.email-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 16px; }
.copy {
  background: none; border: 1px solid var(--rule); color: var(--ink-soft); border-radius: 999px;
  padding: 6px 14px; font: 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
}
.copy:hover { border-color: var(--ink); color: var(--ink); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--max); margin: 0 auto; padding: 28px var(--gutter) 40px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap; border-top: 1px solid var(--rule);
}
.footer-mark { display: flex; align-items: center; gap: 14px; }
.footer .coord { margin-left: auto; }
.footer .fine { font-size: 13px; color: var(--ink-soft); width: 100%; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .channels ul { grid-template-columns: repeat(3, 1fr); }
  .channels li:nth-child(4) { padding-left: 0; border-left: 0; }
  .channels li:nth-child(n+4) { border-top: 1px solid var(--rule); }
}
@media (max-width: 640px) {
  .brand .wordmark { font-size: 13px; letter-spacing: .2em; }
  .channels ul { grid-template-columns: 1fr 1fr; }
  .channels li:nth-child(n) { padding-left: 0; border-left: 0; }
  .channels li:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--rule); }
  .channels li:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition: none !important; }
}
