/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --space-deep: #060818;
  --space-navy: #0a0e27;
  --space-blue: #121a3a;
  --orange-glow: #ff6b1a;
  --orange-bright: #ff8c2a;
  --yellow-star: #ffd54f;
  --ice-blue: #7ec8e3;
  --ice-white: #e8f4fc;
  --chrome: #c0cdd8;
  --chrome-bright: #f0f6ff;
  --panel-bg: rgba(10, 14, 39, 0.75);
  --nebula-1: #1a3a6e;
  --nebula-2: #6e2a1a;
  --theme-color: #0a0e27;
  --font-display: "Orbitron", sans-serif;
  --font-body: "Rajdhani", sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--space-deep);
  color: var(--ice-white);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Starfield Canvas ── */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Nebula overlays ── */
.nebula {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
  animation: nebula-drift 20s ease-in-out infinite alternate;
}

.nebula-1 {
  width: 60vw;
  height: 60vw;
  max-width: 500px;
  max-height: 500px;
  background: radial-gradient(circle, var(--nebula-1, #1a3a6e) 0%, transparent 70%);
  top: -10%;
  right: -15%;
  transition: background 0.6s ease;
}

.nebula-2 {
  width: 50vw;
  height: 50vw;
  max-width: 400px;
  max-height: 400px;
  background: radial-gradient(circle, var(--nebula-2, #6e2a1a) 0%, transparent 70%);
  bottom: -5%;
  left: -10%;
  animation-delay: -10s;
  transition: background 0.6s ease;
}

@keyframes nebula-drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.1); }
}

/* ── Layout ── */
.site {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: 1.5rem 1.25rem 5rem;
  gap: 2rem;
  max-width: 980px;
  margin: 0 auto;
}

/* ── Hero / Logo ── */
.hero {
  display: flex;
  justify-content: center;
  width: 100%;
  animation: fade-up 0.8s ease both;
}

.logo-wrap {
  position: relative;
  width: min(85vw, 380px);
}

.logo-glow {
  position: absolute;
  inset: -15%;
  background: radial-gradient(
    ellipse at center,
    color-mix(in srgb, var(--orange-glow) 35%, transparent) 0%,
    color-mix(in srgb, var(--orange-bright) 10%, transparent) 40%,
    transparent 70%
  );
  animation: pulse-glow 3s ease-in-out infinite;
  pointer-events: none;
  transition: background 0.6s ease;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.logo {
  position: relative;
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 30px color-mix(in srgb, var(--orange-glow) 30%, transparent));
  animation: logo-float 6s ease-in-out infinite;
  transition: filter 0.6s ease;
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ── Mission Control Panel ── */
.mission-panel {
  position: relative;
  width: 100%;
  max-width: 700px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(192, 205, 216, 0.25);
  border-radius: 4px;
  padding: 1.5rem 1.25rem 1rem;
  animation: fade-up 0.8s ease both;
  overflow: hidden;
}

.mission-panel::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background:
    /* HUD grid */
    repeating-linear-gradient(
      90deg,
      rgba(126, 200, 227, 0.08) 0 1px,
      transparent 1px 14px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(126, 200, 227, 0.06) 0 1px,
      transparent 1px 14px
    ),
    /* warm scanning bloom */
    radial-gradient(
      circle at 18% 28%,
      color-mix(in srgb, var(--orange-glow) 22%, transparent) 0%,
      transparent 45%
    ),
    radial-gradient(
      circle at 80% 20%,
      color-mix(in srgb, var(--ice-blue) 16%, transparent) 0%,
      transparent 52%
    );
  opacity: 0.9;
  mix-blend-mode: screen;
}

.mission-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* subtle diagonal plating */
  background: repeating-linear-gradient(
    135deg,
    rgba(240, 246, 255, 0.04) 0 2px,
    transparent 2px 10px
  );
  opacity: 0.15;
}

.panel-border .corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--orange-glow);
  border-style: solid;
  z-index: 2;
}

.corner-tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.corner-tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.corner-bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.corner-br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.panel-header {
  text-align: center;
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 1;
}

.panel-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--orange-bright);
  display: block;
  margin-bottom: 0.25rem;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: linear-gradient(180deg, var(--ice-white), var(--ice-blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 18px rgba(126, 200, 227, 0.22);
}

.scan-line {
  position: absolute;
  left: -20%;
  width: 140%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--orange-glow) 60%, transparent),
    transparent
  );
  animation: scan 3s linear infinite;
  top: 100%;
  opacity: 0.75;
  z-index: 1;
  margin-top: 0.65rem;
}

