/* ============================================================
   Clear Hearing — Design Tokens v2.0
   Category-native DTC hearing aid direction.
   Mirrors the visual language of Boots Hearingcare, Specsavers
   Hearing, Amplifon UK, and Smart Hearing — the sites Roy already
   recognises as "legitimate hearing aid companies".
   ============================================================ */

/* Inter font is loaded via <link> in HTML head for non-blocking parallel fetch
   with preconnect hints. See HTML page heads for preconnect + stylesheet links. */

:root {
  /* ---------- Colour — Surface ---------- */
  --color-white:        #FFFFFF;
  --color-bg:           #FFFFFF;        /* default page background — clean white, category standard */
  --color-surface:      #F7F9FC;        /* soft grey-blue card/section surface */
  --color-surface-warm: #FEF8F1;        /* used only for "offer" callouts */

  /* ---------- Colour — Brand (hearing aid category navy) ---------- */
  --color-navy:         #0B2C5C;        /* primary brand colour — Boots/Amplifon-adjacent */
  --color-navy-dark:    #071F42;
  --color-navy-soft:    #1A3F6E;
  --color-navy-tint:    #EEF2F9;

  /* ---------- Colour — Signal (conversion CTA) ---------- */
  --color-signal:       #00A36C;        /* trust green — Specsavers-adjacent, health-positive, says "go" not "stop" */
  --color-signal-hover: #00845A;
  --color-signal-tint:  #E6F7F0;

  /* ---------- Colour — Trust (Boots/Specsavers health green) ---------- */
  --color-trust:        #00A36C;
  --color-trust-tint:   #E6F7F0;
  --color-trust-dark:   #00845A;

  /* ---------- Colour — Accent ---------- */
  --color-amber:        #F57C00;        /* scarcity / sale badges */
  --color-amber-tint:   #FFF3E0;
  --color-gold:         #F6B93B;        /* star ratings */

  /* ---------- Colour — Neutrals ---------- */
  --color-text:         #0F1A2E;
  --color-text-sec:     #4A5568;
  --color-text-muted:   #4B5563;
  --color-text-light:   #6B7280;
  --color-border:       #E5E7EB;
  --color-border-light: #F3F4F6;
  --color-border-dark:  #D1D5DB;

  /* ---------- Colour — Status / result bands ---------- */
  --color-healthy:      #00A36C;
  --color-healthy-tint: #E6F7F0;
  --color-mild:         #F57C00;
  --color-mild-tint:    #FFF3E0;
  --color-reduced:      #D32F2F;
  --color-reduced-tint: #FDECEA;

  /* ---------- Typography — Families ---------- */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-serif: 'Inter', 'Georgia', serif; /* we no longer use a serif — fallback only */

  /* ---------- Typography — Scale (mobile default) ---------- */
  --fs-display: 2.125rem;  /* 34px */
  --fs-h1:      1.75rem;   /* 28px */
  --fs-h2:      1.375rem;  /* 22px */
  --fs-h3:      1.125rem;  /* 18px */
  --fs-lead:    1.125rem;  /* 18px */
  --fs-body:    1.0625rem; /* 17px */
  --fs-small:   0.9375rem; /* 15px */
  --fs-micro:   0.8125rem; /* 13px */
  --fs-cta:     1.0625rem; /* 17px */

  /* ---------- Typography — Line height ---------- */
  --lh-tight:  1.15;
  --lh-snug:   1.3;
  --lh-normal: 1.5;
  --lh-body:   1.6;

  /* ---------- Spacing (4px baseline) ---------- */
  --space-1:  0.25rem;  /*  4px */
  --space-2:  0.5rem;   /*  8px */
  --space-3:  0.75rem;  /* 12px */
  --space-4:  1rem;     /* 16px */
  --space-5:  1.25rem;  /* 20px */
  --space-6:  1.5rem;   /* 24px */
  --space-8:  2rem;     /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */

  /* ---------- Layout ---------- */
  --container-reading: 44rem;    /* 704px */
  --container:         72rem;    /* 1152px */
  --container-wide:    80rem;    /* 1280px */
  --gutter-mobile:     1.25rem;  /* 20px */
  --gutter-desktop:    2rem;     /* 32px */

  /* ---------- Radius ---------- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 9999px;

  /* ---------- Shadows (cool, clean, modern DTC) ---------- */
  --shadow-sm:  0 1px 2px rgba(15, 26, 46, 0.06);
  --shadow-md:  0 2px 8px rgba(15, 26, 46, 0.08);
  --shadow-lg:  0 8px 24px rgba(15, 26, 46, 0.10);
  --shadow-xl:  0 16px 40px rgba(15, 26, 46, 0.12);
  --shadow-cta: 0 4px 14px rgba(0, 163, 108, 0.28);
  --shadow-focus: 0 0 0 3px rgba(11, 44, 92, 0.18);

  /* ---------- Motion ---------- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-base: 220ms;

  /* ---------- Touch targets (still large for 65+) ---------- */
  --tap-min: 52px;
}

