/* Colt Platform: shared styles for coltplatform.com.
   Tokens first, then base, layout, components, page sections.
   Light and dark follow the device setting; there is no toggle. */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light dark;

  /* Corporate palette */
  --paper: #faf8f3;
  --surface: #ffffff;
  --ink: #1c1f1d;
  --ink-2: #4a504c;
  --line: #e2ddd2;
  --line-strong: #c9c3b6;
  --accent: #2f5d46;
  --accent-hover: #244a37;
  --accent-ink: #ffffff;
  --accent-tint: #e7eee8;

  /* Recipes & Notes palette (used under .product) */
  --cream: #f5f0e4;
  --cream-2: #ece5d3;
  --sage: #8fa98a;
  --sage-deep: #3d5c43;
  --sage-tint: #dfe7d9;

  --focus: #1f6feb;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --step-4: clamp(2.1rem, 1.5rem + 2.8vw, 3.5rem);

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: clamp(3.5rem, 2.5rem + 4vw, 6rem);

  /* Layout */
  --width: 72rem;
  --width-text: 40rem;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);

  /* Shape */
  --radius-s: 6px;
  --radius-m: 12px;
  --radius-l: 20px;
  --border: 1px solid var(--line);
  --shadow: 0 1px 2px rgb(28 31 29 / 0.06), 0 8px 24px -12px rgb(28 31 29 / 0.18);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fast: 150ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121412;
    --surface: #1a1d1b;
    --ink: #ecebe6;
    --ink-2: #a9aea9;
    --line: #2d322f;
    --line-strong: #434a45;
    --accent: #8cc4a2;
    --accent-hover: #a6d4b7;
    --accent-ink: #0f1a14;
    --accent-tint: #1c2a22;

    --cream: #171a16;
    --cream-2: #20241f;
    --sage: #6f8a6b;
    --sage-deep: #a9c4a4;
    --sage-tint: #232c22;

    --focus: #79b8ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -12px rgb(0 0 0 / 0.6);
  }
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--step-0)/1.6 var(--font-sans);
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
h1, h2 { font-family: var(--font-serif); font-weight: 600; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; text-wrap: pretty; }
p + p { margin-top: var(--space-4); }
a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent-tint); }

.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 10;
  background: var(--surface); color: var(--ink);
  padding: var(--space-2) var(--space-4); border: var(--border); border-radius: var(--radius-s);
}
.skip-link:focus { top: var(--space-4); }

