/* ============================================================================
   Nibbl — getnibbl.app
   Visual system mirrors the iOS app's "VioletGrove" theme:
   ingredients = violet, timers = indigo, temperatures = pink. Those three
   accents are the app's way of color-coding a recipe, and they carry the site.
   No build step, no external requests — the font is self-hosted, everything
   below is plain CSS.
   ========================================================================== */

/* --- Font: Bricolage Grotesque (variable), subset to Latin, same face the
       app ships. Graceful fall back to the system stack while it loads. --- */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/BricolageGrotesque-var.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

/* --- Design tokens -------------------------------------------------------- */
:root {
  color-scheme: light dark;

  /* Brand accents (light). Dark variants overridden below. */
  --primary: #8b5cf6;          /* violet — ingredients, brand */
  --primary-light: #c4b5fd;
  --primary-dark: #6d28d9;
  --secondary: #6366f1;        /* indigo — timers / durations */
  --accent: #ec4899;           /* pink — temperatures */

  /* Surfaces & text */
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --border: #e7e9f0;

  /* Elevation — soft violet shadow in light mode (matches app cards) */
  --shadow-card: 0 1px 2px rgb(15 23 42 / 0.04), 0 12px 32px -12px rgb(139 92 246 / 0.28);
  --shadow-cta: 0 8px 24px -6px rgb(139 92 246 / 0.5);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-chip: 9px;
  --maxw: 760px;

  --font: "Bricolage Grotesque", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #9e73fa;
    --primary-light: #614a94;
    --primary-dark: #8c42e6;
    --secondary: #7a7df7;
    --accent: #f261ad;

    --bg: #12121a;
    --surface: #282833;
    --surface-2: #1e1e28;
    --text: #f0f0f7;
    --text-secondary: #b2b5bf;
    --text-tertiary: #737684;
    --border: #33333f;

    /* No colored glow on near-black — elevation comes from surface contrast,
       exactly as the app suppresses card shadows in dark mode. */
    --shadow-card: none;
    --shadow-cta: 0 8px 24px -8px rgb(0 0 0 / 0.6);
  }
}

/* --- Reset & base --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  font-optical-sizing: auto;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

a { color: var(--primary-dark); }

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

/* Ambient wash — a soft violet/pink bloom behind the hero, no image needed. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 45% at 50% -8%, color-mix(in srgb, var(--primary) 20%, transparent), transparent 70%),
    radial-gradient(45% 35% at 88% 8%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}

/* --- Site header (wordmark) ---------------------------------------------- */
.site-head {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 24px 0;
}

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

.wordmark .glyph {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  box-shadow: 0 4px 12px -5px color-mix(in srgb, var(--secondary) 60%, transparent);
}

/* --- Hero ----------------------------------------------------------------- */
.hero {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(40px, 8vw, 84px) 24px 24px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.1rem, 7.5vw, 4.4rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.035em;
  overflow-wrap: break-word;
}
/* Balance the headline only where it comfortably fits two lines; on narrow
   phones let it wrap naturally so a long word can drop to the next line. */
@media (min-width: 560px) {
  .hero h1 { text-wrap: balance; }
}

.hero .tagline {
  margin-top: 14px;
  font-size: clamp(1.15rem, 3.5vw, 1.5rem);
  font-weight: 600;
  color: var(--text-secondary);
  text-wrap: balance;
}

.hero .sub {
  max-width: 46ch;
  margin: 18px auto 0;
  color: var(--text-secondary);
  font-size: 1.05rem;
  text-wrap: pretty;
}

/* --- Signature: a live cooking-mode step, color-coded like the app -------- */
.step-card {
  margin: clamp(30px, 6vw, 46px) auto 0;
  max-width: 520px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: clamp(18px, 4vw, 26px);
}

.step-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.step-index {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary-dark);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0;
}
@media (prefers-color-scheme: dark) {
  .step-index { color: var(--primary); }
}

.step-line {
  font-size: clamp(1.15rem, 3.4vw, 1.42rem);
  font-weight: 500;
  line-height: 1.55;
  color: var(--text);
}

