/* Vafadar public pages (LR-2 S2-02). Colours and type from
   docs/design/tokens.json; the idea: every page is a sheet of the
   household's record, set on a flat ground. No scripts, no third parties. */

@font-face {
  font-family: "Figtree";
  src: url("/assets/fonts/Figtree-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/assets/fonts/Figtree-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #FFF8F5;        /* surface */
  --ground: #F2E6DF;       /* surfaceContainerHigh */
  --ink: #201B17;          /* onSurface */
  --ink-soft: #51443B;     /* onSurfaceVariant */
  --teal: #006A60;         /* primary */
  --on-teal: #FFFFFF;
  --teal-field: #00413A;   /* primary 24 */
  --on-field: #FFF8F5;
  --apricot: #E8955A;      /* tertiary seed: fills only, never text on cream */
  --on-apricot: #311300;
  --amber-fill: #FFDCC6;   /* tertiaryContainer: "due", never red */
  --on-amber: #311300;
  --done-fill: #9EF2E4;    /* primaryContainer */
  --on-done: #00201C;
  --success-fill: #B8F1B9; /* status.done (semantic.success): the app's Done pill */
  --on-success: #002108;
  --danger: #BA1A1A;
  --on-danger: #FFFFFF;
  --alert-fill: #FFDAD6;
  --on-alert: #410002;
  --field-line: #837469;   /* outline: form fields only */
  --mark-fill: #FFDCC6;
  /* Focus ring (UX-1, WCAG 1.4.11): teal on the paper and ground (6.19 / 5.31).
     The teal fields (hero, home bar, footer) switch it to apricot (4.89). */
  --focus: #006A60;
  --focus-on-field: #E8955A;

  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --step-display: clamp(2.5rem, 1.6rem + 4.2vw, 5.25rem);
  --step-title: clamp(2.125rem, 1.6rem + 2.4vw, 3.75rem);
  --step-head: clamp(1.375rem, 1.2rem + 0.8vw, 1.875rem);
  --step-body: 1.0625rem;
  --step-small: 0.875rem;

  --margin: clamp(16px, 4vw, 48px);
  --radius: 16px;
  --measure: 66ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #241F1B;
    --ground: #17120F;
    --ink: #ECE0DA;
    --ink-soft: #D6C3B6;
    --teal: #82D5C8;
    --on-teal: #003732;
    --teal-field: #003732;
    --on-field: #ECE0DA;
    --amber-fill: #713703;
    --on-amber: #FFDCC6;
    --done-fill: #005048;
    --on-done: #9EF2E4;
    --success-fill: #1D5128;
    --on-success: #B8F1B9;
    --danger: #FFB4AB;
    --on-danger: #690005;
    --alert-fill: #93000A;
    --on-alert: #FFDAD6;
    --field-line: #9E8E82;
    --mark-fill: #713703;
    --focus: #82D5C8;      /* 9.56 on paper, 10.89 on ground */
    --focus-on-field: #E8955A; /* 5.57 on the dark teal field */
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  line-height: 1.55;
  font-feature-settings: "tnum" 1;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--teal); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
/* On a teal field the teal ring would vanish (1.78): use apricot there. */
.hero, .close, .page-home .bar, .page-home .skip { --focus: var(--focus-on-field); }
h1, h2, h3 { font-weight: 600; margin: 0; text-wrap: balance; }
p, ul, dl { margin: 0; }
strong { font-weight: 600; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 16px; z-index: 2; }
.skip:focus { left: var(--margin); }

/* Bar: wordmark, three links. */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px var(--margin);
}
.brand img { border-radius: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.25rem; }
.bar nav { display: flex; gap: clamp(12px, 3vw, 32px); }
.bar nav a { color: var(--ink); text-decoration: none; font-weight: 600; padding: 12px 0; }
.bar nav a:hover, .bar nav a[aria-current="page"] { color: var(--teal); text-decoration: underline; }

