/* Project 2nd Chance — "The Turning Point"
   Committed single theme: the page's darkness and light are the story, not a preference. */

:root {
  color-scheme: dark light;

  --cast-iron: #191310;
  --flour: #F4EEE2;
  --flour-deep: #EAE2D0;
  --ticket: #FBF8F0;
  --brick: #9C3B34;
  --brick-lifted: #C96A5F;
  --raw-dough: #CBBDA6;
  --espresso: #2A211C;
  --terracotta: #B0623C;

  --font-display: "Besley", serif;
  --font-mono: "IBM Plex Mono", monospace;
  --font-body: "Newsreader", serif;

  --s1: 8px;  --s2: 16px; --s3: 24px; --s4: 32px;
  --s6: 48px; --s8: 64px; --s10: 80px; --s12: 96px;

  --wrap: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--cast-iron);
  color: var(--flour);
  font-family: var(--font-body);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.19rem);
  line-height: 1.65;
  overflow-x: hidden;
}

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

h1, h2, h3 { font-family: var(--font-display); margin: 0; }

a { color: var(--brick-lifted); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
a:focus-visible { outline: 2px solid var(--brick-lifted); outline-offset: 3px; }
.act--light a, .act--light a:focus-visible { color: var(--brick); outline-color: var(--brick); }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--flour); color: var(--espresso);
  font-family: var(--font-mono); padding: 10px 18px; z-index: 100;
}
.skip-link:focus { left: 0; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(20px, 4vw, 48px); }
.wrap--prose { max-width: 880px; }

/* ------ shared voices ------ */

.docket {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--raw-dough);
  margin: 0 0 var(--s2);
}
.docket--light { color: var(--brick); }

.prose { max-width: 62ch; color: var(--raw-dough); margin: 0 0 var(--s3); }
.act--light .prose { color: var(--espresso); }
.prose--centered { margin-inline: auto; text-align: center; }

/* ------ header ------ */

.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(25, 19, 16, 0.85);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background 300ms ease, color 300ms ease;
}
.site-head__inner {
  max-width: var(--wrap); margin-inline: auto;
  padding: 10px clamp(20px, 4vw, 48px);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
}
.site-head__brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.site-head__seal { width: 52px; height: auto; flex: none; }
.site-head__wordmark {
  font-family: var(--font-mono); font-weight: 500; font-size: 0.8rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--flour);
  transition: color 300ms ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-head__tag {
  display: block;
  font-size: 0.62rem; letter-spacing: 0.14em;
  color: var(--raw-dough); margin-top: 2px;
  transition: color 300ms ease;
}
.site-head__link {
  font-family: var(--font-mono); font-weight: 500; font-size: 0.74rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--brick-lifted); border: 1px solid var(--brick-lifted);
  padding: 9px 16px; text-decoration: none;
  white-space: nowrap;
  transition: background 200ms ease, color 200ms ease, border-color 300ms ease;
}
.site-head__link:hover { background: var(--brick-lifted); color: var(--cast-iron); text-decoration: none; }
body.lit .site-head { background: rgba(244, 238, 226, 0.88); }
body.lit .site-head__wordmark { color: var(--espresso); }
body.lit .site-head__tag { color: var(--terracotta); }
body.lit .site-head__link { color: var(--brick); border-color: var(--brick); }
body.lit .site-head__link:hover { background: var(--brick); color: var(--flour); }
body.lit .site-head__link:focus-visible { outline-color: var(--brick); }
@media (max-width: 720px) {
  .site-head__seal { width: 40px; }
  .site-head__tag { display: none; }
  .site-head__wordmark { font-size: 0.66rem; letter-spacing: 0.1em; }
  .site-head__link { padding: 8px 10px; font-size: 0.66rem; }
  .site-head__brand { gap: 10px; }
}

/* ------ acts ------ */

.act { position: relative; }
.act--dark { background: var(--cast-iron); color: var(--flour); }
.act--light { background: var(--flour); color: var(--espresso); }

/* ACT I */

.act--thesis {
  min-height: 100svh;
  display: flex; align-items: center;
  padding-block: var(--s12) var(--s10);
  overflow: hidden;
}
.act--thesis .wrap { width: 100%; position: relative; z-index: 1; }
/* Ghost seal: fills the wide-screen void with the brand's own letterpress mark,
   faint enough to read as paper texture, not a claim. */
