/* site/assets/css/site.css
   Responsibility: the entire visual design system — color tokens (light +
   dark via prefers-color-scheme), type scale (Fraunces display / Inter
   body), layout primitives, and every component used by html.js, views.js
   and scripts/build.mjs (header, footer, hero, cards, grid, forms, FAQ
   accordion, callouts). Mobile-first, no horizontal scroll at 360px,
   AA contrast in both themes. No preprocessor, no build step. */

/* ---------- tokens ---------- */
:root {
  --bg: #fbf8f3;
  --bg-elevated: #ffffff;
  --bg-sunken: #f2ece1;
  --text: #201d18;
  --text-muted: #5c564a;
  --border: #e5ddcd;
  --accent: #5f7a52;       /* sage */
  --accent-ink: #22301c;
  --accent-contrast: #fbfaf5;
  --clay: #b96a44;
  --clay-text: #9a5636; /* darker than --clay: 4.75:1 on --bg-sunken, meets WCAG AA for text */
  --slate: #445269;
  --focus: #2f6fed;
  --danger: #b3261e;
  --success-bg: #e9f2e6;
  --success-ink: #24401f;

  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --gutter: 16px;
  --container-max: 1160px;
  --container-narrow: 720px;

  --shadow-card: 0 1px 2px rgba(30, 25, 15, 0.06), 0 8px 24px -12px rgba(30, 25, 15, 0.18);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181712;
    --bg-elevated: #211f19;
    --bg-sunken: #141310;
    --text: #f3efe4;
    --text-muted: #b8b0a0;
    --border: #38352b;
    --accent: #8fb37e;
    --accent-ink: #eef5ea;
    --accent-contrast: #14210f;
    --clay: #e0916a;
    --clay-text: #e0916a; /* already 7.46:1 on dark --bg-sunken — no separate darkening needed */
    --slate: #8fa3c2;
    --focus: #6ea0ff;
    --success-bg: #1c2c19;
    --success-ink: #cfe8c8;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  }
}

/* ---------- reset & base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--text);
}
p { margin: 0 0 1em; color: var(--text); }
ol, ul { padding-left: 1.25em; }
::selection { background: var(--accent); color: var(--accent-contrast); }

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--bg-elevated);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

.wrap {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.section { padding-top: 56px; padding-bottom: 56px; }
.section--narrow { max-width: var(--container-narrow); }
.section--centered { text-align: center; }
.section--tight { padding-top: 28px; padding-bottom: 28px; }

.page-title { font-size: clamp(1.8rem, 1.4rem + 2vw, 2.6rem); }
.page-lede { font-size: 1.125rem; color: var(--text-muted); max-width: 60ch; }
.section--centered .page-lede { margin-left: auto; margin-right: auto; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
  margin-right: auto;
}
.brand__mark { flex: none; }
.site-nav {
  display: none;
  gap: 24px;
  font-size: 0.95rem;
}
.site-nav a { text-decoration: none; color: var(--text-muted); }
.site-nav a:hover { color: var(--text); }
@media (min-width: 760px) {
  .site-nav { display: flex; }
}
.cta-form { display: inline-flex; margin: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  padding: 13px 24px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.1;
  transition: transform 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn--primary:hover { opacity: 0.92; }
.btn--secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--secondary:hover { background: var(--bg-sunken); }
.btn--sm { padding: 9px 16px; font-size: 0.9rem; }
.btn--lg { padding: 16px 30px; font-size: 1.1rem; }
.btn--disabled {
  background: var(--bg-sunken);
  color: var(--text-muted);
  cursor: default;
  border-color: var(--border);
}
.btn--block { width: 100%; }

/* ---------- hero ---------- */
.hero {
  padding-top: 56px;
  padding-bottom: 40px;
  text-align: center;
}
.hero__eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(2.1rem, 1.5rem + 3.2vw, 3.6rem);
  max-width: 18ch;
  margin-left: auto;
  margin-right: auto;
}
.hero__sub {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 52ch;
  margin: 0 auto 28px;
}
.price-anchor {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}
.price-anchor__was {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.price-anchor__now {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 600;
  color: var(--text);
}
.price-anchor__note { width: 100%; font-size: 0.9rem; color: var(--text-muted); }
.hero__cta { margin-top: 22px; margin-bottom: 8px; }
.hero__fineprint { font-size: 0.85rem; color: var(--text-muted); }

/* trust points */
.trust-points {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  text-align: left;
}
@media (min-width: 640px) {
  .trust-points { grid-template-columns: repeat(3, 1fr); text-align: center; }
}
.trust-points li {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.95rem;
  color: var(--text);
}
.trust-points strong { display: block; font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 2px; }

/* ---------- grid / cards ---------- */
.template-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 20px 0 40px;
}
@media (min-width: 560px) { .template-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .template-grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}
.card__cover { position: relative; aspect-ratio: 8 / 5; background: var(--bg-sunken); }
.card__cover .cover, .card__cover img.cover { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card__title { font-size: 1.05rem; margin: 0; }
.card__promise { color: var(--text-muted); font-size: 0.92rem; margin: 0; flex: 1; }
.card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.card__link { margin-top: auto; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-sunken);
}
.tag--minimal { color: var(--accent-ink); border-color: var(--accent); }
.tag--cozy { color: var(--clay-text); border-color: var(--clay); }

.badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

/* ---------- how it works ---------- */
.steps {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  counter-reset: step;
}
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li {
  counter-increment: step;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.steps li::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 12px;
}
.steps h3 { font-size: 1.05rem; margin-bottom: 6px; }
.steps p { color: var(--text-muted); margin: 0; font-size: 0.95rem; }

/* ---------- FAQ ---------- */
.faq-list { margin: 24px 0 0; display: grid; gap: 10px; }
.faq-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 20px;
}
.faq-item summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 16px 0;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  float: right;
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
}
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p { color: var(--text-muted); padding-bottom: 16px; margin: 0; }
.faq-item p a { color: var(--accent-ink); }

/* ---------- forms ---------- */
.stacked-form { display: grid; gap: 10px; max-width: 420px; margin-top: 16px; }
.stacked-form label { font-size: 0.9rem; font-weight: 600; }
input[type='email'], input[type='text'] {
  font: inherit;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}
input[type='email']:focus, input[type='text']:focus { border-color: var(--accent); }
.subscribe-form { display: flex; flex-wrap: wrap; gap: 10px; max-width: 480px; margin: 20px auto 0; }
.subscribe-form input[type='email'] { flex: 1 1 220px; }
/* Shown after a successful /api/subscribe redirect to /#subscribed-success — pure CSS :target,
   no JS (the site ships none): hidden until the URL fragment matches this element's id. */
.subscribe-confirm { display: none; max-width: 480px; margin: 20px auto 0; text-align: left; }
.subscribe-confirm:target { display: block; }
/* honeypot: visually hidden but present for bots, not display:none (some crawlers skip those) */
.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- callouts ---------- */
.callout {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 24px 0;
}
.callout h2 { font-size: 1.1rem; }
.callout__note { color: var(--text-muted); font-size: 0.9rem; margin-top: 12px; margin-bottom: 0; }
.callout--success { background: var(--success-bg); color: var(--success-ink); border-color: transparent; }
.callout--success p { color: inherit; margin: 0; }
.callout--rollout { background: var(--bg-sunken); border-color: var(--clay); }
.callout--rollout p { margin: 0; }

.spinner { color: var(--text-muted); }

/* ---------- legal / prose ---------- */
.prose h2 { font-size: 1.3rem; margin-top: 1.6em; }
.prose h1 { margin-bottom: 0.3em; }
.prose a { color: var(--accent-ink); text-decoration-color: var(--accent); }
.prose ul { color: var(--text); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

.empty-state { color: var(--text-muted); }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 32px 0;
  background: var(--bg-sunken);
}
.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
@media (min-width: 640px) {
  .site-footer__inner { flex-direction: row; align-items: center; justify-content: space-between; }
}
.brand--footer { font-size: 1rem; margin-right: 0; }
.site-footer__sold-by { color: var(--text-muted); font-size: 0.85rem; margin: 6px 0 0; }
.site-footer__legal { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.88rem; }
.site-footer__legal a { text-decoration: none; color: var(--text-muted); }
.site-footer__legal a:hover { color: var(--text); }

/* ---------- template page ---------- */
.template-hero {
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 40px 0;
}
@media (min-width: 860px) { .template-hero { grid-template-columns: 1.1fr 1fr; } }
.template-hero__cover { border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.template-hero__cover .cover { width: 100%; height: auto; aspect-ratio: 8/5; object-fit: cover; }
/* compact price-anchor / trust-points strip reused on Template Pages next to the CTA (quality
   review: SEO-landing pages had no price anchor or trust signals at all) — left-aligned, tighter
   spacing than the homepage hero's centered version. */
.price-anchor--compact { justify-content: flex-start; margin: 14px 0 4px; }
.price-anchor--compact .price-anchor__note { width: auto; }
.trust-points--compact {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 16px;
}
@media (min-width: 480px) { .trust-points--compact { grid-template-columns: repeat(3, 1fr); } }
.trust-points--compact li { padding: 10px 12px; font-size: 0.85rem; text-align: left; }
.trust-points--compact strong { font-size: 0.95rem; }

.spec-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.spec-list li { display: flex; gap: 8px; align-items: flex-start; color: var(--text-muted); }
.spec-list li::before { content: '✓'; color: var(--accent); font-weight: 700; }

.related-grid { margin-top: 12px; }

/* ---------- reduced motion ---------- */
/* .btn's hover/active transform+opacity transition and the FAQ <details> open/close have no
   motion-preference guard anywhere else in this file (quality review finding #6). */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
