/* I Just Ate Beets — landing page styles
   Tokens and values follow design/README.md exactly. */

:root {
  color-scheme: light;

  /* Color */
  --beet: #80133F;
  --beet-deep: #6A0F34;
  --beet-press: #550C2A;
  --blush: #F3D6E0;
  --ink: #1F1A1C;
  --ink-2: #5C5457;
  --ink-3: #3D3639;
  --line: #8A8084;
  --rule: #E2DADD;
  --wash: #F4EEF0;
  --paper: #FAF7F5;
  --white: #FFFFFF;
  --ring: #F0DCE4;
  --ring-err: #F5E1E8;
  --bubble: #ECE6E9;
  --dim: rgba(24, 18, 21, 0.64);
  --hint: #EFE3E8;
  --on-beet-rule: rgba(255, 255, 255, 0.18);

  /* Type */
  --font-sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Layout: mobile (<720px) */
  --container: none;
  --pad-x: 20px;
  --header-h: 56px;

  /* Motion */
  --ease-flood: cubic-bezier(.2, .7, .1, 1);
  --t-flood: 700ms;
  --t-rise: 500ms;
  --d-rise-left: 450ms;
  --d-rise-right: 650ms;
  --t-fade: 200ms;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-done { overflow: hidden; }

[hidden] { display: none !important; }

/* Feature flag: the Text message option (SMS_ENABLED in config.js, mirrored by
   <html data-sms>). Elements for one mode are removed from the other. */
html[data-sms="off"] [data-sms-only],
html[data-sms="on"] [data-no-sms],
html:not([data-sms]) [data-no-sms] { display: none !important; }
html[data-sms="off"] .howto { margin-top: 12px; }

h1, h2, p, ol { margin: 0; }

button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  cursor: pointer;
}

strong { font-weight: 700; }

/* Personality touch: text selection is beet juice. */
::selection { background: var(--beet); color: var(--white); }
.on-beet ::selection, .on-beet::selection { background: var(--white); color: var(--beet); }

/* ---------- Layout shells ---------- */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

/* Header */
.site-header {
  flex: none;
  border-bottom: 1px solid var(--rule);
}

.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

a.brand:focus-visible {
  outline: 3px solid var(--beet);
  outline-offset: 4px;
  border-radius: 2px;
}

.mark {
  flex: none;
  width: 12px;
  height: 12px;
  background: var(--beet);
  border-radius: 2px;
}

/* Main */
.main {
  flex: 1 0 auto;
  padding-top: 32px;
  padding-bottom: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* ---------- Type roles ---------- */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.eyebrow--blush { color: var(--blush); }

.h1 {
  margin-top: 12px;
  font-size: 36px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.h1 .beet { color: var(--beet); }

.lede {
  margin-top: 16px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 30em;
  text-wrap: pretty;
}

/* ---------- Action block ---------- */

.action { min-width: 0; }

.control-label {
  margin-bottom: 10px;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

.control-label--method { margin-top: 24px; }

/* Reminder times: 1..MAX_TIMES rows of a select, rows after the first removable */
.times {
  display: grid;
  gap: 8px;
}

.time-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-select {
  flex: 1;
  min-width: 0;
  height: 52px;
  margin: 0;
  padding: 0 16px;
  background-color: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' stroke='%231F1A1C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 20px;
  line-height: 1;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none;
  appearance: none;
}

.time-select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px var(--ring);
}

.time-remove {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.time-remove:hover { background: var(--wash); }

.time-remove:focus-visible {
  outline: 3px solid var(--beet);
  outline-offset: 2px;
}

/* Segmented method choice */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--white);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
}

.segment {
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
}

.segment:hover { background: var(--wash); }

.segment[aria-checked="true"] {
  background: var(--ink);
  color: var(--paper);
}

.segment:focus-visible {
  outline: 3px solid var(--beet);
  outline-offset: 2px;
}

/* Method bodies */
.method-body { margin-top: 24px; }

/* a) Text message */
.field-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.field-label {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

.field-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-2);
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 16px;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: 12px;
}

.input-shell:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px var(--ring);
}

.input-shell.is-error { border-color: var(--beet); }

.input-shell.is-error:focus-within { box-shadow: 0 0 0 4px var(--ring-err); }

.input-prefix {
  font-size: 20px;
  line-height: 1;
  font-weight: 500;
  color: var(--ink-2);
}

.input-divider {
  flex: none;
  width: 1px;
  height: 28px;
  background: var(--rule);
}

.input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: var(--line);
  opacity: 1;
}

