/* Shared styles for benjamindwinters.com. Lives at the root (not /assets)
   because /assets/* is cached as immutable in netlify.toml. */
:root {
  --text: #f4f3eb;
  --soft: rgba(244, 243, 235, 0.78);
  --faint: rgba(244, 243, 235, 0.5);
  --rule: rgba(244, 243, 235, 0.18);
  --accent: #d6a088;          /* ember */
  --night: #050a12;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, sans-serif;
  --gutter: clamp(20px, 5.6vw, 80px);
  --ease: cubic-bezier(.4, 0, .2, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--night);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
em { font-style: italic; }

.skip { position: fixed; top: 10px; left: 10px; z-index: 20; padding: 8px 12px; background: var(--text); color: var(--night); transform: translateY(-200%); }
.skip:focus { transform: none; }

/* ---------- SCENE (fixed photo layer) ---------- */
.scene-stage { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--night); }
.scene {
  position: absolute; inset: 0;
  background: url("/assets/atmosphere.jpg") no-repeat;
  background-size: cover;
  filter: grayscale(.9) brightness(.62) contrast(1.12);
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1400ms var(--ease), transform 2400ms var(--ease);
}
.scene.on { opacity: 1; transform: scale(1); }
/* Three crops of one photograph: mountain, open water, sky. */
.scene--mountain { background-position: 50% 46%; }
.scene--water    { background-size: auto 230%; background-position: 40% 100%; }
.scene--sky      { background-size: auto 190%; background-position: 70% 0%; }
@media (max-aspect-ratio: 1/1) {
  .scene--mountain { background-size: auto 100%; background-position: 50% 50%; }
}
.scene-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(5,10,18,.6), rgba(5,10,18,0) 26%),
    linear-gradient(90deg, rgba(5,10,18,.7), rgba(5,10,18,.08) 74%),
    linear-gradient(180deg, rgba(5,10,18,0) 52%, rgba(5,10,18,.5));
}

/* ---------- HEADER ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px var(--gutter);
}
.wordmark {
  font-family: var(--serif); font-size: 26px; line-height: 1; letter-spacing: -0.01em;
  opacity: 0; transform: translateY(-6px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}
.wordmark em { color: var(--accent); }
/* Inner pages: header scrolls away with the page so it never sits on text. */
body.inner .site-header { position: absolute; }
body.scrolled .wordmark, body.inner .wordmark { opacity: 1; transform: none; }
.site-nav { display: flex; gap: clamp(18px, 2.4vw, 34px); font-size: 14px; letter-spacing: 0.01em; }
.site-nav a { padding: 8px 0; color: var(--soft); border-bottom: 1px solid transparent; transition: color 200ms, border-color 200ms; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); border-color: var(--text); }
@media (max-width: 560px) {
  .site-header { padding: 16px var(--gutter); }
  .site-nav { gap: 16px; font-size: 13px; }
}

/* ---------- SECTION INDEX (right edge) ---------- */
.section-index {
  position: fixed; right: var(--gutter); top: 50%; z-index: 4;
  display: flex; flex-direction: column; gap: 14px; align-items: flex-end;
  transform: translateY(-50%);
  opacity: 0; visibility: hidden; transition: opacity 300ms, visibility 300ms;
}
body.scrolled .section-index { opacity: 1; visibility: visible; }
.section-index a { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--faint); transition: color 200ms; }
.section-index a span:first-child { font-variant-numeric: tabular-nums; }
.section-index .lbl { opacity: 0; transform: translateX(6px); transition: opacity 240ms, transform 240ms; white-space: nowrap; }
.section-index a::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.section-index a:hover .lbl, .section-index a.active .lbl { opacity: 1; transform: none; }
.section-index a.active, .section-index a:hover { color: var(--text); }
@media (max-width: 860px) { .section-index { display: none; } }

/* ---------- HOME: chapters ---------- */
/* svh = the screen height with mobile browser toolbars showing, so the
   bottom-aligned name is visible on first load on iPhone. */
