/* Components: station card, node, status pill, rail, next pill, toast, featured card, dialog. */

/* Station card ------------------------------------------------------------ */
.station-card {
  display: grid;
  grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  transition: border-color 0.4s, box-shadow 0.4s;
}
.station[data-state="done"] .station-card { border-color: rgba(181, 245, 52, 0.3); }
.station[data-state="next"] .station-card {
  border-color: rgba(0, 221, 254, 0.5);
  box-shadow: 0 0 0 1px rgba(0, 221, 254, 0.14), 0 14px 40px rgba(0, 0, 0, 0.35);
}

.card-thumb {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--radius-thumb);
  background: #0b0f10;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.card-title {
  font: 700 clamp(19px, 1.9vw, 25px)/1.15 var(--font-body);
  letter-spacing: -0.01em;
}
.card-num { margin-right: 0.45em; font-family: var(--font-label); color: var(--lime); }
.card-dot { margin-right: 0.4em; color: var(--muted); }
.station[data-state="next"] .card-num { color: var(--cyan); }
.station[data-state="idle"] .card-num { color: var(--text); }
.card-kind { margin-top: 4px; color: var(--muted); font-size: 15px; }

/* Status pill ------------------------------------------------------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 14px/1 var(--font-body);
  transition: transform 0.2s var(--ease-out), background-color 0.2s, border-color 0.2s;
}
.status-pill svg { width: 16px; height: 16px; flex: none; fill: currentColor; }
.status-pill:hover { transform: translateY(-1px); }
.status-pill[data-state="done"] {
  color: var(--lime);
  border-color: rgba(181, 245, 52, 0.5);
  background: rgba(181, 245, 52, 0.12);
}
.status-pill[data-state="next"] {
  color: #031116;
  border-color: var(--cyan);
  background: var(--cyan);
  font-weight: 700;
}
.status-pill[data-state="idle"] {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.04);
}
.status-pill[data-state="idle"]:hover { border-color: var(--lime); }

/* Node -------------------------------------------------------------------- */
/* The outer box-shadow is the dark "pad" that is wider than the road, so the road looks like it
   passes *through* the node. (A z-index:-1 pseudo-element would paint over the node's own border.) */
.station-node {
  --ring: var(--idle);
  --glow: transparent;
  display: grid;
  place-items: center;
  border: 4px solid var(--ring);
  border-radius: 50%;
  background: #0a0e0f;
  box-shadow:
    0 0 0 8px rgba(7, 9, 10, 0.95),
    0 0 0 9px rgba(255, 255, 255, 0.07),
    0 0 28px 6px var(--glow);
  font: 700 clamp(17px, 1.5vw, 21px)/1 var(--font-label);
  color: var(--text);
  transition: border-color 0.4s, box-shadow 0.4s, transform 0.3s var(--ease-out);
}
.station[data-state="done"] .station-node { --ring: var(--lime); --glow: rgba(181, 245, 52, 0.45); }
.station[data-state="next"] .station-node { --ring: var(--cyan); --glow: rgba(0, 221, 254, 0.45); }
.station[data-state="next"] .station-node::after {
  position: absolute;
  inset: -12px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  content: "";
  animation: node-pulse 2.2s ease-out infinite;
}
.station.active .station-node { transform: scale(1.07); }

@keyframes node-pulse {
  from { transform: scale(1); opacity: 0.75; }
  to { transform: scale(1.6); opacity: 0; }
}

