/* site.css v1.2.0 — Session 45 (Mobile hardening pass, Apr 24 2026)
   Kova site-wide foundation: tokens, base reset, canonical primitives, a11y baseline.

   Linked from: Homepage, Auth, Free, Trending, Promo, Start, Refund, Terms, Privacy, 404.
   Dashboard & Builder continue to use their per-surface tokens until Session 16 migration.

   S45 (v1.2.0): Mobile UX hardening block added at bottom of file (see "MOBILE
        HARDENING PASS" section). Addresses P0+P1 findings from the 3-phase mobile
        audit: global iOS-zoom kill on form inputs (16px floor on touch devices),
        nav tap-target 44px minimum site-wide, text-wrap balance on headings to
        kill orphan-word bugs, trust-strip cleaner wrap on mobile. All additions
        are @media-scoped so desktop layout is unchanged. HTML cache-bust bumped
        ?v=3 → ?v=4 on the 5 HTMLs that reference site.css (homepage, start, promo,
        auth, free).
   S20: Transitional aliases (--teal, --teal2, --violet, --violet2, --amber, --rose)
        removed. All 10 linked surfaces migrated to System A role tokens directly
        (--accent, --accent-2, --cool, --cool-2, --warm, --red). 181 var-ref
        substitutions + 49 local :root alias-def strikes across the 10 surfaces.
        Start was migrated in S17 already; its link was refreshed to ?v=2 for
        consistent cache invalidation. System B is gone.
   S15: Initial shared stylesheet (v1.0.0).

   Canonical favicon (for <link rel="icon">):
   data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><rect width='32' height='32' fill='%23141418' rx='6'/><text x='3' y='26' font-family='monospace' font-size='26' font-weight='bold' fill='%23e8e6f0'>K</text><circle cx='27' cy='24' r='5' fill='%232dd4bf'/></svg>
*/

/* ─────────────────────────────────────────────────────────────────────────
   Design tokens
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Surface + text tiers (role-based) */
  --bg:       #141418;
  --bg2:      #1c1c22;
  --bg3:      #242430;
  --bg4:      #2c2c3a;
  --surface:  #1c1c22;
  --border:   #2e2e3c;
  --border2:  #3a3a4c;
  --text:     #e8e6f0;
  --text2:    #9896a8;
  --text3:    #8a88a0;

  /* Role-based color system (System A — canonical) */
  --accent:     #2dd4bf;
  --accent-2:   #14b8a6;
  --accent-bg:  rgba(45, 212, 191, 0.06);
  --accent-b:   rgba(45, 212, 191, 0.2);

  --warm:       #fbbf24;
  --warm-bg:    rgba(251, 191, 36, 0.08);
  --warm-b:     rgba(251, 191, 36, 0.2);

  --cool:       #a78bfa;
  --cool-2:     #7c3aed;
  --cool-bg:    rgba(167, 139, 250, 0.08);
  --cool-b:     rgba(167, 139, 250, 0.2);

  --red:        #fb7185;
  --red-bg:     rgba(251, 113, 133, 0.08);
  --red-b:      rgba(251, 113, 133, 0.25);

  --green:      #4ade80;
  --green-bg:   rgba(74, 222, 128, 0.08);
  --green-b:    rgba(74, 222, 128, 0.2);

  /* Spacing scale — 4px grid */
  --sp-0:   0;
  --sp-1:   4px;
  --sp-2:   8px;
  --sp-3:   12px;
  --sp-4:   16px;
  --sp-5:   20px;
  --sp-6:   24px;
  --sp-7:   28px;
  --sp-8:   32px;
  --sp-10:  40px;
  --sp-12:  48px;
  --sp-14:  56px;
  --sp-16:  64px;
  --sp-20:  80px;

  /* Type scale */
  --fs-micro: 10px;
  --fs-xs:    11px;
  --fs-sm:    13px;
  --fs-base:  16px;
  --fs-md:    18px;
  --fs-lg:    22px;
  --fs-xl:    28px;
  --fs-h2:    clamp(24px, 3vw, 32px);
  --fs-h1:    clamp(28px, 4vw, 42px);

  /* Motion */
  --tr: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography families */
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Plus Jakarta Sans', sans-serif;
}

/* ─────────────────────────────────────────────────────────────────────────
   Base reset
   ───────────────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ─────────────────────────────────────────────────────────────────────────
   Canonical nav logo
   Dual selector supports both legacy markup (KOV<span>A</span>.) and
   canonical markup (KOV<span class="a">A</span>.) so per-surface HTML
   migration can happen gradually without breaking the visual.
   ───────────────────────────────────────────────────────────────────────── */

