/* ─────────────────────────────────────────────────────────────
   Axcelner — editorial one-pager (v3)
   Quiet, precise, instrument-grade. No bluish glow background.
   Background reads like a deep, slightly warm, archival surface.
   ───────────────────────────────────────────────────────────── */

:root {
  /* A near-black with the faintest warm cast, so it doesn't read "tech blue" */
  --bg: #0c0c0e;
  --bg-2: #0a0a0c;
  --ink: #f1f0ec;        /* slightly warm white for an archival feel */
  --ink-soft: #c6c5c0;
  --ink-dim: #8a8884;
  --ink-faint: #525049;
  --rule: rgba(241, 240, 236, 0.10);
  --rule-soft: rgba(241, 240, 236, 0.06);

  /* The brand blue stays, but it appears ONLY in accents, never in the field */
  --accent: #43b8ff;
  --accent-soft: #87cfff;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-serif: "Instrument Serif", ui-serif, Georgia, serif;

  --col: 640px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "ss02";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
  /* Very subtle radial light from top center, near-white not blue */
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255, 252, 244, 0.045), transparent 70%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: rgba(67, 184, 255, 0.28); color: #fff; }

/* Accessibility — skip link for keyboard / screen reader users */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 3px;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ───── Ambient: grain + vignette + instrument fiducials ───── */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
/* Film grain, neutral (no blue tint) */
.ambient .grain {
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.95  0 0 0 0 0.94  0 0 0 0 0.9  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.4'/></svg>");
  opacity: 0.07;
  mix-blend-mode: screen;
}
/* Vignette: darkens edges, holds focus to the column */
.ambient .vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 80% at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
}
main, header, footer { position: relative; z-index: 1; }

/* ───── Intro animation — punch-in, hold, zoom-through ───── */
.intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: intro-bg-fade 0.95s cubic-bezier(0.4, 0, 0.2, 1) 1.85s forwards;
}
.intro-word {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(56px, 10vw, 120px);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  opacity: 0;
  transform: scale(0.45);
  filter: blur(14px);
  animation: intro-word 2.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  will-change: transform, opacity, filter, letter-spacing;
}
@keyframes intro-word {
  0%   { opacity: 0; transform: scale(0.45); filter: blur(14px); letter-spacing: 0.20em; }
  26%  { opacity: 1; transform: scale(1);    filter: blur(0);    letter-spacing: -0.045em; }
  58%  { opacity: 1; transform: scale(1);    filter: blur(0);    letter-spacing: -0.045em; }
  100% { opacity: 0; transform: scale(4.4);  filter: blur(5px);  letter-spacing: -0.08em; }
}
@keyframes intro-bg-fade {
  to { opacity: 0; visibility: hidden; }
}

/* ───── Hero — staggered reveal as the intro fades ───── */
.head .mark,
.head h1,
.head .sub,
.head .sub-note {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 1s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.head .mark     { animation-delay: 1.95s; }
.head h1        { animation-delay: 2.10s; }
.head .sub      { animation-delay: 2.30s; }
.head .sub-note { animation-delay: 2.50s; }

/* Topbar drops in from the top, post-intro */
.topbar {
  opacity: 0;
  transform: translateY(-8px);
  animation: rise-top 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 2.4s forwards;
}

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes rise-top {
  to { opacity: 1; transform: translateY(0); }
}

/* ───── Scroll-triggered reveal ───── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.95s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.95s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .intro { display: none; }
  .head .mark, .head h1, .head .sub, .head .sub-note,
  .topbar, .reveal {
    opacity: 1;
    transform: none;
    animation: none;
    transition: none;
  }
}

/* ───── Top chrome ───── */

.topbar {
  position: fixed;
  top: 26px;
  right: 36px;
  z-index: 10;
  display: flex;
  gap: 26px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.topbar a:hover { color: var(--accent-soft); }

.metabar {
  position: fixed;
  top: 26px;
  left: 36px;
  z-index: 10;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex;
  gap: 16px;
  align-items: center;
}
.metabar .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  display: inline-block;
}

@media (max-width: 760px) {
  .topbar { top: 18px; right: 20px; gap: 18px; font-size: 11.5px; }
  .metabar { top: 18px; left: 20px; font-size: 10px; }
  .metabar .doc-tag { display: none; }
}

/* ───── Header ───── */

.head {
  padding: clamp(140px, 22vh, 220px) 24px 56px;
  text-align: center;
}
.head .mark {
  display: inline-block;
  margin-bottom: 24px;
}
.head .mark img {
  width: clamp(58px, 7.5vw, 78px);
  height: auto;
}

.head h1 {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(56px, 10vw, 120px);
  line-height: 0.96;
  letter-spacing: -0.045em;
  color: var(--ink);
}

.head .sub {
  margin: clamp(28px, 4vw, 40px) auto 0;
  max-width: 760px;
  padding: 0 16px;
  font-size: clamp(18px, 2.1vw, 25px);
  line-height: 1.38;
  letter-spacing: -0.012em;
  color: var(--ink-soft);
  font-weight: 400;
}
.head .sub em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink);
  font-size: 1.06em;
  letter-spacing: -0.005em;
}

