/* ============ Adam Byrne — V2 scroll narrative ============ */

:root {
  --bg: #f3efe7;
  --bg-deep: #ece7dc;
  --ink: #26231f;
  --ink-soft: #6b655c;
  --oxblood: #6e1423;
  --signal: #c2452d;
  --steel: #a8a49c;
  --line: #d8d2c6;
  --forest-deep: #101b14;
  --forest-mid: #1d3123;
  --future-deep: #0b0e1a;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* smooth scrolling is applied per-click in JS so browser scroll
   restoration and programmatic jumps stay instant */

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }

/* ============ CTAs ============ */

.cta {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font: 600 0.85rem/1 var(--font-body);
  letter-spacing: 0.02em;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}
.cta:hover { transform: translateY(-1px); }
.cta:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.cta-primary { background: var(--oxblood); border-color: var(--oxblood); }
.cta-outline { background: transparent; color: var(--bg); border-color: rgba(243,239,231,0.6); }
.cta-outline:hover { background: rgba(243,239,231,0.12); }
.cta-outline-light { background: transparent; color: #e8e6f2; border-color: rgba(232,230,242,0.5); }
.cta-ghost-light { background: transparent; color: #9a97ad; border-color: transparent; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ============ Header ============ */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.9rem 2rem;
  transition: background 300ms ease, box-shadow 300ms ease;
}
.site-header.is-solid {
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--line);
}
.site-header.is-solid .site-nav a,
.site-header.is-solid .wordmark { color: var(--ink); }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: #f3efe7;
  text-decoration: none;
}
.wordmark img { display: block; }

.site-nav { display: flex; gap: 1.6rem; margin-left: auto; }
.site-nav a {
  color: #e9e4d8;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}
.site-nav a:hover { color: #fff; }
.site-header.is-solid .site-nav a:hover { color: var(--oxblood); }

.header-cta { padding: 0.65rem 1.1rem; font-size: 0.78rem; }

.menu-toggle {
  display: none;
  appearance: none;
  background: transparent;
  border: 0;
  width: 2.2rem; height: 2.2rem;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  margin-left: auto;
}
.menu-toggle span { display: block; height: 2px; background: currentColor; color: #f3efe7; }
.site-header.is-solid .menu-toggle span { color: var(--ink); background: currentColor; }

.mobile-menu {
  position: fixed;
  top: 3.6rem; left: 0; right: 0;
  z-index: 49;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 1.5rem 1.4rem;
}
.mobile-menu a { color: var(--ink); text-decoration: none; padding: 0.5rem 0; font-weight: 500; }
.mobile-menu .cta { justify-content: center; margin-top: 0.5rem; }
.mobile-menu[hidden] { display: none; }

/* ============ Sticky knife layer ============ */

.knife-layer {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
#knife-canvas { position: relative; z-index: 1; width: 100%; height: 100%; display: block; }

.knife-loading {
  position: absolute;
  left: 50%; bottom: 18vh;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 450ms ease;
}
.knife-loading img { width: min(38vw, 320px); opacity: 0.9; border-radius: 0.5rem; }
.knife-loading p {
  margin: 0;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #cfc9ba;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.45; } 50% { opacity: 1; } }
.knife-loading.is-done { opacity: 0; pointer-events: none; }
.knife-loading[hidden] { display: none; }

/* scene videos fade in over their poster stills once safely playing */
.scene-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 700ms ease;
}
.scene-video.is-playing { opacity: 1; }

/* ============ Hero ============ */

.hero {
  position: relative;
  min-height: 130vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 10rem 6vw 0;
  overflow: hidden;
}

/* --- forest key art: knife is composited onto the stone pedestal by the
       3D layer (anchor coords in v2.js must match this image) --- */
.hero-art { position: fixed; inset: 0; z-index: -1; }
.ha-base {
  position: absolute; inset: 0;
  background: #101b14 url('/assets/scene/hero-forest.jpg') center / cover no-repeat;
}
.ha-motes { position: absolute; inset: 0; overflow: hidden; }
.ha-motes i {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255, 244, 205, 0.55);
  filter: blur(1px);
  animation: mote 9s ease-in-out infinite;
}
@keyframes mote {
  0%, 100% { transform: translate(0, 0); opacity: 0.15; }
  50% { transform: translate(14px, -26px); opacity: 0.75; }
}
.ha-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(130% 100% at 50% 40%, transparent 62%, rgba(6, 10, 7, 0.6) 100%);
}

.hero-copy { position: relative; max-width: 34rem; }
.hero .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #d9c9a3;
  margin: 0 0 1.5rem;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  font-weight: 560;
  color: #f6f2e7;
  margin: 0 0 1.3rem;
  text-shadow: 0 2px 24px rgba(0,0,0,0.35);
}
.hero .sub { color: #ece5d2; font-size: 1.15rem; font-weight: 600; letter-spacing: 0.002em; margin: 0 0 0.5rem; }
.hero .body { color: #cfc7b2; max-width: 46ch; line-height: 1.65; margin: 0 0 2.2rem; }

.scroll-hint {
  position: absolute;
  bottom: 2.2rem; left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(240, 234, 216, 0.55);
  animation: pulse 2.4s ease-in-out infinite;
  transition: opacity 400ms ease;
}
.scroll-hint.is-hidden { opacity: 0; }

/* ============ Chapters ============ */

.chapters { position: relative; background: var(--bg); }

.chapter {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 7rem 5vw;
  max-width: 110rem;
  margin: 0 auto;
}
.ch-content { max-width: 34rem; }
.chapter.content-left  .ch-content { justify-self: start; }
.chapter.content-right .ch-content { justify-self: end; }

.ch-label {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--oxblood);
  margin: 0 0 1.2rem;
}
.chapter h2 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 3.4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.005em;
  font-weight: 580;
  margin: 0 0 0.6rem;
}
.ch-line {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 480;
  font-size: 1.3rem;
  line-height: 1.3;
  color: var(--oxblood);
  margin: 0 0 1rem;
}
.ch-body { color: var(--ink-soft); max-width: 58ch; line-height: 1.6; margin: 0 0 2.2rem; }

/* ----- artifacts ----- */

/* narrow vertical stack: keeps the artifact column clear of the knife */
.artifacts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 27rem;
}

