/* =========================================================================
   Christian Hearing & Tinnitus — Referral Landing Page
   -------------------------------------------------------------------------
   Contents
   1.  Design tokens (colors, type, spacing, radius, shadow)
   2.  Base & resets
   3.  Layout helpers (container)
   4.  Buttons
   5.  Header
   6.  Hero
   7.  Trust cards
   8.  How it works (steps)
   9.  Referral form
   10. Success screen
   11. Footer
   12. Reveal animation + reduced motion
   13. Responsive breakpoints
   -------------------------------------------------------------------------
   Editing tip: almost every color, size and spacing value lives in the
   :root token block below. Change a token once and it updates everywhere.
   ========================================================================= */

/* ============================ 1. DESIGN TOKENS =========================== */
:root {
  /* Brand colors */
  --navy:        #0B3C6D;   /* primary */
  --navy-deep:   #082C50;   /* darker navy for depth / footer */
  --navy-hover:  #0E4A85;   /* button hover */
  --white:       #FFFFFF;
  --gray-bg:     #F5F7FA;   /* light gray section background */
  --gray-card:   #FBFCFE;   /* very soft card tint */
  --border:      #DFE6EF;   /* hairline borders */
  --green:       #2E7D32;   /* success */
  --green-soft:  #E8F5E9;   /* success background tint */

  /* Text */
  --ink:         #16283C;   /* primary text (near-navy, softer than black) */
  --ink-soft:    #4A5A6D;   /* secondary text */
  --ink-onNavy:  #EAF1F8;   /* text on navy surfaces */

  /* Typography */
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans:  "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* Spacing scale */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;

  /* Radius */
  --radius-sm: 10px;
  --radius:    16px;
  --radius-lg: 22px;

  /* Shadows — soft, never harsh */
  --shadow-sm: 0 1px 3px rgba(11, 60, 109, 0.06);
  --shadow:    0 8px 24px rgba(11, 60, 109, 0.08);
  --shadow-lg: 0 18px 48px rgba(11, 60, 109, 0.12);

  /* Layout */
  --max-width: 1080px;
}

/* ============================== 2. BASE ================================= */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.125rem;         /* 18px base — comfortable for readers 35-80 */
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  color: var(--navy);
  line-height: 1.15;
  margin: 0;
}

p { margin: 0; }

a { color: var(--navy); }

img, svg { display: block; }

/* Visible, high-contrast focus for keyboard users everywhere */
:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Skip link — hidden until focused */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--navy);
  color: var(--white);
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

/* ========================== 3. LAYOUT HELPER =========================== */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-5);
}
.section-title--tight { margin-bottom: var(--space-2); }

/* ============================= 4. BUTTONS ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 0.95rem 1.6rem;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease,
              box-shadow 0.18s ease;
  min-height: 52px;            /* large tap target */
}

.btn--primary {
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
  background: var(--navy-hover);
  transform: translateY(-2px) scale(1.02);   /* subtle enlarge on hover */
  box-shadow: var(--shadow);
}
.btn--primary:active { transform: translateY(0) scale(0.99); }

.btn--ghost {
  background: var(--white);
  color: var(--navy);
  border-color: var(--navy);
}
.btn--ghost:hover {
  background: var(--gray-bg);
  transform: translateY(-2px);
}

.btn--lg {
  font-size: 1.25rem;
  padding: 1.1rem 2rem;
  min-height: 60px;
}

.btn--block { width: 100%; }

/* Loading spinner inside the submit button */
.btn__spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.45);
  border-top-color: var(--white);
  border-radius: 50%;
  display: none;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading { pointer-events: none; opacity: 0.9; }
.btn.is-loading .btn__spinner { display: inline-block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== 5. HEADER ============================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.brand__mark {
  height: 42px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand__name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--navy);
  line-height: 1.15;
}
.brand__amp { color: var(--ink-soft); }

.header-phone {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: background-color 0.18s ease;
  white-space: nowrap;
}
.header-phone:hover { background: var(--gray-bg); }

/* ================================ 6. HERO ============================== */
.hero {
  background:
    radial-gradient(1200px 400px at 50% -120px, rgba(11, 60, 109, 0.06), transparent 70%),
    var(--gray-bg);
  border-bottom: 1px solid var(--border);
}
.hero__inner {
  padding-block: var(--space-7) var(--space-6);
  text-align: center;
  max-width: 760px;
}
.hero__logo {
  display: block;
  width: auto;
  height: auto;
  max-height: 130px;
  max-width: 270px;
  margin: 0 auto var(--space-4);
  border-radius: 20px;
  filter: drop-shadow(0 12px 26px rgba(11, 60, 109, 0.18));
}
.hero__eyebrow {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--border);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-4);
}
.hero__title {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.hero__subtitle {
  font-size: clamp(1.15rem, 2.6vw, 1.4rem);
  color: var(--ink-soft);
  margin-top: var(--space-4);
  margin-inline: auto;
  max-width: 620px;
}
.hero__subtitle strong { color: var(--green); }
.hero__actions { margin-top: var(--space-5); }
.hero__note {
  margin-top: var(--space-3);
  font-size: 1rem;
  color: var(--ink-soft);
}

/* ============================== 7. TRUST ============================== */
.trust { padding-block: var(--space-7); }

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
.card {
  background: var(--gray-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.card__icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto var(--space-3);
  color: var(--navy);
  background: var(--gray-bg);
  border-radius: 50%;
}
.card__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.card__text {
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* =========================== 8. HOW IT WORKS ========================== */
.steps {
  padding-block: var(--space-7);
  background: var(--gray-bg);
  border-block: 1px solid var(--border);
}
.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  counter-reset: step;
}
.step {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-4) var(--space-4);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.step__num {
  position: absolute;
  top: calc(-1 * var(--space-3));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--white);
  background: var(--navy);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
.step__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: var(--space-2) auto var(--space-3);
  color: var(--navy);
  background: var(--gray-bg);
  border-radius: 14px;
}
.step__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--space-1);
}
.step__text { color: var(--ink-soft); font-size: 1.05rem; }

