/* ============================================================
   NEDOCS — Gamified Emergency Department theme
   PostHog-inspired playful UI: chunky borders, offset shadows,
   floating ED graphics, EKG animations, mascot "Nedi the Triage Heart".
   Layered on top of UIKit/Bootstrap marketing styles.
   ============================================================ */

:root {
  --ed-ink: #0c1b33;
  --ed-paper: #fff8f1;
  --ed-red: #e4002b;
  --ed-red-deep: #bb3800;
  --ed-amber: #ff8500;
  --ed-yellow: #ffde00;
  --ed-green: #28a800;
  --ed-blue: #0061f2;
  --ed-violet: #6d28d9;
  --ed-teal: #0d9488;
  --ed-shadow: 6px 6px 0 var(--ed-ink);
  --ed-shadow-sm: 4px 4px 0 var(--ed-ink);
  --ed-border: 3px solid var(--ed-ink);
}

/* ---------- Animations ---------- */
@keyframes ed-float {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-14px) rotate(var(--rot, 0deg)); }
}
@keyframes ed-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes ed-pulse-ring {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}
@keyframes ed-heartbeat {
  0%, 28%, 70%, 100% { transform: scale(1); }
  14% { transform: scale(1.18); }
  42% { transform: scale(1.1); }
}
@keyframes ed-dash {
  to { stroke-dashoffset: -1000; }
}
@keyframes ed-siren {
  0%, 100% { box-shadow: 0 0 0 0 rgba(228,0,43,0.55); }
  50% { box-shadow: 0 0 0 10px rgba(228,0,43,0); }
}
@keyframes ed-wobble {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}
@keyframes ed-shine {
  0% { background-position: -150% 0; }
  100% { background-position: 250% 0; }
}
@keyframes ed-pop-in {
  0% { transform: scale(0.6) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Playful navbar touches ---------- */
.navbar-marketing .navbar-brand .navbar-brand-icon {
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
}
.navbar-marketing .navbar-brand:hover .navbar-brand-icon {
  transform: rotate(-12deg) scale(1.12);
}
.navbar-marketing .btn-primary {
  border: 2px solid var(--ed-ink);
  box-shadow: 3px 3px 0 var(--ed-ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.navbar-marketing .btn-primary:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ed-ink);
}
.navbar-marketing .btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ed-ink);
}

/* ---------- Gamified HERO ---------- */
.ed-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(0,97,242,0.25), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(228,0,43,0.22), transparent 55%),
    linear-gradient(165deg, #0c1b33 0%, #122a52 55%, #0c1b33 100%);
  color: #fff;
  padding: 4.5rem 0 5rem;
}

/* scrolling EKG line across the hero */
.ed-ekg {
  position: absolute;
  left: 0; right: 0; bottom: 12%;
  height: 120px;
  width: 100%;
  opacity: 0.5;
  pointer-events: none;
}
.ed-ekg path {
  fill: none;
  stroke: #34d399;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(52,211,153,0.8));
  stroke-dasharray: 1000;
  animation: ed-dash 6s linear infinite;
}

/* floating ED graphics in hero */
.ed-floaty {
  position: absolute;
  font-size: 2.4rem;
  line-height: 1;
  opacity: 0.85;
  pointer-events: none;
  animation: ed-float 6s ease-in-out infinite;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.35));
}
.ed-floaty--1 { top: 14%; left: 6%;  --rot: -8deg; animation-duration: 7s; }
.ed-floaty--2 { top: 22%; right: 8%; --rot: 10deg; animation-duration: 5.5s; }
.ed-floaty--3 { bottom: 24%; left: 12%; --rot: 6deg; animation-duration: 8s; }
.ed-floaty--4 { top: 55%; right: 14%; --rot: -6deg; animation-duration: 6.5s; }
.ed-floaty--5 { bottom: 14%; right: 30%; --rot: 4deg; animation-duration: 7.5s; }

.ed-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--ed-yellow);
  color: var(--ed-ink);
  border: 2px solid var(--ed-ink);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.45);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  animation: ed-wobble 4s ease-in-out infinite;
}
.ed-hero__badge .ed-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ed-red);
  animation: ed-heartbeat 1.4s ease-in-out infinite;
}

.ed-hero__title {
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-size: clamp(2.1rem, 4.4vw, 3.4rem);
  margin: 1rem 0 1rem;
}
.ed-hero__title .ed-mark {
  position: relative;
  white-space: nowrap;
  color: var(--ed-yellow);
}
.ed-hero__title .ed-mark::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 2px;
  height: 0.4em;
  background: rgba(228,0,43,0.55);
  border-radius: 4px;
  z-index: -1;
  transform: rotate(-1deg);
}

