/* CHEF-MATE site: CHECK-MATE's site stylesheet (../Check-mate/website/css/style.css), same family palette,
   with CHEF-MATE's pawn-gold accent (the apps share every colour but the accent). */
:root {
  --bg: #fafafc;
  --surface: #ffffff;
  --border: #e2e4ec;
  --text: #0b2251;
  --text-muted: #566389;
  --accent: #d89138;
  --accent-dark: #5a3609;
  --accent-text: #1f1e1c;
  /* Gold is a fill colour: as text on the page it needs a darker ink to hold 4.5:1;
     the hero's top stop is dark enough for white text. */
  --accent-ink: #8f5410;
  --hero-top: #8a5413;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", "Noto Sans Hebrew", "Noto Sans Arabic", "Noto Sans SC", sans-serif;
}

/* Theme resolution order: explicit [data-theme] (set by the manual toggle,
   persisted in localStorage) wins in both directions; with no override, the
   OS preference decides. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #05080f;
    --surface: #0d1730;
    --border: #202a4a;
    --text: #f5f6f8;
    --text-muted: #9aa4c4;
    --accent: #e3a24f;
    --accent-dark: #3a2408;
    --accent-text: #1f1e1c;
    --accent-ink: #e8ae62;
    --hero-top: #7a4a10;
  }
}

:root[data-theme="dark"] {
  --bg: #05080f;
  --surface: #0d1730;
  --border: #202a4a;
  --text: #f5f6f8;
  --text-muted: #9aa4c4;
  --accent: #e3a24f;
  --accent-dark: #3a2408;
  --accent-text: #1f1e1c;
  --accent-ink: #e8ae62;
  --hero-top: #7a4a10;
}

* {
  box-sizing: border-box;
}

.skip-link {
  position: absolute;
  top: -100px;
  inset-inline-start: 12px;
  z-index: 100;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 24px;
}

/* Header */
.site-header {
  padding-block: 16px;
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.a11y-controls {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}

/* The theme toggle's [role=group] wrapper is a plain block element whose
   button children are inline by default, so as this row ran out of space
   they'd text-wrap into their own jagged sub-lines (one icon per line)
   instead of the group moving as a whole - making it a flex row of its
   own, fixed at its content size, keeps all three theme buttons together
   on one line regardless of how tight the row around it gets. */
.a11y-controls > [role="group"] {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
}

.a11y-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.a11y-button:hover {
  transform: translateY(-2px);
  border-color: var(--accent-ink);
}

.a11y-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.a11y-button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent-ink);
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand-icon {
  border-radius: 8px;
  transition: transform 0.15s ease;
}

.brand:hover .brand-icon {
  transform: translateY(-2px);
}

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

.lang-picker-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.lang-dropdown {
  position: relative;
}

.lang-dropdown-button {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.lang-dropdown-button:hover {
  transform: translateY(-2px);
  border-color: var(--accent-ink);
}

.lang-flag {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.lang-caret {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.lang-dropdown-list {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 320px;
  width: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(11, 34, 81, 0.18);
  z-index: 20;
}

.lang-dropdown-list[hidden] {
  display: none;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
}

.lang-option:hover,
.lang-option.is-active {
  background: var(--bg);
}

.lang-option img {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Hero */
.hero {
  background: linear-gradient(180deg, var(--hero-top) 0%, var(--accent-dark) 100%);
  padding-block: 56px;
  color: #ffffff;
}

.hero-row {
  display: flex;
  align-items: center;
  gap: 48px;
  flex-wrap: wrap;
}

.hero-copy {
  flex: 1 1 360px;
  min-width: 280px;
}

.hero-copy h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.15;
  margin: 0 0 16px;
}

.hero-subhead {
  font-size: 1.1rem;
  /* >=4.5:1 against --hero-top (WCAG AA for normal text) - see the --hero-top comment. */
  color: rgba(255, 255, 255, 0.96);
  margin: 0 0 28px;
  max-width: 46ch;
}

.languages-note {
  margin-top: 16px;
  font-size: 0.85rem;
  /* Solid white, not translucent: at this small a size even 0.96 opacity
     only just clears 4.5:1 against --hero-top - not worth the risk. */
  color: #ffffff;
}

.hero-art {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
}

.hero-art img {
  width: min(310px, 70vw);
  height: auto;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.25));
  transition: transform 0.15s ease, filter 0.15s ease;
}

.hero-art img:hover {
  transform: translateY(-4px);
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.32));
}

.cta-button {
  display: inline-block;
  transition: transform 0.15s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
}

.cta-button:focus-visible,
.lang-dropdown-button:focus-visible,
.lang-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.play-badge {
  width: 220px;
  height: auto;
  border-radius: 8px;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.25));
}

/* How it works */
.how-it-works {
  padding-block: 64px;
}

.how-it-works h2,
.features h2,
.faq h2 {
  text-align: center;
  font-size: 1.8rem;
  margin: 0 0 32px;
}

.steps {
  list-style: none;
  margin: 0 auto 40px;
  padding: 0;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 1.05rem;
}