/* Buttons: one shape (pill, the brand's), one fill. */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 14px 28px; border: 0; border-radius: 999px;
  background: var(--apricot); color: var(--on-apricot);
  font: 600 var(--step-body)/1.2 var(--font); text-decoration: none; cursor: pointer;
  transition: transform .15s ease;
}
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0) scale(.98); }
.button.quiet { background: var(--paper); color: var(--teal); }
.button.danger { background: var(--danger); color: var(--on-danger); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Home: the hero is a teal field holding the record card. */
.page-home .bar { background: var(--teal-field); color: var(--on-field); }
.page-home .bar .brand, .page-home .bar nav a { color: var(--on-field); }
.hero {
  background: var(--teal-field); color: var(--on-field);
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 96px);
  align-items: center;
  padding: clamp(32px, 6vw, 96px) var(--margin) clamp(64px, 10vw, 160px);
}
.hero h1 { font-size: var(--step-display); line-height: 1.02; letter-spacing: -0.03em; max-width: 14ch; }
.hero .lede { margin-top: 36px; font-size: clamp(1.125rem, 1rem + .5vw, 1.375rem); max-width: 40ch; }
.hero .actions { margin-top: 36px; }
.hero .proof { margin-top: 16px; font-size: var(--step-small); }
.hero-text > * { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
.hero-text > :nth-child(2) { animation-delay: .08s; }
.hero-text > :nth-child(3) { animation-delay: .16s; }
.hero-text > :nth-child(4) { animation-delay: .24s; }

/* The record card: a real fragment of the Today screen. */
.card {
  margin: 0; background: var(--paper); color: var(--ink);
  border-radius: var(--radius); padding: 28px;
  animation: rise .7s .2s cubic-bezier(.2,.7,.2,1) both;
}
.card-head { display: flex; justify-content: space-between; font-weight: 600; font-size: var(--step-head); margin-bottom: 20px; }
.card-head span + span { color: var(--ink-soft); font-weight: 400; font-size: var(--step-body); align-self: end; }
.entries { list-style: none; padding: 0; display: grid; gap: 12px; }
.entry {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 16px;
  padding: 16px 18px; border-radius: 12px; background: var(--ground);
}
.entry .pet { font-weight: 600; }
.entry .what { grid-column: 1; color: var(--ink-soft); }
.entry .who { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: var(--step-small); }
.entry.done .who { background: var(--success-fill); color: var(--on-success); }
.entry.due .who { background: var(--amber-fill); color: var(--on-amber); }
.card figcaption { margin-top: 16px; font-size: var(--step-small); color: var(--ink-soft); }

/* What it keeps: a facts sheet. */
.keeps, .faq, .cta { padding: clamp(80px, 10vw, 160px) var(--margin) 0; }
.keeps h2, .faq h2, .cta h2 { font-size: var(--step-title); line-height: 1.08; letter-spacing: -0.02em; max-width: 18ch; }
.facts { margin-top: 56px; background: var(--paper); border-radius: var(--radius); overflow: hidden; }
.facts div { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 8px 48px; padding: clamp(24px, 3vw, 40px); }
.facts div:nth-child(even) { background: var(--done-fill); color: var(--on-done); }
.facts dt { font-weight: 600; font-size: var(--step-head); line-height: 1.2; }
.facts dd { margin: 0; max-width: 52ch; align-self: center; }

/* Questions as reading text. */
.faq { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 48px; }
.answers { columns: 2 30ch; column-gap: 56px; }
.answers p { break-inside: avoid; margin-bottom: 20px; }

.cta { padding-bottom: clamp(80px, 10vw, 160px); display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: 32px 64px; align-items: end; }
.cta p { max-width: 46ch; font-size: clamp(1.125rem, 1rem + .4vw, 1.3125rem); }
.cta .actions { margin-top: 28px; }

/* Documents: one paper sheet on the ground. */
.sheet {
  background: var(--paper); border-radius: var(--radius);
  margin: clamp(8px, 2vw, 32px) var(--margin) clamp(64px, 8vw, 128px);
  padding: clamp(24px, 5vw, 80px);
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); column-gap: clamp(32px, 5vw, 96px);
}
.sheet > * { grid-column: 2; }
.sheet .sheet-head { grid-column: 1 / -1; margin-bottom: clamp(32px, 4vw, 64px); }
.sheet h1 { font-size: var(--step-title); line-height: 1.05; letter-spacing: -0.02em; max-width: 20ch; }
.sheet .lede { margin-top: 24px; font-size: clamp(1.125rem, 1rem + .4vw, 1.3125rem); max-width: 48ch; }
.sheet .updated { margin-top: 16px; color: var(--ink-soft); font-size: var(--step-small); }
.toc { grid-column: 1; grid-row: 2 / span 20; align-self: start; position: sticky; top: 24px; display: flex; flex-direction: column; gap: 4px; }
.toc a { color: var(--ink-soft); text-decoration: none; padding: 6px 0; font-weight: 600; }
.toc a:hover { color: var(--teal); }
.sheet { overflow-wrap: break-word; } /* echoed email addresses */
.sheet section { max-width: var(--measure); margin-bottom: 48px; scroll-margin-top: 24px; }
.sheet section:last-child { margin-bottom: 0; }
.sheet h2 { font-size: var(--step-head); line-height: 1.25; margin-bottom: 16px; }
.sheet p + p, .sheet p + ul, .sheet ul + p { margin-top: 14px; }
.sheet ul { padding-left: 1.2em; }
.sheet li + li { margin-top: 10px; }
.sheet.narrow { grid-template-columns: minmax(0, 1fr); max-width: 760px; margin-left: auto; margin-right: auto; }
.sheet.narrow > * { grid-column: 1; }
mark { background: var(--mark-fill); color: var(--on-amber); padding: 0 4px; border-radius: 4px; }

