
/* ==========================================================
   HEALTHBRIDGE — COMPLETE DESIGN SYSTEM
   Accessible • Professional • Modern Healthcare
========================================================== */

:root {
  --primary: #315b48;
  --primary-dark: #244535;
  --primary-light: #eaf1eb;

  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-soft: #f0f4ef;

  --ink: #26362d;
  --muted: #59685f;

  --border: #dce5dc;

  --success: #347451;
  --warning: #95651d;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --shadow:
    0 4px 12px rgba(35, 65, 46, 0.04),
    0 14px 36px rgba(35, 65, 46, 0.055);

  --base-size: 18px;
}

/* ==========================================================
   RESET
========================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", Arial, sans-serif;
  font-size: var(--base-size);
  line-height: 1.7;
}

button,
input {
  font: inherit;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid #c18a35;
  outline-offset: 4px;
}

/* ==========================================================
   ACCESSIBILITY
========================================================== */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 12px 18px;
  background: white;
  border-radius: 8px;
}

.skip-link:focus {
  left: 10px;
}

.access-bar {
  min-height: 52px;
  padding: 8px 7%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 9px;
  background: #edf2ed;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.access-bar > span {
  color: var(--muted);
}

.access-button {
  background: white;
  border: 1px solid #cbd7cc;
  border-radius: 8px;
  padding: 8px 13px;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.access-button:hover {
  background: var(--primary-light);
}

/* ==========================================================
   HEADER
========================================================== */

.site-header {
  height: 82px;
  padding: 0 7%;

  display: flex;
  align-items: center;
  justify-content: space-between;

  position: sticky;
  top: 0;
  z-index: 20;

  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);

  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;

  color: var(--primary);
  text-decoration: none;

  font: 800 1.45rem Manrope, sans-serif;
  letter-spacing: -0.04em;
}

.brand-mark {
  font-size: 1.8rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.main-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;

  transition: color 0.2s ease;
}

.main-nav a:hover {
  color: var(--primary);
}

.menu-toggle {
  display: none;
  padding: 9px 13px;

  background: white;
  border: 1px solid var(--border);
  border-radius: 9px;

  font-size: 1.35rem;
  cursor: pointer;
}

/* ==========================================================
   GLOBAL SECTIONS
========================================================== */

.section {
  padding: 86px 7%;
}

.section-heading {
  max-width: 760px;
  margin: 0 auto 42px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 12px;

  color: var(--primary);

  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.section-heading h2 {
  margin: 0 0 15px;

  font: 800 clamp(1.9rem, 3vw, 2.65rem)/1.2 Manrope, sans-serif;

  letter-spacing: -0.045em;
}

.section-heading > p:last-child {
  color: var(--muted);
  margin: 0;
  font-size: 1.05rem;
}

/* ==========================================================
   BUTTONS
========================================================== */

.button {
  min-height: 48px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  padding: 12px 21px;

  border: 1px solid transparent;
  border-radius: 10px;

  font-size: 0.94rem;
  font-weight: 800;

  text-decoration: none;
  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  background: var(--primary);
  color: white;
}

.button-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(49,91,72,0.18);
}

.button-secondary {
  background: white;
  color: var(--primary);
  border-color: #b9c9bb;
}