.artifact {
  appearance: none;
  border: 1px solid var(--line);
  background: #fbf8f1;
  border-radius: 0.9rem;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  align-items: stretch;
  min-height: 6.4rem;
  font: inherit;
  color: inherit;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}
.artifact:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px -18px rgba(38, 35, 31, 0.45);
  border-color: var(--steel);
}
.artifact:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

.artifact > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 400ms ease;
}
.artifact:hover > img { transform: scale(1.04); }

.artifact .pair { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.artifact .pair img { width: 100%; height: 100%; object-fit: cover; display: block; }

.a-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.9rem 1.1rem;
}
.a-meta strong { font-size: 0.95rem; letter-spacing: -0.005em; }
.a-meta .mono { font-size: 0.6rem; letter-spacing: 0.08em; color: var(--ink-soft); text-transform: uppercase; }

/* typographic cards: single cell, meta line is redundant */
.artifact.is-typo, .artifact.is-metrics, .artifact.is-press { grid-template-columns: 1fr; }
.artifact.is-typo .a-meta, .artifact.is-metrics .a-meta, .artifact.is-press .a-meta { display: none; }

.a-typo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.45rem;
  padding: 1.1rem 1.2rem;
}
.a-typo strong { font-size: 1.1rem; line-height: 1.25; letter-spacing: -0.005em; font-weight: 600; }
.a-kicker { font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--oxblood); }
.a-desc { font-size: 0.82rem; line-height: 1.45; color: var(--ink-soft); }