/* Forms (fields keep their lines). */
.form { display: grid; gap: 12px; margin-top: 20px; max-width: 26rem; }
.form label { font-weight: 600; }
.form input {
  font: 400 1.125rem/1.3 var(--font); color: var(--ink); background: var(--paper);
  min-height: 52px; padding: 12px 16px; border: 2px solid var(--field-line); border-radius: 12px; width: 100%;
}
.form input:focus-visible { border-color: var(--teal); outline-offset: 2px; }
.form .button { justify-self: start; margin-top: 8px; }
.sheet .form + p { margin-top: 20px; }
.alert, .note { padding: 14px 18px; border-radius: 12px; margin-bottom: 24px; }
.alert { background: var(--alert-fill); color: var(--on-alert); font-weight: 600; }
.note { background: var(--mark-fill); color: var(--on-amber); }

/* The close: an inverse field with the name cropped by its edge. */
.close { background: var(--teal-field); color: var(--on-field); overflow: hidden; padding: clamp(56px, 8vw, 112px) var(--margin) 0; }
.close a { color: var(--on-field); }
.close-inner { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px 64px; }
.disclaimer { font-size: var(--step-head); line-height: 1.35; max-width: 34ch; }
.legal { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.legal a { font-weight: 600; text-decoration: none; padding: 4px 0; }
.legal a:hover { text-decoration: underline; }
.copy { grid-column: 1 / -1; font-size: var(--step-small); margin-top: 24px; }
.wordmark {
  font-weight: 600; font-size: clamp(6rem, 26vw, 26rem); line-height: .8; letter-spacing: -0.05em;
  white-space: nowrap; margin: 24px 0 0 -0.04em; transform: translateY(22%);
}

/* Section parts lift into place as they scroll into view: CSS
   scroll-driven animation, transform only (never hidden), no script. */
@supports (animation-timeline: view()) {
  .keeps h2, .facts div, .faq h2, .answers p, .cta h2, .cta > div, .sheet section, .disclaimer, .legal {
    animation: lift linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 60%;
  }
}

@keyframes lift { from { transform: translateY(32px); } to { transform: none; } }
@keyframes rise { from { transform: translateY(24px); } to { transform: none; } } /* never transparent */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Phone. */
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; padding-top: 16px; padding-bottom: 8px; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: clamp(2.25rem, 9.5vw, 3.25rem); }
  .facts div { grid-template-columns: minmax(0, 1fr); }
  .cta { grid-template-columns: minmax(0, 1fr); }
  .entry { grid-template-columns: minmax(0, 1fr); }
  .entry .who { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 8px; }
  .faq { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .answers { columns: 1; }
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .sheet > *, .toc { grid-column: 1; }
  .toc { grid-row: auto; position: static; flex-direction: row; flex-wrap: wrap; gap: 0 18px; margin-bottom: 40px; }
  .close-inner { grid-template-columns: minmax(0, 1fr); }
  .wordmark { font-size: 34vw; }
}