@media (min-width: 960px) {
  .act--thesis::after {
    content: ""; position: absolute;
    right: -6%; top: 50%; transform: translateY(-50%) rotate(8deg);
    width: min(44vw, 720px); aspect-ratio: 1;
    background: url("../img/seal.png") center / contain no-repeat;
    opacity: 0.08; pointer-events: none;
  }
}
.thesis {
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 6.5rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: var(--flour);
  margin: var(--s4) 0 var(--s4);
  max-width: 14ch;
}
.thesis__line { display: block; }
/* The key word carries the accent as colour: at this line-height any underline
   collides with the next line's caps and reads as a strikethrough. */
.thesis__built { font-style: normal; color: var(--brick-lifted); }
.thesis__intro { max-width: 56ch; color: var(--raw-dough); margin: 0 0 var(--s8); }
.scroll-cue { margin: 0; }
.scroll-cue__rule {
  display: block; width: 1px; height: 48px;
  background: var(--raw-dough); margin-top: var(--s2);
}

/* ACT II */

.act--stakes { padding-block: var(--s12); }
.stakes__pull { margin: var(--s6) 0 var(--s2); padding: 0; }
.stakes__pull p {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2.4rem); line-height: 1.3;
  color: var(--raw-dough); margin: 0; max-width: 32ch;
}
.stakes__attr { margin-bottom: var(--s6); }

/* ACT III — the turn.
   Base build (no JS): three stacked stepped panels. */