.nav-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.5px;
  color: var(--text);
  text-decoration: none;
}

.nav-logo .a,
.nav-logo span:not([class]) {
  color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────────────────
   4-button system
   ───────────────────────────────────────────────────────────────────────── */

.btn {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: var(--sp-3) var(--sp-5);
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
  line-height: 1;
}

.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--accent);
  color: #0d1f1e;
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(45, 212, 191, 0.35);
}
.btn-primary:hover {
  box-shadow: 0 0 22px rgba(45, 212, 191, 0.55);
  opacity: 0.95;
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border-color: var(--border2);
}
.btn-ghost:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover {
  background: var(--red-bg);
}

.btn-sm {
  font-size: var(--fs-xs);
  padding: var(--sp-2) var(--sp-4);
}

/* ─────────────────────────────────────────────────────────────────────────
   Base primitives — available for new markup, won't override inline <style>
   ───────────────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--sp-6);
  transition: all var(--tr);
}

.badge {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: var(--sp-1) var(--sp-3);
  border-radius: 2px;
  border: 1px solid transparent;
  display: inline-block;
  line-height: 1.4;
}

.pill {
  font-family: var(--mono);
  font-size: var(--fs-micro);
  letter-spacing: 1px;
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  border: 1px solid var(--border2);
  color: var(--text2);
  background: var(--bg3);
  display: inline-block;
  line-height: 1.6;
}

.input {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--sp-3) var(--sp-4);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ─────────────────────────────────────────────────────────────────────────
   A11y baseline
   ───────────────────────────────────────────────────────────────────────── */

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

/* Skip-to-content link — hidden offscreen until focused */
.skip-to-content {
  position: fixed;
  top: -48px;
  left: 8px;
  z-index: 10000;
  background: var(--accent);
  color: #0d1f1e;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: var(--sp-2) var(--sp-4);
  border-radius: 4px;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-to-content:focus {
  top: 8px;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

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

/* ═════════════════════════════════════════════════════════════════════════
   S45 MOBILE HARDENING PASS (Apr 24 2026) — v1.2.0
   ═════════════════════════════════════════════════════════════════════════
   Drop-in mobile UX fixes from the 3-phase mobile audit (Phases 1+2+3).
   Only P0+P1 issues included; P2/P3 polish deferred to next sweep.
   
   Scope: every surface that links /site.css — so these rules reach
   homepage, /start/, /promo/, /auth/, /free/, /trending/, etc.
   
   Desktop-safety: every rule is @media-scoped or targets generic form
   controls at 16px (which matches --fs-base, so no visible change).
   ═════════════════════════════════════════════════════════════════════════ */

/* ─── GL-1 · KILL iOS INPUT ZOOM (P0, 4 audit findings collapsed)
   iOS Safari auto-zooms any <input>/<select>/<textarea> with font-size <16px
   the moment it receives focus. Targets all generic form controls so
   per-surface local styles that set font-size:11-13px get overridden on touch
   devices only. Desktop keeps whatever the local rule says.
*/
@media (hover: none) and (pointer: coarse) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* ─── CP-1 · TAP TARGETS ≥44px ON TOUCH (P0)
   Applies to all 4-button-system classes + .nav-cta/.nav-link patterns.
   Targets touch devices only so desktop button density is preserved.
*/
@media (hover: none) and (pointer: coarse) {
  .btn,
  .btn-primary,
  .btn-ghost,
  .btn-danger,
  .btn-sm,
  .btn-teal,
  .nav-cta,
  .nav-link,
  .nav-btn,
  nav a[class*="btn"],
  nav button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* ─── CP-5 · TRUST STRIP CLEANER WRAP AT MOBILE (P2 but cheap)
   The 5-item "Secured · SSL · No tracking · Cancel · 7-day refund" strip
   wraps into uneven 3-row layout at 375px with orphan bullets. Hide the
   dividers on narrow widths; let whitespace+gap do the work.
*/
@media (max-width: 640px) {
  .trust-strip {
    gap: 6px 10px;
    font-size: 9px;
  }
  .trust-strip .trust-divider {
    display: none;
  }
}

/* ─── TEXT-WRAP BALANCE ON HEADLINE ELEMENTS (kills orphan words)
   Addresses S-2 "/start/ time orphan", H-anywhere similar patterns, and
   dashboard TR-1 "now. orphan". text-wrap:balance distributes words across
   lines evenly without manual <br> tags. Safe baseline: >90% browser
   coverage as of 2026; falls back to default wrap on older browsers.
*/
h1, h2, .section-title, .promo-title, .hero h1 {
  text-wrap: balance;
}

/* === END S45 MOBILE HARDENING PASS === */
