/* Lettered: the app's room for its paintings. Colors from App/ReadAlong/Library/Theme.swift and the
   P&P caption palette (packages/pride-and-prejudice/book.json); type is the system serif, which on an
   iPhone or a Mac is New York, the same face the app uses. */

:root {
  /* light: the caption paper of the P&P book (book.json), with Mrs Bennet's maroon as the accent */
  color-scheme: light dark;
  --bg: #f7f2e9;
  --sheet: #fffdf8;
  --ink: #2b231d;
  --ink-2: #6a5d52;        /* 5.7:1 on --bg */
  --accent: #7a3344;       /* buttons: 7.9:1 */
  --accent-hover: #8c3d50;
  --on-accent: #fbf6ee;
  --field-border: #94857a; /* 3.2:1 */
  --placeholder: #776a5f;  /* 5.2:1 on --sheet */
  --rule: rgba(43, 35, 29, 0.12);
  --error: #a3352a;
  --caption-ink: #3b2e25;  /* P&P caption ink */
  --caption-halo: #f5eee2; /* P&P caption halo */
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --measure: 34rem;
}
@media (prefers-color-scheme: dark) {
  /* dark: a warm charcoal, lighter than the app's varnish, with its gold */
  :root {
    --bg: #211d19;
    --sheet: #2c2722;
    --ink: #f4eee4;
    --ink-2: #b8aea2;      /* 7.7:1 */
    --accent: #f2c27c;     /* Look.Ink.gold, softened: 10:1 */
    --accent-hover: #f7d197;
    --on-accent: #211d19;
    --field-border: #7d7369;
    --placeholder: #a0978c;
    --rule: rgba(244, 238, 228, 0.12);
    --error: #ffb4a6;
  }
}

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.6;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  font-variant-numeric: oldstyle-nums proportional-nums;
  font-optical-sizing: auto;
  hanging-punctuation: first;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
cite { font-style: italic; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- The frame: a painting with its line being read ---------- */

.frame {
  position: relative;
  height: min(76svh, 216vw);
  min-height: 28rem;
  overflow: hidden;
  background: #cdbf9f;
}
.frame picture, .frame-painting {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.frame-painting { object-fit: cover; object-position: 50% 38%; }

/* the picture eases out of the page above it and back into it below */
.frame::before, .frame::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  pointer-events: none;
}
.frame::before { top: 0; height: 3rem; background: linear-gradient(var(--bg), transparent); }
.frame::after { bottom: 0; height: 7rem; background: linear-gradient(transparent, var(--bg)); }

.caption {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  width: min(88%, 24rem);
  text-align: center;
  color: var(--caption-ink);
  font-size: clamp(1.45rem, 1.05rem + 1.9vw, 2rem);
  line-height: 1.3;
  text-wrap: balance;
  text-shadow: 0 0 2px var(--caption-halo), 0 0 8px var(--caption-halo), 0 0 18px var(--caption-halo);
}
/* With JavaScript (reel.js) the still sentence gives way to the stage, where the lines play as in the app. */
.frame.reel .caption { opacity: 0; }
.scene-room { opacity: 0; transition: opacity 1.5s ease-in-out; }
.frame.at-room .scene-room { opacity: 1; }
.frame.seeked .scene-room { transition: none; }

.stage {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 44%;
  width: min(88%, 24rem);
  height: 0;
  transform: translateX(-50%);
  font-size: clamp(1.7rem, 1.05rem + 3vw, 2.3rem);
  line-height: 1.26;
}
.stage .line {
  position: absolute;
  left: 0; right: 0;
  top: 0;
  transform: translateY(-50%);
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 0 2px var(--caption-halo), 0 0 8px var(--caption-halo), 0 0 18px var(--caption-halo);
}
.stage .line.leading { text-align: left; }
.stage .line.trailing { text-align: right; }
/* the caption's paper: a soft light wash so the line reads over a busy part of the picture */
.caption::before, .stage .line::before {
  content: "";
  position: absolute;
  inset: -1.4em -1.8em;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(245, 238, 226, 0.8), rgba(245, 238, 226, 0.5) 55%, rgba(245, 238, 226, 0));
}
.stage .line-text { display: inline-block; }
.stage .w { display: inline-block; }
.stage .l { display: inline-block; will-change: transform; }
.stage .tag {
  display: block;
  margin-bottom: 0.3em;
  font-size: 0.36em;   /* the app: 24 against a 66 caption, tracked 4 */
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.stage .line.wry .line-text { font-style: italic; }

.reel-control {
  position: absolute;
  z-index: 2;
  right: 1.25rem;
  bottom: 0.85rem;
  min-height: 2.25rem;
  padding: 0 0.9rem;
  font: inherit;
  font-size: 0.875rem;
  color: #f4eee4;          /* over the picture in either theme */
  background: rgba(18, 16, 15, 0.55);
  border: 1px solid rgba(245, 240, 230, 0.28);
  border-radius: 999px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.reel-control:hover { background: rgba(18, 16, 15, 0.75); }

.frame-credit {
  position: absolute;
  z-index: 1;
  bottom: 1rem;
  left: 1.5rem;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--ink-2);
}

/* ---------- The pitch: name, promise, form ---------- */

.pitch {
  padding: max(1.75rem, env(safe-area-inset-top)) 1.5rem 2.25rem;
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
}
h1 {
  font-size: clamp(2.25rem, 1.55rem + 3vw, 3.375rem);
  line-height: 1.06;
  font-weight: 400;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
/* the name: the app's own mark, in the accent and set apart from the sentence */
.brand {
  color: var(--accent);
  font-style: italic;
  letter-spacing: -0.01em;
}
/* the rest of the sentence a step down, so the italic name (which reads smaller) leads */
.tagline { font-size: 0.92em; letter-spacing: -0.018em; }
.lede {
  margin-top: 1rem;
  max-width: 27rem;
  color: var(--ink-2);
  font-size: 1.125rem;
  line-height: 1.55;
  text-wrap: pretty;
}

/* the text pages (/joined, /try-again) */
.text { padding: 0.75rem 1.5rem 2.5rem; max-width: calc(var(--measure) + 3rem); margin: 0 auto; }
.text p + p { margin-top: 0.75rem; }

/* ---------- Signup ---------- */

.signup { margin-top: 2.25rem; position: relative; }
.signup label { display: block; font-size: 0.9375rem; letter-spacing: 0.005em; color: var(--ink); margin-bottom: 0.5rem; }
.signup-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.signup input[type="email"] {
  flex: 1 1 15rem;
  min-width: 0;
  min-height: 3.25rem;
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 1.0625rem;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--field-border);
  border-radius: 12px;
  -webkit-appearance: none;
  appearance: none;
}
.signup input[type="email"]::placeholder { color: var(--placeholder); opacity: 1; }
.signup input[type="email"]:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }
.signup input[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }

