/*
 * shared.css — Sound Injury & Electrodiagnostics
 * Contains: CSS variables, base reset, typography, layout utilities,
 *           header, nav/dropdown, mobile menu, FAB, footer.
 *
 * Root pages:      <link rel="stylesheet" href="shared.css">
 * Education pages: <link rel="stylesheet" href="../shared.css">
 *
 * Do NOT put page-specific styles here.
 * Do NOT put any URL paths here (no href, no src, no url()).
 */


/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  /* Brand Palette */
  --ink: #002D4F;
  --muted: #475569;
  --brand: #5D9B9B;

  /* Stone Colors */
  --stone-mid: #335772;
  --stone-light: #9EC3C3;

  --brand-dark: #4a7d7d;
  --sand: #F4EBD9;
  --bg: #ffffff;
  --card: #ffffff;
  --line: #e2e8f0;
  --header-h: 100px;
  --soft-blue: #f0f9ff;

  /* Safe area insets (notched devices) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}


/* ============================================================
   BASE RESET
   ============================================================ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.75;
  padding-top: calc(var(--header-h) + var(--safe-top));
  -webkit-font-smoothing: antialiased;
}


/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4 {
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: 0;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
}
h1 { font-weight: 800; font-size: 3.5rem; line-height: 1.1; margin-bottom: 24px; }
h2 { font-size: 2.5rem; font-weight: 700; margin-bottom: 1.5rem; line-height: 1.2; }
h3 { font-size: 1.6rem; font-weight: 600; margin-bottom: 1rem; }
p  { margin: 0 0 1.8em; color: var(--muted); }
strong { color: var(--ink); font-weight: 600; }

@media (max-width: 768px) {
  body { font-size: 17px; }
  h1   { font-size: 2.5rem; }
  h2   { font-size: 1.9rem; }
}
@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.6rem; }
}

a       { color: var(--brand); text-decoration: none; transition: all .2s ease; }
a:hover { color: var(--brand-dark); }


/* ============================================================
   FOCUS STYLES — keyboard accessibility
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}
a:focus-visible        { outline-offset: 2px; }
button:focus-visible   { outline-offset: 2px; }
.btn:focus-visible     { outline-color: var(--ink); }
.fab-phone:focus-visible,
.fab-email:focus-visible {
  outline-offset: 4px;
  outline-color: white;
}


/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 max(32px, var(--safe-left));
  padding-right: max(32px, var(--safe-right));
}

section { padding: 80px 0; }
@media (max-width: 768px) { section { padding: 60px 0; } }

.text-center { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 4px 6px -1px rgba(0, 45, 79, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px -5px rgba(0, 45, 79, 0.08);
  border-color: #cbd5e1;
}


/* ============================================================
   HEADER
   ============================================================ */
header {
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(110%) blur(16px);
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  z-index: 1000;
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}


/* ============================================================
   BRAND / LOGO
   ============================================================ */
.brand-icon { width: 70px; height: auto; flex-shrink: 0; }

.brand-group {
  display: flex;
  align-items: center;
  gap: 20px;
  text-decoration: none;
  height: 100%;
}

.brand-divider { width: 1px; height: 48px; background: var(--line); flex-shrink: 0; }

.brand-block-practice { display: flex; align-items: center; gap: 8px; }
.brand-stack          { display: flex; flex-direction: column; line-height: 1; }

