/* =============================
   Design Tokens
   ============================= */

:root {
  --primary-color: #1f4fd8;
  --secondary-color: #f6c344;
  --urgent-color: #c53030;

  --background-color: #ffffff;
  --light-background: #f5f7fb;
  --reassurance-background: #eef4ff;

  --text-color: #1a1a1a;
  --border-radius: 12px;
}

/* =============================
   Global Header Navigation
   ============================= */

.site-header {
  background: linear-gradient(180deg, #0f4ea8, #0b3f88);
  color: white;
  padding: 24px 20px 18px;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.branding h1 {
  margin: 0;
  font-size: 2.2rem;
}

.tagline {
  margin: 6px 0 18px;
  font-size: 1.1rem;
  opacity: 0.95;
}

/* Navigation Bar */
.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,0.25);
  padding-top: 14px;
}

.main-nav a {
  color: white;
  text-decoration: none;
  font-size: 1.1rem;
  padding: 10px 16px;
  border-radius: 10px;
  position: relative;
}

/* Hover & focus */
.main-nav a:hover {
  background-color: rgba(255,255,255,0.18);
}

.main-nav a:focus-visible {
  background-color: rgba(255,255,255,0.24);
  outline: 3px solid #f6c344;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(11, 63, 136, 0.45);
}

/* Active page indicator */
.main-nav a.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -6px;
  height: 3px;
  background-color: #8cc6ff;
  border-radius: 3px;
}

/* Emergency button */
.nav-urgent {
  background-color: #c53030;
  margin-left: auto;
  font-weight: bold;
}

.nav-urgent:hover,
.nav-urgent:focus {
  background-color: #a72828;
}

/* Mobile friendliness */
@media (max-width: 700px) {
  .branding h1 {
    font-size: 1.8rem;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
  }

  .main-nav a {
    width: 100%;
    text-align: center;
  }

  .nav-urgent {
    margin-left: 0;
    grid-column: 1 / -1;
  }
}

/* =============================
   Base Reset
   ============================= */

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

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -56px;
  z-index: 10000;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fff;
  color: #0b3f88;
  font-weight: bold;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

.skip-link:focus {
  top: 16px;
  outline: 3px solid #f6c344;
}

h1, h2, h3 {
  line-height: 1.3;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.6rem; }

p,
li {
  max-width: 65ch;
}

/* =============================
   Buttons & Button-Like Links
   ============================= */

button,
.btn {
  min-width: 190px;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
  padding: 14px 20px;
  border-radius: var(--border-radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  vertical-align: middle;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

button:focus,
.btn:focus {
  outline: 3px solid #000;
  outline-offset: 2px;
}

.btn:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 63, 136, 0.14);
}

.btn:active,
button:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn,
button {
  background-color: #fff;
  color: var(--primary-color);
  border-color: rgba(31, 79, 216, 0.22);
}

