/*
  The Couple’s Quest marketing site. One stylesheet, no build step, no external requests.
  System font stack only. Palette: docs/phase6-brand.md. Brand blue #4bc0d9 and brand pink #fd9bc7 are light pastels, so
  they are only ever fills, art and gradients with INK text on them; white text appears only on the deep accent (#1c7487)
  and on navy. Every text pair below is WCAG AA (4.5:1) or better in both themes (ratios listed in backend/PROGRESS.md,
  "Phase 6"); focus rings are 3px and always visible.
*/

:root {
  color-scheme: light dark;

  /* Brand constants (the same in both themes). */
  --brand-blue: #4bc0d9;
  --brand-pink: #fd9bc7;
  --ink: #0b2a36;                 /* text on the pastels: 7.0:1 on blue, 7.6:1 on pink */
  --navy: #0c2e3c;                /* header, footer and other navy surfaces; white text 14.3:1 */
  --navy-deep: #081e29;
  --on-navy: #ffffff;
  --on-navy-muted: #bcd7e0;       /* 9.5:1 on navy */
  --gradient: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-pink) 100%);

  /* Theme tokens (light). */
  --bg: #eaf7fb;
  --surface: #f3fbfd;
  --raised: #fafeff;
  --text: #0b2a36;
  --muted: #3b5864;
  --link: #1c7487;                /* 4.9:1 on the page, 5.4:1 on white */
  --accent: #1c7487;              /* prominent fills carry a white label (5.4:1) */
  --accent-hover: #155d6d;
  --on-accent: #ffffff;
  --accent-2: #c8045c;            /* secondary highlights; 5.8:1 on white */
  --soft: #e1f2f7;
  --border: #c3dce5;              /* hairlines: decorative only */
  --border-strong: #5f8794;       /* controls: 3:1 against the page */
  --focus: #0b5fff;
  --notice-bg: #fff6dd;
  --notice-text: #4a3500;
  --notice-border: #d9b44a;
  --shadow: 0 1px 2px rgba(11, 42, 54, 0.06), 0 8px 24px rgba(11, 42, 54, 0.10);

  --radius: 1rem;
  --radius-sm: 0.625rem;
  --gutter: 1rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #081e29;
    --surface: #0e2b39;
    --raised: #153a4b;
    --text: #eaf6fa;
    --muted: #a9c4cd;
    --link: #4bc0d9;              /* 8.0:1 on the page */
    --accent: #4bc0d9;            /* prominent fills carry the INK label (7.0:1), not white */
    --accent-hover: #7ad3e6;
    --on-accent: #0b2a36;
    --accent-2: #fd9bc7;
    --soft: #153a4b;
    --border: #1d4658;
    --border-strong: #6b93a2;
    --focus: #8ab4ff;
    --notice-bg: #2e2609;
    --notice-text: #f4e3a6;
    --notice-border: #8a6f1c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--link);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

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

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--focus);
  border-radius: var(--radius-sm);
  transition: top 0.15s;
}

.skip-link:focus {
  top: 0.5rem;
}

.wrap {
  width: min(100% - 2 * var(--gutter), 68rem);
  margin-inline: auto;
}

.wrap-narrow {
  width: min(100% - 2 * var(--gutter), 46rem);
  margin-inline: auto;
}

/* ---------- Header / footer ---------- */

/* Header and footer are navy in both themes: white text, and the pastel logo reads best on it. */
.site-header {
  background: var(--navy);
  color: var(--on-navy);
  border-bottom: 3px solid transparent;
  border-image: var(--gradient) 1;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-block: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  color: var(--on-navy);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* The logo is /logo.svg, one swappable file (website/frontend/README.md). Wide: 391 x 263. */
.logo {
  display: block;
  width: auto;
  height: 2.25rem;
  flex: none;
}

.site-header nav ul,
.site-footer nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-header nav a,
.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--on-navy);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-header nav a:hover,
.site-footer nav a:hover,
.site-header nav a[aria-current="page"],
.site-footer nav a[aria-current="page"] {
  border-bottom-color: var(--brand-blue);
}