.button-secondary:hover {
  background: var(--primary-light);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================
   HERO
========================================================== */

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 7%;
  align-items: center;

  min-height: 520px;

  background:
    radial-gradient(
      circle at 85% 20%,
      rgba(215,230,216,0.65),
      transparent 40%
    ),
    linear-gradient(120deg,#f7f8f4,#eef3ed);
}

.hero-copy {
  max-width: 660px;
}

.hero h1 {
  margin: 0 0 23px;

  font: 800 clamp(2.5rem, 4.5vw, 3.8rem)/1.12 Manrope, sans-serif;

  letter-spacing: -0.055em;
}

.hero-lead {
  max-width: 580px;

  margin: 0 0 29px;

  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.8;
}

/* Hero overview */

.hero-panel {
  padding: 30px;

  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  box-shadow: var(--shadow);
}

.hero-panel > .eyebrow {
  margin-bottom: 16px;
}

.overview-link {
  display: grid;
  grid-template-columns: 43px 1fr 20px;
  gap: 13px;
  align-items: center;

  padding: 17px 0;

  color: var(--ink);
  text-decoration: none;

  border-top: 1px solid var(--border);

  transition: padding 0.2s ease;
}

.overview-link:hover {
  padding-left: 5px;
}

.overview-link > span {
  width: 39px;
  height: 39px;

  display: grid;
  place-items: center;

  background: var(--primary-light);
  border-radius: 50%;

  color: var(--primary);
  font-weight: 800;
}

.overview-link strong {
  display: block;
  font: 700 1.05rem Manrope, sans-serif;
}

.overview-link small {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.overview-link b {
  color: var(--primary);
}

/* ==========================================================
   LEARNING
========================================================== */

.learn-section {
  background: white;
}

.lesson-tools {
  max-width: 600px;
  margin: 0 auto 27px;
}

.search-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

.lesson-tools input {
  width: 100%;
  min-height: 52px;

  padding: 13px 16px;

  color: var(--ink);
  background: white;

  border: 1px solid #cbd7cc;
  border-radius: 10px;
}

.lesson-tools input:focus {
  border-color: var(--primary);
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 20px;

  max-width: 1100px;
  margin: auto;
}

.lesson-card,
.resource-card,
.connect-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  padding: 25px;

  box-shadow: var(--shadow);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.lesson-card:hover,
.resource-card:hover,
.connect-card:hover {
  transform: translateY(-4px);
  border-color: #b8cbb9;
  box-shadow: 0 12px 28px rgba(35,65,46,0.09);
}

.lesson-icon,
.resource-icon {
  width: 46px;
  height: 46px;

  display: grid;
  place-items: center;

  margin-bottom: 17px;

  background: var(--primary-light);
  color: var(--primary);

  border-radius: 13px;

  font-size: 1.4rem;
}

.lesson-card h3,
.resource-card h3,
.connect-card h3 {
  margin: 0 0 9px;

  font: 700 1.16rem Manrope, sans-serif;
}

.lesson-card p:not(.eyebrow),
.resource-card p:not(.eyebrow),
.connect-card p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.96rem;
  margin: 0 0 15px;
}

.text-link {
  padding: 0;
  border: 0;

  background: none;
  color: var(--primary);

  font-weight: 800;
  cursor: pointer;
}

.text-link:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  color: var(--muted);
}

.learn-note,
.support-note {
  max-width: 1100px;
  margin: 27px auto 0;

  padding: 17px 20px;

  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;

  font-size: 0.94rem;
}

/* ==========================================================
   SERVICES
========================================================== */

.services-section {
  background: #f0f3ee;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 21px;

  max-width: 1100px;
  margin: auto;
}

.resource-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.resource-card .eyebrow {
  margin-bottom: 9px;
}

.resource-card .button {
  margin-top: auto;
}

.support-note {
  background: white;
}

/* ==========================================================
   CONNECT
========================================================== */

.connect-section {
  background: white;
}

.connect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;

  max-width: 1050px;
  margin: auto;
}

.connect-card {
  padding: 29px;
}

.connect-card.featured {
  background: #f0f4ef;
  border-color: #cbd9cc;
}

.connect-icon {
  margin-bottom: 12px;

  color: var(--primary);
  font-size: 1.7rem;
}

.connect-card ul {
  padding-left: 23px;
  margin: 15px 0 20px;
}

.connect-card li {
  margin: 8px 0;
  padding-left: 3px;
}

.connect-card .small-note {
  font-size: 0.86rem !important;
}

.shared-contact {
  max-width: 1050px;
  margin: 25px auto 0;

  padding: 27px;

  background: #f4f6f1;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.shared-contact h3 {
  margin: 0 0 9px;
  font: 700 1.25rem Manrope, sans-serif;
}

.shared-contact > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.96rem;
  margin: 0 0 17px;
}

/* ==========================================================
   SENSOR DASHBOARD
========================================================== */

.sensor-section {
  background: #f0f3ee;
}

.sensor-panel {
  max-width: 950px;
  margin: auto;
  padding: 32px;

  background: white;
  border: 1px solid var(--border);
  border-radius: 22px;

  box-shadow: var(--shadow);
}

/* Camera */

.camera-preview-container {
  margin-bottom: 28px;
}

.camera-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 17px;
}

.camera-preview-header h3 {
  margin: 5px 0 0;
  font: 700 1.2rem Manrope, sans-serif;
}