.btn.primary,
button.primary {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.btn.secondary,
button.secondary {
  background-color: #eef4ff;
  color: #0f4ea8;
  border-color: rgba(31, 79, 216, 0.2);
}

.btn.urgent,
button.urgent {
  background-color: var(--urgent-color);
  color: #fff;
  border-color: var(--urgent-color);
}

.btn.primary:hover,
button.primary:hover {
  background-color: #183fb0;
  border-color: #183fb0;
}

.btn.secondary:hover,
button.secondary:hover {
  background-color: #dfeafe;
  border-color: rgba(31, 79, 216, 0.3);
}

.btn.urgent:hover,
button.urgent:hover {
  background-color: #a72828;
  border-color: #a72828;
}

.btn[aria-current="page"] {
  box-shadow: inset 0 0 0 2px rgba(15, 78, 168, 0.18);
}

/* =============================
   Header
   ============================= */

.header {
  background-color: var(--primary-color);
  color: white;
  padding: 20px;
  text-align: center;
}

/* =============================
   Hero
   ============================= */

.hero {
  padding: 50px 20px;
  text-align: center;
}

.hero-buttons {
  margin-top: 30px;
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-subtext {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  max-width: 40ch;
}

/* =============================
   Sections
   ============================= */

.section {
  padding: 50px 20px;
}

.section > *:first-child {
  margin-top: 0;
}

.section > *:last-child {
  margin-bottom: 0;
}

.section.light {
  background-color: var(--light-background);
}

.section.reassurance {
  background-color: var(--reassurance-background);
}

.section h3 {
  margin-bottom: 20px;
}

.section-kicker {
  margin: 0 0 10px;
  color: var(--primary-color);
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-intro {
  max-width: 46ch;
  font-size: 1.08rem;
  color: #27415f;
}

.page-meta {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 5px solid var(--primary-color);
  background: #eef4ff;
  border-radius: 10px;
}

.page-meta p {
  margin: 0;
}

.conversion-path {
  text-align: center;
  background: linear-gradient(180deg, #ffffff, #eef4ff);
}

/* =============================
   Cards & Grids
   ============================= */

.card-grid,
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.card {
  background-color: #fff;
  padding: 25px;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  text-align: center;
  font-size: 1.1rem;

  /* IMPORTANT: neutralize link styles */
  color: inherit;
  text-decoration: none;
}

.card p {
  color: #31465d;
}

.conversion-card {
  min-height: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.conversion-card h4,
.conversion-card p {
  margin: 0;
}

.conversion-card .btn {
  margin-top: auto;
}

.conversion-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background-color: #eef4ff;
  color: #0f4ea8;
  font-size: 0.85rem;
  font-weight: bold;
}

.card h4 {
  margin-top: 0;
}

.card img {
  display: block;
  width: 100%;
  max-width: 280px;
  height: 180px;
  margin: 0 auto 18px;
  object-fit: cover;
  border-radius: 16px;
  background: linear-gradient(180deg, #f1f6ff, #dfeafe);
  border: 1px solid rgba(31, 79, 216, 0.12);
}

.hero-cards .card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-cards .card:hover,
.hero-cards .card:focus {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(15, 63, 136, 0.14);
}

.hero-cards .card.urgent img {
  background: linear-gradient(180deg, #fff3f0, #ffe1db);
  border-color: rgba(197, 48, 48, 0.16);
}

.lesson-card {
  cursor: pointer;
  
}

.lesson-card:hover,
.lesson-card:focus {
  outline: 3px solid var(--primary-color);
}

/* =============================
   Checklist
   ============================= */

.checklist {
  list-style: none;
  padding-left: 0;
}

.checklist li {
  margin-bottom: 14px;
  padding-left: 34px;
  position: relative;
}

.checklist li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--primary-color);
}

/* =============================
   Quiz
   ============================= */

.quiz-question {
  margin-bottom: 1.5rem;
}

.quiz-option {
  display: block;
  margin: 0.5rem 0;
}

.quiz-feedback {
  font-weight: bold;
  margin-top: 0.5rem;
}

/* =============================
   Layout Helpers
   ============================= */

.button-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  align-items: stretch;
}

.button-row.compact {
  margin-top: 1.5rem;
}

.lesson-controls {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.lesson-controls .left,
.lesson-controls .right {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.button-row .btn,
.button-row button,
.hero-buttons .btn,
.hero-buttons button,
.lesson-controls .btn,
.lesson-controls button {
  min-height: 56px;
}

.two-column {
  display: flex;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
}

/* =============================
   Images & Modal
   ============================= */

.image-column img {
  max-width: 220px;
  width: 100%;
  cursor: pointer;
}

.enlargeable:focus-visible {
  outline: 4px solid #f6c344;
  outline-offset: 4px;
  border-radius: 14px;
}

.image-caption {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.5rem;
  text-align: center;
}

.image-attribution {
  font-size: 0.75rem;
  color: #777;
  text-align: center;
  margin-top: 0.25rem;
}

.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.image-modal[hidden] {
  display: none;
}

.image-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  text-align: center;
  background: #102948;
  padding: 1.25rem 1.25rem 1rem;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}

.image-modal-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
}

.image-modal-content p {
  color: #fff;
  margin-top: 1rem;
}

.image-modal-close {
  min-width: 0;
  margin-left: auto;
  margin-bottom: 1rem;
  padding: 10px 14px;
  background: #fff;
  color: #102948;
  border-color: #fff;
}

.review-panel {
  border-top: 1px solid rgba(15, 78, 168, 0.12);
}

.review-note {
  font-weight: bold;
}

.source-list {
  padding-left: 1.25rem;
  margin: 0.75rem 0 0;
}

.source-list li {
  margin-bottom: 0.65rem;
}

.source-list a {
  color: var(--primary-color);
}

/* =============================
   Footer
   ============================= */

.footer {
  background-color: #eee;
  border-top: 1px solid #d7dce5;
  padding: 30px 20px;
  text-align: center;
}

.footer p {
  margin: 0 auto 10px;
  max-width: 42ch;
  color: #425569;
  font-size: 0.98rem;
}

.footer a {
  display: inline-block;
  margin: 10px 15px;
  color: var(--text-color);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* =============================
   Accessibility
   ============================= */

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* =============================
   Print
   ============================= */

@media print {
  header,
  footer,
  nav,
  button,
  .btn,
  .skip-link {
    display: none;
  }

  body {
    font-size: 14pt;
    color: #000;
    background: #fff;
  }

  .section {
    padding: 0;
    margin-bottom: 1.5rem;
  }

  .section.light,
  .section.reassurance,
  .callout,
  .page-meta,
  .card,
  .conversion-card,
  .related-guide-card {
    background: #fff !important;
    box-shadow: none !important;
    border: 0 !important;
  }

  .button-row,
  .hero-buttons {
    display: none;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  #lesson-progress {
    display: none;
  }

}

/* =============================
   Scroll to Side in Guides
   ============================= */

.horizontal-scroll {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x mandatory;
}

.horizontal-scroll > .card {
  min-width: 260px;
  scroll-snap-align: start;
}

/* Optional: subtle scrollbar styling */
.horizontal-scroll::-webkit-scrollbar {
  height: 10px;
}

.horizontal-scroll::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

.guide-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.guide-index-card {
  display: block;
  padding: 18px;
  border: 1px solid rgba(31, 79, 216, 0.14);
  border-radius: 14px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.guide-index-card:hover,
.guide-index-card:focus-visible {
  border-color: rgba(31, 79, 216, 0.34);
  box-shadow: 0 10px 24px rgba(15, 63, 136, 0.12);
  outline: 3px solid #8cc6ff;
  outline-offset: 2px;
}

.guide-index-card h4,
.guide-index-card p {
  margin: 0;
}

.guide-index-card p {
  margin-top: 0.5rem;
}

.scroll-hint {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: #36506d;
}

.related-guides-list {
  margin-top: 24px;
}

.related-guide-card {
  min-height: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid rgba(31, 79, 216, 0.12);
  box-shadow: 0 10px 24px rgba(15, 63, 136, 0.08);
}

.related-guide-card h4,
.related-guide-card p {
  margin: 0;
}

.related-guide-card p {
  max-width: 32ch;
}

.related-guide-card .btn {
  margin-top: auto;
}

[data-guide-id] {
  position: relative;
}

[data-guide-id]::before {
  content: "";
  display: block;
  width: 72px;
  height: 4px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1f4fd8, #8cc6ff);
}

.inline-quiz {
  margin-top: 2rem;
  padding: 1.5rem;
  border-left: 6px solid #1f4fd8;
  background: #eef4ff;
  border-radius: 8px;
}

.callout {
  margin-top: 20px;
  padding: 1.25rem;
  border-left: 6px solid #1f4fd8;
  background: #eef4ff;
  border-radius: 12px;
}

.callout p {
  margin: 0;
}

.emergency-note {
  border-left-color: var(--urgent-color);
  background: #fff1f1;
}

/* =============================
   Lesson Scroll Progress Bar (Centered, Thicker, With Text)
   ============================= */

#lesson-progress {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 75%;
  max-width: 620px;
  height: 18px;                 /* thicker */
  background: #e0e0e0;
  border-radius: 999px;
  overflow: hidden;
  z-index: 9998;

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

body.lesson-page {
  padding-bottom: 110px;
  scroll-padding-bottom: 110px;
}

#lesson-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: #2e7d32;          /* calm green */
  border-radius: 999px;
  transition: width 0.3s ease-out;
}

#lesson-progress-text {
  position: relative;
  font-size: 0.9rem;
  font-weight: bold;
  color: #000;
  pointer-events: none;         /* prevents blocking clicks */
}

/* =============================
   Lesson Completed Indicator
   ============================= */

#lesson-completed {
  margin-top: 0.5rem;
  font-size: 1.1rem;
  font-weight: bold;
  color: #2e7d32; /* calm green */
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#lesson-completed .checkmark {
  font-size: 1.3rem;
}

/* =============================
   Lesson Card Completion Badge
   ============================= */

.lesson-card-wrapper {
  position: relative;
}

.lesson-completed {
  margin-top: 10px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: bold;
  color: #2e7d32; /* calm green */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.lesson-completed .checkmark {
  font-size: 1.1rem;
}

.lesson-card-wrapper {
  display: flex;
  flex-direction: column;
}

/* =============================
   Lesson Card Completion Checkbox
   ============================= */

.lesson-complete-control {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.lesson-complete-control label {
  font-size: 0.95rem;
  font-weight: bold;
  color: #2e7d32;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.lesson-complete-control input[type="checkbox"] {
  width: 25px;
  height: 25px;
}


@media (max-width: 700px) {
  .btn,
  button,
  .button-row .btn,
  .button-row button,
  .hero-buttons .btn,
  .hero-buttons button,
  .lesson-controls .btn,
  .lesson-controls button {
    width: 100%;
    min-width: 0;
  }

  .lesson-controls .left,
  .lesson-controls .right {
    width: 100%;
  }

  .footer a {
    margin: 8px 10px;
  }

  .page-meta,
  .callout {
    padding: 1rem;
  }

  .section {
    padding: 38px 16px;
  }

  .card,
  .related-guide-card {
    padding: 20px;
  }

  .section-intro {
    font-size: 1rem;
  }

  #lesson-progress {
    width: calc(100% - 24px);
    bottom: 12px;
  }

  body.lesson-page {
    padding-bottom: 104px;
    scroll-padding-bottom: 104px;
  }
}
