/* ========================================
   SierraBay Ambulances — Emergency section
   Self-contained: delete this file + the AMBULANCE blocks in index.html to revert.
   ======================================== */

.ambulance {
  --amb-red: var(--danger);
  --amb-red-glow: rgba(239, 68, 68, 0.45);
  --amb-bg: #07192b;
  --amb-card: rgba(255, 255, 255, 0.05);
  --amb-card-border: rgba(255, 255, 255, 0.1);
  --amb-text: rgba(255, 255, 255, 0.72);

  background: var(--amb-bg);
  color: var(--white);
  padding-top: 0;
  overflow: hidden;
}

.ambulance h2,
.ambulance h3,
.ambulance h4 {
  color: var(--white);
}

/* --- ECG divider --- */
.amb-ecg {
  position: absolute;
  top: 15px;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 3;
  opacity: .3;
  pointer-events: none;
}

.amb-ecg svg {
  width: 100%;
  height: 100%;
}

.amb-ecg path {
  fill: none;
  stroke: var(--amb-red);
  stroke-width: 2;
  stroke-dasharray: 1600;
  stroke-dashoffset: 1600;
  filter: drop-shadow(0 0 6px var(--amb-red-glow));
}

.ambulance.in-view .amb-ecg path {
  animation: ambEcg 2.4s ease-out forwards;
}

@keyframes ambEcg {
  to {
    stroke-dashoffset: 0;
  }
}

/* --- Live dot (also used in nav) --- */
.amb-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: ambPulse 1.6s infinite;
  flex-shrink: 0;
}

@keyframes ambPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.nav a.nav-emergency {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* --- Hero block --- */
.amb-hero {
  position: relative;
  min-height: 640px;
  display: flex;
  align-items: center;
  padding: 80px 0;
}

.amb-hero-media,
.amb-hero-overlay {
  position: absolute;
  inset: 0;
}

.amb-hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.amb-hero-overlay {
  background:
    linear-gradient(90deg, rgba(7, 25, 43, 0.96) 0%, rgba(7, 25, 43, 0.8) 45%, rgba(7, 25, 43, 0.35) 100%),
    linear-gradient(0deg, var(--amb-bg) 0%, transparent 30%);
}

.amb-hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
}

.amb-hero-content {
  max-width: 600px;
}

.amb-logo {
  width: 150px;
  height: auto;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}

.amb-live {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #fca5a5;
  padding: 6px 18px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 30px;
  margin-bottom: 18px;
}

.amb-hero h2 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
}

.amb-hero h2 span {
  color: var(--amb-red);
}

.amb-hero p {
  font-size: 1.1rem;
  color: var(--amb-text);
  margin-bottom: 32px;
}

.amb-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.amb-btn-call {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 34px;
  background: linear-gradient(135deg, #f87171, var(--amb-red));
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 50px;
  box-shadow: 0 6px 25px var(--amb-red-glow);
  transition: all var(--transition-normal);
}

.amb-btn-call:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 35px rgba(239, 68, 68, 0.6);
}

.amb-btn-call i {
  animation: ambRing 2.5s infinite;
}

@keyframes ambRing {

  0%,
  80%,
  100% {
    transform: rotate(0);
  }

  84%,
  92% {
    transform: rotate(-15deg);
  }

  88%,
  96% {
    transform: rotate(15deg);
  }
}

/* Badges */
.amb-badges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 56px;
  max-width: 820px;
}

.amb-badge {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--amb-card-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.amb-badge i {
  color: var(--amb-red);
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.amb-badge strong {
  font-family: var(--font-heading);
  font-size: 1.1rem;
}

.amb-badge span {
  font-size: 0.82rem;
  color: var(--amb-text);
}

/* --- Services --- */
.amb-services {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 40px;
}

.amb-service {
  padding: 32px 26px;
  background: var(--amb-card);
  border: 1px solid var(--amb-card-border);
  border-radius: var(--radius-lg);
  transition: transform var(--transition-normal), border-color var(--transition-normal), background var(--transition-normal);
}

.amb-service:hover {
  transform: translateY(-6px);
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.06);
}

.amb-service-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(239, 68, 68, 0.14);
  color: var(--amb-red);
  font-size: 1.4rem;
  margin-bottom: 20px;
}

.amb-service h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.amb-service p {
  font-size: 0.92rem;
  color: var(--amb-text);
  line-height: 1.65;
}

/* --- Shared subtitles --- */
.amb-subtitle {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
}

.amb-lead {
  text-align: center;
  color: var(--amb-text);
  margin-bottom: 40px;
}

.amb-timeline-wrap,
.amb-reels-wrap,
.amb-gallery-wrap {
  margin-top: 100px;
}

/* --- Timeline --- */
.amb-timeline {
  --amb-progress: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 48px;
  position: relative;
}

.amb-timeline::before,
.amb-timeline::after {
  content: '';
  position: absolute;
  top: 27px;
  left: 12.5%;
  right: 12.5%;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}

.amb-timeline::after {
  background: linear-gradient(90deg, #f87171, var(--amb-red));
  box-shadow: 0 0 12px var(--amb-red-glow);
  transform-origin: left;
  transform: scaleX(var(--amb-progress));
  transition: transform 0.15s linear;
}

.amb-step {
  text-align: center;
  position: relative;
  z-index: 1;
}

.amb-step-dot {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--amb-bg);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: var(--amb-text);
  font-size: 1.1rem;
  transition: all var(--transition-slow);
}

.amb-step.active .amb-step-dot {
  border-color: var(--amb-red);
  color: var(--white);
  background: var(--amb-red);
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.15);
}

.amb-step h4 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.amb-step p {
  font-size: 0.88rem;
  color: var(--amb-text);
  max-width: 220px;
  margin: 0 auto;
}