#cameraStatus,
#waveformStatus {
  display: inline-flex;
  align-items: center;

  padding: 8px 14px;

  background: var(--primary-light);
  color: var(--primary);

  border-radius: 30px;

  font-size: 0.85rem;
  font-weight: 700;
}

#cameraStatus.face-found {
  background: #e7f3eb;
  color: #276844;
}

#cameraStatus.face-missing {
  background: #fff3df;
  color: #805817;
}

.camera-preview {
  position: relative;

  width: 100%;
  max-width: 760px;
  aspect-ratio: 16 / 9;

  margin: 0 auto;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #202923;
  border-radius: 16px;
}

.camera-preview video,
#cameraPreview {
  display: none;

  width: 100%;
  height: 100%;

  object-fit: contain;
  transform: scaleX(-1);
}

#faceOverlay {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: contain;
  transform: scaleX(-1);

  pointer-events: none;
  z-index: 5;
}

#cameraPlaceholder {
  position: absolute;
  inset: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 20px;

  color: white;
  text-align: center;
}

#cameraPlaceholder span {
  font-size: 42px;
}

#cameraPlaceholder p {
  margin: 12px 0 5px;
  font-weight: 700;
}

#cameraPlaceholder small {
  color: #d0d9d2;
}

.camera-help {
  margin: 13px 0 0;
  text-align: center;

  color: var(--muted);
  font-size: 0.88rem;
}

/* Camera controls */

.sensor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.sensor-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Sensor status */

.sensor-intro {
  display: flex;
  align-items: center;
  gap: 15px;

  margin: 35px 0 22px;
  padding: 19px;

  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.sensor-intro .resource-icon {
  flex: none;
  margin: 0;
}

.sensor-intro h3 {
  margin: 0;
  font: 700 1.2rem Manrope, sans-serif;
}

.sensor-intro p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

/* Vital readings */

.reading-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 19px;
  margin: 23px 0;
}

.reading-card {
  padding: 27px;

  background: #f7f9f6;
  border: 1px solid var(--border);
  border-radius: 17px;

  transition: border-color 0.2s ease;
}

.reading-card:hover {
  border-color: #b9cdbb;
}

.reading-card > p:first-child {
  margin: 0 0 12px;

  color: var(--muted);
  font-weight: 800;
  font-size: 1rem;
}

.reading-card > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.reading-card > div span {
  color: var(--primary);

  font: 800 clamp(2.8rem,6vw,3.7rem)/1 Manrope, sans-serif;

  font-variant-numeric: tabular-nums;
}

.reading-card > div small {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
}

.reading-card > p:last-child {
  margin: 10px 0 0;

  color: var(--muted);
  font-size: 0.88rem;
}

/* Breathing graph */

.waveform-container {
  margin-top: 28px;
  padding: 24px;

  background: #fafbf9;
  border: 1px solid var(--border);
  border-radius: 17px;
}

.waveform-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;

  margin-bottom: 19px;
}

.waveform-header h3 {
  margin: 0 0 5px;
  font: 700 1.18rem Manrope, sans-serif;
}

.waveform-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#breathingWaveform {
  display: block;
  width: 100%;
  height: 150px;
}

/* ==========================================================
   FOOTER
========================================================== */

.site-footer {
  padding: 43px 7%;

  background: #243d30;
  color: #edf4ed;

  text-align: center;
}

.footer-brand {
  justify-content: center;
  color: white;
}

.site-footer > p {
  margin: 9px auto;
}

.footer-disclaimer {
  max-width: 780px;
  color: #d6e2d8;
  font-size: 0.86rem;
}

.copyright {
  color: #c0d0c4;
  font-size: 0.8rem;
}

/* ==========================================================
   LESSON DIALOG
========================================================== */

.lesson-dialog {
  width: min(720px,calc(100% - 28px));
  max-height: 88vh;
  overflow: auto;

  padding: 0;

  border: 1px solid var(--border);
  border-radius: 19px;

  box-shadow: 0 20px 70px #0004;
}

.lesson-dialog::backdrop {
  background: rgba(20,37,28,0.72);
  backdrop-filter: blur(3px);
}

.dialog-inner {
  padding: 32px;
}

.dialog-close {
  float: right;

  width: 42px;
  height: 42px;

  background: var(--primary-light);
  border: 0;
  border-radius: 50%;

  font-size: 1.5rem;
  cursor: pointer;
}