.artifact.is-dark { background: #2a2622; border-color: #423c34; color: #f0ebdf; }
.artifact.is-dark .a-desc { color: #b3aa97; }
.artifact.is-dark .a-kicker { color: #d98d77; }
.artifact.is-dark .a-meta { border-color: #423c34; }
.artifact.is-dark .a-meta .mono { color: #b3aa97; }

.artifact.is-metrics .metric strong { font-size: 1.35rem; color: var(--oxblood); display: block; letter-spacing: -0.01em; }
.artifact.is-metrics .metric span { font-size: 0.68rem; color: var(--ink-soft); }
.artifact.is-metrics .metric-row { display: flex; gap: 1rem; margin-top: 0.4rem; }
.artifact.is-metrics .metric-row .metric strong { font-size: 0.95rem; }

.artifact.is-press .a-typo strong { font-style: italic; font-weight: 550; }

/* ============ Why ============ */

.why {
  position: relative;
  background: var(--bg-deep);
  padding: 9rem 1.5rem;
}
.why-inner { max-width: 38rem; margin: 0 auto; }
.why h2 { font-family: var(--font-display); font-size: clamp(2rem, 3.2vw, 2.75rem); line-height: 1.1; letter-spacing: -0.005em; font-weight: 570; margin: 0 0 1.5rem; }
.why p { max-width: 58ch; line-height: 1.65; margin: 0 0 1.1rem; }

/* ============ Finale ============ */

.finale {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 8rem 6vw;
  overflow: hidden;
  color: #e8e6f2;
}

/* --- future key art: knife is composited onto the disc platform by the
       3D layer (anchor coords in v2.js must match this image) --- */
.finale-art { position: absolute; inset: 0; z-index: 0; }
.fa-base {
  position: absolute; inset: 0;
  background: #0b0e1a url('/assets/scene/finale-future.jpg') center / cover no-repeat;
}
.fa-stars { position: absolute; inset: 0; overflow: hidden; }
.fa-stars i {
  position: absolute;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: rgba(210, 222, 255, 0.8);
  animation: pulse 4s ease-in-out infinite;
}
.fa-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(110% 90% at 50% 45%, transparent 55%, rgba(2, 3, 8, 0.8) 100%);
}

.finale-copy { position: relative; z-index: 1; max-width: 32rem; }
.finale h2 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4.6vw, 3.9rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-weight: 560;
  margin: 0 0 1rem;
  color: #f0eefb;
}
.finale .sub {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 460;
  font-size: 1.35rem;
  line-height: 1.35;
  color: #b9bdd8;
  margin: 0 0 1.1rem;
}
.finale .body { color: #9ba0bd; max-width: 46ch; line-height: 1.65; margin: 0 0 2.4rem; }

/* ============ Footer ============ */

.site-footer {
  background: #05070f;
  color: #8f93ad;
  padding: 2.4rem 2rem 2rem;
}
.f-nav { display: flex; gap: 1.6rem; justify-content: center; margin-bottom: 1.4rem; }
.f-nav a { color: #b9bdd8; text-decoration: none; font-size: 0.82rem; }
.f-nav a:hover { color: #fff; }
.f-credit {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 2rem;
  justify-content: space-between;
  font-size: 0.62rem;
}
.f-credit a { color: inherit; }

/* ============ Modal ============ */

.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 17, 13, 0.55); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  background: var(--bg);
  border-radius: 1rem;
  max-width: 46rem;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.5);
  animation: modal-in 320ms cubic-bezier(.22,.9,.3,1) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal-card { animation: none; } }

.modal-close {
  position: absolute;
  top: 0.7rem; right: 0.7rem;
  z-index: 2;
  appearance: none;
  border: 0;
  background: rgba(38,35,31,0.75);
  color: var(--bg);
  width: 2.1rem; height: 2.1rem;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.modal-media img { width: 100%; max-height: 46vh; object-fit: cover; display: block; }
.modal-media:empty { display: none; }
.modal-body { padding: 1.6rem 1.8rem 1.8rem; }
.modal-body h3 { font-family: var(--font-display); font-weight: 570; margin: 0 0 0.6rem; font-size: 1.65rem; line-height: 1.15; letter-spacing: -0.005em; }
.modal-body p { color: var(--ink-soft); margin: 0 0 1rem; }
.modal-facts { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1.2rem; margin: 0 0 1rem; }
.modal-facts dt { font-family: var(--font-mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--steel); align-self: baseline; }
.modal-facts dd { margin: 0; font-size: 0.88rem; }
.modal-note { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--steel); margin: 0; }

/* ============ Reduced motion ============ */

@media (prefers-reduced-motion: reduce) {
  .ha-motes i, .fa-stars i, .scroll-hint, .knife-loading p { animation: none; }
  .artifact, .artifact img, .cta { transition: none; }
}

/* ============ Mobile ============ */

@media (max-width: 900px) {
  .site-nav, .header-cta { display: none; }
  .menu-toggle { display: flex; }
  .site-header { padding: 0.8rem 1.25rem; }

  .hero { min-height: 112vh; padding-top: 7.5rem; }
  .ha-base, .fa-base { background-position: 62% center; }

  .chapter,
  .chapter.content-left,
  .chapter.content-right { grid-template-columns: 1fr; padding: 5.5rem 1.25rem 3rem; min-height: 0; }
  .chapter.content-right .ch-content { grid-column: 1; }
  /* leave headroom for the small knife rendered above the content */
  .chapter .ch-content { padding-top: 34vh; }

  .artifacts { max-width: none; }

  .why { padding: 6rem 1.25rem; }
  .finale-copy { margin-top: 26vh; }
  .f-credit { justify-content: center; text-align: center; }
}

@media (max-width: 560px) {
  .artifact { grid-template-columns: 6.5rem 1fr; }
}

/* contact shadow that grounds the knife in the key-art scenes */
#knife-shadow {
  position: absolute;
  top: 0; left: 0;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(8, 10, 8, 0.8) 0%, rgba(8, 10, 8, 0.38) 45%, transparent 72%);
  filter: blur(6px);
  pointer-events: none;
  will-change: transform, opacity;
}