.wrap { width: min(100% - 2 * var(--gutter), var(--width)); margin-inline: auto; }
.measure { max-width: var(--width-text); }
.eyebrow {
  font-size: var(--step--1); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: var(--space-4);
}
.lead { font-size: var(--step-1); color: var(--ink-2); line-height: 1.55; }
.muted { color: var(--ink-2); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header { border-bottom: var(--border); background: var(--paper); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5);
  padding-block: var(--space-4);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--space-3);
  color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -0.01em;
  min-height: 44px; margin-right: auto;
}
.brand:hover { color: var(--ink); }
.brand svg { width: 28px; height: 28px; flex: none; color: var(--accent); }
.brand svg path { stroke: var(--accent-ink); }
.site-nav { order: 3; flex-basis: 100%; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-1) var(--space-5); flex-wrap: wrap; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 0.45em; }
@media (min-width: 46rem) {
  .site-nav { order: 0; flex-basis: auto; }
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0.6rem 1.15rem;
  border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.button--primary { background: var(--accent); color: var(--accent-ink); }
.button--primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.button--secondary { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.button--secondary:hover { border-color: var(--ink); color: var(--ink); }
.button--small { min-height: 40px; padding: 0.45rem 0.95rem; font-size: 0.9375rem; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }

/* ── Sections ───────────────────────────────────────────────────────────── */
.section { padding-block: var(--space-8); }
.section + .section { border-top: var(--border); }
.section-head { max-width: var(--width-text); margin-bottom: var(--space-7); }
.section-head h2 + p { margin-top: var(--space-4); }

/* Hero */
.hero { padding-block: var(--space-8); }
.hero-grid { display: grid; gap: var(--space-7); align-items: center; }
.hero h1 { max-width: 16ch; }
.hero .lead { margin-top: var(--space-5); max-width: 34rem; }
@media (min-width: 60rem) {
  .hero-grid { grid-template-columns: 1.15fr 1fr; }
}

/* Status line: shown wherever availability is stated */
.status {
  display: inline-flex; align-items: flex-start; gap: var(--space-2);
  font-size: var(--step--1); font-weight: 600; color: var(--ink);
}
.status::before {
  content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-top: 0.45em;
  background: var(--sage); box-shadow: 0 0 0 3px var(--sage-tint); flex: none;
}

/* Product card: flagship product on company pages */
.product-card {
  background: var(--cream); border: 1px solid var(--cream-2); border-radius: var(--radius-l);
  padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}
.product-card__head { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-5); }
.app-icon { width: 64px; height: 64px; border-radius: 22.5%; box-shadow: var(--shadow); flex: none; }
.app-icon--large { width: 96px; height: 96px; }
.product-card__name { font-family: var(--font-serif); font-size: var(--step-2); font-weight: 600; line-height: 1.15; }
.product-card__by { font-size: var(--step--1); color: var(--ink-2); }
.product-card .status { margin-top: var(--space-5); }

/* Check list */
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.ticks li { position: relative; display: grid; grid-template-columns: 1.25rem 1fr; gap: var(--space-3); align-items: start; }
.ticks li::before { content: ""; width: 1.25rem; height: 1.25rem; margin-top: 0.2rem; border-radius: 50%; background: var(--sage-tint); }
.ticks li::after {
  content: ""; position: absolute; left: 0; top: 0.2rem; width: 1.25rem; height: 1.25rem;
  background: var(--sage-deep);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}

/* Numbered editorial columns (principles, the cooking journey) */
.numbered { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-6); counter-reset: p; }
.numbered li { counter-increment: p; border-top: 2px solid var(--ink); padding-top: var(--space-4); }
.numbered li::before {
  content: "0" counter(p); display: block; font-size: var(--step--1); font-weight: 600;
  color: var(--accent); margin-bottom: var(--space-3); font-variant-numeric: tabular-nums;
}
.numbered h3 + p { margin-top: var(--space-2); color: var(--ink-2); }
@media (min-width: 46rem) { .numbered { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); } }

/* Portfolio: one row per product; add an <li> when a new product is real */
.portfolio { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.portfolio-item {
  display: grid; gap: var(--space-4) var(--space-5); align-items: center;
  grid-template-columns: auto 1fr;
  padding: var(--space-5); border: var(--border); border-radius: var(--radius-m); background: var(--surface);
}
.portfolio-item p { color: var(--ink-2); margin-top: var(--space-1); }
.portfolio-item .actions { grid-column: 1 / -1; margin-top: 0; }
@media (min-width: 46rem) {
  .portfolio-item { grid-template-columns: auto 1fr auto; }
  .portfolio-item .actions { grid-column: auto; }
}

/* CTA band */
.cta-band { background: var(--accent-tint); border-radius: var(--radius-l); padding: clamp(1.75rem, 1rem + 3vw, 3.5rem); }
.cta-band h2 { max-width: 20ch; }
.cta-band p { margin-top: var(--space-4); max-width: 38rem; color: var(--ink-2); }

/* Details list (company facts) */
.facts { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; border-top: var(--border); }
.facts div { display: grid; gap: var(--space-1) var(--space-5); padding-block: var(--space-4); border-bottom: var(--border); }
.facts dt { color: var(--ink-2); font-size: var(--step--1); }
.facts dd { margin: 0; }
@media (min-width: 40rem) { .facts div { grid-template-columns: 12rem 1fr; } }

/* Contact routes */
.routes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.route { padding: var(--space-5); border: var(--border); border-radius: var(--radius-m); background: var(--surface); }
.route h2 { font-family: var(--font-sans); font-size: var(--step-1); letter-spacing: -0.01em; }
.route p { margin-top: var(--space-2); color: var(--ink-2); }
.route .route__link { display: inline-block; margin-top: var(--space-3); font-weight: 600; font-size: var(--step-1); overflow-wrap: anywhere; }
@media (min-width: 46rem) { .routes { grid-template-columns: repeat(2, 1fr); } }

/* ── Product page (Recipes & Notes) ─────────────────────────────────────── */
.product { --accent-tint: var(--sage-tint); }
.product .hero { background: var(--cream); border-bottom: 1px solid var(--cream-2); }
.product .eyebrow { display: flex; align-items: center; gap: var(--space-3); text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--ink); }
.product .eyebrow img { width: 40px; height: 40px; border-radius: 22.5%; }
.availability {
  margin-top: var(--space-6); padding: var(--space-4) var(--space-5);
  border-left: 3px solid var(--sage); background: var(--paper); border-radius: 0 var(--radius-s) var(--radius-s) 0;
  max-width: 34rem;
}
.availability p + p { margin-top: var(--space-1); font-size: var(--step--1); color: var(--ink-2); }