@keyframes scan {
  0% { transform: translateX(-100%); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

.mission-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.75rem;
}

.mission-stat {
  position: relative;
  background: rgba(18, 26, 58, 0.6);
  border: 1px solid rgba(126, 200, 227, 0.15);
  border-radius: 3px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 1;
  align-items: center;
  text-align: center;
  box-shadow:
    inset 0 0 0 1px rgba(240, 246, 255, 0.04),
    0 0 30px rgba(10, 14, 39, 0.2);
}

.mission-stat::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05) 0%,
    transparent 35%,
    color-mix(in srgb, var(--orange-glow) 6%, transparent) 100%
  );
  opacity: 0.8;
}

.mission-stat-wide {
  grid-column: span 1;
}

.mission-stat-full {
  grid-column: 1 / -1;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--chrome);
  opacity: 0.8;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--chrome-bright);
  line-height: 1.2;
  letter-spacing: 0.02em;
  word-break: break-word;
  text-shadow:
    0 0 12px color-mix(in srgb, var(--ice-blue) 14%, transparent),
    0 0 26px color-mix(in srgb, var(--orange-glow) 8%, transparent);
  animation: hud-flicker 4.2s steps(1) infinite;
}

.stat-value-trip {
  font-size: 1.15rem;
  background: linear-gradient(90deg, var(--yellow-star), var(--orange-bright));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  word-break: break-word;
  text-shadow:
    0 0 18px color-mix(in srgb, var(--orange-glow) 25%, transparent),
    0 0 30px color-mix(in srgb, var(--yellow-star) 12%, transparent);
  animation: hud-flicker 3.6s steps(1) infinite;
}

.stat-value,
.stat-value-trip {
  position: relative;
}

@keyframes hud-flicker {
  0% { opacity: 0.98; }
  6% { opacity: 0.92; }
  9% { opacity: 1; }
  62% { opacity: 0.99; }
  70% { opacity: 0.88; }
  73% { opacity: 1; }
  100% { opacity: 0.98; }
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(192, 205, 216, 0.1);
  position: relative;
  z-index: 1;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-text {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--chrome);
  opacity: 0.6;
}

/* ── Action Buttons ── */
.action-buttons {
  display: flex;
  flex-direction: column; /* mobile first */
  gap: 0.85rem;
  width: 100%;
  max-width: 920px;
}

.action-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ice-white);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--orange-glow) 15%, transparent) 0%,
    rgba(18, 26, 58, 0.8) 50%,
    color-mix(in srgb, var(--orange-bright) 10%, transparent) 100%
  );
  border: 1px solid rgba(192, 205, 216, 0.3);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  animation: fade-up 0.8s ease both;
  -webkit-tap-highlight-color: transparent;
}

.action-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    var(--orange-glow),
    transparent 40%,
    transparent 60%,
    var(--chrome)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.btn-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--yellow-star) 40%, transparent));
}

.btn-text {
  flex: 1;
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  animation: btn-shimmer 4s ease-in-out infinite;
}

.action-btn:nth-child(2) .btn-shine { animation-delay: 1.3s; }
.action-btn:nth-child(3) .btn-shine { animation-delay: 2.6s; }

@keyframes btn-shimmer {
  0%, 100% { left: -100%; }
  50% { left: 150%; }
}

.action-btn:hover,
.action-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 0 20px color-mix(in srgb, var(--orange-glow) 35%, transparent),
    0 0 40px color-mix(in srgb, var(--orange-glow) 15%, transparent),
    inset 0 0 20px color-mix(in srgb, var(--orange-glow) 5%, transparent);
  border-color: var(--orange-glow);
  outline: none;
}

.action-btn:hover::before,
.action-btn:focus-visible::before {
  opacity: 1;
}

.action-btn:active {
  transform: translateY(0);
}