.head .sub-note {
  margin: 22px auto 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
}
.head .sub-note a {
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: color .2s ease, border-color .2s ease;
}
.head .sub-note a:hover { color: var(--accent-soft); border-color: var(--accent); }
.head .sub-note span { transition: transform .2s ease; display: inline-block; margin-left: 2px; }
.head .sub-note a:hover + span { transform: translateX(3px); }

/* ───── Essay ───── */

.essay {
  max-width: var(--col);
  margin: clamp(80px, 13vh, 140px) auto 0;
  padding: 0 24px;
  font-size: clamp(17px, 1.35vw, 19px);
  line-height: 1.72;
  color: var(--ink-soft);
  letter-spacing: -0.003em;
}
.essay p { margin: 0 0 1.5em; }
.essay p.lead {
  color: var(--ink);
  font-size: 1.06em;
  letter-spacing: -0.008em;
}
.essay strong, .essay b { color: var(--ink); font-weight: 500; }
.essay em { font-family: var(--font-serif); font-style: italic; color: var(--ink); font-size: 1.05em; letter-spacing: -0.005em; }

.essay a.ilink {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(241, 240, 236, 0.3);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color .2s ease, color .2s ease;
}
.essay a.ilink:hover { text-decoration-color: var(--accent); color: var(--accent-soft); }

/* Pull-line in the middle of the essay */
.essay .pull {
  display: block;
  margin: 2.4em -8px;
  padding: 1.4em 0;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-align: left;
}
.essay .pull::before {
  content: "“";
  font-family: var(--font-serif);
  color: var(--accent);
  margin-right: 4px;
  font-style: italic;
}
.essay .pull::after {
  content: "”";
  font-family: var(--font-serif);
  color: var(--accent);
  font-style: italic;
}

/* Research focus block */
.focus {
  margin: 2.6em 0;
  padding: 22px 24px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.012);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.focus .label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
}
.focus ul { margin: 0; padding: 0; list-style: none; }
.focus li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px dashed var(--rule-soft);
}
.focus li:first-child { border-top: 0; padding-top: 2px; }
.focus li .ix {
  color: var(--accent);
  letter-spacing: 0.05em;
}
.focus li .t { color: var(--ink); }

/* Footnotes */
.essay sup {
  font-family: var(--font-mono);
  font-size: 0.7em;
  color: var(--accent-soft);
  margin-left: 2px;
  vertical-align: super;
}
.essay sup a { color: inherit; }

.footnotes {
  max-width: var(--col);
  margin: 80px auto 0;
  padding: 28px 24px 0;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-faint);
}
.footnotes ol { margin: 0; padding: 0 0 0 22px; }
.footnotes li { margin-bottom: 8px; }
.footnotes li::marker { color: var(--accent); }

/* ───── Footer ───── */

footer.foot {
  max-width: var(--col);
  margin: 0 auto;
  padding: 96px 24px 64px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
footer.foot a:hover { color: var(--ink-soft); }
footer.foot .foot-links { display: flex; gap: 22px; }

/* ───── Light theme variant (for tweaks) ───── */
:root[data-theme="light"] {
  --bg: #f5f4ef;
  --bg-2: #ecebe5;
  --ink: #15141a;
  --ink-soft: #3b3a42;
  --ink-dim: #6a6970;
  --ink-faint: #94928f;
  --rule: rgba(0, 0, 0, 0.10);
  --rule-soft: rgba(0, 0, 0, 0.05);
}
:root[data-theme="light"] body {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0, 0, 0, 0.025), transparent 70%),
    var(--bg);
}
:root[data-theme="light"] .ambient .grain { opacity: 0.10; mix-blend-mode: multiply; }
:root[data-theme="light"] .ambient .vignette {
  background: radial-gradient(ellipse 90% 80% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.10) 100%);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