.dialog-inner h2 {
  margin: 0 0 18px;
  font: 800 1.9rem Manrope, sans-serif;
}

.dialog-content h3 {
  margin: 22px 0 8px;
  font: 700 1.1rem Manrope, sans-serif;
}

.dialog-content p,
.dialog-content li {
  font-size: 1rem;
}

.output-actions {
  margin-top: 20px;
}

.quiz-box {
  margin-top: 23px;
  padding: 21px;

  background: var(--surface-soft);
  border-radius: 14px;
}

.quiz-box h3 {
  margin-top: 0;
}

.quiz-choice {
  display: block;
  width: 100%;

  margin: 9px 0;
  padding: 13px 15px;

  background: white;
  border: 1px solid var(--border);
  border-radius: 9px;

  text-align: left;
  cursor: pointer;
}

.quiz-choice.correct {
  background: #e8f3e9;
  border-color: #43835b;
}

.quiz-choice.incorrect {
  background: #faecea;
  border-color: #b75a50;
}

/* ==========================================================
   HIGH CONTRAST
========================================================== */

.high-contrast {
  --bg: #fff;
  --surface: #fff;
  --ink: #000;
  --muted: #222;
  --border: #555;
  --primary: #003d25;
}

.high-contrast .section,
.high-contrast .hero {
  background: white;
}

.high-contrast .hero-panel,
.high-contrast .lesson-card,
.high-contrast .resource-card,
.high-contrast .connect-card {
  border: 2px solid #333;
  box-shadow: none;
}

.high-contrast .access-bar {
  background: white;
  border-color: #333;
}

/* ==========================================================
   RESPONSIVE TABLET
========================================================== */

@media (max-width: 950px) {

  .site-header {
    padding: 0 5%;
  }

  .section {
    padding: 65px 5%;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 35px;
  }

  .hero-panel {
    max-width: 700px;
  }

  .lesson-grid,
  .resource-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .main-nav {
    gap: 18px;
  }
}

/* ==========================================================
   RESPONSIVE MOBILE
========================================================== */

@media (max-width: 650px) {

  .site-header {
    height: 70px;
  }

  .brand {
    font-size: 1.25rem;
  }

  .menu-toggle {
    display: block;
  }

  .main-nav {
    display: none;

    position: absolute;
    top: 70px;
    left: 0;
    right: 0;

    padding: 14px 5% 20px;

    background: white;
    border-bottom: 1px solid var(--border);

    flex-direction: column;
    gap: 0;
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav a {
    padding: 13px 0;
    border-top: 1px solid var(--border);
  }

  .access-bar {
    justify-content: flex-start;
    flex-wrap: wrap;
    padding: 10px 5%;
    gap: 7px;
  }

  .access-bar > span {
    width: 100%;
  }

  .section {
    padding: 49px 5%;
  }

  .hero {
    min-height: 0;
  }

  .hero h1 {
    font-size: 2.4rem;
  }

  .hero-lead {
    font-size: 1rem;
  }

  .hero-panel {
    padding: 21px;
  }

  .lesson-grid,
  .resource-grid,
  .connect-grid,
  .reading-grid {
    grid-template-columns: 1fr;
  }

  .lesson-card,
  .resource-card,
  .connect-card {
    padding: 22px;
  }

  .section-heading {
    margin-bottom: 29px;
  }

  .sensor-panel {
    padding: 19px;
  }

  .reading-card {
    padding: 24px;
  }

  .reading-card > div span {
    font-size: 3rem;
  }

  .sensor-actions {
    flex-direction: column;
  }

  .sensor-actions button {
    width: 100%;
  }

  .camera-preview {
    aspect-ratio: 4 / 3;
  }

  .waveform-container {
    padding: 17px;
  }

  .site-footer {
    padding: 33px 5%;
  }

  .dialog-inner {
    padding: 23px;
  }

  .shared-contact {
    padding: 21px;
  }
}

/* ==========================================================
   REDUCED MOTION
========================================================== */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

}

/* ==========================================================
   PRINT
========================================================== */

@media print {

  .site-header,
  .access-bar,
  .site-footer,
  .button,
  .text-link,
  .lesson-tools {
    display: none !important;
  }

  .section {
    padding: 15px;
  }

  .lesson-dialog {
    display: block;
    position: static;
    max-height: none;
    box-shadow: none;
  }

}


