/* Maren Halstead, one page site (local draft).
   Palette and type mood are taken from the three trilogy covers:
   blue hour navy, gold foil lettering, lamp amber, pale steel.
   Type sizes sit on the 12 / 14 / 16 / 18 / 20 / 24 / 30 / 36 / 48 / 60 / 72 / 96 scale.
   Spacing uses only 2 4 8 12 16 24 32 40 48 64 80 96. */

/* ---------- Fonts (bundled, open licence, see fonts/ and NOTES.md) ---------- */
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/CormorantGaramond-var-latin.woff") format("woff");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Jost";
  src: url("../fonts/Jost-var-latin.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* light theme: the morning after, cool daylight on glass */
  --bg: #EDF1F5;
  --surface: #F8FAFC;
  --text: #0C1826;
  --muted: #40556A;
  --accent: #7A5A1F;
  --line: rgba(12, 24, 38, 0.14);
  --line-strong: rgba(122, 90, 31, 0.42);
  --foil-a: #A27E38;
  --foil-b: #5F4518;
  --btn-bg: #0C1826;
  --btn-fg: #F4ECDC;
  --btn-hover: #1D354C;
  --nav-bg: rgba(248, 250, 252, 0.74);
  --panel-bg: rgba(237, 241, 245, 0.92);
  --cover-shadow: 0 24px 48px rgba(12, 24, 38, 0.28);

  --serif: "Cormorant Garamond", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Jost", "Century Gothic", "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  --curve: cubic-bezier(0.22, 1, 0.36, 1);
}