/* Features: a grid of short items, each with an icon tile.
   When genuine app screenshots exist, put an <img> in .feature__visual and
   add .features--rows to the container for wide alternating rows. */
.features { display: grid; gap: var(--space-7) var(--space-6); grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.feature { display: grid; gap: var(--space-4); align-content: start; }
.feature__num { font-size: var(--step--1); font-weight: 600; color: var(--sage-deep); font-variant-numeric: tabular-nums; margin-bottom: var(--space-2); }
.feature h3 { font-family: var(--font-serif); font-size: var(--step-2); }
.feature p:not(.feature__num) { margin-top: var(--space-3); color: var(--ink-2); max-width: 34rem; }
.feature__visual {
  order: -1; margin: 0; width: 56px; height: 56px; border-radius: var(--radius-m);
  background: var(--sage-tint); display: grid; place-items: center; overflow: hidden;
}
.feature__visual svg { width: 60%; color: var(--sage-deep); }
.feature__visual img { width: 100%; height: 100%; object-fit: cover; }

.features--rows { grid-template-columns: 1fr; gap: var(--space-8); }
.features--rows .feature__visual { order: 0; width: auto; height: auto; aspect-ratio: 4 / 3; border-radius: var(--radius-l); background: var(--cream); border: 1px solid var(--cream-2); }
@media (min-width: 52rem) {
  .features--rows .feature { grid-template-columns: 1fr 1fr; gap: var(--space-8); align-items: center; }
  .features--rows .feature:nth-child(even) .feature__visual { order: -1; }
}

/* FAQ: native disclosure, no script */
.faq { border-top: var(--border); max-width: 48rem; }
.faq details { border-bottom: var(--border); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
  padding-block: var(--space-5); font-weight: 600; font-size: var(--step-1); min-height: 44px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; width: 0.6rem; height: 0.6rem; flex: none; margin-right: 0.25rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-25%); transition: transform var(--fast) var(--ease);
}
.faq details[open] summary::after { transform: rotate(-135deg); }
.faq details > div { padding-bottom: var(--space-5); color: var(--ink-2); max-width: 40rem; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer { border-top: var(--border); margin-top: var(--space-8); padding-block: var(--space-7) var(--space-6); font-size: 0.9375rem; color: var(--ink-2); }
.footer-grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.footer-grid h2 { font-family: var(--font-sans); font-size: var(--step--1); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); margin-bottom: var(--space-3); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.footer-grid a { color: var(--ink-2); text-decoration: none; display: inline-block; padding-block: 0.3rem; }
.footer-grid a:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 45.99rem) { .footer-grid > :last-child { grid-column: 1 / -1; } }
.footer-legal { margin-top: var(--space-7); padding-top: var(--space-5); border-top: var(--border); font-size: var(--step--1); }

/* ── Motion preference ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Utilities ──────────────────────────────────────────────────────────── */
.lead-gap { margin-top: var(--space-5); }
.gap-top { margin-top: var(--space-4); }
.section--flush { padding-top: 0; }

/* ── Colour scheme preview (flag: colour_scheme_switcher in flags.js) ───────
   Inert unless flags.js sets data-scheme on <html>. Values come from the app:
   app = constants/colors.ts, journal and sage = constants/conceptThemes.ts.
   Token mapping: paper=background, surface=card, ink=foreground,
   ink-2=mutedForeground, line=border, accent=primary, accent-tint=secondary,
   sage=accent (status dot), sage-deep=icon colour, cream=product hero. */