.step-num {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.screenshot-strip {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-block: 8px 16px;
  scroll-snap-type: x proximity;
}

.screenshot-strip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.screenshot-strip img {
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: 200px;
  height: auto;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(11, 34, 81, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.screenshot-strip img:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 32px rgba(11, 34, 81, 0.22);
}

/* Features */
.features {
  padding-block: 64px;
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(11, 34, 81, 0.12);
}

.feature-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Promo video */
.promo-video {
  padding-block: 40px 56px;
}

.video-frame {
  position: relative;
  display: flex;
  justify-content: center;
  max-width: 960px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(11, 34, 81, 0.18);
  background: #000;
}

/* mp4 clips carry real width/height attributes (set from video-config.json
   by scripts/build-website.js), so the browser knows the true intrinsic
   aspect ratio - portrait or landscape - before the file loads. No forced
   box shape here, unlike the iframe case below: just cap the rendered size
   and let it keep its natural proportions. See assets/video/README.md.
   Height is capped in real pixels, not just vh: this clip is portrait
   (1080x2560), and on a short/wide desktop window 70vh alone could make it
   fill nearly the whole browser viewport, leaving the native control bar
   (which the browser overlays at the very bottom edge of the element) with
   no room to breathe above the taskbar. */
.video-frame video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(70vh, 640px);
  border: 0;
}

/* YouTube embeds have no real intrinsic size of their own (the iframe is
   just a document viewport) and the player always presents at 16:9
   regardless of the source video's actual orientation, so this is the one
   case that should stay a fixed-ratio box. */
.video-frame iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

/* FAQ */
.faq {
  padding-block: 64px;
}

.faq-list {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  background: var(--surface);
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.faq-item summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 1.1rem;
}

.faq-item[open] summary::after {
  content: "\2212";
}

.faq-item summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.faq-item p {
  margin: 12px 0 0;
  color: var(--text-muted);
}

/* Final CTA */
.final-cta {
  padding-block: 56px;
  text-align: center;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 24px;
}

.footer-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-row a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-row a:hover {
  color: var(--accent-ink);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cta-button,
  .hero-art img,
  .screenshot-strip img,
  .feature-card,
  .brand-icon,
  .lang-dropdown-button,
  .a11y-button,
  .skip-link {
    transition: none;
  }
}

@media (max-width: 640px) {
  /* Back to art-first (column-reverse), matching the original desktop-
     style ordering. This only works now because the art itself is
     shrunk (below) to a size that doesn't recreate the original
     problem - it used to be ~450px and pushed the Play badge off the
     bottom of a short phone viewport entirely. */
  .hero-row {
    flex-direction: column-reverse;
    text-align: center;
  }

  .hero-art img {
    width: min(190px, 48vw);
  }

  .hero-copy {
    text-align: center;
  }

  .hero-subhead {
    margin-inline: auto;
  }

  .footer-row {
    flex-direction: column;
    text-align: center;
  }

  /* Three items (brand, a11y controls, language picker) wrapping
     independently used to stack into 4-5 short rows, pushing the hero's
     Google Play badge below the fold. Grid (not flex-wrap) guarantees
     the brand its own top row and language+accessibility their own
     shared row below it, always - a flex-wrap fallback here could still
     drop them onto two half-empty rows for a long native language name
     or a larger text-size setting; grid forces them to shrink/truncate
     within their column instead of ever wrapping apart.

     grid-row is explicit on purpose, not left to auto-placement: a11y
     controls (column 2) comes before the language picker (column 1) in
     the DOM, and grid's sparse auto-placement algorithm processes items
     in DOM order - it would claim row 2/col 2 for a11y-controls first,
     then be unable to backfill the language picker into row 2/col 1
     (the cursor had already moved past it), pushing it to a row of its
     own instead. Confirmed via layout measurement, not just visually. */
  .header-row {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 12px;
    row-gap: 8px;
  }

  .brand {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .lang-picker {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
  }

  .a11y-controls {
    grid-column: 2;
    grid-row: 2;
  }

  /* The "Language" text label is redundant with the flag+name it's
     labelling (still read by screen readers via aria-labelledby) - on
     mobile it was wasted width better spent on the language name
     itself not needing to truncate as aggressively. */
  .lang-picker-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .lang-dropdown {
    /* Without flex-grow, .lang-picker (a plain flex row) stretches to
       fill its 1fr grid column as expected, but this - its only normal-
       flow child, since the label above is visually hidden - stayed
       shrink-wrapped to its own content width, leaving the column's
       extra room on bigger phones unused instead of handed to the
       button. Confirmed via measurement: dropdown width was tracking
       ~40-70px narrower than its parent at every size before this. */
    flex: 1 1 auto;
    min-width: 0;
  }

  .lang-dropdown-button {
    width: 100%;
  }

  #lang-current-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Anchored to the button's left edge now that the picker sits on the
     left, with a viewport-relative cap so a narrow phone still can't
     clip it on the right instead. */
  .lang-dropdown-list {
    width: min(220px, calc(100vw - 48px));
    inset-inline-start: 0;
    inset-inline-end: auto;
  }
}
/* ===================== CHEF-MATE additions ===================== */
.hero-art img { border-radius: 28px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35); }
.screenshot-strip img { border-radius: 18px; }
.coming-soon { display: inline-block; margin-top: 10px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); color: #fff; font-weight: 600; }
.final-cta .coming-soon { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.play-badge.is-soon { opacity: 0.75; }
/* Six cards: three, two or one per row, never 4 + 2. */
.feature-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .feature-grid { grid-template-columns: 1fr; } }
.chains-note { color: var(--text-muted); margin-top: 16px; }