/* Chips: tinted like the app's TintedCapsule style (≈15% fill, colored text) */
.chip {
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  border-radius: var(--radius-chip);
  padding: 0.06em 0.42em;
  border: 0;
}
.chip--ing {
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary-dark);
}
.chip--temp {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
@media (prefers-color-scheme: dark) {
  .chip--ing { color: var(--primary); }
}

/* The timer chip is an actual control in the app — give it button affordance. */
.chip--timer {
  display: inline-flex;
  align-items: center;
  gap: 0.32em;
  cursor: pointer;
  background: color-mix(in srgb, var(--secondary) 15%, transparent);
  color: var(--secondary);
  transition: transform 0.18s ease, background 0.18s ease;
}
.chip--timer::before {
  content: "";
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
}
.chip--timer:hover {
  background: color-mix(in srgb, var(--secondary) 24%, transparent);
}
.chip--timer:active { transform: scale(0.95); }
@media (prefers-reduced-motion: no-preference) {
  .chip--timer:hover::before { animation: spin 1.1s linear infinite; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.step-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.step-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot--ing { background: var(--primary); }
.dot--timer { background: var(--secondary); }
.dot--temp { background: var(--accent); }

/* --- Call to action ------------------------------------------------------- */
.cta-wrap { margin-top: clamp(28px, 5vw, 40px); }

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(140deg, var(--primary), var(--primary-dark));
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.02rem;
  padding: 15px 30px;
  border-radius: 999px;
  box-shadow: var(--shadow-cta);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.store-badge::before { content: ""; }
.store-badge:hover { transform: translateY(-2px); filter: brightness(1.04); }
.store-badge:active { transform: translateY(0) scale(0.98); }

.badge-note {
  margin-top: 12px;
  color: var(--text-tertiary);
  font-size: 0.88rem;
}

/* --- Features ------------------------------------------------------------- */
.features {
  width: 100%;
  max-width: var(--maxw);
  margin: clamp(52px, 9vw, 88px) auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.feature {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px 22px;
  overflow: hidden;
}
/* Top hairline picks up each feature's coded color. */
.feature::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--tint, var(--primary));
}
.feature--ing { --tint: var(--primary); }
.feature--timer { --tint: var(--secondary); }
.feature--temp { --tint: var(--accent); }

.feature .icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  margin-bottom: 14px;
  background: color-mix(in srgb, var(--tint) 15%, transparent);
  color: var(--tint);
}
.feature .icon svg { width: 22px; height: 22px; }

.feature h3 { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.01em; }
.feature p { margin-top: 6px; color: var(--text-secondary); font-size: 0.95rem; }

/* --- Footer --------------------------------------------------------------- */
footer {
  margin-top: auto;
  padding: 44px 24px 36px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.9rem;
}
footer nav { margin-bottom: 8px; }
footer a { color: var(--text-secondary); text-decoration: none; margin: 0 6px; }
footer a:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
footer .sep { color: var(--text-tertiary); }

/* --- Legal / content pages ------------------------------------------------ */
.legal {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 44px) 24px 20px;
}
.legal .eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
}
.legal h1 {
  font-size: clamp(2rem, 6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 6px;
  text-wrap: balance;
}
.legal .updated {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  margin-top: 8px;
}
.legal h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 34px 0 10px;
}
.legal p, .legal li { color: var(--text-secondary); }
.legal p { margin-bottom: 12px; }
.legal ul { padding-left: 20px; margin-bottom: 12px; }
.legal li { margin-bottom: 8px; }
.legal a { color: var(--primary-dark); text-underline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  .legal a { color: var(--primary); }
}
.legal strong { color: var(--text); font-weight: 700; }

.legal .banner {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 22px 0 4px;
}
.legal .banner strong { color: var(--text); }

/* Divider between the last section and the footer on content pages */
.legal hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 36px 0 0;
}

/* --- Entrance motion (once, on load; disabled for reduced motion) --------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
    animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: var(--d, 0ms);
  }
  @keyframes rise { to { opacity: 1; transform: none; } }
}
