/* Recipe Runner website. One hand-written file: no fonts, no images, no external requests.
   Colour pairs used together are checked by test/contrast.test.mjs, so change a token and the test says whether it still passes. */

:root {
  color-scheme: light dark;

  --bg: #FFF4E8;
  --surface: #FFFBF6;
  --text: #2B1B14;
  --muted: #6B5A50;
  --accent: #C8421A;
  --accent-hover: #AE3716;
  --on-accent: #FFFFFF;
  --field-border: #7A685D;
  --ok: #2A7A44;
  --ok-bg: #E8F3EA;
  --err: #B3261E;
  --err-bg: #FBE9E4;
  /* Decorative only (card edges, dividers): carries no information, so it is not contrast-tested. */
  --hairline: #EAD8C6;
  --shadow: 0 1px 2px rgba(43, 27, 20, 0.05), 0 10px 28px rgba(43, 27, 20, 0.06);

  --serif: ui-serif, "New York", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --col: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1B1210;
    --surface: #261A16;
    --text: #F7EBE0;
    --muted: #C9B6A9;
    --accent: #FF8552;
    --accent-hover: #FF9B73;
    --on-accent: #2B1B14;
    --field-border: #A08D81;
    --ok: #7FD19A;
    --ok-bg: #1D2B21;
    --err: #FF9B8E;
    --err-bg: #35201C;
    --hairline: #3A2A24;
    --shadow: none;
  }
}