.signup button {
  flex: 1 0 auto;
  min-height: 3.25rem;
  padding: 0 1.4rem;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.signup button:hover { background: var(--accent-hover); }
.signup button:active { transform: translateY(1px); }
.signup button[disabled] { opacity: 0.7; cursor: progress; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.signup-status:empty { display: none; }
.signup-status:focus { outline: none; }
.signup-status { margin-top: 0.85rem; font-size: 1.0625rem; }
.signup-status.error { color: var(--error); }
.signup.done label, .signup.done .signup-row { display: none; }
.signup.done .signup-status {
  margin-top: 0;
  padding: 1rem 1.15rem;
  background: var(--sheet);
  border-left: 3px solid var(--accent);
  border-radius: 4px 12px 12px 4px;
  animation: settle 0.5s ease-out;
}

.fine-print { margin-top: 0.9rem; max-width: 27rem; color: var(--ink-2); font-size: 0.875rem; line-height: 1.55; text-wrap: pretty; }
.joined .fine-print { display: none; }   /* after signing up (app.js) */

/* ---------- The video (shown once it has an id) ---------- */

.watch { padding: 1rem 1.5rem 0; max-width: calc(var(--measure) + 3rem); margin: 0 auto; }
.watch h2 { font-size: 1.375rem; line-height: 1.3; font-weight: 500; }
.video {
  position: relative;
  margin-top: 0.9rem;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #2a241e 0%, #0f0d0c 75%);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.video picture { position: absolute; inset: 6% 0; display: flex; justify-content: center; }
.video picture img { height: 100%; width: auto; border-radius: 8px; object-fit: cover; }
.video-play {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: none;
  cursor: pointer;
}
.video-play::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 4.25rem; height: 4.25rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(245, 240, 230, 0.94) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5.5v13l11-6.5z' fill='%2312100f'/%3E%3C/svg%3E") 56% 50% / 46% no-repeat;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease-out;
}
.video-play:hover::after { transform: translate(-50%, -50%) scale(1.06); }
.video-play:focus-visible { outline-offset: -4px; border-radius: 14px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- The small print at the foot ---------- */

.foot {
  padding: 1.5rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.foot p + p { margin-top: 0.5rem; }

/* ---------- Wide screens: the pitch on the left, the app playing on the right ---------- */

@media (min-width: 960px) {
  .page {
    display: grid;
    grid-template-columns: 1fr 46vw;
    grid-template-rows: 1fr auto auto;
    min-height: 100dvh;
  }
  .pitch { grid-column: 1; grid-row: 1; align-self: center; margin: 0; padding: 4rem 5vw 2rem; max-width: calc(var(--measure) + 10vw); }
  .watch { grid-column: 1; grid-row: 2; margin: 0; padding: 0 5vw 1rem; max-width: calc(var(--measure) + 10vw); }
  .foot { grid-column: 1; grid-row: 3; margin: 0; padding: 1rem 5vw 2rem; max-width: calc(var(--measure) + 10vw); }
  .frame { grid-column: 2; grid-row: 1 / -1; position: sticky; top: 0; height: 100vh; height: 100dvh; min-height: 0; }
  .frame::before { display: none; }
  .frame::after { height: 7rem; background: linear-gradient(transparent, rgba(18, 16, 15, 0.6)); }
  .frame-credit { left: 2.25rem; bottom: 1.5rem; color: #f4eee4; text-shadow: 0 1px 8px rgba(18, 16, 15, 0.7); }
}

/* ---------- /joined and /try-again (the form's answers without JavaScript) ---------- */

.plain .text { padding-top: 3rem; }
.plain h1 { margin: 2.5rem 0 1rem; }
.plain-mark { font-size: 1.75rem; line-height: 1; }
.plain-mark a { color: var(--ink); text-decoration: none; }
