/* =================================================================
   WORLD PATIENT SAFETY DAY 2026 — SQHN MICROSITE
   Design tokens: SQHN Green (primary + secondary shades) as the core
   brand pair; Orange and Red as functional/accent colours. Fraunces
   (display) + Lexend (body/utility).
   ================================================================= */

:root {
  /* --- Brand colours (sampled directly from the SQHN logo) --- */
  --color-primary: #367171;        /* SQHN Green (logo's teal-green) — primary actions, links, headings */
  --color-primary-dark: #234A4A;   /* deep shade of SQHN Green for hero/footer backgrounds */
  --color-secondary: #72AE9D;      /* SQHN Green (lighter, from logo ring interior) — secondary accents */
  --color-secondary-light: #E7F3EF; /* pale green tint for light section backgrounds */
  --color-red: #ED3237;         /* SQHN Red (logo ribbon) — required marks, alerts only */
  --color-orange: #F9A431;      /* SQHN Orange (logo ring) — icons, stat highlights, slogan emphasis */

  /* --- Neutrals --- */
  --color-white: #FFFFFF;
  --color-bg: #F7FAF9;
  --color-ink: #12262D;
  --color-ink-soft: #4A5D63;
  --color-border: #DCE6E4;

  /* --- Typography --- */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Lexend', system-ui, -apple-system, sans-serif;

  /* --- Layout --- */
  --container-width: 1180px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --shadow-card: 0 4px 24px rgba(18, 38, 45, 0.08);

  /* --- Motion --- */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
}

/* =================================================================
   RESET & BASE
   ================================================================= */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--color-ink);
}

p { margin: 0 0 1em; color: var(--color-ink-soft); }

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

ul { padding: 0; margin: 0; list-style: none; }

button { font-family: inherit; cursor: pointer; }

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Visually hidden but accessible to screen readers */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-primary);
  color: var(--color-white);
  padding: 12px 20px;
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 500;
}
.skip-link:focus {
  left: 0;
}

/* Consistent, visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--color-orange);
  outline-offset: 2px;
}

/* Respect reduced motion preferences */
@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;
  }
}

/* =================================================================
   SHARED: EYEBROW / SECTION HEADINGS
   ================================================================= */
.eyebrow {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: 0 0 0.75em;
}

.eyebrow--accent { color: var(--color-orange); }

.section {
  padding: 96px 0;
}

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

.section h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  max-width: 720px;
}

.section__lede {
  font-size: 1.1rem;
  max-width: 640px;
}

.section__grid--2col {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: start;
  margin-top: 32px;
}

/* =================================================================
   BUTTONS
   ================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-white);
}
.btn--primary:hover { background: var(--color-primary-dark); transform: translateY(-1px); }

.btn--secondary {
  background: var(--color-secondary);
  color: var(--color-white);
}
.btn--secondary:hover { background: #5C9483; transform: translateY(-1px); }

.btn--ghost {
  background: transparent;
  border-color: var(--color-white);
  color: var(--color-white);
}
.hero .btn--ghost { border-color: rgba(255,255,255,0.7); }
.btn--ghost:hover { background: rgba(255,255,255,0.12); }

/* Ghost button used on light backgrounds (outside hero) needs dark border */
.pledge-result__actions .btn--ghost,
.footer .btn--ghost {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn__spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =================================================================
   HERO
   ================================================================= */
.hero {
  position: relative;
  background: linear-gradient(160deg, var(--color-primary-dark) 0%, var(--color-primary) 55%, var(--color-secondary) 100%);
  color: var(--color-white);
  padding: 56px 0 72px;
  overflow: hidden;
  text-align: center;
}

.hero__pulse-line {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  color: rgba(255, 255, 255, 0.18);
  line-height: 0;
}
.hero__pulse-line svg { width: 100%; height: 90px; display: block; }

.hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero__logos {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}
.hero__logo { height: 96px; width: auto; object-fit: contain; }

.hero__title {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  max-width: 780px;
  color: var(--color-white);
  margin-bottom: 0.15em;
}

.hero__date {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  font-weight: 600;
  color: var(--color-orange);
  margin-bottom: 20px;
}

.hero__theme {
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.78);
  max-width: 600px;
  margin-bottom: 18px;
}

.hero__slogan {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-style: italic;
  color: var(--color-orange);
  margin-bottom: 24px;
}

.hero__lede {
  max-width: 640px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.05rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin: 16px 0 48px;
}