.error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 10px;
  color: var(--beet);
  font-size: 15px;
  line-height: 21px;
  font-weight: 600;
}

.error__icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 0.5px;
  border-radius: 50%;
  background: var(--beet);
  color: var(--white);
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* b) Notification — supported */
.push-copy {
  font-size: 16px;
  line-height: 1.5;
}

.push-copy p { text-wrap: pretty; }

.push-copy p + p {
  margin-top: 10px;
  color: var(--ink-2);
}

/* c, d) Notices */
.notice {
  background: var(--wash);
  border-radius: 12px;
  padding: 20px;
}

.notice__title {
  font-size: 17px;
  line-height: 24px;
  font-weight: 700;
}

.notice__body {
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-3);
  text-wrap: pretty;
}

.notice__small {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

.notice--failure { margin-top: 16px; }

.howto {
  margin-top: 4px;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-3);
  display: grid;
  gap: 4px;
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--beet);
  color: var(--white);
  font-weight: 700;
  line-height: 1;
}

.btn--primary {
  height: 56px;
  font-size: 18px;
  letter-spacing: -0.005em;
}

.btn--secondary {
  height: 52px;
  margin-top: 16px;
  font-size: 17px;
}

.btn:hover { background: var(--beet-deep); }

.btn:active {
  background: var(--beet-press);
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.btn[aria-busy="true"] { cursor: progress; }

.text-button {
  display: flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:focus-visible {
  outline: 3px solid var(--beet);
  outline-offset: 2px;
}

/* Submit + line under the button */
.submit { margin-top: 16px; }

.action[data-method="push"] .submit { margin-top: 24px; }

.consent {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: pretty;
}

.consent a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 12px 0; /* inline padding widens the tap target without moving the text */
}

.consent a:focus-visible {
  outline: 3px solid var(--beet);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Legal footer ---------- */

.site-footer {
  flex: none;
  border-top: 1px solid var(--rule);
}

.site-footer__inner {
  padding-top: 28px;
  padding-bottom: 24px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

.legal {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.legal__label {
  margin-bottom: 4px;
  font-size: inherit;
  line-height: inherit;
  font-weight: 700;
  color: var(--ink);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 20px;
  margin-top: 16px;
}

.footer-row:first-child { margin-top: 0; }

.footer-row a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 12px 0;
}

.footer-row a:focus-visible {
  outline: 3px solid var(--beet);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Permission-prompt overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--dim);
  animation: ijab-fade var(--t-fade) ease-out both;
}

.overlay__hint {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 196px;
  color: var(--white);
}

.hint-desktop { display: none; }

.overlay__title {
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.overlay__body {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--hint);
}

/* ---------- Confirmation layer ---------- */

.confirm {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--beet);
  color: var(--white);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  animation: ijab-flood var(--t-flood) var(--ease-flood) both;
}

.confirm .site-header { border-bottom-color: var(--on-beet-rule); }

.confirm .mark { background: var(--white); }

.confirm__content {
  flex: 1 0 auto;
  padding-top: 40px;
  padding-bottom: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  align-content: center;
  align-items: center;
}

.confirm__left { animation: ijab-rise var(--t-rise) ease-out var(--d-rise-left) both; }

.confirm__right { animation: ijab-rise var(--t-rise) ease-out var(--d-rise-right) both; }

.confirm__heading {
  margin-top: 12px;
  font-size: 40px;
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-wrap: balance;
  outline: none;
}

.confirm__lede {
  margin-top: 16px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--blush);
  max-width: 26em;
}

/* Beet timer */
.timer { margin-top: 32px; }

.timer__clock {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 40px;
  line-height: 1;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--white);
}

.timer__note {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--blush);
}

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

.confirm__arriving { margin-bottom: 10px; }

/* SMS preview */
.sms-card {
  background: var(--white);
  color: var(--ink);
  border-radius: 18px;
  padding: 16px;
}

.sms-card__to {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-2);
}

.sms-card__bubble {
  margin-top: 12px;
  background: var(--bubble);
  border-radius: 18px 18px 18px 6px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.4;
}

/* Push preview */
.push-card {
  background: var(--white);
  color: var(--ink);
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.push-card__tile {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--beet);
  display: flex;
  align-items: center;
  justify-content: center;
}

.push-card__dot {
  width: 12px;
  height: 12px;
  background: var(--white);
  border-radius: 2px;
}

.push-card__text {
  flex: 1;
  min-width: 0;
}

.push-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-2);
}

.push-card__app { font-weight: 600; }

.push-card__title {
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}

