/* clinic-intro.css — Cinematic overlay v3
 * Z-index: 10002+. Reduced-motion: hidden.
 * Features: animated mesh bg, glass doors, phone mockup, ECG
 */

@media (prefers-reduced-motion: reduce) {
  .ch-intro { display: none !important; }
}

.ch-intro {
  position: fixed;
  inset: 0;
  z-index: 10002;
  overflow: hidden;
  background: #071f1d;
}

.ch-intro--locked,
.ch-intro--locked body {
  overflow: hidden !important;
}

/* ── Animated gradient mesh ── */
.ch-intro__mesh {
  position: absolute;
  inset: -50%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(15,118,110,0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(15,212,165,0.2) 0%, transparent 40%),
    radial-gradient(ellipse at 60% 80%, rgba(15,118,110,0.3) 0%, transparent 50%);
  animation: ch-mesh-rotate 8s linear infinite;
}

@keyframes ch-mesh-rotate {
  0%   { transform: rotate(0deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1.2); }
}

/* ── Ambient particles ── */
.ch-intro__ambient {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ch-intro__particle {
  position: absolute;
  opacity: 0;
  animation: ch-particle-drift 6s ease-in-out infinite;
}

@keyframes ch-particle-drift {
  0%   { opacity: 0; transform: translateY(30px) rotate(0deg) scale(0.8); }
  15%  { opacity: 0.25; }
  85%  { opacity: 0.25; }
  100% { opacity: 0; transform: translateY(-50px) rotate(60deg) scale(1.1); }
}

/* ── Ceiling flash ── */
.ch-intro__flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 100% 60% at 50% 0%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.3) 35%, transparent 70%);
  opacity: 0;
  z-index: 10000;
  pointer-events: none;
}

.ch-intro__flash--fire {
  animation: ch-flash 900ms ease-out forwards;
}

@keyframes ch-flash {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  30%  { opacity: 0.7; }
  100% { opacity: 0; }
}

/* ── Doors ── */
.ch-intro__door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.03) 50%, rgba(255,255,255,0.06) 100%);
  border: 1px solid rgba(255,255,255,0.12);
  overflow: hidden;
  will-change: transform;
  box-shadow: inset 0 0 80px rgba(15,212,165,0.03);
}

.ch-intro__door--left {
  left: 0;
  border-right: 1.5px solid rgba(255,255,255,0.2);
}

.ch-intro__door--right {
  right: 0;
  border-left: 1.5px solid rgba(255,255,255,0.2);
}

.ch-intro__handle {
  position: absolute;
  top: 50%;
  width: 4px;
  height: 80px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.3), rgba(255,255,255,0.1));
  border-radius: 2px;
  box-shadow: 0 0 16px rgba(15,212,165,0.15);
}

.ch-intro__door--left .ch-intro__handle { right: 28px; }
.ch-intro__door--right .ch-intro__handle { left: 28px; }