/* ==========================================================
   HEALTHBRIDGE — DESIGN ENHANCEMENT 2.0
   Typography • Motion • Accessibility • Visual Polish
========================================================== */


/* ==========================================================
   01. TYPOGRAPHY REFINEMENT
========================================================== */

/* Import fonts if they are not already loaded in your HTML.
   For best performance, load these through Google Fonts
   in the HTML head instead of importing them here. */

:root {
  --font-heading: "Manrope", "Segoe UI", sans-serif;
  --font-body: "DM Sans", "Segoe UI", Arial, sans-serif;

  --text-main: #26362d;
  --text-secondary: #526258;
  --text-subtle: #66756b;

  --animation-fast: 180ms;
  --animation-medium: 300ms;
  --animation-slow: 550ms;

  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

body {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.75;
  letter-spacing: 0.005em;
  color: var(--text-main);
  font-weight: 400;
}

h1,
h2,
h3,
h4,
h5,
h6,
.brand {
  font-family: var(--font-heading);
  text-wrap: balance;
}

h1 {
  font-weight: 800;
  letter-spacing: -0.055em;
}

h2 {
  font-weight: 800;
  letter-spacing: -0.04em;
}

h3 {
  font-weight: 750;
  letter-spacing: -0.025em;
}

p {
  text-wrap: pretty;
}

p,
li {
  color: var(--text-secondary);
}

small {
  font-size: 0.9rem;
  line-height: 1.6;
}

::selection {
  background: #d9e9dc;
  color: #193b29;
}


/* ==========================================================
   02. SMOOTH SCROLLING
========================================================== */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 105px;
}

section,
.section {
  scroll-margin-top: 105px;
}


/* ==========================================================
   03. GLOBAL TRANSITIONS
========================================================== */

a,
button,
input,
textarea,
select,
.lesson-card,
.resource-card,
.connect-card,
.overview-link {
  transition:
    color var(--animation-fast) ease,
    background-color var(--animation-fast) ease,
    border-color var(--animation-fast) ease,
    box-shadow var(--animation-medium) var(--ease-smooth),
    transform var(--animation-medium) var(--ease-smooth);
}


/* ==========================================================
   04. SUBTLE PAGE ENTRANCE ANIMATION
========================================================== */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes gentleFloat {
  0%, 100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

.hero-copy {
  animation: fadeUp 750ms var(--ease-smooth) both;
}

.hero-panel {
  animation: fadeUp 850ms var(--ease-smooth) 100ms both;
}

.section-heading {
  animation: fadeUp 650ms var(--ease-smooth) both;
}


/* ==========================================================
   05. HERO POLISH
========================================================== */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -1;

  width: 420px;
  height: 420px;

  right: -130px;
  bottom: -180px;

  border-radius: 50%;

  background: rgba(201, 220, 203, 0.23);
  filter: blur(2px);
  pointer-events: none;
}

.hero h1 {
  max-width: 720px;
}

.hero-lead {
  max-width: 590px;
  line-height: 1.85;
}

.hero-panel {
  transition:
    transform 450ms var(--ease-smooth),
    box-shadow 450ms var(--ease-smooth);
}

.hero-panel:hover {
  transform: translateY(-3px);
  box-shadow:
    0 10px 28px rgba(35, 65, 46, 0.06),
    0 24px 50px rgba(35, 65, 46, 0.07);
}


/* ==========================================================
   06. NAVIGATION POLISH
========================================================== */

.main-nav a {
  position: relative;
  padding: 10px 0;
}

.main-nav a::after {
  content: "";
  position: absolute;

  left: 0;
  bottom: 2px;

  width: 0;
  height: 2px;

  background: var(--primary);
  border-radius: 5px;

  transition: width 260ms var(--ease-smooth);
}

.main-nav a:hover::after,
.main-nav a:focus-visible::after {
  width: 100%;
}

.brand {
  transition:
    transform 220ms var(--ease-smooth),
    color 220ms ease;
}

.brand:hover {
  transform: translateY(-1px);
}


/* ==========================================================
   07. BUTTON MICRO-INTERACTIONS
========================================================== */

.button {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}

.button-primary {
  box-shadow: 0 3px 10px rgba(49, 91, 72, 0.12);
}