.site-header :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--brand-blue);
}

.site-footer {
  margin-top: 4rem;
  padding-block: 2rem;
  background: var(--navy);
  color: var(--on-navy);
}

.site-footer .muted {
  color: var(--on-navy-muted);
}

.site-footer a:not(.brand) {
  color: var(--on-navy);
}

.site-footer .brand {
  min-height: 0;
  margin-bottom: 0.5rem;
}

.footer-grid {
  display: grid;
  gap: 1.25rem 2rem;
}

@media (min-width: 48rem) {
  .footer-grid {
    grid-template-columns: 1fr auto;
  }
  .footer-grid .fine-print {
    grid-column: 1 / -1;
  }
}

.footer-tagline {
  margin: 0;
}

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

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2rem, 6.5vw, 3.4rem);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
}

h3 {
  font-size: 1.2rem;
}

p {
  margin: 0 0 1em;
}

.lead {
  font-size: clamp(1.1rem, 2.6vw, 1.3rem);
  color: var(--muted);
  max-width: 38rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--link);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.small {
  font-size: 0.875rem;
}

address {
  font-style: normal;
  margin: 0 0 1em;
}

code,
kbd {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--soft);
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.4rem;
  border: 2px solid transparent;
  border-radius: 0.8rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

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

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

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

.btn-secondary:hover {
  background: var(--soft);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block: 1.5rem;
}

/* "Coming soon to the App Store": a status badge, not a button (it is not a link and has no hover state). */
.store-soon {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: 48px;
  margin: 0;
  padding: 0.45rem 1.25rem;
  border: 2px solid var(--accent);
  border-radius: 0.8rem;
  background: var(--soft);
  color: var(--text);
  line-height: 1.15;
}

.store-soon-kicker {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.store-soon-name {
  font-size: 1.2rem;
  font-weight: 800;
}

/* ---------- Home ---------- */

/* The hero is the signature gradient (brand blue to brand pink) with INK text, never white. */
.hero {
  padding-block: clamp(2rem, 7vw, 4.5rem);
  background: var(--gradient);
  color: var(--ink);
}

.hero .eyebrow,
.hero .lead,
.hero .hero-facts,
.hero .demo figcaption {
  color: var(--ink);
}

.hero .eyebrow {
  font-size: 0.85rem;
}

.hero .btn-secondary {
  color: var(--ink);
  border-color: var(--ink);
}

.hero .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.45);
}

.hero .hero-facts li::before {
  background: var(--ink);
}

/* On the pastel gradient the badge and the demo card keep their own fixed colors, whatever the theme. */
.hero .store-soon {
  background: #fafeff;
  color: var(--ink);
  border-color: var(--ink);
}

.hero .store-soon-kicker {
  color: #3b5864;                 /* 7.5:1 on #fafeff */
}