.turn { background: var(--cast-iron); }
.turn__docket {
  position: relative; z-index: 2;
  max-width: var(--wrap); margin-inline: auto;
  padding: var(--s6) clamp(20px, 4vw, 48px) 0;
}
.turn__panel {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: var(--s6) clamp(20px, 4vw, 48px);
}
.turn__panel--1 { background: #191310; color: var(--flour); }
.turn__panel--2 { background: #877565; color: #FBF8F0; }
.turn__panel--2 .turn__beat-sub { color: #FBF8F0; }
.turn__panel--3 { background: #F4EEE2; color: var(--espresso); }
.turn__panel--3 .turn__beat-sub { color: var(--brick); }
.turn__beat-line {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.75rem, 3.5vw, 3rem); line-height: 1.1;
  margin: 0 0 var(--s2); max-width: 22ch;
}
.turn__beat-sub { margin: 0; }

/* Enhanced build (JS + motion + color-mix support): sticky stage. */
.turn__stage { display: none; }
body.js-turn .turn { height: 220vh; }
body.js-turn .turn__panels {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
body.js-turn .turn__stage {
  display: grid; place-items: center;
  position: sticky; top: 0; height: 100svh;
  text-align: center; padding: var(--s6) clamp(20px, 4vw, 48px);
  background: color-mix(in oklab, var(--flour) calc(var(--turn-p, 0) * 100%), var(--cast-iron));
}
body.js-turn .turn__beat {
  grid-area: 1 / 1;
  opacity: 0;
  transition: opacity 200ms linear;
}
/* Each beat keeps its own fixed ink (matching the no-JS stepped panels) so the
   copy stays legible at every point of the background sweep — only the ground moves. */
body.js-turn .turn__beat[data-beat="0"] { color: var(--flour); }
body.js-turn .turn__beat[data-beat="1"] { color: #FBF8F0; text-shadow: 0 1px 14px rgba(25, 19, 16, 0.35); }
body.js-turn .turn__beat[data-beat="2"] { color: var(--espresso); }
body.js-turn .turn__beat[data-beat="2"] .turn__beat-sub { color: var(--brick); opacity: 1; }
body.js-turn .turn__beat-sub { color: inherit; opacity: 0.75; }

/* ACT IV */

.act--bridge { padding-block: var(--s12); }
.bridge__lead {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2.2rem); line-height: 1.25;
  color: var(--espresso); max-width: 30ch; margin: var(--s3) 0 var(--s10);
}
.bridge__lead strong { color: var(--brick); }

.timecard {
  position: relative;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--s4);
  margin-bottom: var(--s10);
  padding-top: var(--s4);
}
.timecard__rule {
  position: absolute; left: 0; right: 0; top: 55%;
  height: 2px; background: var(--brick);
  transform: scaleX(1); transform-origin: left center;
}
.timecard__card {
  position: relative; z-index: 1;
  background: var(--ticket);
  border: 1px solid var(--espresso);
  box-shadow: 0 6px 18px rgba(42, 33, 28, 0.08);
  padding: var(--s4) var(--s3) var(--s3);
}
.timecard__card h3 {
  font-weight: 800; font-size: 1.5rem; color: var(--espresso);
  margin: 0 0 var(--s2);
}
.timecard__card p:last-child { margin: 0; color: var(--espresso); font-size: 1rem; }
.held {
  position: absolute; top: -32px; right: 18px;
  width: 64px; height: 64px; border: 2px solid var(--brick); border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 500; font-size: 0.72rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--brick);
  background: var(--ticket);
  transform: rotate(-8deg);
}

.photo { margin: 0 0 var(--s10); }
.photo img { border: 2px solid var(--terracotta); }
.photo figcaption { margin-top: var(--s2); }

.menu {
  background: var(--ticket);
  border: 1px solid var(--espresso);
  max-width: 720px;
  padding: var(--s4) clamp(20px, 4vw, 40px);
  box-shadow: 0 6px 18px rgba(42, 33, 28, 0.08);
}
.menu__head { margin-bottom: var(--s3); }
.menu__list { list-style: none; margin: 0 0 var(--s4); padding: 0; }
.menu__list li {
  display: flex; align-items: baseline; gap: 10px;
  padding-block: 10px;
}
.menu__item { color: var(--espresso); flex: none; }
.menu__dots {
  flex: 1; min-width: 24px; height: 0.6em;
  background-image: radial-gradient(circle, var(--espresso) 1px, transparent 1.5px);
  background-size: 8px 2px;
  background-position: bottom left;
  background-repeat: repeat-x;
  opacity: 0.5;
}
.cert {
  flex: none;
  font-family: var(--font-mono); font-weight: 500; font-size: 0.72rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ticket); background: var(--brick);
  padding: 3px 10px;
  transform: rotate(-2deg);
}
.menu__closer {
  font-family: var(--font-display); font-style: italic; font-weight: 700;
  font-size: 1.25rem; color: var(--espresso); margin: 0;
}

/* ACT V */

.act--roots { padding-block: var(--s12) 0; }
.pillars {
  font-weight: 800; font-size: clamp(1.5rem, 3.4vw, 2.8rem);
  color: var(--espresso); text-align: center;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: clamp(12px, 2vw, 24px);
  margin-bottom: var(--s3);
}
.pin { width: 10px; height: 10px; border-radius: 50%; background: var(--brick); flex: none; }

.cred { background: var(--flour-deep); margin-top: var(--s10); padding-block: var(--s10); }
.cred__grid {
  display: grid; grid-template-columns: 38% 1fr;
  gap: clamp(24px, 4vw, 64px); align-items: center;
}
.photo--tall { margin: 0; }
.cred__lead { font-size: 1.19rem; color: var(--espresso); margin: 0 0 var(--s4); max-width: 40ch; }
.figure { margin-bottom: var(--s4); }
.figure:last-child { margin-bottom: 0; }
.figure__num {
  font-family: var(--font-display); font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1.1;
  text-decoration: none;
  display: inline-block;
}
.act--light .figure__num { color: var(--brick); }
.figure__num:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.figure .docket { margin: 4px 0 0; }

.founder {
  display: grid; grid-template-columns: 45% 1fr;
  gap: clamp(24px, 4vw, 64px); align-items: center;
  padding-block: var(--s12);
}
.founder__photo { margin: 0; }
.founder__text h2 {
  font-weight: 800; font-size: clamp(1.75rem, 3vw, 2.6rem);
  color: var(--espresso); margin-bottom: var(--s3);
}

.launch {
  border-top: 1px solid var(--espresso);
  padding-block: var(--s6) var(--s10);
}
.launch .docket { margin-bottom: var(--s1); }
.launch__partners { color: var(--espresso); opacity: 0.75; }

/* ACT VI */

.act--ask { padding-block: var(--s12); }
.ask__title {
  font-weight: 800; font-size: clamp(2rem, 4vw, 3.4rem);
  color: var(--flour); margin-bottom: var(--s8);
}
.ask__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.ask__card {
  border: 1px solid var(--raw-dough);
  padding: var(--s4) var(--s3);
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
}
.ask__card:hover { transform: translateY(-2px); border-color: var(--brick-lifted); background: #221913; }
.ask__card > p:nth-of-type(2) { color: var(--raw-dough); margin: 0 0 var(--s4); }
.btn {
  display: inline-block;
  font-family: var(--font-mono); font-weight: 500; font-size: 0.76rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--brick-lifted); border: 1px solid var(--brick-lifted);
  padding: 12px 20px; text-decoration: none;
  margin-bottom: var(--s3);
}
.btn:hover { background: var(--brick-lifted); color: var(--cast-iron); }
.ask__mail { margin: 0; overflow-wrap: anywhere; }

/* footer */

.site-foot { background: var(--cast-iron); border-top: 1px solid rgba(203, 189, 166, 0.25); }
.site-foot__inner { padding-block: var(--s8); }
.site-foot__seal { width: 72px; margin-bottom: var(--s3); }
.site-foot__tag { color: var(--brick-lifted); }
.site-foot .docket { margin-bottom: var(--s1); }

/* ------ motion (only when JS opts in; page is final-state by default) ------ */

body.js-motion .reveal {
  opacity: 0; transform: translateY(14px);
  transition: opacity 500ms ease-out, transform 500ms ease-out;
}
body.js-motion .reveal.visible { opacity: 1; transform: none; }

body.js-motion .thesis__line {
  opacity: 0; transform: translateY(14px);
  animation: rise 600ms ease-out forwards;
}
body.js-motion .thesis__line:nth-child(1) { animation-delay: 0.1s; }
body.js-motion .thesis__line:nth-child(2) { animation-delay: 0.35s; }
body.js-motion .thesis__line:nth-child(3) { animation-delay: 0.6s; }
body.js-motion .thesis__line:nth-child(4) { animation-delay: 0.85s; }
body.js-motion .thesis__intro, body.js-motion .scroll-cue {
  opacity: 0; animation: rise 600ms ease-out 1.15s forwards;
}
body.js-motion .thesis__built {
  color: var(--flour);
  animation: inkIn 500ms ease-out 1.3s forwards;
}
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes inkIn { to { color: var(--brick-lifted); } }

body.js-motion .timecard__rule { transform: scaleX(0); transition: transform 700ms ease-out; }
body.js-motion .timecard.struck .timecard__rule { transform: scaleX(1); }
body.js-motion .held {
  opacity: 0; transform: rotate(-14deg) scale(1.3);
  transition: opacity 260ms cubic-bezier(0.34, 1.4, 0.64, 1), transform 260ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
body.js-motion .timecard.struck .timecard__card:nth-child(2) .held { transition-delay: 700ms; }
body.js-motion .timecard.struck .timecard__card:nth-child(3) .held { transition-delay: 950ms; }
body.js-motion .timecard.struck .timecard__card:nth-child(4) .held { transition-delay: 1200ms; }
body.js-motion .timecard.struck .held { opacity: 1; transform: rotate(-8deg) scale(1); }

body.js-motion .cert {
  opacity: 0; transform: rotate(-10deg) scale(1.3);
  transition: opacity 260ms cubic-bezier(0.34, 1.4, 0.64, 1), transform 260ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
body.js-motion .menu.struck li:nth-child(1) .cert { transition-delay: 0ms; }
body.js-motion .menu.struck li:nth-child(2) .cert { transition-delay: 80ms; }
body.js-motion .menu.struck li:nth-child(3) .cert { transition-delay: 160ms; }
body.js-motion .menu.struck li:nth-child(4) .cert { transition-delay: 240ms; }
body.js-motion .menu.struck li:nth-child(5) .cert { transition-delay: 320ms; }
body.js-motion .menu.struck .cert { opacity: 1; transform: rotate(-2deg) scale(1); }

body.js-motion .stamp {
  opacity: 0; transform: rotate(-10deg) scale(1.2);
  transition: opacity 300ms cubic-bezier(0.34, 1.4, 0.64, 1), transform 300ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
body.js-motion .stamp.struck { opacity: 1; transform: rotate(-4deg) scale(1); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

/* ------ responsive ------ */

@media (max-width: 720px) {
  .timecard { grid-template-columns: 1fr; gap: var(--s6); padding-left: 20px; }
  .timecard__rule {
    left: 0; right: auto; top: 0; bottom: 0; height: auto; width: 2px;
    transform: scaleY(1); transform-origin: top center;
  }
  body.js-motion .timecard__rule { transform: scaleY(0); }
  body.js-motion .timecard.struck .timecard__rule { transform: scaleY(1); }
  .held { top: -26px; right: 12px; width: 56px; height: 56px; font-size: 0.66rem; }

  .cred__grid, .founder { grid-template-columns: 1fr; }
  .photo--tall { max-width: 420px; }
  .founder__photo { max-width: 520px; }

  .ask__grid { grid-template-columns: 1fr; }
  .menu__list li { flex-wrap: wrap; }
}
