/* Late Knock, the website. The app's "Late Edition" look (screens spec v2, section 3):
   white and warm black, near-black ink, one cherry accent, Bodoni Moda for titles and covers,
   Hanken Grotesk for everything you tap, Literata for reading. The amber light belongs to the
   mark alone. Fonts come from this site (guardrail 15): nothing is loaded from anyone else. */

@font-face {
  font-family: "Bodoni Moda";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/bodoni-moda-latin-opsz-normal.woff2") format("woff2-variations"), url("/assets/bodoni-moda-latin-opsz-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Bodoni Moda";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/bodoni-moda-latin-opsz-italic.woff2") format("woff2-variations"), url("/assets/bodoni-moda-latin-opsz-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/hanken-grotesk-latin-wght-normal.woff2") format("woff2-variations"), url("/assets/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/assets/literata-latin-opsz-normal.woff2") format("woff2-variations"), url("/assets/literata-latin-opsz-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Literata";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("/assets/literata-latin-opsz-italic.woff2") format("woff2-variations"), url("/assets/literata-latin-opsz-italic.woff2") format("woff2");
}

/* Tokens: the screens spec, section 3.1. Day first, Night under prefers-color-scheme. */
:root {
  color-scheme: light dark;
  --bg: #FFFFFF;
  --surface: #F3EFEA;
  --surface2: #E9E3DD;
  --line: #E0D8D1;
  --ink: #1B1517;
  --ink2: #5E5652;
  --accent: #C91D45;
  --accent-text: #B8183D;
  --on-accent: #FFFFFF;
  --primary: #1B1517;
  --on-primary: #F3EFEA;
  --bubble-in: #F3EFEA;
  --bubble-out: #1B1517;
  --on-bubble-out: #F3EFEA;

  /* The Night palette, for the moments that are always Night (a wait). */
  --night-bg: #141012;
  --night-surface: #211B1D;
  --night-ink: #F3EFEA;
  --night-ink2: #ABA29E;
  --night-accent-text: #EC6E8A;

  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --ui: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --prose: "Literata", Georgia, "Times New Roman", serif;

  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
  --step-3: clamp(2.125rem, 1.5rem + 2.6vw, 3.25rem);
  --step-4: clamp(2.75rem, 1.4rem + 5.6vw, 5.75rem);
  --wide: 1120px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141012;
    --surface: #211B1D;
    --surface2: #2D2528;
    --line: #3A3134;
    --ink: #F3EFEA;
    --ink2: #ABA29E;
    --accent: #E0496B;
    --accent-text: #EC6E8A;
    --on-accent: #141012;
    --primary: #F3EFEA;
    --on-primary: #141012;
    --bubble-in: #211B1D;
    --bubble-out: #F3EFEA;
    --on-bubble-out: #141012;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--ui);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.08; text-wrap: balance; margin: 0; }
h1 em, h2 em, h3 em { font-weight: 400; }
p { margin: 0; }
:where(ul[role="list"], ol[role="list"]) { list-style: none; margin: 0; padding: 0; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 10;
  padding: 10px 16px; border-radius: 999px;
  background: var(--primary); color: var(--on-primary); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

.band { padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.inner { max-width: var(--wide); margin-inline: auto; }

.eyebrow {
  font: 600 0.75rem/1.35 var(--ui);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink2);
  text-wrap: balance;
}

/* ---------- The header ---------- */
.top { padding-block: 18px; border-bottom: 1px solid var(--line); }
.top .inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.lockup { display: inline-flex; align-items: center; gap: 0.4em; text-decoration: none; font: 400 1.5rem/1 var(--display); min-height: 44px; }
.lockup:hover { color: inherit; }
.lockup .mark { height: 1.4em; width: auto; flex: none; }
.lockup .words em { font-style: italic; }
.mark-night { display: none; }
@media (prefers-color-scheme: dark) {
  .mark-day { display: none; }
  .mark-night { display: block; }
}
.nav ul { display: flex; flex-wrap: wrap; gap: 0 4px; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: 10px;
  font-size: 0.9375rem; text-decoration: none; color: var(--ink2); border-radius: 999px;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ---------- Buttons and badges ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 12px 26px; border-radius: 999px;
  background: var(--primary); color: var(--on-primary);
  font: 600 1.0625rem/1.2 var(--ui); text-decoration: none;
}
.button:hover { color: var(--on-primary); background: var(--accent); }
@media (prefers-color-scheme: dark) { .button:hover { color: var(--on-accent); } }
.badges { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.badges li { font: 600 0.75rem/1.35 var(--ui); letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink2); }

/* ---------- The hero ---------- */
.hero { padding-block: clamp(40px, 6vw, 84px); }
.hero .inner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.hero h1 { font-size: var(--step-4); letter-spacing: -0.01em; margin-top: 18px; line-height: 1.02; }
.hero h1 em { font-style: italic; }
.hero .lede { margin-top: 24px; font-size: var(--step-1); line-height: 1.5; max-width: 34ch; }
.hero .button { margin-top: 32px; }
.hero .badges { margin-top: 28px; }

/* ---------- Chat bubbles (the screens spec, section 4) ---------- */
.chat {
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 16px 16px 20px;
  background: var(--bg);
  max-width: 420px;
  width: 100%;
  justify-self: end;
}
.chat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 6px 14px; border-bottom: 1px solid var(--line); }
.chat-head b { font: 500 1.375rem/1 var(--display); }
.chat-head .status { font-size: 0.8125rem; color: var(--ink2); }
.chat-head .status.typing-now { color: var(--accent-text); }
.thread { display: flex; flex-direction: column; gap: 6px; padding: 14px 2px 4px; min-height: 260px; max-height: 440px; overflow-y: auto; overscroll-behavior: contain; border-radius: 8px; }
.thread > * { flex: none; }
.stamp { align-self: center; font: 600 0.71875rem/1.3 var(--ui); letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink2); padding: 6px 0 4px; font-variant-numeric: tabular-nums; }
.msg { max-width: 80%; padding: 9px 14px; border-radius: 20px 20px 20px 6px; font-size: 1rem; line-height: 1.38; }
.msg.in { align-self: flex-start; background: var(--bubble-in); color: var(--ink); }
.msg.out { align-self: flex-end; background: var(--bubble-out); color: var(--on-bubble-out); border-radius: 20px 20px 6px 20px; }
.note { align-self: flex-start; font-size: 0.75rem; color: var(--ink2); margin: -2px 0 2px 6px; }
.system { align-self: center; font: italic 400 0.96875rem/1.4 var(--display); color: var(--ink2); padding: 2px 0; text-align: center; }
.typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 13px 14px; border-radius: 20px 20px 20px 6px; background: var(--bubble-in); }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink2); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.arrive { animation: arrive 180ms ease-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Doors: rounded at the top, squarer at the foot, a door's shape. */
.doors { display: grid; gap: 8px; margin-top: 14px; }
.door {
  font: 500 1rem/1.32 var(--ui);
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 22px 22px 9px 9px;
  border: 1.5px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.door:hover { background: var(--surface); }
.door:active { transform: scale(0.98); }

/* A wait is always Night (screens spec 3.6). */
.wait {
  margin-top: 14px;
  padding: 18px;
  border-radius: 20px;
  background: var(--night-bg);
  color: var(--night-ink);
  border: 1px solid #3A3134;
  display: grid;
  gap: 8px;
}
.wait .eyebrow { color: var(--night-ink2); }
.wait .clock { font: 400 3rem/0.95 var(--display); font-variant-numeric: tabular-nums; }
.wait .clock .min { color: var(--night-accent-text); }
.wait p { font-size: 0.9375rem; line-height: 1.45; }
.wait .small { color: var(--night-ink2); font-size: 0.875rem; }
.replay {
  justify-self: start; min-height: 44px; padding: 0; margin-top: 2px;
  background: none; border: 0; cursor: pointer;
  font: 600 0.9375rem/1 var(--ui); color: var(--night-ink);
  text-decoration: underline; text-underline-offset: 3px;
}
.replay:focus-visible { outline-color: var(--night-accent-text); }

/* ---------- Sections ---------- */
.section { padding-block: clamp(56px, 8vw, 104px); border-top: 1px solid var(--line); }
.sec-head { display: grid; gap: 14px; max-width: 760px; }
.sec-head h2 { font-size: var(--step-3); }
.sec-head p { color: var(--ink2); max-width: 60ch; }

/* Two ways to read */
.formats { margin-top: 48px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); }
.format { display: grid; gap: 16px; align-content: start; }
.format h3 { font-size: var(--step-2); }
.specimen { border-top: 2px solid var(--ink); padding-top: 20px; }
.specimen.texts { display: flex; flex-direction: column; gap: 6px; }
.specimen.book { font: 400 1.0625rem/1.62 var(--prose); max-width: 46ch; display: grid; gap: 14px; }
.book-chat { font-family: var(--ui); background: var(--surface); border-radius: 18px; padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.book-chat .chat-title { display: grid; gap: 2px; padding: 2px 4px 8px; border-bottom: 1px solid var(--line); }
.book-chat .chat-title b { font: 600 0.9375rem/1.3 var(--ui); }
.book-chat .chat-title span { font-size: 0.8125rem; color: var(--ink2); }
.book-chat .banner { align-self: center; text-align: center; font-size: 0.75rem; line-height: 1.4; color: var(--ink2); padding: 4px 8px 2px; }
.book-chat .msg.in { background: var(--bg); }
.specimen.book .ask { font: italic 400 1.1875rem/1.32 var(--display); margin-top: 4px; }
.book-doors { display: grid; gap: 8px; }
.book-doors .door { font: 400 1.0625rem/1.4 var(--prose); }
.book-doors .door[aria-pressed="true"] { font-style: italic; border-width: 2px; }
.book-doors .door[aria-pressed="true"]::after { content: " \2713"; font-style: normal; }
.reaction { min-height: 1.6em; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.9375rem; color: var(--ink2); }
.facts { list-style: none; padding: 0; margin: 0; }
.sample-note { font-size: 0.8125rem; color: var(--ink2); }

/* How a night works */
.night { margin-top: 48px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(24px, 4vw, 48px); }
.night li { display: grid; gap: 12px; align-content: start; }
.night h3 { font-size: var(--step-2); }
.night .num { font: italic 400 3.5rem/0.9 var(--display); color: var(--accent-text); }

/* The shelf: typographic covers drawn from the story cards (screens spec 3.2) */
.shelf { margin-top: 48px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px clamp(20px, 3vw, 40px); }
.story { display: grid; grid-template-columns: minmax(96px, 132px) minmax(0, 1fr); gap: 18px; align-items: start; }
.cover {
  container-type: inline-size;
  aspect-ratio: 165 / 214;
  width: 100%;
  border-radius: 14px;
  padding: 10%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 0 0 1px var(--hairline, transparent);
}
.cover .trope { font: 600 max(0.625rem, 6.2cqi)/1.25 var(--ui); letter-spacing: 0.12em; text-transform: uppercase; }
.cover .title { font: 500 19cqi/1 var(--display); text-wrap: balance; }
.cover .title em { font-weight: 400; font-style: italic; }
.story-words { display: grid; gap: 6px; align-content: start; }
.story-words h3 { font-size: 1.375rem; line-height: 1.15; }
.story-words .format { font-size: 0.875rem; color: var(--ink2); }
.story-words .hook { font: italic 400 1.0625rem/1.4 var(--display); }
.who-for { margin-top: 56px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px clamp(24px, 5vw, 64px); align-items: start; }
.who-for p { color: var(--ink2); max-width: 52ch; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font-size: 0.875rem; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; }

/* The promise */
.promise { margin-top: 40px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(24px, 5vw, 64px); }
.promise li { padding-block: 18px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.promise b { font: 500 1.375rem/1.2 var(--display); }
.promise span { color: var(--ink2); }

/* Questions, privacy, imprint on the home page */
.fine .inner { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 4vw, 56px); }
.fine h2 { font-size: var(--step-2); margin-bottom: 16px; }
.fine dl { margin: 0; display: grid; gap: 16px; }
.fine dt { font-weight: 600; }
.fine dd { margin: 4px 0 0; color: var(--ink2); }
.fine p { color: var(--ink2); }
.fine p + p { margin-top: 12px; }
.fine .more { margin-top: 16px; }
.fine .more a { color: var(--ink); font-weight: 600; }
.fine address { font-style: normal; }
.fine address p + p { margin-top: 4px; }
.fine address a { color: var(--ink); }

/* The stacked lock-up (screens spec 11.4): the mark over the words, centred. */
.stacked { display: inline-grid; justify-items: center; gap: 18px; padding-block: 4px 20px; }
.stacked .mark { height: 104px; width: auto; }
.stacked .wordmark { width: 200px; height: auto; }

/* ---------- Text pages: privacy, terms, support ---------- */
.page { padding-block: clamp(40px, 6vw, 80px) clamp(56px, 8vw, 104px); }
.page .inner { max-width: 760px; }
.page h1 { font-size: var(--step-3); }
.page .dateline { margin-top: 14px; color: var(--ink2); }
.page .intro { margin-top: 20px; font-size: var(--step-1); line-height: 1.5; }
.page h2 { font-size: var(--step-2); margin-top: 48px; margin-bottom: 14px; }
.page h3 { font: 600 1.0625rem/1.4 var(--ui); margin-top: 24px; margin-bottom: 6px; }
.page p + p, .page p + ul, .page ul + p { margin-top: 12px; }
.page ul { margin: 12px 0 0; padding-left: 1.2em; }
.page li + li { margin-top: 8px; }
.page li::marker { color: var(--ink2); }
.page .box { margin-top: 28px; padding: 20px 22px; border-radius: 18px; background: var(--surface); }
.page .box h2 { margin: 0; font-size: 1.375rem; }
.page .box ul { margin-top: 10px; }
.page address { font-style: normal; }
.page .toc { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.page .toc ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; }
.page .toc li + li { margin-top: 0; }
.page .toc a { display: inline-flex; min-height: 44px; align-items: center; color: var(--ink2); }
.page dl { margin: 0; }
.page dt { font: 600 1.0625rem/1.4 var(--ui); margin-top: 28px; }
.page dd { margin: 6px 0 0; }
.page dd p + p { margin-top: 10px; }
.mail { font-weight: 600; }

/* ---------- The footer ---------- */
.foot { padding-block: 40px 48px; border-top: 1px solid var(--line); font-size: 0.9375rem; color: var(--ink2); }
.foot .inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 32px; align-items: start; }
.foot .lockup { font-size: 1.25rem; color: var(--ink); }
.foot .imprint { margin-top: 12px; display: grid; gap: 2px; font-style: normal; }
.foot .imprint a { color: var(--ink); }
.foot .legal ul { display: flex; flex-wrap: wrap; gap: 0 4px; justify-content: flex-end; }
.foot .legal a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 10px; color: var(--ink); }
.foot .small { margin-top: 6px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 1000px) {
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fine .inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fine .inner > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .hero .inner, .formats, .who-for { grid-template-columns: minmax(0, 1fr); }
  .chat { justify-self: start; }
  .night { grid-template-columns: minmax(0, 1fr); }
  .promise { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .shelf { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .story { grid-template-columns: 104px minmax(0, 1fr); gap: 16px; }
  .fine .inner { grid-template-columns: minmax(0, 1fr); }
  .foot .inner { grid-template-columns: minmax(0, 1fr); }
  .foot .legal ul { justify-content: flex-start; margin-left: -10px; }
  .top .nav ul { margin-left: -10px; }
}

@media (prefers-reduced-motion: reduce) {
  .typing i { animation: none; opacity: 0.6; }
  .arrive { animation: arrive-fade 120ms linear both; }
  .door:active { transform: none; }
  html:focus-within { scroll-behavior: auto; }
}
@keyframes arrive-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  html:focus-within { scroll-behavior: smooth; }
}
@media (forced-colors: active) {
  .door, .chat, .wait, .cover { border: 1px solid CanvasText; }
}

/* The covers' colours, from each story's card (written by build.py). */
.cover--the-layover { background: #C91D45; color: #FFFFFF; }
.cover--do-not-disturb { background: #1B1517; color: #F3EFEA; }
.cover--the-season { background: #1F4A3A; color: #F3EFEA; }
.cover--snowed-in { background: #24394A; color: #F3EFEA; }
.cover--touch-move { background: #E6DED1; color: #1B1517; }
.cover--base-notes { background: #6B4A1E; color: #F3EFEA; }
.cover--wrong-number { background: #E2B33C; color: #1B1517; }
.cover--time-difference { background: #2A2F5B; color: #F3EFEA; }
.cover--noise-complaint { background: #C9D3DA; color: #1B1517; }
@media (prefers-color-scheme: dark) {
  .cover--do-not-disturb { --hairline: #3A3134; }
}
