/* HowMuchie marketing site
 * ============================================================================
 * COLOUR TOKENS
 * Ported verbatim from the shipping app's single colour source:
 *   /Users/waynefoo/Flutter Projects/HowMuch/frontend/lib/theme/app_colors.dart
 * Warm-paper backgrounds, warm-brown ink, one orange accent. Blue is links only.
 *
 * Every colour on this page resolves through a token in the :root block below.
 * There are no raw hex literals outside it — so re-skinning the site to a
 * different brand identity is an edit to ONE block, not a sweep through the
 * stylesheet. (See the open brand question in README.md.)
 * ========================================================================== */

:root {
  /* Backgrounds & surfaces */
  --paper: #fdf8f0;
  --paper-2: #fbf0e0;
  --sand: #f5e6d0;
  --cream: #fef3c7;
  --surface: #ffffff;
  --line: #ecdcc4;

  /* Ink */
  --ink-strong: #271809;
  --ink: #3c2a16;
  --ink-soft: #7a6446;
  --ink-faint: #a89072;

  /* Accent — orange IS the brand */
  --orange: #f97316;
  --orange-600: #ea580c;
  --orange-400: #fb923c;
  --orange-tint: #fdecd8;
  --orange-ink: #9a3412;

  /* Web-only addition to the app ramp. The app's eyebrow/CTA orange
   * (--orange-600) measures 3.37:1 on paper and white-on--orange measures
   * 2.80:1 — both below the WCAG AA 4.5:1 floor for text this size. On a phone
   * the app can lean on size and proximity; a web page cannot. This is the next
   * stop down the same Tailwind orange ramp the palette is built from
   * (orange-700), so it stays on-brand while clearing AA:
   *   #c2410c on paper = 4.90:1   ·   white on #c2410c = 5.18:1 */
  --orange-700: #c2410c;

  /* Accent button pair, so light and dark each pick a legible combination. */
  --btn-bg: var(--orange-700);
  --btn-ink: #ffffff;

  /* Semantic */
  --link: #2563eb;
  --success: #16a34a;
  --success-ink: #12813f;
  --success-tint: #e7f6ec;
  --danger: #d1493a;
  --danger-tint: #fbe7e3;
  --danger-ink: #8f2a1e;
  --warm-shadow: 120 70 20; /* rgb triplet, so shadows can carry alpha */

  /* Type */
  --font-display: "Baloo 2", ui-rounded, "Segoe UI Rounded", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Rhythm */
  --measure: 62ch;
  --radius: 18px;
  --radius-lg: 26px;
  --gap: clamp(1rem, 3vw, 2rem);
  --section-y: clamp(3.5rem, 9vw, 7rem);
  --shell: min(100% - 2.5rem, 68rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1309;
    --paper-2: #221709;
    --sand: #2c1e0f;
    --cream: #44240d;
    --surface: #2f2114;
    --line: #54402c;

    --ink-strong: #fbf3e7;
    --ink: #efe3d3;
    --ink-soft: #c7b096;
    --ink-faint: #9c8467;

    --orange: #fb923c;
    --orange-600: #fb923c;
    --orange-400: #fb923c;
    --orange-700: #fb923c;
    --orange-tint: #44240d;
    --orange-ink: #ffd9b8;

    /* On a dark ground the accent must get LIGHTER, which flips the button's
     * text to the app's darkOnOrange ink. White on #fb923c is only 2.0:1. */
    --btn-bg: var(--orange-400);
    --btn-ink: #2a1200;

    --link: #93b4ff;
    --success-tint: #17301f;
    --success-ink: #7ee2a8;
    --danger: #ff8a75;
    --danger-tint: #4a1d15;
    --danger-ink: #ffd9d1;
    --warm-shadow: 0 0 0;
  }
}

/* ============================================================================
 * FONTS — self-hosted, subset to Latin + currency signs (58 KB total).
 * Not loaded from the Google Fonts CDN: that is a third-party request to a
 * Google server on every page view, which pulls the site into GDPR/consent
 * territory for EU visitors — exactly what choosing Plausible was meant to
 * avoid. Self-hosting also removes a cross-origin round trip from the critical
 * path.
 * ========================================================================== */