/* --- Reels --- */
.amb-reels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 280px));
  justify-content: center;
  gap: 32px;
}

.amb-reel {
  margin: 0;
}

.amb-reel-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  padding: 0;
  border: 6px solid #1c2c3e;
  border-radius: 32px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transition: transform var(--transition-normal);
}

.amb-reel-frame:hover {
  transform: translateY(-6px);
}

.amb-reel-frame img,
.amb-reel-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.amb-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: var(--white);
  font-size: 1.3rem;
  box-shadow: 0 0 0 10px rgba(239, 68, 68, 0.25);
  transition: transform var(--transition-fast);
}

.amb-play i {
  margin-left: 4px;
}

.amb-reel-frame:hover .amb-play {
  transform: scale(1.1);
}

.amb-reel-frame.playing .amb-play,
.amb-reel-frame.playing img {
  display: none;
}

.amb-reel figcaption {
  display: flex;
  flex-direction: column;
  text-align: center;
  margin-top: 16px;
}

.amb-reel figcaption strong {
  font-family: var(--font-heading);
  font-size: 0.95rem;
}

.amb-reel figcaption span {
  font-size: 0.85rem;
  color: var(--amb-text);
}

/* --- Gallery --- */
.amb-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  grid-auto-flow: dense;
  gap: 16px;
  margin-top: 40px;
}

.amb-g {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0d2338;
}

.amb-g-wide {
  grid-column: span 2;
}

.amb-g-tall {
  grid-row: span 2;
}

.amb-g img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow), filter var(--transition-slow);
}

.amb-g::after {
  content: '\f00e';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  color: var(--white);
  background: rgba(7, 25, 43, 0.45);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.amb-g:hover img {
  transform: scale(1.06);
}

.amb-g:hover::after {
  opacity: 1;
}

/* --- Lightbox --- */
.amb-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 12, 22, 0.94);
  padding: 24px;
}

.amb-lightbox[hidden] {
  display: none;
}

.amb-lightbox img {
  max-width: min(1100px, 100%);
  max-height: 88vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
}

.amb-lb-close,
.amb-lb-nav {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.amb-lb-close:hover,
.amb-lb-nav:hover {
  background: var(--amb-red);
}

.amb-lb-close {
  top: 20px;
  right: 20px;
}

.amb-lb-nav {
  top: 50%;
  transform: translateY(-50%);
}

.amb-lb-nav.prev {
  left: 20px;
}

.amb-lb-nav.next {
  right: 20px;
}

/* --- Mobile sticky call --- */
.amb-sticky-call {
  display: none;
}

/* --- Responsive --- */
@media (max-width: 1024px) {

  .amb-services,
  .amb-badges {
    grid-template-columns: repeat(2, 1fr);
  }

  .amb-hero h2 {
    font-size: 2.5rem;
  }
}

@media (max-width: 768px) {
  .amb-hero {
    min-height: auto;
    padding: 100px 0 60px;
  }

  .amb-hero-overlay {
    background: linear-gradient(0deg, var(--amb-bg) 0%, rgba(7, 25, 43, 0.85) 60%, rgba(7, 25, 43, 0.6) 100%);
  }

  .amb-hero h2 {
    font-size: 2rem;
  }

  .amb-cta a {
    flex: 1 1 100%;
    justify-content: center;
  }

  .amb-subtitle {
    font-size: 1.6rem;
  }

  .amb-timeline-wrap,
  .amb-reels-wrap,
  .amb-gallery-wrap {
    margin-top: 72px;
  }

  /* Vertical timeline */
  .amb-timeline {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-left: 8px;
  }

  .amb-timeline::before,
  .amb-timeline::after {
    top: 28px;
    bottom: 28px;
    left: 35px;
    right: auto;
    width: 3px;
    height: auto;
  }

  .amb-timeline::after {
    transform-origin: top;
    transform: scaleY(var(--amb-progress));
  }

  .amb-step {
    display: grid;
    grid-template-columns: 56px 1fr;
    column-gap: 18px;
    text-align: left;
  }

  .amb-step-dot {
    grid-row: span 2;
    margin: 0;
  }

  .amb-step p {
    margin: 0;
    max-width: none;
  }

  /* Reels become a swipe carousel */
  .amb-reels {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    margin: 0 -24px;
    padding: 0 24px 12px;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .amb-reels::-webkit-scrollbar {
    display: none;
  }

  .amb-reel {
    flex: 0 0 68%;
    scroll-snap-align: center;
  }

  .amb-gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 150px;
    gap: 10px;
  }

  .amb-lb-nav {
    top: auto;
    bottom: 20px;
    transform: none;
  }

  .amb-sticky-call {
    position: fixed;
    left: 16px;
    right: 84px; /* leave room for the scroll-top button */
    bottom: 24px;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 50px;
    background: var(--amb-red);
    color: var(--white);
    font-family: var(--font-heading);
    font-weight: 700;
    box-shadow: 0 10px 30px var(--amb-red-glow);
    transform: translateY(140%);
    transition: transform var(--transition-normal);
  }

  .amb-sticky-call .amb-live-dot {
    background: var(--white);
  }

  .ambulance.in-view .amb-sticky-call {
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .amb-badges {
    gap: 10px;
  }

  .amb-badge {
    padding: 14px;
  }

  .amb-service {
    padding: 26px 22px;
  }

  .amb-services {
    grid-template-columns: 1fr;
  }
}

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

  .amb-live-dot,
  .amb-btn-call i {
    animation: none;
  }

  .ambulance.in-view .amb-ecg path {
    animation: none;
    stroke-dashoffset: 0;
  }
}
