/*
  Shared styling for the Sugar EQ site. The palette is lifted straight from
  the app's own dashboard — the candy-paint backdrop, the brass trim, the
  spectrum green — so the pages and the product read as one thing.

  Dark by default, because the app is; the light scheme is a deliberate
  second pass rather than an inversion.

  Every colour, space, radius and font lives as a custom property here.
  Nothing is hard-coded twice further down.
*/

:root {
  color-scheme: dark light;

  /* Palette — the same values ContentView.swift paints the dash with */
  --candy-top: #3b0d2e;
  --candy-mid: #1c0a3d;
  --candy-deep: #0a0517;
  --surface: #1a1024;
  --surface-raised: #241733;

  --brass: #d6a33d;
  --brass-bright: #ffe8a1;
  --chrome: #cfd4da;
  --spectrum: #6bff9e;
  --lamp-amber: #ffc74d;
  --lamp-blue: #66d9ff;

  --ink: #f4ecff;
  --ink-soft: rgba(244, 236, 255, 0.74);
  --ink-faint: rgba(244, 236, 255, 0.5);
  --rule: rgba(214, 163, 61, 0.24);

  --page-gradient:
    radial-gradient(120% 80% at 50% -10%, rgba(214, 163, 61, 0.16), transparent 60%),
    linear-gradient(180deg, var(--candy-top) 0%, var(--candy-mid) 45%, var(--candy-deep) 100%);

  /* Type */
  --font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-3: clamp(2rem, 1.6rem + 2vw, 3.25rem);

  /* Space */
  --space-xs: 0.5rem;
  --space-s: 0.85rem;
  --space-m: 1.4rem;
  --space-l: 2.4rem;
  --space-xl: 4rem;

  --radius: 18px;
  --measure: 68ch;
  --shell: 46rem;
  --shell-wide: 74rem;
}

@media (prefers-color-scheme: light) {
  :root {
    --candy-top: #f3ecf7;
    --candy-mid: #eee7f6;
    --candy-deep: #e8e0f2;
    --surface: #ffffff;
    --surface-raised: #fbf8ff;

    --brass: #8a6412;
    --brass-bright: #6d4e0b;
    --chrome: #5c6470;
    --spectrum: #12833f;

    --ink: #1b1226;
    --ink-soft: rgba(27, 18, 38, 0.76);
    --ink-faint: rgba(27, 18, 38, 0.56);
    --rule: rgba(138, 100, 18, 0.24);

    --page-gradient:
      radial-gradient(120% 80% at 50% -10%, rgba(138, 100, 18, 0.1), transparent 60%),
      linear-gradient(180deg, var(--candy-top) 0%, var(--candy-deep) 100%);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 var(--space-m) var(--space-xl);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.62;
  color: var(--ink);
  background: var(--page-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: var(--shell); margin: 0 auto; }
.shell--wide { max-width: var(--shell-wide); margin: 0 auto; }

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  padding: var(--space-m) 0;
}

.masthead .mark { border-radius: 22%; }

.wordmark {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 800;
  font-size: var(--step-1);
  letter-spacing: 0.01em;
}

.wordmark a {
  color: var(--brass-bright);
  text-decoration: none;
  background: linear-gradient(180deg, var(--brass-bright), var(--brass));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- hero ---------- */

.hero { padding: var(--space-l) 0 var(--space-m); }

.hero--split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-l);
  align-items: center;
}

@media (min-width: 56rem) {
  .hero--split { grid-template-columns: 1.05fr 0.95fr; }
}

h1 {
  margin: 0 0 var(--space-s);
  font-size: var(--step-3);
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 18ch;
}

.lede {
  margin: 0 0 var(--space-m);
  font-size: var(--step-1);
  color: var(--ink-soft);
  max-width: 46ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-s);
  margin-bottom: var(--space-m);
}

.badge-link { display: inline-flex; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.62em 1.15em;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--rule);
  color: var(--ink);
  background: var(--surface-raised);
}

.button:hover { border-color: var(--brass); }

.button--primary {
  border-color: transparent;
  color: #2a1c05;
  background: linear-gradient(180deg, var(--brass-bright), var(--brass));
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.badge {
  font-size: 0.82rem;
  padding: 0.28em 0.7em;
  border-radius: 999px;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
}

.pending {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.55em 1em;
  border-radius: 999px;
  font-weight: 600;
  color: var(--brass-bright);
  border: 1px dashed var(--rule);
}

/* ---------- the app window ---------- */

.window {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--rule);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35);
  background: var(--candy-deep);
  max-width: min(100%, 306px);
  margin-inline: auto;
}

@media (min-width: 56rem) {
  .window { max-width: 360px; }
}

.window img { display: block; width: 100%; height: auto; }

.window-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-m);
  align-items: start;
}

figure { margin: 0; }

figcaption {
  margin-top: var(--space-xs);
  font-size: 0.86rem;
  color: var(--ink-faint);
  text-align: center;
}

/* ---------- feature rows ---------- */

main { margin-top: var(--space-xl); }

.feature-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-l);
  align-items: center;
  padding: var(--space-l) 0;
  border-top: 1px solid var(--rule);
}

@media (min-width: 56rem) {
  .feature-row { grid-template-columns: 0.9fr 1.1fr; }
  .feature-row--reverse .feature-row-media { order: 2; }

  /* A section with no screenshot must not sit in the narrow media column
     with half the row empty beside it — it spans instead. Paragraphs are
     still held to --measure, so the text doesn't run to a silly length. */
  .feature-row--full { grid-template-columns: 1fr; }
}

.eyebrow {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: var(--space-xs);
}

h2 {
  margin: 0 0 var(--space-s);
  font-size: var(--step-2);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h3 { margin: var(--space-m) 0 var(--space-xs); font-size: var(--step-1); }

p { max-width: var(--measure); }

a { color: var(--brass-bright); }

@media (prefers-color-scheme: light) {
  a { color: var(--brass); }
}

/* ---------- grids and callouts ---------- */

.grid {
  display: grid;
  /* min() is load-bearing: a bare minmax(14rem, 1fr) makes this grid's
     minimum contribution three 14rem tracks, which forces the column it
     sits in wider than a narrow viewport and overflows the page. Capping
     the track minimum at 100% lets it collapse to one column instead. */
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  gap: var(--space-m);
  margin: var(--space-m) 0;
}

.feature {
  padding: var(--space-m);
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
}

.feature h3 { margin-top: 0; }
.feature p { margin-bottom: 0; color: var(--ink-soft); }

.icon { font-size: 1.5rem; display: block; margin-bottom: var(--space-xs); }

.callout {
  padding: var(--space-m);
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface-raised);
  margin: var(--space-m) 0;
}

.callout p { margin: 0; }

.callout--warn { border-color: var(--lamp-amber); }

/* Lamp legend — mirrors the three indicator lights on the dash. */
.lamps { list-style: none; padding: 0; margin: var(--space-m) 0; }

.lamps li {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  padding: 0.5em 0;
  border-bottom: 1px solid var(--rule);
}

.lamps li::before {
  content: "";
  flex: none;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: var(--lamp);
  box-shadow: 0 0 8px var(--lamp);
}

.lamps .power { --lamp: var(--spectrum); }
.lamps .eq { --lamp: var(--lamp-amber); }
.lamps .signal { --lamp: var(--lamp-blue); }

.lamps strong { letter-spacing: 0.08em; }

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

footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-m);
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-m);
  justify-content: space-between;
}

footer nav { display: flex; flex-wrap: wrap; gap: var(--space-m); }

/* Respect a reduced-motion preference for anything that animates. */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