@font-face {
  font-family: "Baloo 2";
  src: url("../fonts/Baloo2-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/PlusJakartaSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/PlusJakartaSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  background-image: linear-gradient(175deg, var(--paper) 0%, var(--paper-2) 46%, var(--sand) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink-strong);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.1rem, 1.35rem + 3.4vw, 3.75rem);
}
h2 {
  font-size: clamp(1.65rem, 1.15rem + 2.1vw, 2.6rem);
}
h3 {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  line-height: 1.25;
}

p {
  margin: 0 0 1.1em;
  max-width: var(--measure);
  text-wrap: pretty;
}

a {
  color: var(--link);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

/* ============================================================================
 * LAYOUT PRIMITIVES
 * ========================================================================== */
.shell {
  width: var(--shell);
  margin-inline: auto;
}

.section {
  padding-block: var(--section-y);
  border-block-start: 1px solid var(--line);
}

.section:first-of-type {
  border-block-start: 0;
}

.section--tint {
  background: color-mix(in srgb, var(--orange-tint) 55%, transparent);
}

.skip-link {
  position: absolute;
  inset-inline-start: 0.75rem;
  inset-block-start: -4rem;
  z-index: 20;
  padding: 0.7rem 1.1rem;
  background: var(--surface);
  color: var(--ink-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: inset-block-start 0.15s ease;
}

.skip-link:focus {
  inset-block-start: 0.75rem;
}

.eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  /* --orange-700 clears AA on the paper end of the gradient (4.90:1) but drops
   * to 4.22:1 where the page reaches the sand end, so the eyebrow uses the
   * deeper --orange-ink: 5.9-6.9:1 across the ENTIRE gradient. */
  color: var(--orange-ink);
  margin: 0 0 0.9rem;
}

.lede {
  font-size: clamp(1.075rem, 1rem + 0.45vw, 1.25rem);
  color: var(--ink-soft);
}

/* ============================================================================
 * MASTHEAD
 * ========================================================================== */
.masthead {
  padding-block: 1.5rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink-strong);
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  border: 1px solid var(--line);
}

.brand span {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

/* ============================================================================
 * HERO
 * ========================================================================== */
.hero {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) var(--section-y);
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 62rem) {
  .hero {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  }
}

.hero__copy p {
  max-width: 46ch;
}

/* The device shots are cropped tight to the phone bezel and run off the bottom
 * of the source image. The mask dissolves that hard cut into the page instead
 * of leaving it looking like a broken/truncated image. */
.device-fade {
  -webkit-mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
}

.hero__device {
  justify-self: center;
  max-width: 300px;
  width: 100%;
}

/* ============================================================================
 * CTA
 * ========================================================================== */
.cta-group {
  margin-block: 1.6rem 0.9rem;
}

.play-badge {
  display: inline-block;
  /* Google's badge artwork ships with its own mandatory clear space baked in,
   * so it must not be cropped, recoloured or re-drawn. Scale only. */
  width: 216px;
  border-radius: 10px;
  transition: transform 0.15s ease;
}

.play-badge:hover {
  transform: translateY(-2px);
}

.play-badge img {
  width: 100%;
}

.cta-note {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ============================================================================
 * CARDS & GRIDS
 * ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  box-shadow: 0 2px 10px rgb(var(--warm-shadow) / 0.05);
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

@media (min-width: 40rem) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding-inline-start: 3.4rem;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.1rem;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--orange-tint);
  color: var(--orange-ink);
  border: 1px solid color-mix(in srgb, var(--orange) 32%, transparent);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
}

.steps h3 {
  margin-block-end: 0.25rem;
}

.steps p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.975rem;
}

/* Split: copy beside device shot */
.split {
  display: grid;
  gap: clamp(1.75rem, 5vw, 3.5rem);
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 56rem) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
  }
  .split--flip > :first-child {
    order: 2;
  }
}

.device {
  justify-self: center;
  max-width: 280px;
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px rgb(var(--warm-shadow) / 0.14);
}