/* dark theme tokens, used three ways: forced, by system setting, and inside the night panels */
:root[data-theme="dark"],
.night {
  --bg: #08111A;
  --surface: #0E1C29;
  --text: #F2EADB;
  --muted: #A8B7C5;
  --accent: #D9BE8A;
  --line: rgba(242, 234, 219, 0.14);
  --line-strong: rgba(217, 190, 138, 0.4);
  --foil-a: #F8E9C5;
  --foil-b: #BB9860;
  --btn-bg: #D9BE8A;
  --btn-fg: #0A1622;
  --btn-hover: #F0DDB0;
  --nav-bg: rgba(10, 22, 34, 0.62);
  --panel-bg: rgba(8, 17, 26, 0.92);
  --cover-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08111A;
    --surface: #0E1C29;
    --text: #F2EADB;
    --muted: #A8B7C5;
    --accent: #D9BE8A;
    --line: rgba(242, 234, 219, 0.14);
    --line-strong: rgba(217, 190, 138, 0.4);
    --foil-a: #F8E9C5;
    --foil-b: #BB9860;
    --btn-bg: #D9BE8A;
    --btn-fg: #0A1622;
    --btn-hover: #F0DDB0;
    --nav-bg: rgba(10, 22, 34, 0.62);
    --panel-bg: rgba(8, 17, 26, 0.92);
    --cover-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html.menu-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 28px;
  font-weight: 400;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2, h3 { text-wrap: balance; font-weight: 500; }
p, li { text-wrap: pretty; }
a { color: inherit; }
::selection { background: #D9BE8A; color: #0A1622; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

.wrap { width: 100%; max-width: 1152px; margin-inline: auto; padding-inline: 16px; }
.section { padding-block: 64px; }
[id] { scroll-margin-top: 96px; }
.night { color: var(--text); }

.skip {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  padding: 8px 12px; border-radius: 8px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: 14px; line-height: 20px; font-weight: 600;
  transform: translateY(-64px);
  transition: transform 500ms var(--curve);
}
.skip:focus { transform: none; }

/* ---------- Type roles ---------- */
.display {
  font-family: var(--serif);
  font-size: 36px; line-height: 40px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: lining-nums;
}
.kicker {
  font-size: 14px; line-height: 20px; font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.lede { color: var(--muted); max-width: 44ch; }
.foil {
  color: var(--foil-b);
  background-image: linear-gradient(90deg, var(--foil-a), var(--foil-b));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.link {
  color: var(--accent); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
  transition: opacity 300ms var(--curve);
}
.link:hover { opacity: 0.72; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; /* taller than the 8 / 12 house size so it is a comfortable thumb target */
  border: 0; border-radius: 9999px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-family: var(--sans); font-size: 16px; line-height: 24px; font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer;
  transition: background-color 300ms var(--curve), transform 300ms var(--curve);
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(0.98); }
.btn--sm { padding: 8px 16px; font-size: 14px; line-height: 20px; }

/* ---------- Navigation: a small floating pane of glass ---------- */
.nav { position: fixed; top: 24px; left: 0; right: 0; z-index: 60; pointer-events: none; padding-inline: 24px; }
.nav__bar {
  pointer-events: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  width: 100%; margin-inline: auto;
  padding: 8px 8px 8px 24px;
  border-radius: 9999px;
  border: 1px solid var(--line);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
}
.nav__brand {
  font-family: var(--serif); font-size: 16px; line-height: 24px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
}
.nav__links, .nav__cta { display: none; }
.nav__links a {
  font-size: 14px; line-height: 20px; font-weight: 500;
  padding: 8px 12px; border-radius: 9999px;
  text-decoration: none; color: var(--muted);
  transition: color 300ms var(--curve), background-color 300ms var(--curve);
}
.nav__links a:hover { color: var(--text); }
.nav__links a[aria-current="true"] { color: var(--text); background: var(--line); }

.nav__toggle {
  position: relative; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 9999px; background: transparent; color: inherit; cursor: pointer;
}
.nav__toggle span {
  position: absolute; left: 12px; right: 12px; top: 50%; height: 2px; margin-top: -1px;
  background: currentColor; border-radius: 2px;
  transition: transform 500ms var(--curve);
}
.nav__toggle span:first-child { transform: translateY(-4px); }
.nav__toggle span:last-child { transform: translateY(4px); }
.nav__toggle[aria-expanded="true"] span:first-child { transform: rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:last-child { transform: rotate(-45deg); }

/* phone menu: a full height panel, links arrive one after another */
.menu {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; justify-content: center; gap: 40px;
  padding: 96px 32px 48px;
  background: var(--panel-bg);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  opacity: 0; visibility: hidden;
  transition: opacity 300ms var(--curve), visibility 0s linear 300ms;
}
.menu.is-open { opacity: 1; visibility: visible; transition: opacity 300ms var(--curve), visibility 0s; }
.menu__links { display: flex; flex-direction: column; gap: 16px; }
.menu__links a {
  font-family: var(--serif); font-size: 36px; line-height: 40px; font-weight: 500;
  text-decoration: none; padding-block: 4px;
}
.menu__links a, .menu__cta {
  opacity: 0; transform: translateY(24px);
  transition: opacity 500ms var(--curve), transform 500ms var(--curve), background-color 300ms var(--curve);
}
.menu.is-open .menu__links a, .menu.is-open .menu__cta {
  opacity: 1; transform: none;
  transition-delay: calc(var(--i) * 60ms + 80ms);
}
.menu__cta { align-self: flex-start; }

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  margin: 12px; border-radius: 24px;
  background: #08111A;
  box-shadow: inset 0 0 0 1px rgba(248, 233, 197, 0.12);
}
.hero__sky { position: absolute; inset: 0; z-index: -2; }
.hero__sky img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.hero__shade { position: absolute; inset: 0; z-index: -1; background: rgba(6, 13, 21, 0.46); }

.hero__inner {
  display: grid; gap: 40px; align-items: center;
  padding-top: 112px; padding-bottom: 48px;
}
.hero__copy { max-width: 680px; }
.hero__name {
  font-family: var(--serif);
  font-size: 48px; line-height: 1;
  font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
}
.hero__name span { display: block; }
.hero__name span + span { margin-top: 4px; }
.hero__line {
  margin-top: 24px; max-width: 26ch;
  font-family: var(--serif); font-size: 24px; line-height: 32px; font-weight: 500;
  text-wrap: balance;
}
.hero__action { margin-top: 32px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.hero__proof { font-size: 14px; line-height: 20px; color: var(--text); opacity: 0.8; }

.hero__cover {
  justify-self: center;
  width: min(72%, 300px);
  border-radius: 4px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.6), 0 0 96px rgba(230, 166, 78, 0.16);
  transition: transform 500ms var(--curve);
}
.hero__cover img { width: 100%; border-radius: 4px; }
.hero__cover:hover { transform: translateY(-4px); }

/* the cover sits behind glass: one soft reflection crosses it */
.glass { position: relative; display: block; overflow: hidden; }
.glass::after {
  content: ""; position: absolute; top: -20%; left: 0; width: 36%; height: 140%;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(var(--gx, -180%)) skewX(-16deg);
  transition: transform 800ms var(--curve);
  pointer-events: none;
}

/* one page load sequence: the copy settles, the cover rises, the glass catches the light */
@keyframes settle { from { opacity: 0; transform: translateY(32px); } to { opacity: 1; transform: none; } }
@keyframes lights { from { opacity: 0; } to { opacity: 1; } }
@keyframes glint { from { transform: translateX(-180%) skewX(-16deg); } to { transform: translateX(420%) skewX(-16deg); } }
.hero .hero__sky { animation: lights 1600ms var(--curve) both; }
.hero__name { animation: settle 800ms var(--curve) 100ms both; }
.hero__line { animation: settle 800ms var(--curve) 200ms both; }
.hero__action { animation: settle 800ms var(--curve) 300ms both; }
.hero__cover { animation: settle 1000ms var(--curve) 400ms both; }
.hero__cover.glass::after { animation: glint 1800ms var(--curve) 1200ms backwards; }

/* ---------- Tagline ---------- */
.tagline { padding-block: 80px 32px; }
.tagline__text {
  font-family: var(--serif); font-size: 36px; line-height: 40px; font-weight: 500;
  text-align: center;
}
.tagline__row { display: block; }
.tagline__row + .tagline__row { margin-top: 8px; }
.js .tagline .w { opacity: 0.28; transition: opacity 500ms var(--curve); }
.js .tagline .w.is-lit { opacity: 1; }

/* ---------- Book One ---------- */
.book__grid { display: grid; gap: 40px; }
.book__head .display { margin-top: 12px; font-size: 48px; line-height: 1; }
.book__sub { margin-top: 12px; color: var(--muted); }
.book__hook {
  margin-top: 24px; max-width: 30ch;
  font-family: var(--serif); font-size: 24px; line-height: 32px; font-weight: 500;
}
.book__body > p { max-width: 62ch; }
.inside { margin-block: 32px; max-width: 62ch; border-block: 1px solid var(--line); }
.inside li { padding-block: 12px; font-size: 16px; line-height: 24px; }
.inside li + li { border-top: 1px solid var(--line); }

.clause {
  align-self: start;
  padding: 32px;
  border: 1px solid var(--line-strong); border-radius: 16px;
  background: var(--surface);
}
.clause__label { font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: 0.04em; color: var(--accent); }
.clause__num {
  font-family: var(--serif); font-size: 96px; line-height: 1; font-weight: 500;
  font-variant-numeric: lining-nums; letter-spacing: -0.02em;
  display: inline-block; margin-top: 4px;
}
.clause__terms { margin-top: 16px; font-family: var(--serif); font-size: 30px; line-height: 36px; font-weight: 500; }
.clause__terms span { display: block; }
.clause__note { margin-top: 24px; font-size: 14px; line-height: 20px; color: var(--muted); max-width: 34ch; }
.clause__signed { margin-top: 48px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.clause__party { padding-top: 8px; border-top: 1px solid var(--line-strong); font-size: 14px; line-height: 20px; color: var(--muted); }
.nb { white-space: nowrap; }

/* ---------- Inside the story: three panes of one window ---------- */
.panes { margin-top: 40px; display: grid; gap: 12px; }
.pane {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex;
  min-height: 224px; padding: 24px;
  border-radius: 16px;
  background: #08111A url("../images/window-lights.jpg") 50% 50% / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(248, 233, 197, 0.12);
}
.pane::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(6, 13, 21, 0.52); }
.pane__text { flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.pane:nth-child(1) { background-position: 0% 30%; }
.pane:nth-child(2) { background-position: 46% 60%; }
.pane:nth-child(3) { background-position: 100% 80%; }
.pane__line { max-width: 26ch; font-family: var(--serif); font-size: 24px; line-height: 32px; font-weight: 500; }
.panes__more { margin-top: 40px; max-width: 36ch; font-family: var(--serif); font-size: 24px; line-height: 32px; font-weight: 500; }
.panes__more .link { font-weight: 500; }

/* ---------- About ---------- */
.about__grid { display: grid; gap: 32px; }
.about__mark {
  width: 96px; height: 96px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 12px;
  font-family: var(--serif); font-size: 36px; line-height: 40px; font-weight: 600; letter-spacing: 0.04em;
}
.about__text p { margin-top: 24px; max-width: 62ch; }
.about__text .honesty {
  margin-top: 32px; padding: 16px 24px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface);
  font-size: 16px; line-height: 24px;
}

/* ---------- The letter ---------- */
.letter__card {
  display: grid; gap: 32px;
  padding: 32px 24px;
  border: 1px solid var(--line); border-radius: 24px;
  background: var(--surface);
}
.letter__copy .lede { margin-top: 16px; }
.signup__label { display: block; font-size: 14px; line-height: 20px; font-weight: 600; margin-bottom: 8px; }
.signup__row { display: grid; gap: 12px; }
.signup__input {
  width: 100%; min-width: 0;
  padding: 12px 24px;
  border: 1px solid var(--line-strong); border-radius: 9999px;
  background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 24px;
  transition: border-color 300ms var(--curve);
}
.signup__input::placeholder { color: var(--muted); opacity: 0.8; }
.signup__input:hover { border-color: var(--accent); }
.signup__input[aria-invalid="true"] { border-color: #C2413B; }
.signup__msg { min-height: 20px; margin-top: 12px; font-size: 14px; line-height: 20px; color: var(--muted); }
.signup__msg.is-error { color: #C2413B; }
:root[data-theme="dark"] .signup__msg.is-error { color: #F0958F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .signup__msg.is-error { color: #F0958F; } }

.social { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.social__lead { font-size: 14px; line-height: 20px; color: var(--muted); }
.social__list { display: flex; flex-wrap: wrap; gap: 8px; }
.social__item {
  display: inline-block; padding: 4px 12px;
  border: 1px solid var(--line); border-radius: 9999px;
  font-size: 14px; line-height: 20px; font-weight: 500; color: var(--muted); text-decoration: none;
}
span.social__item { cursor: default; }
a.social__item { color: var(--text); border-color: var(--line-strong); transition: background-color 300ms var(--curve); }
a.social__item:hover { background: var(--line); }

/* ---------- Final call ---------- */
.final { padding: 32px 12px 12px; }
.final__panel {
  position: relative; isolation: isolate; overflow: hidden;
  border-radius: 24px; background: #08111A;
  box-shadow: inset 0 0 0 1px rgba(248, 233, 197, 0.12);
}
.final__panel .hero__sky img { object-position: 60% 30%; }
.final__panel .hero__shade { background: rgba(6, 13, 21, 0.68); }
.final__inner { padding: 80px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.final__inner .display { font-size: 48px; line-height: 1; }
.final__inner .btn { margin-top: 16px; }

/* ---------- Footer ---------- */
.footer { padding-block: 48px; }
.footer__grid { display: grid; gap: 16px; }
.footer__brand { font-family: var(--serif); font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.footer__legal, .footer__copy { font-size: 14px; line-height: 20px; color: var(--muted); max-width: 62ch; }

/* ---------- Scroll reveals (once, only when scripts run) ---------- */
.js .reveal { opacity: 0; transform: translateY(32px); transition: opacity 700ms var(--curve), transform 700ms var(--curve); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Very narrow phones ---------- */
@media (max-width: 359px) {
  .hero__name { font-size: 36px; line-height: 40px; }
}

/* ---------- Wider screens ---------- */
@media (min-width: 640px) {
  .wrap { padding-inline: 32px; }
  .hero__name { font-size: 72px; }
  .hero__line { font-size: 30px; line-height: 36px; }
  .tagline__text { font-size: 48px; line-height: 1; }
  .tagline__row + .tagline__row { margin-top: 12px; }
  .signup__row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .letter__card { padding: 48px; }
}

@media (min-width: 768px) {
  .section { padding-block: 96px; }
  .display { font-size: 48px; line-height: 1; }
  .tagline { padding-block: 96px 32px; }
  .panes { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 48px; }
  .pane { min-height: 416px; padding: 32px; }
  .pane:nth-child(1) { background-position: 0% 50%; }
  .pane:nth-child(2) { background-position: 50% 50%; }
  .pane:nth-child(3) { background-position: 100% 50%; }
  .pane:nth-child(2).reveal { transition-delay: 120ms; }
  .pane:nth-child(3).reveal { transition-delay: 240ms; }
  .panes__more { margin-top: 48px; }
  .about__grid { grid-template-columns: 96px minmax(0, 1fr); gap: 48px; }
  .about__text p:first-of-type { margin-top: 32px; }
  .final__inner { padding: 96px 32px; }
  .final__inner .display { font-size: 60px; }
  .footer__grid { grid-template-columns: auto minmax(0, 1fr) auto; gap: 48px; align-items: start; }
}

@media (min-width: 960px) {
  .nav__bar { width: auto; max-width: max-content; gap: 16px; }
  .nav__links { display: flex; gap: 4px; }
  .nav__cta { display: inline-flex; }
  .nav__toggle, .menu { display: none; }
}

@media (min-width: 1024px) {
  .hero { min-height: min(calc(100svh - 24px), 880px); display: grid; }
  .hero__inner {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 64px;
    padding-top: 112px; padding-bottom: 64px; padding-inline: 64px;
  }
  .hero__cover { justify-self: end; width: min(100%, 400px, calc((min(100svh, 904px) - 224px) * 0.625)); }
  .hero__sky img { object-position: 50% 40%; }
  .tagline__text { font-size: 60px; }
  .book__grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: 64px; row-gap: 40px;
    grid-template-areas: "head clause" "body clause";
  }
  .book__head { grid-area: head; }
  .book__body { grid-area: body; }
  .clause { grid-area: clause; padding: 40px; position: sticky; top: 112px; }
  .book__head .display { font-size: 72px; }
  .book__hook { font-size: 30px; line-height: 36px; }
  .panes__more { font-size: 30px; line-height: 36px; }
  .clause__num { font-size: 128px; }
  .letter__card { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; padding: 64px; align-items: center; }
  .about__grid { grid-template-columns: 128px minmax(0, 1fr); gap: 64px; }
  .about__mark { width: 128px; height: 128px; font-size: 48px; line-height: 1; }
}

@media (min-width: 1280px) {
  .hero__name { font-size: 96px; }
}

/* ---------- Reduced motion: no movement, plain fades only ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  @keyframes settle { from { opacity: 0; } to { opacity: 1; } }
  .hero__cover.glass::after { animation: none; }
  .glass::after { transition: none; }
  .js .reveal { transform: none; }
  .menu__links a, .menu__cta { transform: none; }
  .btn:active, .hero__cover:hover { transform: none; }
  .skip { transition: none; }
}