.push-card__body {
  font-size: 15px;
  line-height: 1.35;
}

.text-button--on-beet {
  margin-top: 16px;
  color: var(--white);
  font-size: 16px;
  text-underline-offset: 4px;
}

.text-button--on-beet:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 3px;
}

/* ---------- Secondary pages (privacy, terms) ---------- */

.doc {
  flex: 1 0 auto;
  padding-top: 32px;
  padding-bottom: 48px;
}

.doc__inner { max-width: 640px; }

.doc .h1 { text-wrap: balance; }

.doc__meta {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-2);
}

.doc__body { margin-top: 32px; }

.doc__body h2 {
  margin-top: 28px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.doc__body h2 + p, .doc__body p + p, .doc__body h2 + ul, .doc__body p + ul, .doc__body ul + p {
  margin-top: 10px;
}

.doc__body p, .doc__body li {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  text-wrap: pretty;
}

.doc__body ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.doc__body a {
  color: var(--beet);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.doc__body a:focus-visible {
  outline: 3px solid var(--beet);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- TEST MODE (temporary) ----------
   Remove this block together with the matching blocks in index.html and app.js. */

.testbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30; /* above the confirmation layer */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 20px;
  background: var(--beet);
  color: var(--white);
}

.testbar__text {
  font-size: 14px;
  line-height: 1.3;
}

.testbar__button {
  height: 32px;
  padding: 0 12px;
  border: 1.5px solid var(--white);
  border-radius: 8px;
  background: transparent;
  color: var(--white);
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
}

.testbar__button:hover { background: rgba(255, 255, 255, 0.12); }

.testbar__button:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 2px;
}

.testbar__button[aria-busy="true"] { cursor: progress; }

/* Five quick taps on the logo open the password field; no double-tap zoom in the way. */
.brand { touch-action: manipulation; }

.testbar__unlock {
  display: flex;
  align-items: center;
  gap: 8px;
}

.testbar__input {
  width: 150px;
  height: 32px;
  padding: 0 10px;
  border: 1.5px solid var(--white);
  border-radius: 8px;
  background: transparent;
  color: var(--white);
  font: 500 16px/1 'Public Sans', system-ui, sans-serif; /* 16px: no zoom on iOS */
}

.testbar__input::placeholder { color: var(--blush); opacity: 1; }

.testbar__input:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 2px;
}

.testbar__result {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
}

/* Keep the bar from covering the header; app.js measures the bar into --testbar-h. */
body.is-testing .page,
body.is-testing .confirm {
  padding-top: var(--testbar-h, 44px);
}

/* ---------- /TEST MODE ---------- */

/* ---------- Motion ---------- */

@keyframes ijab-flood {
  from { clip-path: inset(100% 0 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes ijab-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes ijab-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --t-flood: 0ms;
    --t-rise: 0ms;
    --d-rise-left: 0ms;
    --d-rise-right: 0ms;
    --t-fade: 0ms;
  }

  .overlay, .confirm, .confirm__left, .confirm__right { animation: none; }
}

/* ---------- Tablet (720–1023px) ---------- */

@media (min-width: 720px) {
  :root {
    --container: 624px; /* 560px column + 2 × 32px side padding */
    --pad-x: 32px;
    --header-h: 64px;
  }

  .h1 {
    font-size: 48px;
    line-height: 50px;
  }

  .panel {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: 16px;
    padding: 32px;
  }
}

/* ---------- Desktop (≥1024px) ---------- */

@media (min-width: 1024px) {
  :root {
    --container: 1200px;
    --pad-x: 48px;
    --header-h: 72px;
  }

  .main {
    padding-top: 96px;
    padding-bottom: 112px;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 72px;
  }

  .h1 {
    font-size: 64px;
    line-height: 1.02;
    letter-spacing: -0.03em;
  }

  .lede { font-size: 20px; }

  .site-footer__inner {
    padding-top: 40px;
    padding-bottom: 32px;
    font-size: 14px;
  }

  .legal {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 48px;
  }

  .overlay__hint {
    left: 392px;
    right: auto;
    top: 28px;
    bottom: auto;
    max-width: 360px;
  }

  .hint-mobile { display: none; }

  .hint-desktop { display: inline; }

  .confirm__content {
    padding-top: 96px;
    padding-bottom: 96px;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 72px;
  }

  .confirm__heading {
    font-size: 72px;
    letter-spacing: -0.03em;
  }

  .confirm__lede { font-size: 20px; }

  .timer__clock { font-size: 56px; }

  .doc {
    padding-top: 96px;
    padding-bottom: 112px;
  }
}
