/* ------------------------------------------------------------------
   Tokens
   Polar night for the hero, a cool snowfield for reading, holly red for
   the one action on each screen, brass for starlight. Young Serif carries
   the storybook voice; Atkinson Hyperlegible keeps every disclosure easy
   to read for parents and grandparents alike.
------------------------------------------------------------------- */
@font-face {
  font-family: "Young Serif";
  src: url("fonts/young-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --night: #13213c;
  --night-2: #1c2f52;
  --snow: #f4f7fb;
  --paper: #ffffff;
  --ink: #18202f;
  --ink-soft: #3a4558;
  --line: #cfd7e3;
  --field: #7d8aa0;
  --holly: #b3261e;
  --holly-dark: #8c1c16;
  --holly-wash: #fdf1f0;
  --brass: #e2b04a;
  --bubble: #e9e9eb;
  --focus: #b3261e;

  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --phone-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --step--1: 0.9rem;
  --step-0: 1.125rem;
  --step-1: 1.3rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 1.4rem + 2.6vw, 2.75rem);
  --step-4: clamp(2.5rem, 1.5rem + 4.4vw, 4.25rem);

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 10px;
}

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

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

body {
  margin: 0;
  background: var(--snow);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
}

/* Young Serif defaults to old-style figures, where 1 and 11 read as I and II.
   Dates are the point of this site, so use lining figures wherever it's set. */
h1, h2, h3, .advent-day, .thread-day, .steps li::before {
  font-variant-numeric: lining-nums;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.12;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

p { margin: 0 0 1em; }

a { color: var(--holly-dark); text-underline-offset: 0.15em; }
a:hover { color: var(--holly); }

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--paper);
  color: var(--ink);
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip:focus { top: 1rem; }

.wrap {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ------------------------------------------------------------------
   Wordmark and top bar
------------------------------------------------------------------- */
.wordmark {
  font-family: var(--serif);
  font-size: var(--step-1);
  color: var(--paper);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem; /* 44px tap target */
}
.wordmark::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.45em;
  background: var(--brass);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  vertical-align: 0.05em;
}
.wordmark:hover { color: var(--paper); }

.bar {
  background: var(--night);
  padding: 0.5rem var(--gutter);
  --focus: var(--brass);
}

/* ------------------------------------------------------------------
   Buttons
------------------------------------------------------------------- */
.btn {
  display: inline-block;
  font: 700 var(--step-0) / 1 var(--sans);
  color: var(--paper);
  background: var(--holly);
  border: 0;
  border-radius: var(--radius);
  padding: 0.95rem 1.5rem;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--holly-dark); color: var(--paper); }
.btn-large { font-size: var(--step-1); padding: 1.1rem 2.4rem; }
.btn-block { width: 100%; padding: 1.1rem 1.5rem; }

