/* ════════════════════════════════════════════════════════════════
   Print HQ — public homepage (/). Standalone stylesheet: the homepage is
   the one page that does NOT load /css/style.css, so the token set is
   mirrored here. They MUST match style.css (see its :root) — Studio Bazaar
   dual theme: DARK is the default (:root), light overrides on
   html[data-theme="light"] (set by /js/theme.js in <head> from
   localStorage('phq-theme')). Baloo 2 display / Inter UI; lime remains the
   only action color in both modes. Mobile-first; verified at 390px/1440px.
   ════════════════════════════════════════════════════════════════ */

/* ── Tokens (mirror of /css/style.css :root — keep in sync) ──── */
:root {
  /* The homepage is a standalone sheet, so it carries its own half of
     the pair — audit finding 35. :root IS the dark default; the light
     half lives in html[data-theme="light"] below. */
  color-scheme: dark;

  /* Contract — dark (default mode) */
  --bg:      #0E0F13;
  --panel:   #15171C;
  --panel-2: #1B1E25;
  --line:    #262A33;
  --text:    #E8EAED;
  --dim:     #9AA0AA;
  --faint:   #868D98;  /* audit finding 32: was #5E646E (3.01:1 on --panel) */
  --blue:    #5B78FF;
  --stage:   #26282E;
  --ok:      #4ADE80;
  --warn:    #FBBF24;
  --danger:  #F87171;

  /* Contract — both modes */
  --lime:     #9CEE69;
  --lime-ink: #0A0C08;
  --saffron:  #FF9E2C;
  --teal:     #0FA3A3;

  /* Contract — ink tokens (audit finding 33) */
  --on-blue:   #0A0C08;
  --on-status: #0A0C08;

  /* Support tokens (theme-dependent, not part of the contract) */
  --blue-hover:    #7A93FF;
  --blue-soft:     rgba(91, 120, 255, 0.16);
  --blue-border:   rgba(91, 120, 255, 0.45);
  --border-strong: #3A404D;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.55);
  --focus-ring: 0 0 0 3px rgba(91, 120, 255, 0.40);

  --font-ui: 'Inter', 'Mukta', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Baloo 2', 'Mukta', cursive;
  --fs-11: 0.6875rem; --fs-12: 0.75rem;  --fs-13: 0.8125rem;
  --fs-14: 0.875rem;  --fs-16: 1rem;     --fs-18: 1.125rem;
  --fs-22: 1.375rem;  --fs-28: 1.75rem;  --fs-36: 2.25rem;
  --lh-tight: 1.2; --lh-body: 1.5;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-full: 999px;
  --tap-min: 44px;
}

/* Light mode — cream bazaar (html[data-theme="light"], set by theme.js) */
html[data-theme="light"] {
  /* The other half of the pair (audit finding 35). */
  color-scheme: light;

  --bg:      #F6F3EA;
  --panel:   #FFFFFF;
  --panel-2: #FBFAF5;
  --line:    #E8E4D8;
  --text:    #191919;
  --dim:     #6B6B60;
  --faint:   #6F6F64;  /* audit finding 32: was #9C9C90 (2.77:1 on --panel) */
  --blue:    #0025CC;
  --stage:   #E9E5D8;
  --ok:      #12703A;
  --warn:    #96530A;
  --danger:  #C2261F;

  --on-blue:   #FFFFFF;
  --on-status: #FFFFFF;

  --blue-hover:    #001DA3;
  --blue-soft:     #E8EBFA;
  --blue-border:   #B9C2F0;
  --border-strong: #C9C3B2;
  --shadow-sm: 0 1px 2px rgba(28, 27, 22, 0.08);
  --shadow-md: 0 4px 12px rgba(28, 27, 22, 0.10);
  --shadow-lg: 0 8px 28px rgba(0, 37, 204, 0.12);
  --focus-ring: 0 0 0 3px rgba(0, 37, 204, 0.25);
}

/* ── Compat aliases — old names this page was written against,
      re-pointed at the Studio Bazaar tokens (kept byte-compatible
      with the suite: tests/home.test.js asserts the lime literal) ── */
:root {
  --brand-blue:        var(--blue);
  --brand-blue-deep:   var(--blue-hover);
  --brand-blue-soft:   var(--blue-soft);
  --brand-blue-border: var(--blue-border);
  --brand-lime:        #9CEE69;   /* the ONE accent: final CTAs only (same in both modes) */
  --brand-lime-deep:   #7BD344;
  --brand-cream:       var(--bg);

  --n-0:   var(--panel);
  --n-50:  var(--bg);
  --n-100: var(--panel-2);
  --n-200: var(--line);
  --n-300: var(--border-strong);
  --n-500: var(--faint);
  --n-700: var(--dim);
  --n-900: var(--text);
}

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