.device-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.75rem, 2vw, 1.5rem);
  align-items: start;
  justify-self: center;
  max-width: 420px;
}

.device-pair img {
  border-radius: var(--radius);
  box-shadow: 0 14px 32px rgb(var(--warm-shadow) / 0.13);
  -webkit-mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
}

/* The mask erases the shadow along with the image, so the shadow moves to a
 * wrapper-free approach: drop it on the element behind the mask instead. */
.device-fade,
.device-pair img {
  box-shadow: none;
  filter: drop-shadow(0 14px 26px rgb(var(--warm-shadow) / 0.16));
}

/* ============================================================================
 * BUDGET CALLOUT — mirrors the in-app warning band
 * ========================================================================== */
.callout {
  margin: 0 0 1.4rem;
  padding: 1.15rem 1.35rem;
  background: var(--danger-tint);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius);
  color: var(--danger-ink);
  max-width: 34rem;
}

.callout p {
  margin: 0;
  max-width: none;
}

.callout__meta {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-block-end: 0.4rem !important;
}

.callout__headline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1.25;
  margin-block-end: 0.3rem !important;
}

/* ============================================================================
 * PRICE
 * ========================================================================== */
.price-grid {
  display: grid;
  gap: 1rem;
  margin-block-start: 1.75rem;
}

@media (min-width: 44rem) {
  .price-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.price-card h3 {
  color: var(--orange-ink);
}

.price-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.975rem;
}

.price-card li {
  padding-inline-start: 1.6rem;
  position: relative;
}

.price-card li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.55em;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--orange);
}

/* ============================================================================
 * FAQ
 * ========================================================================== */
.faq {
  display: grid;
  gap: 0.75rem;
  margin-block-start: 1.75rem;
}

.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1.05rem clamp(1rem, 3vw, 1.5rem);
  font-weight: 700;
  color: var(--ink-strong);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

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

.faq summary::after {
  content: "+";
  font-family: var(--font-display);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--orange-ink);
  flex: none;
}

.faq details[open] summary::after {
  content: "\2212"; /* minus */
}

.faq details > div {
  padding: 0 clamp(1rem, 3vw, 1.5rem) 1.2rem;
  color: var(--ink-soft);
}

.faq details > div p {
  margin: 0;
}

/* ============================================================================
 * FINAL CTA + NOTIFY FORM
 * ========================================================================== */
.final-cta {
  text-align: center;
}

.final-cta h2,
.final-cta p {
  margin-inline: auto;
}

.final-cta h2 {
  max-width: 20ch;
}

.notify {
  margin-block-start: 2.75rem;
  padding-block-start: 2.25rem;
  border-block-start: 1px solid var(--line);
}

.notify__form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-block-start: 1rem;
}

.notify__form label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.notify__form input {
  flex: 1 1 17rem;
  max-width: 22rem;
  min-height: 48px;
  padding: 0.7rem 1rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.notify__form input::placeholder {
  color: var(--ink-soft);
}

.notify__form input:focus-visible {
  border-color: var(--orange-700);
}

.btn {
  min-height: 48px;
  padding: 0.7rem 1.6rem;
  font: inherit;
  font-weight: 700;
  color: var(--btn-ink);
  background: var(--btn-bg);
  border: 1px solid var(--btn-bg);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: var(--orange-ink);
  border-color: var(--orange-ink);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.notify__status {
  min-height: 1.5rem;
  margin: 0.85rem 0 0;
  font-size: 0.925rem;
  max-width: none;
}

.notify__status[data-state="success"] {
  color: var(--success-ink);
  font-weight: 700;
}
.notify__status[data-state="error"] {
  color: var(--danger-ink);
  font-weight: 700;
}
.notify__status[data-state="pending"] {
  color: var(--ink-soft);
}

/* ============================================================================
 * FOOTER
 * ========================================================================== */
.footer {
  padding-block: 2.5rem 3.5rem;
  border-block-start: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.footer p {
  margin: 0;
  max-width: none;
}

/* Utility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