/* ------------------------------------------------------------------
   Hero: the one bold moment. A working phone that shows Santa's
   first text with the child's name typed into it.
------------------------------------------------------------------- */
.hero {
  --focus: var(--brass);
  color: var(--paper);
  background-color: var(--night);
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 68%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 47% 14%, #fffa 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 82%, #fff6 50%, transparent 51%),
    radial-gradient(2px 2px at 78% 30%, #e2b04acc 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 61%, #fff8 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 88%, #fff6 50%, transparent 51%),
    radial-gradient(60rem 30rem at 85% 110%, #2a4677 0%, transparent 70%);
  padding: 1.25rem var(--gutter) 4rem;
  overflow: hidden;
}
.hero-inner {
  max-width: 68rem;
  margin: 0 auto;
  display: grid;
  /* minmax(0, 1fr): without it the 23rem conversation widens the column
     past a 320px screen and the hero's overflow:hidden clips the form. */
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
}
.hero-copy .wordmark { margin-bottom: clamp(2rem, 6vw, 4.5rem); }
.hero h1 {
  font-size: var(--step-4);
  max-width: 13ch;
  letter-spacing: -0.01em;
}
.lede {
  font-size: var(--step-1);
  color: #d9e1ee;
  max-width: 32ch;
}

.name-form { margin: 2rem 0 1rem; max-width: 30rem; }
.name-form label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.45rem;
}
.name-row { display: flex; gap: 0.6rem; }
.name-row input {
  flex: 1;
  min-width: 0;
  font: var(--step-1) var(--sans);
  padding: 0.75rem 0.9rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.name-row input::placeholder { color: #8a94a6; }
.price-line { color: #e3e9f2; font-size: 1rem; max-width: 34rem; }

/* The conversation: the texts themselves, straight on the night sky.
   No device frame; the bubbles are the product. */
.convo {
  margin: 0;
  width: min(100%, 23rem);
  justify-self: center;
  display: grid;
  gap: 0.5rem;
  font-family: var(--phone-font);
}
.convo-who {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.875rem;
  color: #d9e1ee;
}
.avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: linear-gradient(#a7adba, #858c99);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  font-weight: 600;
}
.convo-stamp {
  text-align: center;
  font-size: 0.875rem;
  color: #9fb0c9;
  margin: 0.4rem 0 0.2rem;
}
.bubble {
  background: var(--bubble);
  color: #000;
  font-family: var(--phone-font);
  font-size: 0.95rem;
  line-height: 1.35;
  border-radius: 1.15rem;
  padding: 0.6rem 0.85rem;
  margin: 0;
  max-width: 86%;
  justify-self: start;
  overflow-wrap: anywhere;
}
.bubble-out {
  justify-self: end;
  background: #2f6fe4;
  color: #fff;
}
.typing {
  display: none;
  width: 3.6rem;
  background: var(--bubble);
  border-radius: 1.15rem;
  padding: 0.75rem 0.85rem;
  gap: 0.3rem;
}
.typing i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #9a9aa0;
  animation: blink 1s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
.bubble-wrap { display: grid; }
.bubble-wrap.is-typing .typing { display: flex; }
.bubble-wrap.is-typing .bubble { display: none; }
.bubble.arrived { animation: arrive 0.32s cubic-bezier(.2,.9,.3,1.25); transform-origin: 0 100%; }
.convo-caption {
  font-family: var(--sans);
  font-size: var(--step--1);
  color: #c6d0df;
  margin-top: 0.75rem;
}

@keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
@keyframes arrive { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 52rem) {
  .hero { padding-bottom: 5.5rem; }
  .hero-inner { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr); gap: 4rem; }
  .convo { margin-top: 3.5rem; }
}

/* ------------------------------------------------------------------
   Reading sections
------------------------------------------------------------------- */
.season, .how, .faq { padding: clamp(3rem, 8vw, 5.5rem) 0 0; }
.season h2, .how h2, .faq h2 { font-size: var(--step-3); }
.section-lede { color: var(--ink-soft); max-width: 46ch; font-size: var(--step-1); }

.thread {
  list-style: none;
  margin: 2.25rem 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 1.5rem;
  max-width: 40rem;
}
.thread li { display: grid; gap: 0.4rem; }
.thread-day {
  font-family: var(--serif);
  font-size: var(--step-1);
  color: var(--holly-dark);
}
.bubble-static { font-size: 1.05rem; max-width: 100%; }

/* The December calendar: one joined block, like an advent calendar.
   A single list on phones; five across from tablet width up. */
.advent {
  list-style: none;
  margin: 2.25rem 0 0.9rem;
  padding: 0;
  display: grid;
  border-top: 1px solid var(--line);
}
.advent li {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.advent-day {
  font-family: var(--serif);
  font-size: var(--step-1);
  line-height: 1;
  white-space: nowrap;
}
.advent-beat { font-size: 1rem; line-height: 1.35; }
/* "Dec" only fits the wide calendar; on phones it stays for screen readers. */
.advent-month {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.advent li:last-child {
  background: var(--night);
  color: var(--paper);
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  border-radius: var(--radius);
  border-bottom: 0;
  margin-top: 0.5rem;
}
.star,
.advent li.is-picture .advent-day::after {
  content: "";
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--brass);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}
.advent li.is-picture .advent-day::after { margin-left: 0.3rem; vertical-align: 0.15em; }
.advent-key { color: var(--ink-soft); font-size: 1rem; display: flex; align-items: center; gap: 0.5rem; }

/* The calendar answers to the width it actually gets, not the viewport. */
.season .wrap { container: season / inline-size; }

/* Medium: two columns read top to bottom, Dec 1-13 then 14-25. */
@container season (min-width: 34rem) {
  .advent {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(13, auto);
    grid-auto-flow: column;
    column-gap: 2rem;
    border-top: 0;
  }
  .advent li:nth-child(1),
  .advent li:nth-child(14) { border-top: 1px solid var(--line); }
  .advent li:last-child { margin-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
}

/* Wide: the 5 x 5 advent calendar. */
@container season (min-width: 50rem) {
  .advent {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-flow: row;
    column-gap: 0;
    border: 2px solid var(--night);
    border-radius: var(--radius);
    background: var(--paper);
    overflow: hidden;
  }
  .advent li {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 8.25rem;
    padding: 0.85rem 0.9rem 1rem;
    border-right: 1px solid var(--line);
  }
  .advent li:nth-child(1),
  .advent li:nth-child(14) { border-top: 0; }
  .advent li:nth-child(5n) { border-right: 0; }
  .advent li:nth-last-child(-n + 5) { border-bottom: 0; }
  .advent-day { font-size: var(--step-2); }
  .advent-month { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .advent li:last-child { border-radius: 0; margin-top: 0; padding: 0.85rem 0.9rem 1rem; }
}

.samples-title { font-size: var(--step-2); margin: 3rem 0 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 40rem) {
  .thread li { grid-template-columns: 5.5rem 1fr; align-items: start; gap: 1rem; }
  .thread-day { padding-top: 0.35rem; }
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  gap: 1.5rem;
  max-width: 44rem;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  gap: 1rem;
}
.steps li p { margin: 0; }
.steps li::before {
  content: counter(step);
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1;
  color: var(--holly);
}

.qa { margin: 2rem 0 0; max-width: 44rem; }
.qa dt {
  font-weight: 700;
  font-size: var(--step-1);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.qa dt:first-child { border-top: 0; padding-top: 0; }
.qa dd { margin: 0.35rem 0 1.25rem; color: var(--ink-soft); }

.closing {
  --focus: var(--brass);
  margin-top: clamp(3rem, 8vw, 5.5rem);
  background: var(--night);
  color: var(--paper);
  padding: clamp(3rem, 8vw, 4.5rem) 0;
}
.closing h2 { font-size: var(--step-3); max-width: 18ch; }

/* ------------------------------------------------------------------
   Footer
------------------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--line);
  padding: 2.25rem 0 3rem;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.home .foot { border-top: 0; }
.foot-inner { max-width: 62rem; margin: 0 auto; padding: 0 var(--gutter); }
.foot-links {
  list-style: none;
  padding: 0;
  margin: 0 0 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.4rem;
}
.foot-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem; /* 44px tap target */
  min-width: 2.75rem;
}
.foot-fine { margin: 0; }

/* ------------------------------------------------------------------
   Signup flow
------------------------------------------------------------------- */
.flow-wrap {
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 3.5rem) var(--gutter) 3rem;
}
.flow-wrap h1 { font-size: var(--step-3); }
.step-count { color: var(--ink-soft); font-size: var(--step--1); margin-bottom: 0.5rem; }
.flow-lede { font-size: var(--step-1); color: var(--ink-soft); }

.signup { margin-top: 2rem; display: grid; gap: 1.6rem; }
.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field legend {
  display: block;
  font-weight: 700;
  margin-bottom: 0.4rem;
  padding: 0;
}
.hint { color: var(--ink-soft); font-size: 1rem; margin: -0.15rem 0 0.5rem; }
.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="datetime-local"],
.field select,
.field textarea {
  width: 100%;
  font: var(--step-1) var(--sans);
  padding: 0.75rem 0.9rem;
  border: 2px solid var(--field);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.field input::placeholder { color: #8a94a6; }
.has-error input[type="text"],
.has-error input[type="tel"] { border-color: var(--holly); }
.field-error { color: var(--holly-dark); font-weight: 700; font-size: 1rem; margin: 0.4rem 0 0; }

.choice { display: grid; gap: 0.6rem; }
/* Two classes so this outranks `.field > label` above. */
.choice > .choice-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 0.85rem 1rem;
  cursor: pointer;
}
.choice-option:has(input:checked) { border-color: var(--holly); background: var(--holly-wash); }
.choice-option input { width: 1.3rem; height: 1.3rem; accent-color: var(--holly); margin: 0; }

.consent {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 0.2rem;
}
.consent.has-error { border: 2px solid var(--holly); }
.check { display: flex; gap: 0.8rem; align-items: flex-start; min-height: 2.75rem; font-weight: 700; cursor: pointer; }
.check input { width: 1.45rem; height: 1.45rem; margin: 0.1rem 0 0; flex: none; accent-color: var(--holly); }
.consent .field-error { margin-left: 2.25rem; }
.disclosure {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0.8rem 0 1rem;
}

.siblings input { margin-top: 0.1rem; }

.order-lines { list-style: none; margin: 0; padding: 0; }
.order-lines li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.order-lines .order-total { font-weight: 700; border-bottom: 0; font-size: var(--step-1); }
.order-note { color: var(--ink-soft); font-size: 1rem; margin: 0.4rem 0 0; }

.renewal-terms {
  border-left: 4px solid var(--brass);
  padding: 0.2rem 0 0.2rem 1rem;
}
.renewal-terms p { margin-bottom: 0.6rem; }
.renewal-terms p:last-child { margin-bottom: 0; color: var(--ink-soft); font-size: 1rem; }

.btn:disabled,
.btn[aria-disabled="true"] { background: #9aa3b2; cursor: not-allowed; }

/* Family vs gift: the radio choice swaps which consent block shows. */
.signup .only-gift { display: none; }
.signup:has(input[name="recipient"][value="gift"]:checked) .only-gift,
.signup.is-gift .only-gift { display: block; }
.signup:has(input[name="recipient"][value="gift"]:checked) .only-family,
.signup.is-gift .only-family { display: none; }
.signup:has(input[name="recipient"][value="gift"]:checked) span.only-gift,
.signup.is-gift span.only-gift { display: inline; }

.error-summary {
  border-left: 5px solid var(--holly);
  background: var(--holly-wash);
  padding: 1rem 1.2rem 0.4rem;
  margin-top: 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.error-summary p { font-weight: 700; margin-bottom: 0.4rem; }
.error-summary ul { margin: 0 0 0.6rem; padding-left: 1.2rem; }

/* ------------------------------------------------------------------
   Policy pages
------------------------------------------------------------------- */
.doc-wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 3.5rem) var(--gutter) 3rem;
}
.doc-wrap h1 { font-size: var(--step-3); }
.prose { font-size: 1.0625rem; line-height: 1.65; }
.prose h2 { font-size: var(--step-2); margin: 2.2rem 0 0.6rem; scroll-margin-top: 1rem; }
.prose ul { padding-left: 1.3rem; }
.prose li { margin-bottom: 0.45rem; }
.prose table { border-collapse: collapse; width: 100%; margin: 1rem 0 1.5rem; font-size: 1rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem 0.6rem 0; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 700; }
mark.todo { background: #fff1b8; color: var(--ink); padding: 0 0.2em; border-radius: 3px; }
.todo-banner {
  background: #fff1b8;
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  font-size: 1rem;
}

@media (max-width: 30rem) {
  .prose table, .prose thead, .prose tbody, .prose tr, .prose th, .prose td { display: block; }
  .prose thead { position: absolute; left: -9999px; }
  .prose tr { border-bottom: 1px solid var(--line); padding: 0.5rem 0; }
  .prose td { border: 0; padding: 0.15rem 0; }
  .prose td:first-child { font-weight: 700; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ------------------------------------------------------------------
   Dashboard and admin
------------------------------------------------------------------- */
.field textarea { min-height: 8rem; resize: vertical; line-height: 1.4; }
.btn-quiet { background: transparent; color: var(--holly-dark); border: 2px solid currentColor; }
.btn-quiet:hover { background: var(--holly-wash); color: var(--holly-dark); }
.account h2, .flow-wrap h2 { font-family: var(--serif); font-weight: 400; font-size: var(--step-2); margin: 2rem 0 0.75rem; }
.account form { margin: 0.75rem 0; }
.notice { background: var(--holly-wash); border-left: 4px solid var(--holly); padding: 0.75rem 1rem; border-radius: var(--radius); }
.account-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.account-list li { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; background: var(--paper); }
.account-list p { margin: 0.2rem 0; overflow-wrap: anywhere; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.admin-wrap { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.admin-wrap > form { margin: 1rem 0 1.25rem; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; }
.admin-stats div { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; }
.admin-stats strong { display: block; font-size: var(--step-2); font-variant-numeric: lining-nums tabular-nums; }
.inline-form { display: inline; }