body {
  min-height: 100%;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: var(--lh-body);
  background: var(--brand-cream);
  color: var(--n-900);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { line-height: var(--lh-tight); font-weight: 700; }
a { color: var(--brand-blue); }
a:hover { color: var(--brand-blue-deep); }
img, svg { max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }

/* Inline stroke icons (no sprite dependency on this page). */
.icon {
  width: 20px; height: 20px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.28em; pointer-events: none;
}
.icon-sm { width: 16px; height: 16px; }

/* ── Brand lockup ───────────────────────────────────────────── */
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; white-space: nowrap; line-height: 1;
}
/* Real PrintHQ wordmark (from the ERP brand assets): green on dark,
   blue on light — the two official one-colour variants. The wordmark
   itself reads "PrintHQ", so the lockup only adds the word "Studio". */
.brand-logo { height: 22px; width: auto; display: block; }
.brand-logo-dark { display: block; }
.brand-logo-light { display: none; }
html[data-theme="light"] .brand-logo-dark { display: none; }
html[data-theme="light"] .brand-logo-light { display: block; }
.brand-sub {
  font-family: var(--font-display); font-weight: 500;
  font-size: var(--fs-16); color: var(--dim);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-cta {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap-min); padding: 10px 22px;
  border: 1px solid var(--brand-lime); border-radius: var(--r-md);
  background: var(--brand-lime); color: var(--lime-ink);
  font-family: inherit; font-size: var(--fs-14); font-weight: 600;
  line-height: 1.2; text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow-md);
}
.btn-cta:hover { background: var(--brand-lime-deep); border-color: var(--brand-lime-deep); color: var(--lime-ink); }

/* ── Theme toggle pill (mirrors style.css; wired by /js/theme.js) ── */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; min-height: 36px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-full);
  color: var(--text); font-family: inherit; font-size: var(--fs-12); font-weight: 600;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--panel); border-color: var(--blue-border); color: var(--text); }
.theme-toggle .theme-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--lime);
}

/* ── Top bar ────────────────────────────────────────────────── */
.home-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
  max-width: 1120px; margin: 0 auto;
  padding: var(--s-4) var(--s-5);
}
.home-topbar-links { display: flex; gap: var(--s-5); }
.home-topbar-links a {
  font-size: var(--fs-14); font-weight: 500; text-decoration: none;
  color: var(--n-700); min-height: var(--tap-min); display: inline-flex; align-items: center;
}
.home-topbar-links a:hover { color: var(--brand-blue); }

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  max-width: 1120px; margin: 0 auto;
  padding: var(--s-8) var(--s-5) var(--s-10);
  text-align: center;
}
.hero-title {
  font-family: var(--font-display);
  font-size: var(--fs-28); letter-spacing: -0.01em;
  max-width: 16ch; margin: 0 auto var(--s-3);
}
.hero-sub {
  font-size: var(--fs-14); color: var(--n-700);
  max-width: 46ch; margin: 0 auto var(--s-6);
}
.hero-cta { min-width: 220px; }

/* ── Sections ───────────────────────────────────────────────── */
.section {
  max-width: 1120px; margin: 0 auto;
  padding: 0 var(--s-5) var(--s-10);
}
.section-head { margin-bottom: var(--s-4); }
.section-head h2 { font-family: var(--font-display); font-size: var(--fs-22); margin-bottom: 2px; }
.section-note { font-size: var(--fs-13); color: var(--n-700); }
.status-line { font-size: var(--fs-13); color: var(--n-700); padding: var(--s-3) 0; }

/* ── Product cards ──────────────────────────────────────────── */
.product-grid {
  display: grid; grid-template-columns: 1fr; gap: var(--s-3);
}
.product-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  min-height: 148px; padding: var(--s-4);
  background: var(--n-0); border: 1px solid var(--n-200); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); text-decoration: none; color: inherit;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.product-card:hover {
  box-shadow: var(--shadow-md); border-color: var(--brand-blue-border);
  transform: translateY(-2px);
}
.product-card-icon { color: var(--brand-blue); width: 40px; height: 40px; stroke-width: 1.5; margin-bottom: 2px; }
.product-card-name { font-size: var(--fs-16); font-weight: 600; }
.product-card-size { font-size: var(--fs-13); color: var(--n-700); }
.product-card-info { font-size: var(--fs-12); color: var(--n-700); }
.product-card-price {
  font-size: var(--fs-13); color: var(--brand-blue); font-weight: 600;
  margin-top: auto; padding-top: var(--s-2);
}