.ch-intro__door--slide-left {
  animation: ch-door-left 1400ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.ch-intro__door--slide-right {
  animation: ch-door-right 1400ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes ch-door-left  { to { transform: translateX(-105%); } }
@keyframes ch-door-right { to { transform: translateX(105%); } }

/* ── Logo on doors ── */
.ch-intro__logo {
  position: absolute;
  top: 50%;
  width: 100%;
  height: 56px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  filter: brightness(2) blur(0.3px);
  pointer-events: none;
}

.ch-intro__logo img {
  height: 48px;
  width: auto;
  filter: drop-shadow(0 0 24px rgba(15,212,165,0.4));
}

.ch-intro__door--left .ch-intro__logo  { justify-content: flex-end; }
.ch-intro__door--right .ch-intro__logo { justify-content: flex-start; }

/* ── Center content (tagline + phone) ── */
.ch-intro__center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10003;
  display: flex;
  align-items: center;
  gap: 48px;
  opacity: 0;
  pointer-events: none;
}

.ch-intro__center--show {
  animation: ch-center-in 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ch-center-in {
  0%   { opacity: 0; transform: translate(-50%, -45%) scale(0.92); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ── Tagline ── */
.ch-intro__tagline {
  text-align: center;
  white-space: nowrap;
}

.ch-intro__tagline-ar {
  font-family: 'Tajawal', sans-serif;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 30px rgba(0,0,0,0.5), 0 0 60px rgba(15,212,165,0.25);
  margin-bottom: 8px;
  direction: rtl;
}

.ch-intro__tagline-en {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 2px 30px rgba(0,0,0,0.5);
  letter-spacing: 0.04em;
}

/* ── Heartbeat ── */
.ch-intro__heartbeat {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  opacity: 0;
}

.ch-intro__heartbeat--show {
  animation: ch-hb-in 500ms ease-out forwards;
}

@keyframes ch-hb-in {
  0%   { opacity: 0; transform: scale(0.7); }
  60%  { transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}

.ch-intro__heartbeat svg {
  filter: drop-shadow(0 0 16px rgba(15,212,165,0.6));
}

.ch-intro__beep-dot {
  r: 4;
  fill: #0fd4a5;
  filter: drop-shadow(0 0 8px #0fd4a5);
  opacity: 0;
}

.ch-intro__beep-dot--go {
  opacity: 1;
  animation: ch-beep-travel 1000ms ease-in-out forwards;
}

@keyframes ch-beep-travel {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Phone mockup ── */
.ch-intro__phone {
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(30px) rotateY(-15deg);
  perspective: 800px;
}

.ch-intro__phone--show {
  animation: ch-phone-in 1000ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ch-phone-in {
  0%   { opacity: 0; transform: translateY(30px) rotateY(-15deg); }
  100% { opacity: 1; transform: translateY(0) rotateY(-5deg); }
}

.ch-intro__phone-frame {
  width: 140px;
  height: 260px;
  background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 24px;
  border: 2px solid rgba(255,255,255,0.15);
  overflow: hidden;
  position: relative;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.5),
    0 0 40px rgba(15,212,165,0.15),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

.ch-intro__phone-notch {
  width: 50px;
  height: 6px;
  background: #000;
  border-radius: 3px;
  margin: 8px auto 0;
}

.ch-intro__phone-screen {
  padding: 12px 10px;
}

.ch-intro__screen-header {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #0fd4a5;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

.ch-intro__screen-stats {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.ch-intro__screen-stat {
  flex: 1;
  background: rgba(15,212,165,0.1);
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
}

.ch-intro__screen-stat-num {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.ch-intro__screen-stat-lbl {
  font-family: 'DM Sans', sans-serif;
  font-size: 6px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ch-intro__screen-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 80px;
  padding: 8px 4px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}

.ch-intro__screen-bar {
  flex: 1;
  background: linear-gradient(to top, #0f766e, #0fd4a5);
  border-radius: 3px 3px 0 0;
  animation: ch-bar-grow 800ms ease-out forwards;
  transform-origin: bottom;
  transform: scaleY(0);
}

@keyframes ch-bar-grow {
  to { transform: scaleY(1); }
}

.ch-intro__screen-bar:nth-child(1) { animation-delay: 1100ms; }
.ch-intro__screen-bar:nth-child(2) { animation-delay: 1200ms; }
.ch-intro__screen-bar:nth-child(3) { animation-delay: 1300ms; }
.ch-intro__screen-bar:nth-child(4) { animation-delay: 1400ms; }
.ch-intro__screen-bar:nth-child(5) { animation-delay: 1500ms; }
.ch-intro__screen-bar:nth-child(6) { animation-delay: 1600ms; }
.ch-intro__screen-bar:nth-child(7) { animation-delay: 1700ms; }

.ch-intro__phone-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(ellipse at center, rgba(15,212,165,0.3) 0%, transparent 70%);
  z-index: -1;
  animation: ch-phone-glow-pulse 2s ease-in-out infinite;
}

@keyframes ch-phone-glow-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 0.8; transform: scale(1.1); }
}

/* ── Fade out ── */
.ch-intro--fade-out {
  animation: ch-overlay-out 700ms ease-in-out forwards;
}

@keyframes ch-overlay-out {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Mobile: stack tagline + phone vertically ── */
@media (max-width: 640px) {
  .ch-intro__center {
    flex-direction: column;
    gap: 24px;
  }
  .ch-intro__phone-frame {
    width: 110px;
    height: 200px;
  }
}