.brand-word {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.brand-side {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 4px;
}

/* SVG cairn helpers */
.stone-base    { filter: url(#headerStoneTexture); }
.circle-outline { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }

@media (max-width: 768px) {
  .brand-icon { width: 60px; }
  .brand-side { font-size: 14px; }
  .brand-word { font-size: 16px; }
}
@media (max-width: 500px) {
  .brand-side     { font-size: 12px; letter-spacing: 0.02em; }
  .brand-word     { font-size: 14px; }
  .brand-divider  { display: none; }
  .brand-icon     { width: 56px; }
  .brand-group    { gap: 12px; }
  .brand-block-practice { gap: 8px; }
}


/* ============================================================
   NAVIGATION — DESKTOP
   ============================================================ */
nav ul {
  list-style: none;
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 0;
}

nav a.nav-link {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
nav a.nav-link:hover  { background: var(--soft-blue); }
nav a.btn-nav         { background: var(--ink); color: white !important; border-radius: 8px; }
nav a.btn-nav:hover   { background: var(--brand); }


/* ============================================================
   DROPDOWN MENU — DESKTOP
   ============================================================ */
.nav-dropdown { position: relative; }

/* Invisible hover bridge — prevents gap from closing dropdown */
.nav-dropdown::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0; right: 0;
  height: 8px;
}

.dropdown-menu {
  visibility: hidden;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 45, 79, 0.15);
  padding: 24px;
  padding-top: 28px;
  margin-top: 0;
  min-width: 320px;
  max-width: 380px;
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow-y: auto;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Scrollbar styling */
.dropdown-menu::-webkit-scrollbar       { width: 8px; }
.dropdown-menu::-webkit-scrollbar-track { background: var(--soft-blue); border-radius: 4px; }
.dropdown-menu::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 4px; }
.dropdown-menu::-webkit-scrollbar-thumb:hover { background: var(--brand-dark); }

.nav-dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
  visibility: visible;
  opacity: 1;
  pointer-events: all;
}

/* Invisible top bridge — prevents dropdown from closing on cursor move down */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0; right: 0;
  height: 8px;
}

.dropdown-section          { margin-bottom: 20px; }
.dropdown-section:last-child { margin-bottom: 0; }

.dropdown-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand);
  color: var(--brand);
}

.dropdown-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: block;
  gap: 0;
}
.dropdown-menu li { margin: 0; }

.dropdown-menu a {
  display: block;
  padding: 8px 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.15s ease;
  text-decoration: none;
  min-height: auto;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.dropdown-menu a:hover {
  background: var(--soft-blue);
  color: var(--brand);
  transform: translateX(4px);
}


/* ============================================================
   HAMBURGER TOGGLE BUTTON
   ============================================================ */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px;
  flex-direction: column;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: rgba(93, 155, 155, 0.2);
  touch-action: manipulation;
}
.bar { width: 28px; height: 3px; background: var(--ink); transition: 0.3s; border-radius: 2px; pointer-events: none; }

/* Mobile chevron toggles — hidden on desktop */
.mobile-chevron { display: none; }


/* ============================================================
   MOBILE NAV (≤900px)
   ============================================================ */
@media (max-width: 900px) {

  /* Dark overlay behind slide-in menu */
  .mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 45, 79, 0.3);
    z-index: 998;
  }
  .mobile-menu-overlay.show { display: block; }

  /* Dropdown accordion — hidden by default, revealed by chevron */
  .dropdown-menu {
    display: none;
    position: static !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: all !important;
    background: var(--soft-blue);
    border: none;
    border-radius: 8px;
    box-shadow: none;
    padding: 8px 0;
    margin: 0 0 4px;
    min-width: unset;
    max-width: unset;
    max-height: unset;
    overflow: visible;
    width: 100%;
    left: auto;
  }
  .dropdown-menu.mobile-open { display: block; }

  /* Disable desktop hover on mobile */
  .nav-dropdown:hover .dropdown-menu              { display: none; }
  .nav-dropdown:hover .dropdown-menu.mobile-open  { display: block; }
  .nav-dropdown::after  { display: none; }
  .dropdown-menu::before { display: none; }

  /* Dropdown section headings */
  .dropdown-section         { margin-bottom: 8px; }
  .dropdown-section-title   { font-size: 0.7rem; padding: 4px 20px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }

  /* Dropdown links */
  .dropdown-menu a { padding: 10px 24px; font-size: 15px; }

  /* Nav-dropdown row: link + chevron side by side */
  .nav-dropdown { display: flex; flex-wrap: wrap; }
  .nav-dropdown > a.nav-link { flex: 1; }

  /* Chevron toggle button */
  .mobile-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    min-height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
    flex-shrink: 0;
  }
  .mobile-chevron:hover { background: var(--soft-blue); }
  .mobile-chevron svg {
    width: 20px; height: 20px;
    stroke: var(--ink);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.25s ease;
  }
  .mobile-chevron.open svg { transform: rotate(180deg); }

  /* Dropdown takes full row width */
  .nav-dropdown > .dropdown-menu { flex-basis: 100%; }

  /* Full-screen slide-in menu panel */
  #menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: white;
    padding: 0 24px 40px;
    padding-top: calc(var(--header-h) + var(--safe-top) + 8px);
    margin: 0;
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    gap: 2px;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  #menu.show { transform: translateX(0); }

  /* Reset nested ul inside dropdown (mobile) */
  .dropdown-menu ul {
    position: static;
    display: block;
    width: auto;
    padding: 0; margin: 0;
    transform: none;
    box-shadow: none;
    background: none;
  }

  /* Mobile nav link sizing */
  #menu a.nav-link { font-size: 17px; padding: 14px 20px; border-radius: 8px; width: auto; }
  #menu a.btn-nav  { margin-top: 12px; text-align: center; justify-content: center; font-size: 17px; padding: 16px 20px; }

  .menu-toggle { display: flex; z-index: 1001; }
  .brand-group { gap: 16px; }

  /* Remove backdrop-filter on mobile:
     it creates a containing block that traps position:fixed children (#menu) inside header */
  header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: white;
  }
}