.button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(49, 91, 72, 0.2);
}

.button-secondary:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: scale(0.98);
}

.button:focus-visible {
  outline: 3px solid #bd8734;
  outline-offset: 4px;
}


/* ==========================================================
   08. CARD INTERACTIONS
========================================================== */

.lesson-card,
.resource-card,
.connect-card {
  position: relative;
  overflow: hidden;

  transition:
    transform 320ms var(--ease-smooth),
    box-shadow 320ms var(--ease-smooth),
    border-color 250ms ease;
}

.lesson-card::before,
.resource-card::before,
.connect-card::before {
  content: "";
  position: absolute;

  top: 0;
  left: 0;

  width: 100%;
  height: 3px;

  background: var(--primary);

  transform: scaleX(0);
  transform-origin: left;

  transition: transform 350ms var(--ease-smooth);
}

.lesson-card:hover::before,
.resource-card:hover::before,
.connect-card:hover::before {
  transform: scaleX(1);
}

.lesson-card:hover,
.resource-card:hover,
.connect-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 32px rgba(35, 65, 46, 0.085);
}


/* ==========================================================
   09. ICON ANIMATIONS
========================================================== */

.lesson-icon,
.resource-icon,
.connect-icon {
  transition:
    transform 300ms var(--ease-smooth),
    background-color 250ms ease;
}

.lesson-card:hover .lesson-icon,
.resource-card:hover .resource-icon {
  transform: scale(1.07) rotate(-3deg);
  background: #dfece0;
}

.connect-card:hover .connect-icon {
  transform: translateY(-3px);
}


/* ==========================================================
   10. OVERVIEW LINKS
========================================================== */

.overview-link {
  position: relative;
  border-radius: 10px;
  padding-left: 8px;
  padding-right: 8px;
}

.overview-link:hover {
  background: #f5f8f4;
  padding-left: 13px;
  padding-right: 13px;
}

.overview-link > span {
  transition:
    transform 280ms var(--ease-smooth),
    background-color 250ms ease;
}

.overview-link:hover > span {
  transform: scale(1.08);
  background: #dceade;
}

.overview-link b {
  transition: transform 250ms ease;
}

.overview-link:hover b {
  transform: translateX(3px);
}


/* ==========================================================
   11. SEARCH INPUT
========================================================== */

.lesson-tools input {
  min-height: 56px;
  padding: 14px 18px;

  font-size: 1.05rem;

  border: 1.5px solid #cbd7cc;
  border-radius: 12px;

  box-shadow: 0 2px 7px rgba(35, 65, 46, 0.025);
}

.lesson-tools input:hover {
  border-color: #9eb5a1;
}

.lesson-tools input:focus {
  outline: none;
  border-color: var(--primary);

  box-shadow:
    0 0 0 4px rgba(49, 91, 72, 0.11),
    0 4px 12px rgba(35, 65, 46, 0.04);
}

.lesson-tools input::placeholder {
  color: #647268;
  opacity: 1;
}


/* ==========================================================
   12. ACCESSIBILITY BUTTONS
========================================================== */

.access-button {
  min-height: 42px;
  min-width: 44px;
  padding: 9px 14px;

  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.access-button:hover {
  background: #e4eee5;
  border-color: #9eb5a1;
}

.access-button:active {
  transform: scale(0.97);
}


/* ==========================================================
   13. SENSOR PANEL
========================================================== */

.sensor-panel {
  transition:
    box-shadow 350ms var(--ease-smooth),
    border-color 250ms ease;
}

.sensor-panel:hover {
  border-color: #cad8ca;
}

.camera-preview {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.camera-preview-header {
  margin-bottom: 20px;
}

#cameraStatus,
#waveformStatus {
  transition:
    background-color 250ms ease,
    color 250ms ease;
}


/* ==========================================================
   14. LIVE READING POLISH
========================================================== */

.reading-card {
  position: relative;
  overflow: hidden;

  transition:
    transform 250ms var(--ease-smooth),
    border-color 250ms ease,
    box-shadow 250ms ease;
}

.reading-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(35, 65, 46, 0.06);
}

.reading-card > div span {
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  transition: color 200ms ease;
}

.reading-card > p:first-child {
  letter-spacing: 0.015em;
}


/* ==========================================================
   15. WAVEFORM CONTAINER
========================================================== */