/* ── WhatsApp Comms Beacon ── */
.whatsapp-beacon {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem 0.7rem 0.85rem;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(
    135deg,
    rgba(37, 211, 102, 0.95) 0%,
    rgba(18, 140, 74, 0.95) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  box-shadow:
    0 4px 24px rgba(37, 211, 102, 0.4),
    0 0 40px rgba(37, 211, 102, 0.15);
  transition: transform 0.2s ease, box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  animation: fade-up 0.8s ease 0.5s both;
}

.whatsapp-beacon:hover,
.whatsapp-beacon:focus-visible {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 8px 32px rgba(37, 211, 102, 0.5),
    0 0 50px rgba(37, 211, 102, 0.2);
  outline: none;
}

.whatsapp-beacon-pulse {
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid rgba(37, 211, 102, 0.5);
  animation: beacon-pulse 2.5s ease-out infinite;
  pointer-events: none;
}

@keyframes beacon-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 0; }
}

.whatsapp-beacon-icon {
  display: flex;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
}

.whatsapp-beacon-label {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}

.whatsapp-beacon-tag {
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.9;
}

.whatsapp-beacon-name {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* ── Resource Viewer ── */
.view-page {
  min-height: 100dvh;
  background: var(--space-deep);
}

.view-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(6, 8, 24, 0.92);
  border-bottom: 1px solid rgba(192, 205, 216, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.view-back {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ice-blue);
  text-decoration: none;
  white-space: nowrap;
}

.view-back:hover,
.view-back:focus-visible {
  color: var(--orange-bright);
  outline: none;
}

.view-title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--chrome);
  opacity: 0.85;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - 52px);
  padding: 1rem;
}

.view-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--chrome);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.view-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(126, 200, 227, 0.2);
  border-top-color: var(--orange-glow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.view-image {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 80px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

.view-image[hidden],
.view-loading[hidden] {
  display: none;
}

/* ── Oops / Coming Soon Page ── */
.oops-site {
  justify-content: center;
  min-height: 100dvh;
}

.oops-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(192, 205, 216, 0.25);
  border-radius: 4px;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  animation: fade-up 0.8s ease both;
}

.oops-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--yellow-star) 50%, transparent));
  animation: logo-float 5s ease-in-out infinite;
}

.oops-title {
  font-size: clamp(1rem, 4.5vw, 1.35rem);
}

.oops-message {
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--chrome-bright);
  margin: 1.25rem 0 0.75rem;
  position: relative;
  z-index: 1;
}

.oops-message #oops-resource {
  color: var(--yellow-star);
  font-weight: 600;
}

.oops-submessage {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--chrome);
  opacity: 0.85;
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 1;
}

.oops-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.status-dot-warn {
  background: var(--yellow-star);
  box-shadow: 0 0 8px var(--yellow-star);
  animation: blink 1.5s ease-in-out infinite;
}

.oops-back-btn {
  width: 100%;
  justify-content: center;
  position: relative;
  z-index: 1;
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  animation: fade-up 0.8s ease both;
}

.site-footer p {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--chrome);
  opacity: 0.5;
}

/* ── Entrance animation ── */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive: larger screens ── */
@media (min-width: 480px) {
  .site {
    padding: 2.5rem 2rem 3rem;
    gap: 2.5rem;
  }

  .logo-wrap {
    width: min(70vw, 420px);
  }

  .mission-panel {
    padding: 2rem 1.75rem 1.25rem;
  }

  .panel-title {
    font-size: 1.25rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .stat-value-trip {
    font-size: 1.3rem;
  }

  .action-btn {
    font-size: 0.9rem;
    padding: 1.1rem 1.5rem;
  }
}

@media (max-width: 520px) {
  .mission-grid {
    grid-template-columns: 1fr;
  }

  .mission-stat-wide {
    grid-column: auto;
  }

  .mission-stat-full {
    grid-column: auto;
  }
}

@media (min-width: 700px) {
  .action-buttons {
    flex-direction: row;
    align-items: stretch;
    gap: 0.9rem;
  }

  .action-btn {
    flex-direction: row;
    align-items: center;
    text-align: left;
  }

  .action-btn {
    flex: 1;
    min-width: 0;
  }

  .btn-text {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
  }
}

@media (max-width: 699px) {
  .action-btn {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.55rem;
    padding: 1rem 1.1rem;
  }

  .btn-icon {
    margin: 0;
  }

  .btn-text {
    width: 100%;
    line-height: 1.15;
  }

  .whatsapp-beacon {
    right: 0.75rem;
    bottom: 0.75rem;
    padding: 0.65rem;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    justify-content: center;
  }

  .whatsapp-beacon-label {
    display: none;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .logo {
    animation: none;
  }
}