/* ============================================================
   FAB — FLOATING ACTION BUTTONS
   Phone on mobile, Email on desktop. Media-query controlled.
   ============================================================ */
.fab-phone, .fab-email {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 64px;
  height: 64px;
  background: var(--brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(93, 155, 155, 0.4);
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s ease;
  text-decoration: none;
}
.fab-phone:hover, .fab-email:hover {
  background: var(--brand-dark);
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(93, 155, 155, 0.6);
}
.fab-phone:active, .fab-email:active { transform: scale(0.95); }
.fab-phone svg, .fab-email svg { width: 28px; height: 28px; fill: white; }

@keyframes fab-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(93, 155, 155, 0.4); }
  50%       { box-shadow: 0 4px 24px rgba(93, 155, 155, 0.7); }
}
.fab-phone, .fab-email { animation: fab-pulse 3s ease-in-out infinite; }

/* Desktop: show email FAB only */
.fab-phone { display: none; }
.fab-email { display: flex; }

/* Mobile: show phone FAB only */
@media (max-width: 768px) {
  .fab-phone { display: flex; bottom: 24px; right: 24px; width: 56px; height: 56px; }
  .fab-email { display: none; }
  .fab-phone svg { width: 24px; height: 24px; }
}
@media (max-width: 480px) {
  .fab-phone { bottom: 20px; right: 20px; width: 52px; height: 52px; }
}


/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: #1e293b;
  color: #94a3b8;
  padding: 80px 0 40px;
  font-size: 0.95rem;
}
footer h4 {
  color: white;
  margin-bottom: 20px;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
footer a       { color: #cbd5e1; text-decoration: none; transition: color 0.2s; }
footer a:hover { color: white; }

.footer-recognition {
  padding-bottom: 40px;
  margin-bottom: 40px;
  border-bottom: 1px solid #334155;
  text-align: center;
}
.footer-recognition h5 {
  color: #94a3b8;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin: 0 0 16px;
}

.recognition-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}
.recognition-item:hover { color: var(--brand); }
.recognition-divider    { margin: 0 16px; color: #475569; }

@media (max-width: 600px) {
  .recognition-item    { font-size: 0.9rem; }
  .recognition-divider { margin: 0 8px; }
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 60px;
  margin-bottom: 60px;
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; } }
@media (max-width: 600px) { .footer-grid { grid-template-columns: 1fr;     gap: 40px; } }

.footer-links         { list-style: none; padding: 0; margin: 0; }
.footer-links li      { margin-bottom: 12px; }
.footer-links a       { font-size: 0.95rem; line-height: 1.6; }

.footer-about p       { line-height: 1.7; margin-bottom: 16px; color: #94a3b8; }

.footer-contact p     { margin-bottom: 12px; line-height: 1.6; }
.footer-contact strong {
  color: #e2e8f0;
  display: block;
  margin-bottom: 4px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-bottom {
  padding-top: 40px;
  border-top: 1px solid #334155;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

.footer-sms-consent {
  text-align: center;
  padding-top: 16px;
  color: #475569;
  font-size: 0.8rem;
  line-height: 1.5;
}

@media (max-width: 600px) {
  footer { padding: 60px 0 32px; }
}