.hero__counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 32px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.hero__counter-number {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--color-white);
  font-variant-numeric: tabular-nums;
}
.hero__counter-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
}

/* =================================================================
   STAT LIST (Why Patient Safety Matters)
   ================================================================= */
.stat-list { display: flex; flex-direction: column; gap: 20px; }
.stat-list__item {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 18px 20px;
  background: var(--color-white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.stat-list__figure {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-secondary);
  flex-shrink: 0;
  min-width: 90px;
}
.stat-list__label {
  font-size: 0.95rem;
  color: var(--color-ink-soft);
}
.stat-list__source {
  margin: 16px 0 0;
  font-size: 0.8rem;
  color: var(--color-ink-soft);
  font-style: italic;
}

/* =================================================================
   NCD CARDS
   ================================================================= */
.ncd-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.ncd-card {
  perspective: 1400px;
  transition: transform var(--transition-base);
  cursor: pointer;
  border-radius: var(--radius-md);
}
.ncd-card:hover { transform: translateY(-4px); }
.ncd-card:focus-visible {
  outline: 3px solid var(--color-orange);
  outline-offset: 4px;
}

.ncd-card__inner {
  position: relative;
  width: 100%;
  min-height: 300px;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}
.ncd-card.is-flipped .ncd-card__inner { transform: rotateY(180deg); }

.ncd-card__front,
.ncd-card__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  box-shadow: var(--shadow-card);
  text-align: left;
  display: flex;
  flex-direction: column;
}
.ncd-card__back {
  transform: rotateY(180deg);
  justify-content: center;
}

.ncd-card__icon {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--color-secondary-light);
  color: var(--color-secondary);
  margin-bottom: 20px;
}
.ncd-card__icon svg { width: 28px; height: 28px; }

.ncd-card:nth-child(1) .ncd-card__icon { background: #FDECEC; color: var(--color-red); }
.ncd-card:nth-child(2) .ncd-card__icon { background: #FCEFE2; color: var(--color-orange); }
.ncd-card:nth-child(3) .ncd-card__icon { background: #E7F1EF; color: var(--color-primary); }
.ncd-card:nth-child(4) .ncd-card__icon { background: #E9F7EA; color: var(--color-secondary); }

.ncd-card__title {
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.ncd-card__stat {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-secondary);
}
.ncd-card:nth-child(1) .ncd-card__stat { color: var(--color-red); }
.ncd-card:nth-child(2) .ncd-card__stat { color: var(--color-orange); }
.ncd-card:nth-child(3) .ncd-card__stat { color: var(--color-primary); }
.ncd-card:nth-child(4) .ncd-card__stat { color: var(--color-secondary); }

.ncd-card__hint {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-ink-soft);
}
.ncd-card__hint svg { width: 14px; height: 14px; flex-shrink: 0; }

.ncd-card__back-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-ink);
}
.ncd-card__text {
  font-size: 0.92rem;
  margin-bottom: 0;
}

/* =================================================================
   PLEDGE FORM
   ================================================================= */
.section--pledge { background: var(--color-white); }

.pledge-intro { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.pledge-intro .section__lede { margin: 0 auto; }

.pledge-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.pledge-form {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 36px;
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-field { margin-bottom: 22px; }

.form-field label {
  display: block;
  font-weight: 500;
  font-size: 0.92rem;
  margin-bottom: 8px;
  color: var(--color-ink);
}

.required { color: var(--color-red); }

.form-field input[type="text"],
.form-field input[type="file"],
.form-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--color-white);
  color: var(--color-ink);
  transition: border-color var(--transition-fast);
}

.form-field input[type="text"]:focus,
.form-field select:focus {
  border-color: var(--color-primary);
  outline: none;
}

.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"] {
  border-color: var(--color-red);
}

.form-hint {
  display: block;
  font-size: 0.82rem;
  color: var(--color-ink-soft);
  margin-top: 6px;
}

.form-error {
  display: block;
  font-size: 0.82rem;
  color: var(--color-red);
  margin-top: 6px;
  min-height: 1em;
}

.form-field--checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.form-field--checkbox input {
  margin-top: 4px;
  width: 18px; height: 18px;
  accent-color: var(--color-secondary);
  flex-shrink: 0;
}
.form-field--checkbox label {
  font-weight: 400;
  font-size: 0.88rem;
  margin-bottom: 0;
}

