/* ── Light-mode variable improvements ───────────────────────────────────────
   theme.css loads after all inline <style> blocks, so same-specificity rules
   here win. Dark-mode is [data-theme="dark"] which is higher specificity anyway.
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Cross-browser & device baseline ─────────────────────────────────────────
   Prevents iOS auto-zoom on landscape, removes tap-highlight flash, kills the
   300ms tap delay on older Mobile Safari, gives the OS a colour-scheme hint
   so form controls and scrollbars adopt the right tone in dark mode.        */
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

:root { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

/* iOS Safari's 100vh includes the URL bar; 100dvh tracks the actual visible
   area. Browsers that don't support 100dvh keep the original 100vh value.   */
@supports (min-height: 100dvh) {
  body { min-height: 100dvh; }
}

/* Remove 300ms tap delay and double-tap zoom on all interactive elements.   */
button, .btn, a, [role="button"], summary,
input[type="checkbox"], input[type="radio"],
.letter-type, .attach-zone, .theme-toggle,
.nav-link, .nav-links a {
  touch-action: manipulation;
}

/* Keyboard focus rings — visible for keyboard users, hidden for mouse users.
   `:focus-visible` only matches when focus is reached via keyboard/AT.      */
button:focus-visible,
.btn:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
.nav-link:focus-visible,
.filter-btn:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: 4px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  /* Inputs already get a coloured border + box-shadow on focus; the
     focus-visible outline is unnecessary and would draw a double ring.     */
  outline: none;
}

/* Disable hover transforms on touch-only devices (they flash on tap and
   feel laggy). Keep them where a real pointer exists.                       */
@media (hover: none) {
  .btn:hover,
  .btn-red:hover,
  .btn-primary:hover,
  .btn-outline:hover,
  .btn-ink:hover {
    transform: none !important;
    box-shadow: none !important;
  }
  .theme-toggle:hover { transform: none; }
}

/* Improve smooth-scroll feel on iOS inside scrollable containers. */
.ac-drop {
  -webkit-overflow-scrolling: touch;
}

:root {
  --ink-muted: #524d47;   /* was #6b6258 — ~5.8:1 on kraft, passes WCAG AA */
  --ink-faint: #6b6258;   /* was #968b7d — now used only for truly secondary hints */
}

/* ── Dark mode ────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --kraft:        #1a1410;
  --kraft-light:  #221c16;
  --kraft-deep:   #120e0a;
  --paper:        #2b241d;
  --ink:          #ede1c5;
  --ink-soft:     #d4c8ad;
  --ink-muted:    #bdb1a1;    /* was #a89e8c — slightly brightened */
  --ink-faint:    #a89e8c;
  --red:          #c25c40;
  --red-deep:     #a8472d;
  --red-stamp:    #d46a4c;
  --line:         rgba(237,225,197,0.12);
  --shadow-soft:  0 1px 2px rgba(0,0,0,0.4), 0 6px 20px rgba(0,0,0,0.3);
  --shadow-card:  0 2px 6px rgba(0,0,0,0.4), 0 14px 40px rgba(0,0,0,0.45);
}
[data-theme="dark"] body::before { display: none; }
[data-theme="dark"] nav { background: rgba(26,20,16,0.94) !important; }

/* ── Rounder, more modern shapes ─────────────────────────────────────────── */
.btn { border-radius: 6px; }

input,
select,
textarea {
  border-radius: 6px;
  font-size: 16px;  /* prevents iOS auto-zoom on focus */
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(168, 71, 45, 0.11);
}

/* Cards and panels */
.panel,
.price-card,
.form-card,
.card,
.result,
.preview-envelope,
.story-quote {
  border-radius: 10px;
}

.order-summary { border-radius: 8px; }

/* Autocomplete dropdown — flat top, rounded bottom */
.ac-drop { border-radius: 0 0 8px 8px; }

/* ── Readability: body copy sizes and contrast ────────────────────────────── */

/* Landing page sections */
.step p                       { font-size: 16px; line-height: 1.75; }
.faq-item p                   { font-size: 16px; line-height: 1.75; }
.usecase p                    { font-size: 15px; line-height: 1.65; }
.price-includes li            { font-size: 15px; }
.section-head p               { font-size: 18px; line-height: 1.65; }

/* About page */
.value p                      { font-size: 16px; line-height: 1.75; }

/* Field hints — use slightly better-contrast faint color */
.field-note { color: var(--ink-faint); font-size: 12.5px; }

/* ── Dark mode: fix sections that use --ink as a dark background ────────────
   In dark mode --ink flips to #ede1c5 (light cream). Every section that was
   intentionally dark must be pinned to a dark value, and any hardcoded
   rgba(250,246,236,...) text colours inside them must be corrected too.     */

/* Story band — index.html and about.html */
[data-theme="dark"] .story              { background: var(--kraft-deep); color: var(--ink); }
[data-theme="dark"] .story-quote        { color: var(--ink); }
[data-theme="dark"] .manifesto p        { color: var(--ink); }

/* Scrolling ticker */
[data-theme="dark"] .ticker             { background: var(--kraft-deep); color: var(--ink); }

/* Featured price card */
[data-theme="dark"] .price-card.featured                             { background: var(--kraft-deep); color: var(--ink); }
[data-theme="dark"] .price-card.featured h3,
[data-theme="dark"] .price-card.featured .price                      { color: var(--ink); }
[data-theme="dark"] .price-card.featured .price-sub,
[data-theme="dark"] .price-card.featured .price-meta,
[data-theme="dark"] .price-card.featured .price small                { color: var(--ink-muted); }
[data-theme="dark"] .price-card.featured .price-includes li          { color: var(--ink-soft); border-bottom-color: rgba(237,225,197,0.12); }

/* Order summary (send page) */
[data-theme="dark"] .order-summary                                   { background: var(--kraft-deep); color: var(--ink); }
[data-theme="dark"] .order-summary-row .label                        { color: var(--ink-muted); }
[data-theme="dark"] .order-summary-row .val                          { color: var(--ink); }

/* Footer — appears on every page */
[data-theme="dark"] footer                                           { background: var(--kraft-deep); color: var(--ink-muted); }
[data-theme="dark"] .footer-brand p                                  { color: var(--ink-muted); }
[data-theme="dark"] .footer-col h4                                   { color: var(--ink-soft); }
[data-theme="dark"] .footer-col a                                    { color: var(--ink-muted); }
[data-theme="dark"] .footer-bottom                                   { color: var(--ink-faint); }
[data-theme="dark"] .footer-bottom a,
[data-theme="dark"] .footer-bottom-links a                           { color: var(--ink-faint); }

/* ── Theme toggle button ──────────────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
  font-family: inherit;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--red); border-color: var(--red); transform: rotate(15deg); }
.theme-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon-icon { display: none; }
.theme-toggle .sun-icon  { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: block; }
[data-theme="dark"] .theme-toggle .sun-icon  { display: none; }