.waveform-container {
  transition:
    border-color 250ms ease,
    box-shadow 250ms ease;
}

.waveform-container:hover {
  border-color: #b9cbb9;
  box-shadow: 0 5px 16px rgba(35, 65, 46, 0.035);
}


/* ==========================================================
   16. DIALOG ANIMATION
========================================================== */

#lessonDialog {
  opacity: 0;
  transform: translateY(15px) scale(0.985);

  transition:
    opacity 250ms ease,
    transform 300ms var(--ease-smooth),
    overlay 300ms allow-discrete,
    display 300ms allow-discrete;
}

#lessonDialog[open] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@starting-style {
  #lessonDialog[open] {
    opacity: 0;
    transform: translateY(15px) scale(0.985);
  }
}

#lessonDialog::backdrop {
  background: rgba(20, 37, 28, 0);
  transition:
    background 250ms ease,
    backdrop-filter 250ms ease;
}

#lessonDialog[open]::backdrop {
  background: rgba(20, 37, 28, 0.72);
  backdrop-filter: blur(4px);
}


/* ==========================================================
   17. QUIZ INTERACTIONS
========================================================== */

.quiz-choice {
  min-height: 50px;
  padding: 14px 17px;

  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms var(--ease-smooth);
}

.quiz-choice:hover {
  transform: translateX(3px);
  background: #f4f8f3;
  border-color: #a7bca9;
}

.quiz-choice.correct {
  animation: answerPop 300ms var(--ease-smooth);
}

.quiz-choice.incorrect {
  animation: answerPop 300ms var(--ease-smooth);
}

@keyframes answerPop {
  0% {
    transform: scale(0.98);
  }

  65% {
    transform: scale(1.015);
  }

  100% {
    transform: scale(1);
  }
}


/* ==========================================================
   18. READ ALOUD
========================================================== */

#readLesson {
  min-height: 48px;
  padding: 12px 17px;

  border: 1px solid #b9cbb9;
  border-radius: 10px;

  background: #edf3ed;
  color: var(--primary-dark);

  font-weight: 750;

  transition:
    background-color 200ms ease,
    transform 200ms ease;
}

#readLesson:hover {
  background: #e1ece2;
  transform: translateY(-1px);
}


/* ==========================================================
   19. SECTION SEPARATION
========================================================== */

.learn-section {
  background: white;
}

.services-section,
.sensor-section {
  background:
    linear-gradient(
      180deg,
      #f1f4ef 0%,
      #f6f8f4 100%
    );
}

.connect-section {
  background: white;
}

.section-heading {
  margin-bottom: 48px;
}

.section-heading > p:last-child {
  max-width: 650px;
  margin-inline: auto;
  line-height: 1.8;
}


/* ==========================================================
   20. TEXT READABILITY
========================================================== */

.hero-lead,
.section-heading > p,
.lesson-card p,
.resource-card p,
.connect-card p {
  line-height: 1.8;
}

.dialog-content p,
.dialog-content li {
  max-width: 68ch;
  line-height: 1.85;
  font-size: 1.06rem;
}

.dialog-inner {
  line-height: 1.8;
}

.lesson-card h3,
.resource-card h3,
.connect-card h3 {
  line-height: 1.4;
}


/* ==========================================================
   21. RESPONSIVE TYPOGRAPHY
========================================================== */

@media (max-width: 650px) {

  body {
    font-size: 17px;
    line-height: 1.75;
  }

  .hero h1 {
    line-height: 1.15;
    letter-spacing: -0.045em;
  }

  .section-heading h2 {
    line-height: 1.25;
  }

  .lesson-card p,
  .resource-card p,
  .connect-card p {
    font-size: 1rem;
  }

  .dialog-content p,
  .dialog-content li {
    font-size: 1rem;
  }

}


/* ==========================================================
   22. REDUCED MOTION
========================================================== */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero-copy,
  .hero-panel,
  .section-heading {
    animation: none !important;
  }

}


/* ==========================================================
   23. HIGH CONTRAST & KEYBOARD ACCESSIBILITY
========================================================== */

:focus-visible {
  outline: 3px solid #a76e20;
  outline-offset: 4px;
}