/* ============================ 9. REFERRAL FORM ======================== */
.referral { padding-block: var(--space-7); }

.referral__card {
  max-width: 640px;
  margin-inline: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(var(--space-4), 4vw, var(--space-6));
}

.referral__head { text-align: center; margin-bottom: var(--space-5); }
.referral__lead { color: var(--ink-soft); }

/* Grouped sections of the form */
.field-group {
  border: none;
  margin: 0 0 var(--space-4);
  padding: 0;
}
.field-group__legend {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--navy);
  padding: 0;
  margin-bottom: var(--space-3);
  width: 100%;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-2);
}

.field { margin-bottom: var(--space-3); }
.field__label {
  display: block;
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: var(--space-1);
}
.field__optional { font-weight: 400; color: var(--ink-soft); font-size: 0.95rem; }
.req { color: var(--green); }

.field__input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  min-height: 54px;                 /* large, easy target */
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.field__input::placeholder { color: #9AA7B6; }
.field__input:hover { border-color: #C5D2E0; }
.field__input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(11, 60, 109, 0.12);
}

/* Invalid field state */
.field__input.is-invalid {
  border-color: #C62828;
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.10);
}

.field__error {
  color: #C62828;
  font-size: 0.98rem;
  font-weight: 600;
  margin-top: var(--space-1);
  min-height: 0;
}
.field__error:empty { display: none; }

/* Custom select wrapper (keeps native accessibility, adds a chevron) */
.select-wrap { position: relative; }
.field__select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 3rem;
  cursor: pointer;
}
.select-wrap__chevron {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--navy);
  pointer-events: none;
}

/* Form-level error (submit failures), shown just above the button */
.field__error--form {
  text-align: center;
  margin-top: var(--space-3);
  margin-bottom: 0;
}

.referral__privacy-hint {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.98rem;
  margin-top: var(--space-3);
}

/* ============================ 10. SUCCESS ============================= */
.success { text-align: center; padding-block: var(--space-4); }
.success__check {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin: 0 auto var(--space-4);
  color: var(--white);
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 10px 28px rgba(46, 125, 50, 0.28);
  animation: pop 0.4s ease;
}
.success__title {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  color: var(--green);
  margin-bottom: var(--space-3);
}
.success__text { font-size: 1.2rem; margin-bottom: var(--space-1); }
.success__note {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--green-soft);
  border-radius: var(--radius-sm);
  color: #1B5E20;
  font-weight: 500;
}
.success .btn { margin-top: var(--space-5); }

@keyframes pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

/* ============================= 11. FOOTER ============================= */
.site-footer {
  background: var(--navy-deep);
  color: var(--ink-onNavy);
  padding-block: var(--space-6) var(--space-4);
}
.site-footer__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
.site-footer__logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 240px;
  max-height: 116px;
  margin-bottom: var(--space-2);
}
.site-footer__tag { color: rgba(234, 241, 248, 0.75); margin-top: var(--space-1); }
.site-footer__heading {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(234, 241, 248, 0.7);
  margin-bottom: var(--space-2);
}
.site-footer__col p { margin-bottom: 0.35rem; color: var(--ink-onNavy); }
.site-footer__col a { color: var(--white); text-decoration: none; }
.site-footer__col a:hover { text-decoration: underline; }
.site-footer__fine { font-size: 0.95rem; color: rgba(234, 241, 248, 0.75); line-height: 1.5; }

.site-footer__legal {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
  color: rgba(234, 241, 248, 0.6);
}

/* ==================== 12. REVEAL ANIMATION / MOTION ==================== */
/* Elements start slightly lowered + transparent, then fade up when in view.
   The .is-visible class is added by script.js via IntersectionObserver.     */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Respect users who prefer reduced motion: no transforms, no smooth scroll */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ========================== 13. RESPONSIVE =========================== */

/* Tablet and up */
@media (min-width: 700px) {
  .card-grid   { grid-template-columns: repeat(3, 1fr); }
  .step-list   { grid-template-columns: repeat(3, 1fr); }
  .site-footer__inner {
    grid-template-columns: 1.4fr 1fr 1fr 1.4fr;
    gap: var(--space-6);
  }
}

/* Small phones: tighten header so the name + phone always fit */
@media (max-width: 460px) {
  .brand__name    { font-size: 1rem; }
  .header-phone__number { display: none; }   /* icon remains as tap-to-call */
  .header-phone   { padding: 0.55rem; }
  .hero__logo     { max-height: 104px; max-width: 220px; }
  .container      { padding-inline: var(--space-3); }
}

/* Larger phones/desktop: a touch more breathing room in the hero */
@media (min-width: 1024px) {
  .hero__inner { padding-block: 6rem var(--space-7); }
}