/* chunky game buttons */
.btn-ed {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--ed-ink);
  box-shadow: 4px 4px 0 var(--ed-ink);
  transition: transform .12s ease, box-shadow .12s ease;
  text-decoration: none;
}
.btn-ed:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--ed-ink); }
.btn-ed:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ed-ink); }
.btn-ed--red { background: var(--ed-red); color: #fff; }
.btn-ed--white { background: #fff; color: var(--ed-ink); }
.btn-ed--yellow { background: var(--ed-yellow); color: var(--ed-ink); }

/* ---------- Mascot: Nedi the Triage Heart ---------- */
.ed-mascot {
  display: inline-block;
  animation: ed-bob 3s ease-in-out infinite;
  transform-origin: bottom center;
}
.ed-mascot--speak { cursor: pointer; }
.ed-mascot--speak:hover { animation: ed-wobble 0.5s ease-in-out infinite; }
.ed-mascot__heart { animation: ed-heartbeat 1.6s ease-in-out infinite; transform-origin: center; }

.ed-speech {
  position: relative;
  display: inline-block;
  background: #fff;
  color: var(--ed-ink);
  border: var(--ed-border);
  border-radius: 16px;
  box-shadow: var(--ed-shadow-sm);
  padding: 0.6rem 0.9rem;
  font-weight: 700;
  font-size: 0.9rem;
  max-width: 16rem;
}
.ed-speech::after {
  content: "";
  position: absolute; left: 24px; bottom: -12px;
  border-width: 12px 10px 0 10px;
  border-style: solid;
  border-color: var(--ed-ink) transparent transparent transparent;
}
.ed-speech::before {
  content: "";
  position: absolute; left: 26px; bottom: -7px;
  border-width: 9px 7px 0 7px;
  border-style: solid;
  border-color: #fff transparent transparent transparent;
  z-index: 1;
}

/* ---------- Live dashboard hero card glow ---------- */
.home-dash-card {
  border: 3px solid var(--ed-ink) !important;
  box-shadow: 10px 10px 0 rgba(0,0,0,0.55) !important;
  transform: rotate(1.2deg);
  transition: transform .3s ease;
}
.home-dash-card:hover { transform: rotate(0deg) scale(1.01); }

/* ---------- Game cards (neo-brutalist) ---------- */
.ed-card {
  position: relative;
  background: #fff;
  border: var(--ed-border);
  border-radius: 18px;
  box-shadow: var(--ed-shadow);
  padding: 1.5rem 1.4rem;
  height: 100%;
  transition: transform .15s ease, box-shadow .15s ease;
  overflow: hidden;
}
.ed-card:hover { transform: translate(-3px,-3px); box-shadow: 9px 9px 0 var(--ed-ink); }
.ed-card__icon {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  border: 2px solid var(--ed-ink);
  box-shadow: 3px 3px 0 var(--ed-ink);
  margin-bottom: 1rem;
  background: var(--ed-yellow);
}
.ed-card__icon svg { width: 30px; height: 30px; }
.ed-card h3, .ed-card .h5, .ed-card .h6 { font-weight: 800; color: var(--ed-ink); }
.ed-card p { color: #495567; }

.ed-card--tilt-l { transform: rotate(-1.2deg); }
.ed-card--tilt-r { transform: rotate(1.2deg); }
.ed-card--tilt-l:hover, .ed-card--tilt-r:hover { transform: rotate(0) translate(-3px,-3px); }

/* corner ribbon "NEW" */
.ed-ribbon {
  position: absolute;
  top: 14px; right: -34px;
  transform: rotate(40deg);
  background: var(--ed-red);
  color: #fff;
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  padding: 0.25rem 2.6rem;
  border-top: 2px solid var(--ed-ink);
  border-bottom: 2px solid var(--ed-ink);
}

/* ---------- Stat / score counters ---------- */
.ed-stat {
  background: #fff;
  border: var(--ed-border);
  border-radius: 18px;
  box-shadow: var(--ed-shadow-sm);
  padding: 1.4rem 1rem;
  text-align: center;
  transition: transform .15s ease;
}
.ed-stat:hover { transform: translateY(-4px) rotate(-1deg); }
.ed-stat__num {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
  color: var(--ed-blue);
  font-variant-numeric: tabular-nums;
}
.ed-stat__label { font-weight: 700; color: var(--ed-ink); margin-top: 0.35rem; }
.ed-stat__sub { font-size: 0.78rem; color: #6b7688; }

/* ---------- Surge meter (interactive gauge game) ---------- */
.ed-surge {
  background: var(--ed-ink);
  border-radius: 22px;
  border: 3px solid #000;
  box-shadow: var(--ed-shadow);
  color: #fff;
  padding: 2rem;
}
.ed-surge__readout {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 28px currentColor;
  transition: color .3s ease;
}
.ed-surge__band {
  display: inline-block;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  border: 2px solid rgba(255,255,255,0.25);
  margin-top: 0.5rem;
}
.ed-meter {
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(90deg,#28a800 0%, #ffde00 30%, #ff8500 55%, #bb3800 78%, #531900 100%);
  position: relative;
  border: 2px solid #000;
  margin: 1.25rem 0 0.5rem;
  overflow: visible;
}
.ed-meter__needle {
  position: absolute;
  top: -8px; bottom: -8px;
  width: 6px;
  background: #fff;
  border: 2px solid var(--ed-ink);
  border-radius: 4px;
  left: 50%;
  transform: translateX(-50%);
  transition: left .35s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 0 10px rgba(255,255,255,0.8);
}
.ed-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(0,0,0,0.4);
  outline: none;
  margin-top: 0.4rem;
}
.ed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ed-yellow);
  border: 3px solid var(--ed-ink);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  cursor: pointer;
}
.ed-slider::-moz-range-thumb {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ed-yellow);
  border: 3px solid var(--ed-ink);
  cursor: pointer;
}
.ed-preset {
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.06);
  color: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.ed-preset:hover { transform: translateY(-2px); background: rgba(255,255,255,0.16); }
.ed-preset.is-active { background: var(--ed-yellow); color: var(--ed-ink); border-color: var(--ed-ink); }

/* ---------- Surge band ladder (gamified levels) ---------- */
.ed-level {
  display: flex;
  align-items: center;
  gap: 1rem;
  border: var(--ed-border);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  background: #fff;
  box-shadow: var(--ed-shadow-sm);
  margin-bottom: 1rem;
  transition: transform .15s ease;
}
.ed-level:hover { transform: translateX(6px); }
.ed-level__badge {
  flex-shrink: 0;
  width: 64px; height: 64px;
  border-radius: 14px;
  border: 2px solid var(--ed-ink);
  box-shadow: 3px 3px 0 var(--ed-ink);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: 900;
  color: #fff;
}
.ed-level__badge small { font-size: 0.6rem; font-weight: 700; opacity: 0.9; }
.ed-level__title { font-weight: 800; color: var(--ed-ink); margin: 0; }
.ed-level__range { font-weight: 700; font-size: 0.8rem; color: #6b7688; }

/* ---------- Achievement / trust badges ---------- */
.ed-achv {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  width: 9rem;
}
.ed-achv__coin {
  width: 88px; height: 88px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--ed-ink);
  box-shadow: 0 6px 0 var(--ed-ink);
  background: radial-gradient(circle at 35% 30%, #fff3b0, #ffde00 55%, #f0b400 100%);
  position: relative;
  animation: ed-bob 4s ease-in-out infinite;
}
.ed-achv__coin svg { width: 42px; height: 42px; }
.ed-achv__name { font-weight: 800; color: var(--ed-ink); font-size: 0.92rem; }
.ed-achv__sub { font-size: 0.74rem; color: #6b7688; }

/* ---------- Section headers ---------- */
.ed-section { padding: 4.5rem 0; }
.ed-section--paper { background: var(--ed-paper); }
.ed-eyebrow {
  display: inline-block;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.78rem;
  color: var(--ed-red);
  background: rgba(228,0,43,0.1);
  border: 2px solid var(--ed-red);
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  margin-bottom: 0.75rem;
}
.ed-h2 { font-weight: 900; color: var(--ed-ink); letter-spacing: -0.02em; }

/* ---------- Final CTA siren panel ---------- */
.ed-cta {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ed-red) 0%, #ff5e3a 100%);
  border: 3px solid var(--ed-ink);
  border-radius: 26px;
  box-shadow: var(--ed-shadow);
  color: #fff;
  padding: 3rem 2rem;
  text-align: center;
}
.ed-cta::before, .ed-cta::after {
  content: "";
  position: absolute;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--ed-yellow);
  border: 3px solid var(--ed-ink);
  animation: ed-siren 1.6s ease-in-out infinite;
}
.ed-cta::before { top: 18px; left: 18px; }
.ed-cta::after { top: 18px; right: 18px; animation-delay: .8s; }

/* ---------- Confetti easter-egg burst ---------- */
.ed-confetti {
  position: fixed;
  top: 0; left: 0;
  width: 10px; height: 14px;
  z-index: 9999;
  pointer-events: none;
  border-radius: 2px;
}

/* ---------- Pulse ring helper ---------- */
.ed-ring { position: relative; }
.ed-ring::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  border: 2px solid var(--ed-red);
  animation: ed-pulse-ring 1.8s ease-out infinite;
}

@media (max-width: 991px) {
  .home-dash-card { transform: none; margin-top: 2rem; }
  .ed-floaty { display: none; }
}