.hero :focus-visible {
  outline-color: var(--ink);
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 56rem) {
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-facts li::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.demo {
  margin: 0;
}

.demo-stack {
  position: relative;
  padding: 0 0.75rem 0.75rem 0;
}

.qcard {
  position: relative;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.qcard-back {
  position: absolute;
  inset: 0.75rem 0 0 0.75rem;
  z-index: 0;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
}

.demo .qcard:not(.qcard-back) {
  z-index: 1;
}

.qcard-kicker {
  margin: 0 0 0.5rem;
  color: var(--link);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.qcard-title {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
}

.demo figcaption {
  margin-top: 0.5rem;
  padding-left: 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.section {
  padding-block: clamp(2rem, 6vw, 3.5rem);
}

.section > .wrap > h2 {
  margin-bottom: 1.25rem;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 0.5rem;
}

.card h3 {
  margin-top: 0.25rem;
}

.card-flat {
  padding-bottom: 1.25rem;
}

.steps {
  counter-reset: step;
}

.grid + p {
  margin-top: 1.25rem;
}

.steps .card::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 0.75rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
}

/* The TestFlight call to action under the hero. */
.section-beta {
  padding-top: clamp(1.5rem, 4vw, 2.5rem);
}

.beta-card {
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--soft);
}

.beta-card h2 {
  margin-top: 0;
}

.beta-card > :last-child {
  margin-bottom: 0;
}

.beta-card .lead,
.beta-card p {
  max-width: 42rem;
}

.badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.checklist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding-left: 1.9rem;
  margin-bottom: 0.9rem;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.4em;
  width: 0.9rem;
  height: 0.5rem;
  border-left: 3px solid var(--accent);
  border-bottom: 3px solid var(--accent);
  transform: rotate(-45deg);
}

/* ---------- Content pages ---------- */

.page {
  padding-block: clamp(1.5rem, 5vw, 3rem);
}

.page h1 {
  margin-bottom: 0.4em;
}

.page h2 {
  margin-top: 2.25rem;
  font-size: clamp(1.3rem, 3.4vw, 1.6rem);
}

.page h3 {
  margin-top: 1.5rem;
}

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

.page li {
  margin-bottom: 0.4em;
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.notice {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-strong);
  border-left-width: 6px;
  border-left-color: var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.notice > :last-child {
  margin-bottom: 0;
}

.notice-warn {
  background: var(--notice-bg);
  color: var(--notice-text);
  border-color: var(--notice-border);
  border-left-color: var(--notice-border);
}

.notice-warn a {
  color: inherit;
}

.notice h2,
.notice h3 {
  margin-top: 0;
  font-size: 1.15rem;
}

.table-wrap {
  margin: 1rem 0 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.table-wrap:focus-visible {
  outline-offset: 0;
}

table {
  width: 100%;
  min-width: 32rem;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--soft);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

/* Narrow screens: tables become stacked, labeled cards (labels come from data-label). */
@media (max-width: 40rem) {
  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table,
  tbody {
    display: block;
    min-width: 0;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  tr {
    display: block;
    margin-bottom: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  tbody th,
  tbody td {
    display: block;
    border-bottom: 0;
  }

  tbody th {
    border-bottom: 1px solid var(--border);
  }

  tbody td {
    padding-block: 0.6rem;
  }

  tbody td + td {
    padding-top: 0;
  }

  td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.15rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
}

/* FAQ */

details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
}

summary {
  min-height: 44px;
  padding: 0.75rem 1rem;
  font-weight: 700;
  cursor: pointer;
  list-style-position: inside;
}

details[open] > summary {
  border-bottom: 1px solid var(--border);
}

details > :not(summary) {
  margin-inline: 1rem;
}

details > :nth-child(2) {
  margin-top: 0.9rem;
}

details > :last-child {
  margin-bottom: 1rem;
}

/* ---------- Join page ---------- */

.join {
  text-align: center;
  padding-block: clamp(1.5rem, 6vw, 3.5rem);
}

.code {
  display: block;
  margin: 0.5rem auto 1.25rem;
  padding: 0.75rem 1rem;
  max-width: 100%;
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: clamp(2rem, 11vw, 3.25rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  user-select: all;
}

.join .btn-row {
  justify-content: center;
}

.join ol {
  display: inline-block;
  max-width: 100%;
  text-align: left;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-block: 1rem;
}

input[type="text"] {
  min-height: 48px;
  width: 12rem;
  max-width: 100%;
  padding: 0.5rem 0.9rem;
  border: 2px solid var(--border-strong);
  border-radius: 0.8rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-family: var(--mono);
  font-size: 1.2rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.status {
  min-height: 1.6em;
  margin: 0.25rem 0 1rem;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

/* ---------- Print (legal pages get printed) ---------- */

@media print {
  .site-header nav,
  .site-footer nav,
  .skip-link,
  .btn-row {
    display: none;
  }
  body,
  .site-header,
  .site-footer,
  .hero {
    background: #fff;
    color: #000;
  }
  .site-header {
    border-image: none;
    border-bottom: 1px solid #000;
  }
  .brand,
  .site-footer .muted,
  .site-footer a:not(.brand) {
    color: #000;
  }
  a {
    color: inherit;
  }
}
