:root {
  --ground: #EEF1F4;
  --ink: #14202B;
  --muted: #4A5866;
  --line: #CBD3DB;
  --accent: #F0A93B;
  --on-accent: #14202B;
  --display: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: "Literata", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0F1923;
    --ink: #E9EEF3;
    --muted: #9AA9B7;
    --line: #26333F;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 18px/1.6 var(--display);
}

.noscript { padding: 24px; }

#app {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 20px 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; padding-top: 48px; }
main:focus { outline: none; }

/* Header and footer */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.logo { width: 28px; height: 28px; display: block; }
.logo path, .hero-line path, .tick path, .rule path {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.logo path { stroke-width: 11; }

.nav {
  color: var(--muted);
  font-size: 16px;
  text-underline-offset: 4px;
}
.nav:hover { color: var(--ink); }

.foot {
  padding: 72px 0 calc(40px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 15px;
}

a { color: inherit; }
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* Headings and text */
.title {
  margin: 0 0 12px;
  font-weight: 600;
  font-size: clamp(30px, 6.5vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.byline { margin: 0 0 32px; color: var(--muted); }
.byline-date { display: block; font-size: 15px; }
.lede { margin: 0 0 28px; color: var(--muted); max-width: 30rem; }

/* The hero line: drawn once when a story is first opened */
.hero-line {
  display: block;
  width: min(100%, 260px);
  height: auto;
  margin: 0 0 32px;
}
.hero-line path { stroke-width: 7; }
.hero-line.draw path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Story */
.prose p {
  margin: 0 0 1.15em;
  max-width: 34rem;
  font: 400 19px/1.75 var(--text);
}

.one-line { margin: 48px 0 40px; max-width: 34rem; }
.rule { display: block; width: 100%; height: 34px; margin-bottom: 20px; }
.rule path { stroke-width: 2px; vector-effect: non-scaling-stroke; }
.one-line-text {
  margin: 0;
  font-weight: 500;
  font-size: clamp(23px, 4.8vw, 29px);
  line-height: 1.3;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.copied { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }

.next { margin: 40px 0 0; color: var(--muted); font-size: 16px; }

.sources { margin-top: 40px; font-size: 15px; color: var(--muted); }
.sources h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--ink); }
.sources ul { margin: 0; padding-left: 18px; }
.sources li { margin-bottom: 4px; overflow-wrap: anywhere; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: var(--ground);
  font: 600 17px/1 var(--display);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--accent); color: var(--on-accent); }
.btn:active { transform: translateY(1px); }

/* Theme list: plain rows, not cards */
.themes {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.themes li { border-bottom: 1px solid var(--line); }

.theme {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 14px 4px;
  background: none;
  border: 0;
  color: var(--ink);
  font: 500 clamp(19px, 4.4vw, 22px)/1.25 var(--display);
  text-align: left;
  cursor: pointer;
}
.tick { width: 40px; height: 22px; flex: none; opacity: 0; transform: translateX(-6px); transition: opacity 0.15s, transform 0.15s; }
.tick path { stroke-width: 9; }
.theme:hover .tick, .theme:focus-visible .tick { opacity: 1; transform: none; }
.theme:focus-visible { outline-offset: -3px; }

/* Gift from a friend */
.gift { margin: 0 0 40px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.gift-lead { margin: 0 0 12px; color: var(--muted); }
.gift h2 { margin: 0 0 4px; font-weight: 600; font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; }
.gift-person { margin: 0 0 16px; color: var(--muted); }
.gift-teaser { margin: 0 0 24px; max-width: 34rem; font: 400 18px/1.7 var(--text); }

/* Archive */
.archive { list-style: none; margin: 32px 0 0; padding: 0; border-top: 1px solid var(--line); }
.archive li { border-bottom: 1px solid var(--line); }
.archive a {
  display: block;
  padding: 18px 4px;
  text-decoration: none;
}
.archive a:hover .a-title { text-decoration: underline; text-underline-offset: 4px; }
.a-title { display: block; font-weight: 500; font-size: 21px; line-height: 1.25; }
.a-meta, .a-date { display: block; color: var(--muted); font-size: 15px; }

.status { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .hero-line.draw path { animation: none; stroke-dashoffset: 0; }
  .tick { transition: none; }
}