/* ── Gallery controls ───────────────────────────────────────── */
.gallery-controls { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-4); }
.search-field {
  display: flex; align-items: center; gap: var(--s-2);
  min-height: var(--tap-min); padding: 0 var(--s-3);
  background: var(--n-0); border: 1px solid var(--n-200);
  border-radius: var(--r-md); color: var(--n-500);
}
.search-field:focus-within { border-color: var(--brand-blue-border); box-shadow: var(--focus-ring); }
.search-field input {
  flex: 1; min-width: 0; min-height: 40px;
  border: 0; background: transparent; outline: none;
  font-family: inherit; font-size: var(--fs-14); color: var(--n-900);
}
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip {
  min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--n-300); border-radius: var(--r-full);
  background: var(--n-0); color: var(--n-700);
  font-family: inherit; font-size: var(--fs-13); font-weight: 500; cursor: pointer;
}
.chip:hover { border-color: var(--brand-blue-border); color: var(--brand-blue); }
.chip[aria-pressed="true"] {
  background: var(--brand-blue-soft); border-color: var(--brand-blue-border);
  color: var(--brand-blue); font-weight: 600;
}

/* ── Template gallery ───────────────────────────────────────── */
.template-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3);
}
.template-card {
  display: flex; flex-direction: column;
  background: var(--n-0); border: 1px solid var(--n-200); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); overflow: hidden; text-decoration: none; color: inherit;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.template-card:hover {
  box-shadow: var(--shadow-md); border-color: var(--brand-blue-border);
  transform: translateY(-2px);
}
.template-thumb {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 4 / 3; background: var(--n-100); overflow: hidden;
}
.template-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* Named fallback when a template has no thumbnail — never a broken image. */
.thumb-fallback {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; padding: var(--s-3); text-align: center;
  background: linear-gradient(135deg, var(--panel-2), var(--stage));
  color: var(--text); font-size: var(--fs-14); font-weight: 600;
}
.template-meta { padding: var(--s-3); display: flex; flex-direction: column; gap: 2px; }
.template-name { font-size: var(--fs-14); font-weight: 600; overflow-wrap: anywhere; }
.template-product { font-size: var(--fs-12); color: var(--n-700); overflow-wrap: anywhere; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-3);
  padding: var(--s-10) var(--s-5); text-align: center;
  background: var(--n-0); border: 1px dashed var(--n-300); border-radius: var(--r-lg);
}
.empty-title { font-size: var(--fs-16); font-weight: 600; }
.empty-sub { font-size: var(--fs-13); color: var(--n-700); max-width: 44ch; }

/* ── Footer strip ───────────────────────────────────────────── */
.home-footer {
  border-top: 1px solid var(--n-200); background: var(--n-100);
  padding: var(--s-8) var(--s-5) var(--s-10);
  display: flex; flex-direction: column; align-items: center; gap: var(--s-3);
  text-align: center;
}
.footer-reassure {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-14); font-weight: 600;
}
.footer-reassure .icon { color: var(--ok); }
.footer-links { display: flex; gap: var(--s-5); flex-wrap: wrap; justify-content: center; }
.footer-links a {
  font-size: var(--fs-14); text-decoration: none; color: var(--brand-blue);
  min-height: var(--tap-min); display: inline-flex; align-items: center;
}
.footer-links a:hover { text-decoration: underline; }
/* Env-gated order hand-off (src/routes/home.js, WHATSAPP_NUMBER): the ONE
 * lime accent marks the conversion exit, everything else in the footer stays
 * a plain blue text link.
 * Audit finding 31: lime is a FILL, never a text colour on the footer
 * surface — #9CEE69 text on the light cream footer (#FBFAF5) was 1.35:1, so
 * the link read as blank space for every light-mode visitor. The link is a
 * lime pill with --lime-ink text, exactly like .btn-cta: 13.89:1. */
.footer-links a.footer-order {
  background: var(--brand-lime); border: 1px solid var(--brand-lime);
  color: var(--lime-ink); font-weight: 600;
  border-radius: var(--r-full); padding: 0 18px; text-decoration: none;
}
.footer-links a.footer-order:hover {
  background: var(--brand-lime-deep); border-color: var(--brand-lime-deep);
  color: var(--lime-ink); text-decoration: none;
}
.footer-fine { font-size: var(--fs-12); color: var(--n-700); max-width: 52ch; }

/* ── ≥600px: wider grids ────────────────────────────────────── */
@media (min-width: 600px) {
  .hero { padding-top: var(--s-12); }
  .hero-title { font-size: var(--fs-36); max-width: 22ch; }
  .hero-sub { font-size: var(--fs-16); }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-controls { flex-direction: row; align-items: center; justify-content: space-between; }
  .search-field { min-width: 300px; }
}

/* ── ≥1024px: desktop (1440px target) ───────────────────────── */
@media (min-width: 1024px) {
  .home-topbar { padding: var(--s-5) var(--s-6); }
  .section, .hero { padding-left: var(--s-6); padding-right: var(--s-6); }
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .template-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}