.photo-preview {
  margin-top: 12px;
  width: 88px; height: 88px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--color-border);
}
.photo-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.form-status {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  min-height: 1.2em;
  margin: 16px 0 0;
}
.form-status[data-state="success"] { color: var(--color-secondary); }
.form-status[data-state="error"] { color: var(--color-red); }

/* Pledge result panel */
.pledge-result {
  background: var(--color-secondary-light);
  border-radius: var(--radius-md);
  padding: 36px;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pledge-result__placeholder {
  text-align: center;
  color: var(--color-ink-soft);
  font-size: 0.95rem;
  max-width: 260px;
}

.pledge-result__card {
  width: 100%;
  text-align: center;
}

#pledgeCanvas {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin: 0 auto 20px;
}

.pledge-result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.pledge-result__share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.88rem;
}
.pledge-result__share-label { color: var(--color-ink-soft); }
.share-link {
  font-weight: 600;
  text-decoration: none;
  color: var(--color-primary);
}
.share-link:hover { text-decoration: underline; }

/* =================================================================
   LIVE COUNTER BANNER
   ================================================================= */
.section--counter {
  padding: 56px 0;
  background: linear-gradient(120deg, var(--color-secondary) 0%, var(--color-primary) 100%);
}
.counter-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  color: var(--color-white);
}
.counter-banner__number {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.counter-banner__label {
  font-size: 1rem;
  color: rgba(255,255,255,0.9);
}

/* =================================================================
   FAQ
   ================================================================= */
.faq-list {
  max-width: 760px;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 20px;
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 0;
  font-weight: 500;
  color: var(--color-ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-size: 1.4rem;
  color: var(--color-secondary);
  font-weight: 400;
  flex-shrink: 0;
  transition: transform var(--transition-base);
}
.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-item p {
  padding-bottom: 18px;
  margin: 0;
  font-size: 0.95rem;
}

/* =================================================================
   FOOTER
   ================================================================= */
.footer {
  background: var(--color-primary-dark);
  color: rgba(255, 255, 255, 0.85);
  padding: 48px 0;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.footer__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.footer__logo {
  height: 64px;
  width: auto;
}
.footer__org {
  font-weight: 600;
  color: var(--color-white);
  margin: 0;
  font-size: 0.95rem;
}
.footer__tagline {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-orange);
  font-style: italic;
}
.footer__nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.footer__nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.9rem;
}
.footer__nav a:hover { color: var(--color-white); text-decoration: underline; }
.footer__copyright {
  width: 100%;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  margin: 24px 0 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 900px) {
  .section { padding: 64px 0; }
  .section__grid--2col { grid-template-columns: 1fr; }
  .ncd-grid { grid-template-columns: repeat(2, 1fr); }
  .pledge-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .ncd-grid { grid-template-columns: 1fr; }
  .hero__logos { padding: 0; }
  .hero__logo { height: 68px; }
  .pledge-form { padding: 24px; }
  .pledge-result { padding: 24px; min-height: auto; }
  .footer__inner { text-align: center; justify-content: center; }
}

/* =================================================================
   SCROLL-REVEAL ANIMATIONS
   Elements fade + rise into view once as they enter the viewport
   (triggered via IntersectionObserver in script.js). Cards, list
   items, and FAQ entries stagger slightly for a cascading feel.
   ================================================================= */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.ncd-card.reveal:nth-child(1) { transition-delay: 0s; }
.ncd-card.reveal:nth-child(2) { transition-delay: 0.1s; }
.ncd-card.reveal:nth-child(3) { transition-delay: 0.2s; }
.ncd-card.reveal:nth-child(4) { transition-delay: 0.3s; }

.stat-list__item.reveal:nth-child(1) { transition-delay: 0s; }
.stat-list__item.reveal:nth-child(2) { transition-delay: 0.1s; }
.stat-list__item.reveal:nth-child(3) { transition-delay: 0.2s; }

.faq-item.reveal:nth-child(1) { transition-delay: 0s; }
.faq-item.reveal:nth-child(2) { transition-delay: 0.06s; }
.faq-item.reveal:nth-child(3) { transition-delay: 0.12s; }
.faq-item.reveal:nth-child(4) { transition-delay: 0.18s; }
.faq-item.reveal:nth-child(5) { transition-delay: 0.24s; }
.faq-item.reveal:nth-child(6) { transition-delay: 0.3s; }

/* Live counter numbers pulse subtly whenever the value updates */
@keyframes counterPulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.hero__counter-number.is-updating,
.counter-banner__number.is-updating {
  animation: counterPulse 0.5s ease;
}