/* ---------- Desktop typography scale-up ---------- */
@media (min-width: 768px) {
  :root {
    --fs-display: 3rem;      /* 48px */
    --fs-h1:      2.25rem;   /* 36px */
    --fs-h2:      1.75rem;   /* 28px */
    --fs-h3:      1.25rem;   /* 20px */
    --fs-lead:    1.25rem;   /* 20px */
    --fs-body:    1.0625rem; /* 17px */
  }
}

/* ============================================================
   Base element styles
   ============================================================ */

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 800;
  color: var(--color-text);
  line-height: var(--lh-tight);
  margin: 0 0 var(--space-4) 0;
  letter-spacing: -0.02em;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); letter-spacing: -0.015em; }
h3 { font-size: var(--fs-h3); font-weight: 700; letter-spacing: -0.01em; }

p {
  margin: 0 0 var(--space-4) 0;
  max-width: 68ch;
}

p.lead {
  font-size: var(--fs-lead);
  color: var(--color-text-sec);
  line-height: var(--lh-normal);
}

a {
  color: var(--color-navy);
  text-decoration-line: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color var(--duration-base) var(--ease-out);
}
a:hover { color: var(--color-signal); }
a:focus-visible {
  outline: 2px solid var(--color-navy);
  outline-offset: 3px;
  border-radius: 2px;
}

strong, b { font-weight: 700; color: var(--color-text); }

small, .caption {
  font-size: var(--fs-small);
  color: var(--color-text-muted);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 800;
  line-height: 1.2;
  min-height: 60px;
  padding: 18px 32px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration-base) var(--ease-out);
  letter-spacing: 0;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* Primary: trust green CTA — soft grey shadow, not colour-tinted */
.btn-primary {
  background: var(--color-signal);
  color: var(--color-white);
  border-bottom: 3px solid rgba(30, 38, 52, 0.15);
  box-shadow: 0 3px 10px rgba(30, 38, 52, 0.15);
  text-transform: none;
}
.btn-primary:hover {
  background: var(--color-signal-hover);
  color: var(--color-white);
  transform: translateY(1px);
  border-bottom-width: 2px;
  box-shadow: 0 2px 6px rgba(30, 38, 52, 0.12);
}
.btn-primary:active {
  transform: translateY(3px);
  border-bottom-width: 0;
  box-shadow: 0 0 3px rgba(30, 38, 52, 0.1);
}

/* Secondary: navy outline */
.btn-secondary {
  background: var(--color-white);
  color: var(--color-navy);
  border: 1.5px solid var(--color-border);
  border-bottom: 3px solid rgba(30, 38, 52, 0.15);
  padding: 16px 30px;
  box-shadow: 0 2px 6px rgba(30, 38, 52, 0.08);
}
.btn-secondary:hover {
  background: var(--color-surface);
  color: var(--color-navy);
  transform: translateY(1px);
  border-bottom-width: 2px;
}
.btn-secondary:active {
  transform: translateY(3px);
  border-bottom-width: 0;
}

/* Navy filled — for dark backgrounds */
.btn-navy {
  background: var(--color-navy);
  color: var(--color-white);
  box-shadow: var(--shadow-md);
}
.btn-navy:hover {
  background: var(--color-navy-dark);
  color: var(--color-white);
}

