/* ============================================================
   CINEMATIC — design tokens & base. Dark, editorial, one accent.
   Deliberately NOT the liquid-glass system (kept distinct from Vitrea/shop).
   ============================================================ */
:root {
  --bg: #060605;
  --bg-2: #0c0b09;
  --bg-3: #121110;
  --ink: #f3ede2;
  --ink-soft: #a89e8f;
  --ink-faint: #83796a; /* lightened from #6c6459 — that failed WCAG AA (~3.5:1) at the small sizes it's used at; this computes to ~4.85:1 */
  --accent: #c9975f;
  --accent-bright: #eab97e;
  --line: rgba(243, 237, 226, 0.1);
  --line-strong: rgba(243, 237, 226, 0.18);

  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "Geist", system-ui, -apple-system, sans-serif;

  --vignette: radial-gradient(
    120% 100% at 50% 50%,
    transparent 45%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* clip, not hidden — hidden forces overflow-y:auto per spec, which can
     turn body into its own scroll container and risk breaking the
     position:sticky chapters rely on. clip has no such side effect. */
  overflow-x: clip;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  margin: 0;
}

/* ============================================================
   Skip link — visually hidden until keyboard-focused
   ============================================================ */
.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 400;
  background: var(--accent);
  color: #14110d;
  padding: 12px 20px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 16px;
}

/* ============================================================
   Background canvas (embers) — sits behind all real content. Giving
   main/nav/footer their own stacking context (position+z-index) means
   everything inside them paints as a unit above the canvas, regardless
   of whether individual children set z-index — avoids a mess of
   auto-vs-positive stacking edge cases with only 3 rules.
   ============================================================ */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.nav, main, footer {
  position: relative;
  z-index: 1;
}

/* ============================================================
   Film grain — fixed overlay, subtle, GPU-cheap (single static SVG,
   no per-frame regeneration).
   ============================================================ */
.grain {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 190;
  pointer-events: none;
  background: var(--vignette);
}

/* ============================================================
   Letterbox bars — cinema-mode framing during work chapters
   ============================================================ */
.letterbox {
  position: fixed;
  left: 0;
  right: 0;
  height: 0;
  background: #000;
  z-index: 150;
  pointer-events: none;
  transition: none;
}
.letterbox-top { top: 0; }
.letterbox-bottom { bottom: 0; }

/* ============================================================
   Chapter progress rail (right edge, desktop only)
   ============================================================ */
.progress-rail {
  position: fixed;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.3s, transform 0.3s;
}
.progress-dot.active {
  background: var(--accent);
  transform: scale(1.6);
}

@media (max-width: 900px) {
  .progress-rail { display: none; }
}

/* ============================================================
   Nav
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 40px;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}
.nav-menu-btn {
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px;
}

@media (max-width: 640px) {
  .nav { padding: 20px 22px; }
}

/* ============================================================
   No-JS nav fallback — <noscript> only renders this when JS is
   unavailable, so the JS-driven overlay menu (which needs script to
   open/close/trap focus) never becomes the only way to reach in-page
   sections. Fixed to the *bottom* of the viewport, not the top —
   avoids any layout math against the fixed .nav bar (which already
   occupies the top edge) and needs no scrolling to reach.
   ============================================================ */
.noscript-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 141;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  padding: 14px 20px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.noscript-nav a {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--ink-soft);
}
.noscript-nav a:hover {
  color: var(--accent);
}

/* ============================================================
   Fullscreen overlay menu
   ============================================================ */
.overlay-menu {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.overlay-menu.open {
  opacity: 1;
  visibility: visible;
}
.overlay-menu a {
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 56px);
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.25s;
}
.overlay-menu a:hover {
  color: var(--accent);
}
.overlay-close {
  position: absolute;
  top: 26px;
  right: 40px;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 8px;
}
@media (max-width: 640px) {
  .overlay-close { right: 22px; }
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  height: 100vh; /* fallback for browsers without svh support */
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  /* No opaque fallback fill here on purpose — leaves the drifting-embers
     canvas (js/embers.js) visible through the hero, not just the glow. */
  background: radial-gradient(70% 60% at 50% 30%, rgba(201, 151, 95, 0.12), transparent 70%);
}
.hero-content {
  position: relative;
  z-index: 2;
}
.hero-kicker {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(56px, 13vw, 160px);
  letter-spacing: -0.02em;
  color: var(--ink);
}
.hero-tagline {
  max-width: 600px;
  margin: 28px auto 0;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.65;
  color: var(--ink-soft);
}
.hero-scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.hero-scroll-hint::after {
  content: "";
  width: 1px;
  height: 40px;
  background: linear-gradient(var(--ink-faint), transparent);
  animation: scrollhint 2s ease-in-out infinite;
}
@keyframes scrollhint {
  0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
  40% { transform: scaleY(1); transform-origin: top; opacity: 1; }
  60% { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ============================================================
   Standard sections (About / How / Skills / Contact)
   ============================================================ */
.section {
  position: relative;
  padding: 160px 24px;
  max-width: 900px;
  margin: 0 auto;
}
.section-kicker {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}
.section h2 {
  font-size: clamp(32px, 5vw, 56px);
  margin-bottom: 30px;
  color: var(--ink);
}
.section p {
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 20px;
  max-width: 720px;
}
.section p strong { color: var(--ink); font-weight: 600; }

@media (max-width: 640px) {
  .section { padding: 100px 22px; }
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-top: 56px;
}
.process-step {
  background: var(--bg);
  padding: 32px 26px;
}
.process-step .step-num {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--accent);
  margin-bottom: 14px;
}
.process-step h3 {
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 10px;
}
.process-step p {
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  margin-top: 20px;
}
.skills-col h3 {
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  font-family: var(--font-sans);
  font-weight: 600;
}
.skills-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.skills-col li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  color: var(--ink);
  font-family: var(--font-display);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 30px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.25s, background 0.25s;
  color: var(--ink);
  /* A fully transparent fill only reads as a "button" against a busy
     scrim/photo background (like the chapter cards) — Contact sits on the
     flat, empty page --bg, where a 1px 18%-alpha border alone all but
     disappears. A solid (not blurred — this site rejected glassmorphism on
     purpose, see the cinematic-redesign notes) translucent ink tint gives
     every pill real presence at rest, not just on hover. */
  background: rgba(243, 237, 226, 0.055);
  border: 1px solid rgba(243, 237, 226, 0.22);
}
.btn:hover {
  transform: translateY(-2px);
  background: rgba(243, 237, 226, 0.09);
  border-color: var(--accent);
}
.btn-disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ============================================================
   Contact
   ============================================================ */
.contact-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 36px;
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  padding: 50px 24px 70px;
  text-align: center;
  border-top: 1px solid var(--line);
}
footer p {
  font-size: 13px;
  color: var(--ink-faint);
  margin: 0;
  font-family: var(--font-sans);
}

/* ============================================================
   Accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}