.chapter { position: relative; min-height: 100vh; min-height: 100svh; }
.chapter--tall { min-height: 170vh; min-height: 170svh; }
.chapter-inner {
  position: sticky; top: 0; min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 120px var(--gutter) clamp(72px, 14vh, 140px);
}
.opening h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(64px, 12vw, 176px); line-height: .9; letter-spacing: -0.035em;
}
.opening h1 em { color: var(--accent); }
.opening .sub { margin-top: 26px; font-size: 15px; letter-spacing: 0.02em; color: var(--soft); }
.cue {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  width: 1px; height: 44px; background: linear-gradient(var(--faint), transparent);
  animation: cue 2.4s var(--ease) infinite;
}
@keyframes cue { 0% { transform: translateX(-50%) scaleY(0); transform-origin: top; } 50% { transform: translateX(-50%) scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: translateX(-50%) scaleY(0); transform-origin: bottom; } }
@media (prefers-reduced-motion: reduce) { .cue { animation: none; } }

.copy { max-width: 600px; }
.copy h2, .page-head h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(56px, 7.6vw, 104px); line-height: .98; letter-spacing: -0.03em;
}
.copy h2 em, .page-head h1 em { color: var(--accent); }
.copy .lead { margin-top: 30px; font-family: var(--serif); font-size: clamp(22px, 2.2vw, 28px); line-height: 1.3; color: var(--text); }
.copy p { margin-top: 18px; font-size: 18px; color: var(--soft); max-width: 36em; }
.actions { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 14px 40px; }
/* Action links: plain label over a faint Ember underline that firms up on hover. */
.arrow-link {
  display: inline-block; padding-bottom: 3px;
  font-size: 17px; color: var(--soft);
  border-bottom: 1px solid rgba(214, 160, 136, 0.35);
  transition: color 240ms var(--ease), border-color 240ms var(--ease);
}
.arrow-link:hover { color: var(--text); border-color: var(--accent); }

/* reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 900ms var(--ease), transform 900ms var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } .scene { transition: opacity 400ms; transform: none; } }

/* ---------- INNER PAGES ---------- */
.page { padding: clamp(140px, 22vh, 220px) var(--gutter) 80px; max-width: calc(760px + 2 * var(--gutter)); }
.page-head p { margin-top: 30px; font-size: 18px; color: var(--soft); max-width: 36em; }
.page-head p.lead { font-family: var(--serif); font-size: clamp(22px, 2.2vw, 28px); line-height: 1.3; color: var(--text); }
.entry { margin-top: 64px; padding-top: 40px; border-top: 1px solid var(--rule); }
.entry h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.05; letter-spacing: -0.01em; margin-bottom: 18px; }
.entry h2 .meta { font-family: var(--sans); font-size: 13px; letter-spacing: 0.04em; color: var(--faint); margin-left: 10px; vertical-align: middle; }
.entry p { color: var(--soft); margin-top: 14px; max-width: 38em; }
.entry p:first-of-type { margin-top: 0; }
.entry .opener { font-family: var(--serif); font-size: clamp(24px, 2.6vw, 32px); line-height: 1.28; color: var(--text); max-width: 26em; }
.entry h2 em { color: var(--accent); }
.entry h2 a { border-bottom: 1px solid var(--rule); }
.entry .intro { margin: 0 0 20px; }
.entry strong { font-weight: 500; color: var(--text); }
.entry ul { list-style: none; display: grid; gap: 8px; }
.entry ul li { position: relative; padding-left: 22px; color: var(--soft); }
.entry ul li::before { content: ""; position: absolute; left: 2px; top: .78em; width: 6px; height: 1px; background: var(--accent); }
.entry .result { margin-top: 22px; color: var(--text); }
.entry .result.pending { color: var(--faint); font-style: italic; }
.entry a, .page-head a.text { color: var(--text); border-bottom: 1px solid var(--rule); transition: border-color 240ms; }
.entry a:hover, .page-head a.text:hover { border-color: var(--text); }
.press { list-style: none; display: grid; gap: 0; }
.press li { padding: 18px 0; border-top: 1px solid var(--rule); padding-left: 0 !important; }
.press li::before { display: none; }
.press li:first-child { border-top: none; padding-top: 0; }
.press .src { display: block; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.press a { border: none; font-family: var(--serif); font-size: 22px; line-height: 1.25; color: var(--text); }
.press a:hover { color: var(--accent); }
.closing { margin-top: 72px; padding-top: 40px; border-top: 1px solid var(--rule); }
.closing p { color: var(--faint); font-size: 15px; }

/* ---------- FOOTER ---------- */
.site-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 22px var(--gutter); font-size: 13px; color: var(--faint);
}
.site-footer a:hover { color: var(--text); }
.home .site-footer { position: absolute; left: 0; right: 0; bottom: 0; }