/* iOS "Increase Contrast": secondary text becomes primary text and the decorative hairlines become real borders. */
@media (prefers-contrast: more) {
  :root {
    --muted: var(--text);
    --hairline: var(--field-border);
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.6 var(--sans);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

svg {
  display: block;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p {
  margin: 0 0 1rem;
  text-wrap: pretty;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

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

main:focus {
  outline: none;
}

h1[tabindex="-1"]:focus {
  outline: none;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

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

.skip-link:focus {
  top: 16px;
  color: var(--on-accent);
}

/* Layout: one centred column with 16 px gutters (more where the notch or the home indicator needs it). */
.wrap {
  width: 100%;
  max-width: calc(var(--col) + 32px);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

main.wrap {
  flex: 1 0 auto;
  padding-top: 8px;
}

.wrap-prose {
  --col: 42rem;
}

.site-header {
  display: flex;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 16px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 1.3125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand:hover {
  color: var(--accent-hover);
}

.brand-mark {
  width: 40px;
  height: auto;
  fill: currentColor;
}

.site-footer {
  margin-top: 56px;
  padding: 20px 0 max(32px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
  text-decoration: underline;
}

.fine {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Surfaces */
.card {
  padding: 28px 20px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.state-card {
  margin-top: 32px;
  text-align: center;
  overflow-wrap: anywhere;
}

.state-card h1 {
  margin-bottom: 12px;
  font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);
}

.state-card .lede {
  margin-bottom: 20px;
}

.icon.state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  stroke-width: 1.5;
}

.actions {
  display: grid;
  gap: 12px;
  justify-items: stretch;
}

/* Buttons: at least 48 px tall. */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 26px;
  border: 2px solid transparent;
  border-radius: 999px;
  font: 600 1rem/1.25 var(--sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.65;
  cursor: progress;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.btn-secondary {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-secondary:hover {
  border-color: var(--accent-hover);
  color: var(--accent-hover);
}

.btn-lg {
  min-height: 56px;
  padding-inline: 34px;
  font-size: 1.0625rem;
}

/* Forms */
.form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
  text-align: left;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 600;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.input[aria-invalid="true"] {
  border-color: var(--err);
  border-width: 2px;
  padding: 9px 13px;
}

.input[aria-invalid="true"]:focus-visible {
  outline-color: var(--err);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.field-error {
  margin: 0;
  color: var(--err);
  font-size: 0.9375rem;
  font-weight: 600;
}

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
}

.check input {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--accent);
}

.icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.is-ok {
  color: var(--ok);
}

.is-err {
  color: var(--err);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  text-align: left;
}

.notice .icon {
  flex: none;
  margin-top: 1px;
}

.notice p {
  margin: 0;
}

.notice-error {
  background: var(--err-bg);
}

.notice-error .icon {
  color: var(--err);
}

.notice-ok {
  background: var(--ok-bg);
}

.notice-ok .icon {
  color: var(--ok);
}

.form + .notice {
  margin-top: 16px;
}

.notice + .hint,
.hint + .actions {
  margin-top: 14px;
}

.spinner {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  margin-right: 0.6em;
  border: 2px solid var(--hairline);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -0.15em;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.steps {
  margin: 0 0 24px;
  padding-left: 1.4rem;
  text-align: left;
}

.steps li {
  margin: 0.5rem 0;
  padding-left: 0.3rem;
}

.divider {
  margin: 28px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  text-align: left;
}

.divider h2 {
  margin-bottom: 6px;
  font-size: 1.25rem;
}

/* Landing */
.hero {
  padding: max(28px, env(safe-area-inset-top)) 0 0;
  text-align: center;
}

.hero-mark {
  width: min(44vw, 164px);
  height: auto;
  margin: 0 auto 10px;
  color: var(--accent);
  fill: currentColor;
}

.wordmark {
  margin: 0 0 30px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero h1 {
  font-size: clamp(2.1rem, 1.4rem + 3.4vw, 3.25rem);
  line-height: 1.1;
}

.hero .lede {
  max-width: 31rem;
  margin: 18px auto 0;
  font-size: 1.1875rem;
}

.cta {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 28px;
}

.cta .fine {
  margin: 0;
}

.peek {
  max-width: 26rem;
  margin: 44px auto 0;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 28px;
  box-shadow: var(--shadow);
  text-align: left;
}

.peek-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.peek-progress span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--hairline);
}

.peek-progress .on {
  background: var(--accent);
}

.peek-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.875rem;
}

.peek-step {
  margin: 0 0 14px;
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.4;
}

.peek-list {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.peek-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--bg);
}

.peek-check {
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--field-border);
  border-radius: 50%;
}

.peek-list .done {
  color: var(--muted);
  text-decoration: line-through;
}

.peek-list .done .peek-check {
  background: var(--accent);
  border-color: var(--accent);
}

.peek-list .done .peek-check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.peek-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.timer-chip,
.peek-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.timer-chip {
  border: 2px solid var(--accent);
  color: var(--accent);
}

.peek-next {
  background: var(--accent);
  color: var(--on-accent);
}

.features {
  display: grid;
  gap: 22px;
  max-width: 26rem;
  margin: 48px auto 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.features li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  color: var(--accent);
}

.features h2 {
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: 0;
}

.features p {
  margin: 2px 0 0;
  color: var(--muted);
}

.trust {
  margin: 44px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  text-align: center;
}

.trust .icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: -4px;
  color: var(--ok);
}

/* Long-form pages: privacy, terms, support */
.prose {
  padding-top: 20px;
}

.prose h1 {
  font-size: clamp(2rem, 1.5rem + 2.4vw, 2.75rem);
}

.prose .meta {
  margin: 10px 0 24px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.prose h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.5rem;
  scroll-margin-top: 16px;
}

.prose h3 {
  margin: 1.5rem 0 0.4rem;
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: 0;
}

.prose ul,
.prose ol {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}

.prose li {
  margin: 0.4rem 0;
  padding-left: 0.2rem;
}

.prose li > p {
  margin: 0;
}

.callout {
  margin: 0 0 1.5rem;
  padding: 18px 20px 6px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
}

.callout h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.toc {
  margin: 0 0 24px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
}

.toc-wide {
  display: none;
  padding: 18px 20px;
}

.toc-title {
  margin: 0 0 6px;
  font-weight: 650;
}

.toc ol {
  margin: 0;
  padding-left: 1.6rem;
}

.toc li {
  margin: 0;
  padding: 0;
}

.toc a {
  display: block;
  padding: 10px 0;
}

.toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 20px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.toc summary::-webkit-details-marker {
  display: none;
}

.toc summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}

.toc[open] summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.toc-narrow ol {
  padding: 0 20px 14px 3rem;
}

.prose .meta time {
  white-space: nowrap;
}

.contact-card {
  margin: 0 0 8px;
}

.contact-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.contact-card p:last-child {
  margin-bottom: 0;
}

@media (min-width: 640px) {
  .card {
    padding: 40px 44px;
  }

  .actions {
    justify-items: center;
  }

  .actions .btn {
    min-width: 16rem;
  }

  .toc-wide {
    display: block;
  }

  .toc-narrow {
    display: none;
  }

  .toc-wide ol {
    columns: 2;
    column-gap: 2rem;
  }

  .toc-wide li {
    break-inside: avoid;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .spinner {
    animation: none;
  }

  .btn:active {
    transform: none;
  }
}

@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .toc {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  a {
    color: inherit;
  }
}