/* Rail -------------------------------------------------------------------- */
.rail {
  position: fixed;
  top: 50%;
  right: 20px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(-50%);
}
.rail a {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid #364139;
  border-radius: 50%;
  background: rgba(9, 14, 11, 0.9);
  font: 600 9px/1 var(--font-label);
  color: #8b9790;
  text-decoration: none;
  transition: all 0.25s;
}
.rail a.active { border-color: var(--lime); color: var(--lime); }
.rail a.completed { border-color: var(--lime); background: var(--lime); color: #0a1006; }

/* Next-stage pill ---------------------------------------------------------- */
.next-pill {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(140%);
  transition: transform 0.35s var(--ease-out), opacity 0.3s, visibility 0s 0.35s;
}
.next-pill.visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.next-pill-kicker {
  font: 600 10px/1 var(--font-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.next-pill b { color: var(--cyan); font-weight: 700; }

/* Toast ------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 60;
  width: max-content; /* a fixed, left:50% box would shrink-to-fit at half the viewport on phones */
  max-width: min(440px, calc(100% - 32px));
  padding: 13px 18px;
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--lime);
  border-radius: 10px;
  background: rgba(14, 20, 16, 0.96);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity 0.25s, transform 0.3s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Featured card (phone) ---------------------------------------------------- */
.featured-media {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #0b0f10;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.featured-media img { width: 100%; height: 100%; object-fit: cover; }
.featured-media:focus-visible { outline-offset: -4px; } /* the card clips overflow: keep the ring inside */
.play-disc {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.38);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.play-disc svg { width: 26px; height: 26px; margin-left: 3px; fill: #fff; }
.featured-body { padding: 16px 18px 20px; }
.featured-kicker {
  font: 700 13px/1 var(--font-label);
  letter-spacing: 0.14em;
  color: var(--cyan);
}
.featured-title { margin-top: 6px; font: 800 28px/1.1 var(--font-body); letter-spacing: -0.01em; }
.featured-teaser { margin-top: 6px; color: #cdd3d2; }
#featured-cta {
  width: 100%;
  justify-content: center;
  margin-top: 16px;
  padding: 15px;
  font-size: 17px;
}

/* Dialog ------------------------------------------------------------------ */
.dialog {
  width: min(760px, calc(100% - 28px));
  max-height: 90svh;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: rgba(12, 16, 18, 0.97);
  color: var(--text);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.6);
}
.dialog:not([open]) { display: none; }
.dialog-content h2:focus { outline: none; }
.dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 0.3s var(--ease-out);
}
.dialog::backdrop {
  background: rgba(3, 7, 4, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.dialog-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
#dialog-kicker {
  font: 700 11px/1 var(--font-label);
  letter-spacing: 0.16em;
  color: var(--lime);
}
.dialog-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: transparent;
  font-size: 22px;
  line-height: 1;
}
.dialog-close:hover { border-color: var(--lime); }
.dialog-content { padding: 22px; overflow: auto; }
.dialog-content h2 { font: 800 clamp(28px, 4vw, 40px)/1.05 var(--font-body); letter-spacing: -0.02em; }
.dialog-content p { margin-top: 12px; color: #b9c3c0; line-height: 1.7; }

/* Sticky footer: the primary actions stay reachable while a tall dialog scrolls. */
.dialog-actions {
  --dlg-pad: 22px;
  position: sticky;
  bottom: calc(var(--dlg-pad) * -1);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin: 24px 0 calc(var(--dlg-pad) * -1);
  padding: 16px 0 var(--dlg-pad);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(to top, rgba(12, 16, 18, 0.98) 75%, rgba(12, 16, 18, 0));
}
.dialog--cockpit .dialog-actions { --dlg-pad: 14px; }
.dialog-actions .button { padding: 12px 18px; font-size: 14px; }

/* Episode player */
.player {
  position: relative;
  width: min(100%, calc(46vh * 1.36));
  margin: 20px auto;
  aspect-ratio: 1088 / 800;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: #050708;
}
.player-video,
.player-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #050708;
}
.player-play {
  position: absolute;
  inset: 0;
  margin: auto;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  transition: transform 0.2s var(--ease-out), background-color 0.2s;
}
.player-play:hover { transform: scale(1.06); background: rgba(0, 0, 0, 0.55); }
.player-play svg { width: 30px; height: 30px; margin-left: 4px; fill: #fff; }
.player-label {
  position: absolute;
  left: 14px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  font: 600 10px/1 var(--font-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.player-error {
  position: absolute;
  inset: auto 0 0;
  margin: 0 !important;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--text) !important;
  font-size: 14px;
}

/* Interactive demos */
.prototype-note {
  display: block;
  margin-top: 12px;
  font: 500 11px/1.5 var(--font-body);
  letter-spacing: 0.02em;
  color: #778c7d !important;
}
label.prototype-note { margin-top: 16px; font: 600 10px/1 var(--font-label); letter-spacing: 0.14em; }

.demo-hotspots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.demo-hotspots button {
  padding: 9px 15px;
  border: 1px solid #415448;
  border-radius: 999px;
  background: #18251c;
  font-size: 13px;
  font-weight: 600;
}
.demo-hotspots button.selected {
  border-color: var(--lime);
  background: var(--lime);
  color: #0b1309;
}
.demo-panel {
  min-height: 84px;
  margin-top: 14px;
  padding: 16px 18px;
  border-left: 3px solid var(--cyan);
  border-radius: 4px 10px 10px 4px;
  background: #101a15;
  font-size: 14px;
  line-height: 1.6;
  color: #cdd8d0;
}

.preview-bars { display: grid; gap: 14px; margin-top: 18px; }
.preview-bars div { display: flex; align-items: center; gap: 14px; }
.preview-bars span { flex: none; width: 150px; font-size: 13px; color: #cdd3d2; }
.preview-bars i {
  display: block;
  height: 8px;
  border-radius: 6px;
  background: var(--cyan);
  transition: width 0.1s linear;
}
.preview-bars div:last-child i { background: var(--lime); }
.demo-range { width: 100%; margin-top: 10px; accent-color: var(--lime); }

.demo-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}
.demo-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: #b4c5b7; }
.demo-form input,
.demo-form select {
  width: 100%;
  padding: 12px;
  font-size: 16px; /* below 16px iOS Safari zooms the page on focus */
  border: 1px solid #3a4b3d;
  border-radius: 8px;
  background: #0b120d;
  color: var(--text);
}
.demo-form .button { justify-content: center; }
.demo-form output {
  grid-column: 1 / -1;
  padding: 14px 16px;
  border-radius: 10px;
  background: #162319;
  font-size: 14px;
  line-height: 1.6;
  color: #d3dfd6;
}

@media (max-width: 1100px) {
  .rail { right: 8px; }
}

@media (max-width: 760px) {
  .rail { display: none; }

  .station-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 10px;
    background: rgba(13, 17, 19, 0.86);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
  .card-body { padding: 0 4px 6px; }
  .status-pill { margin-top: 12px; }

  .next-pill {
    right: 16px;
    bottom: 16px;
    left: 16px;
    justify-content: center;
  }
  .toast { bottom: 84px; }

  .dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .demo-form .button { grid-column: 1 / -1; }
  .dialog-actions { flex-direction: column; }
  .dialog-actions .button { justify-content: center; width: 100%; }
  .preview-bars span { width: 110px; }
}