@media (prefers-contrast: more) {

  body {
    color: #111;
  }

  p,
  li,
  small {
    color: #222;
  }

  .lesson-card,
  .resource-card,
  .connect-card,
  .sensor-panel {
    border: 2px solid #555;
    box-shadow: none;
  }

  .button {
    border-width: 2px;
  }

}


/* ==========================================================
   24. TOUCHSCREEN SUPPORT
========================================================== */

@media (hover: none) {

  .lesson-card:hover,
  .resource-card:hover,
  .connect-card:hover,
  .reading-card:hover {
    transform: none;
  }

  .button:hover {
    transform: none;
  }

}


/* ==========================================================
   25. FINISHING TOUCHES
========================================================== */

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

@media print {

  *,
  *::before,
  *::after {
    box-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }

}

/* END HEALTHBRIDGE DESIGN ENHANCEMENT */

.nav-login-btn {
    background: #d58aa5;
    color: white;
    border: none;
    border-radius: 9px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}

.nav-login-btn:hover {
    background: #bd718f;
}

.auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(35, 25, 30, 0.45);
    backdrop-filter: blur(4px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-overlay.active {
    display: flex;
    animation: authFade 0.2s ease;
}

.auth-modal {
    background: #fff;
    width: 100%;
    max-width: 420px;
    padding: 38px 30px;
    border-radius: 20px;
    position: relative;
    text-align: center;
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
    animation: authPop 0.25s ease;
}

.auth-modal h2 {
    color: #bd718f;
    margin-bottom: 10px;
}

.auth-modal p {
    color: #777;
    margin-bottom: 25px;
}

.auth-close {
    position: absolute;
    top: 12px;
    right: 17px;
    background: none;
    border: none;
    font-size: 27px;
    cursor: pointer;
    color: #888;
}

.auth-primary,
.auth-secondary {
    display: block;
    width: 100%;
    padding: 13px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    margin-top: 12px;
    transition: 0.2s;
}

.auth-primary {
    background: #d58aa5;
    color: white;
    border: none;
}

.auth-secondary {
    background: white;
    color: #bd718f;
    border: 1px solid #d58aa5;
}

.auth-primary:hover {
    background: #bd718f;
}

.auth-secondary:hover {
    background: #fff4f8;
}

@keyframes authFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes authPop {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* NAVIGATION BUTTON */
.nav-login-btn {
    background: #c987a0;
    color: white;
    border: 1px solid #c987a0;
    border-radius: 9px;
    padding: 12px 23px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.nav-login-btn:hover {
    background: #b87590;
}

/* POPUP OVERLAY */
.auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(35, 29, 33, 0.42);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-overlay.active {
    display: flex;
}

/* POPUP */
.auth-modal {
    background: #fff;
    width: 100%;
    max-width: 440px;
    padding: 42px 36px 35px;
    border-radius: 18px;
    position: relative;
    text-align: center;
    border: 1px solid #eee4e8;
    box-shadow: 0 8px 30px rgba(50, 30, 40, 0.12);
}

/* HEADING */
.auth-modal h2 {
    color: #92546d;
    font-size: 25px;
    margin: 8px 0 12px;
}

.auth-modal p {
    color: #666066;
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 25px;
}

/* CLOSE BUTTON */
.auth-close {
    position: absolute;
    top: 15px;
    right: 17px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #f8eff3;
    color: #805568;
    font-size: 25px;
    cursor: pointer;
}

/* LOGIN AND SIGNUP */
.auth-primary,
.auth-secondary {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 13px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-top: 14px;
}

.auth-primary {
    background: #c987a0;
    color: white;
    border: 1px solid #c987a0;
}

.auth-primary:hover {
    background: #b87590;
}

.auth-secondary {
    background: white;
    color: #92546d;
    border: 1px solid #c987a0;
}

.auth-secondary:hover {
    background: #fbf4f7;
}

/* USER PROFILE */
#hb-user-name {
    background: #fbf4f7;
    border: 1px solid #eee0e7;
    border-radius: 10px;
    padding: 14px;
    color: #805568;
    font-weight: 600;
}

/* ACCESSIBILITY */
.auth-primary:focus-visible,
.auth-secondary:focus-visible,
.auth-close:focus-visible,
.nav-login-btn:focus-visible {
    outline: 3px solid #805568;
    outline-offset: 3px;
}

@media (max-width: 480px) {
    .auth-modal {
        padding: 40px 23px 28px;
    }
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