/* Tertiary text link */
.btn-tertiary {
  background: transparent;
  color: var(--color-navy);
  min-height: auto;
  padding: var(--space-3) var(--space-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none;
  font-size: var(--fs-body);
}
.btn-tertiary:hover { color: var(--color-signal); }

.btn-large {
  font-size: 1.125rem;
  padding: 20px 32px;
  min-height: 60px;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus), var(--shadow-cta);
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}
@media (min-width: 768px) { .card { padding: var(--space-8); } }

/* ============================================================
   Form inputs
   ============================================================ */

.field-label {
  display: block;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.field-input {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  color: var(--color-text);
  background: var(--color-white);
  border: 1.5px solid var(--color-border-dark);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}
.field-input:focus {
  outline: none;
  border-color: var(--color-navy);
  box-shadow: var(--shadow-focus);
}
.field-input::placeholder { color: var(--color-text-muted); }

/* ============================================================
   Status badges
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-healthy  { background: var(--color-healthy-tint); color: var(--color-healthy); }
.badge-mild     { background: var(--color-mild-tint); color: var(--color-mild); }
.badge-reduced  { background: var(--color-reduced-tint); color: var(--color-reduced); }
.badge-sale     { background: var(--color-signal); color: var(--color-white); }
.badge-trust    { background: var(--color-trust-tint); color: var(--color-trust); }

/* ============================================================
   Layout helpers
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter-mobile);
}
@media (min-width: 768px) { .container { padding: 0 var(--gutter-desktop); } }

.container-reading {
  max-width: var(--container-reading);
  margin: 0 auto;
  padding: 0 var(--gutter-mobile);
}
@media (min-width: 768px) { .container-reading { padding: 0 var(--gutter-desktop); } }

.container-wide {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 var(--gutter-mobile);
}
@media (min-width: 768px) { .container-wide { padding: 0 var(--gutter-desktop); } }

/* Star rating (Loox-style) */
.stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--color-gold);
  font-size: 1rem;
  letter-spacing: 1px;
}
.stars-count {
  margin-left: var(--space-2);
  color: var(--color-text-sec);
  font-size: var(--fs-small);
  font-weight: 500;
}

/* Trust row */
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  align-items: center;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-small);
  color: var(--color-text-sec);
  font-weight: 500;
}
.trust-item svg { color: var(--color-trust); flex-shrink: 0; }
.trust-item strong { color: var(--color-text); font-weight: 700; }

/* ============================================================
   SOURCES COLLAPSIBLE — legal/compliance footer block
   Native <details>/<summary> pattern, no JS required.
   Usage: place inside the footer of any page that cites claims.
   ============================================================ */
.sources-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-top: var(--space-6);
  overflow: hidden;
}
.sources-block > summary {
  cursor: pointer;
  list-style: none;
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  user-select: none;
}
.sources-block > summary::-webkit-details-marker { display: none; }
.sources-block > summary::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--color-text-muted);
  font-weight: 400;
  line-height: 1;
  transition: transform 200ms var(--ease-out);
  flex-shrink: 0;
}
.sources-block[open] > summary::after {
  content: '\2212';
}
.sources-block > summary:hover {
  background: var(--color-border-light);
}
.sources-body {
  padding: 0 var(--space-5) var(--space-5);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--color-text-sec);
}
.sources-body,
.sources-body p,
.sources-body li,
.sources-body .sources-footer-note {
  max-width: none !important;
}
.sources-body p {
  margin: 0 0 var(--space-3) 0;
  color: var(--color-text-sec);
}
.sources-body ol {
  padding-left: var(--space-5);
  margin: 0;
}
.sources-body li {
  margin-bottom: var(--space-3);
  padding-left: var(--space-1);
}
.sources-body li:last-child { margin-bottom: 0; }
.sources-body strong {
  color: var(--color-text);
  font-weight: 700;
}
.sources-body a {
  color: var(--color-navy);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  word-break: break-word;
}
.sources-body a:hover {
  color: var(--color-signal);
}
.sources-footer-note {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
  max-width: none;
}

/* Reduced motion */
@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;
  }
}