:root[data-scheme] { --accent-hover: color-mix(in srgb, var(--accent) 82%, var(--ink)); }
:root[data-scheme="app"] {
  --paper: #faf4ea; --surface: #ffffff; --ink: #2c211a; --ink-2: #6b5c4a;
  --line: #e5d8bf; --line-strong: #cdba98;
  --accent: #a8401e; --accent-ink: #ffffff; --accent-tint: #f0e6d2;
  --cream: #f0e6d2; --cream-2: #e5d8bf; --sage: #5a7352; --sage-deep: #4f6648; --sage-tint: #e4eadf;
}
:root[data-scheme="journal"] {
  --paper: #f6f0e5; --surface: #fffcf6; --ink: #30262f; --ink-2: #6e5f6b;
  --line: #d9cdb8; --line-strong: #8f818c;
  --accent: #40263d; --accent-ink: #f6f0e5; --accent-tint: #f7ecc4;
  --cream: #f7ecc4; --cream-2: #e8d9a6; --sage: #e9c65b; --sage-deep: #40263d; --sage-tint: #f7ecc4;
}
:root[data-scheme="sage"] {
  --paper: #f7f5ef; --surface: #ffffff; --ink: #26372d; --ink-2: #5f6b62;
  --line: #e6e4dc; --line-strong: #828d7c;
  --accent: #5a6a54; --accent-ink: #ffffff; --accent-tint: #e8ede4;
  --cream: #e8ede4; --cream-2: #d9e0d3; --sage: #8f5628; --sage-deep: #5a6a54; --sage-tint: #e8ede4;
}
@media (prefers-color-scheme: dark) {
  :root[data-scheme="app"] {
    --paper: #1a1410; --surface: #2a211a; --ink: #f5efe2; --ink-2: #b5a48a;
    --line: #4a3d32; --line-strong: #6a5a4b;
    --accent: #d87149; --accent-ink: #1a1410; --accent-tint: #382d24;
    --cream: #2a211a; --cream-2: #4a3d32; --sage: #9dba94; --sage-deep: #9dba94; --sage-tint: #2f3a2c;
  }
  :root[data-scheme="journal"] {
    --paper: #1e151c; --surface: #2b1f29; --ink: #f6f0e5; --ink-2: #c9bcc6;
    --line: #4a3a47; --line-strong: #7a6976;
    --accent: #e9c65b; --accent-ink: #1e151c; --accent-tint: #3a2b37;
    --cream: #2b1f29; --cream-2: #4a3a47; --sage: #e07a62; --sage-deep: #e9c65b; --sage-tint: #3a2b37;
  }
  :root[data-scheme="sage"] {
    --paper: #151c18; --surface: #1f2923; --ink: #f1efe8; --ink-2: #b4bfb6;
    --line: #34423a; --line-strong: #6f7d72;
    --accent: #a3b59b; --accent-ink: #151c18; --accent-tint: #2a3630;
    --cream: #1f2923; --cream-2: #34423a; --sage: #d9a477; --sage-deep: #a3b59b; --sage-tint: #2a3630;
  }
}
:root[data-scheme] .product { --accent-tint: var(--sage-tint); }

.scheme-switcher {
  position: fixed; z-index: 20; left: 50%; bottom: var(--space-4); transform: translateX(-50%);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--space-1);
  width: max-content; max-width: calc(100% - 2 * var(--space-4));
  padding: var(--space-1); border-radius: var(--radius-m);
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  font-size: var(--step--1);
}
.scheme-switcher span { padding-inline: var(--space-2); font-weight: 600; color: var(--ink-2); }
.scheme-switcher button {
  min-height: 36px; padding: 0.3rem 0.7rem; border: 0; border-radius: var(--radius-s);
  font: inherit; font-weight: 600; color: var(--ink); background: transparent; cursor: pointer;
}
.scheme-switcher button:hover { background: var(--accent-tint); }
.scheme-switcher button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
body.has-scheme-switcher { padding-bottom: 6rem; }
