/* ============================================================
   CS-COMET — full-bleed scroll-pinned phase visualization
   Ported from L6 playground (Option C, milestone 2).
   Self-contained namespace `.cs-comet` to avoid index.html conflict.
   ============================================================ */

.cs-comet {
  position: relative;
  width: 100vw;
  margin-left: calc(-50vw + 50%); /* break out of any centered container */
  background: #000;
  color: #fff;
}

.cs-comet__head {
  max-width: 1080px;
  margin: 0 auto;
  text-align: center;
  padding: 80px 24px 40px;
}
.cs-comet__head .label-mono {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #FF4500;
  margin-bottom: 14px;
}
.cs-comet__head h2 {
  font-size: clamp(28px, 4vw, 56px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

/* Stage = full-bleed canvas. HUD hidden — floating tag carries phase info. */
.cs-comet__stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
}
.cs-comet__stage > .cs-comet__canvas { grid-column: 1; grid-row: 1; }
.cs-comet__stage > .cs-comet__connectors { grid-column: 1; grid-row: 1; }

.cs-comet__canvas {
  width: 100%;
  height: clamp(540px, 80vh, 900px);
  display: block;
  background: radial-gradient(ellipse at center, rgba(20,20,30,0.4) 0%, #000 70%);
}

/* HUD hidden — redundant with floating phase tag. Markup retained for JS hooks. */
.cs-comet__hud {
  display: none;
}
.cs-comet__hud-row {
  position: relative;
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 2px;
  background: rgba(8,8,10,0.55);
  opacity: 0.4;
  transition: opacity 350ms cubic-bezier(0.22,1,0.36,1),
              border-color 350ms cubic-bezier(0.22,1,0.36,1),
              background-color 350ms cubic-bezier(0.22,1,0.36,1),
              box-shadow 350ms cubic-bezier(0.22,1,0.36,1);
}
.cs-comet__hud-tick {
  width: 8px;
  background: rgba(255,255,255,0.12);
  border-radius: 1px;
  transition: background 350ms;
}
.cs-comet__hud-row.is-active {
  opacity: 1;
  border-color: rgba(255,69,0,0.55);
  background: rgba(20,8,4,0.85);
  box-shadow: 0 0 24px rgba(255,69,0,0.18), inset 0 0 0 1px rgba(255,69,0,0.12);
}
.cs-comet__hud-row.is-active .cs-comet__hud-tick { background: #FF4500; }
.cs-comet__hud-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 4px;
  display: block;
}
.cs-comet__hud-row.is-active .cs-comet__hud-label { color: #FF4500; }
.cs-comet__hud-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}
.cs-comet__hud-desc {
  font-size: 10.5px;
  line-height: 1.4;
  color: rgba(255,255,255,0.5);
}

/* Floating phase tag — projected above comet head in 3D space */
.cs-comet__tag {
  position: absolute;
  top: 0; left: 0;
  z-index: 4;
  pointer-events: none;
  width: 240px;
  padding: 14px 18px 16px;
  border: 1px solid rgba(255,69,0,0.45);
  border-radius: 2px;
  background: rgba(20,8,4,0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 18px rgba(255,69,0,0.22);
  opacity: 0;
  transition: opacity 220ms cubic-bezier(0.22,1,0.36,1);
  overflow: hidden;
}
.cs-comet__tag-inner { position: relative; z-index: 2; }
.cs-comet__tag-scan {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,69,0,0.9), transparent);
  box-shadow: 0 0 12px rgba(255,69,0,0.6);
  transform: translateY(-4px);
  opacity: 0;
  z-index: 3;
  pointer-events: none;
}
@keyframes csCometGlitchIn {
  0%   { opacity: 0; clip-path: inset(0 100% 0 0); filter: blur(2px); }
  18%  { opacity: 0.6; clip-path: inset(45% 20% 35% 25%); filter: blur(1px); }
  32%  { opacity: 0.9; clip-path: inset(10% 0 60% 8%); }
  46%  { opacity: 0.4; clip-path: inset(55% 4% 0 0); filter: blur(0.5px); }
  62%  { opacity: 0.95; clip-path: inset(0 8% 18% 0); }
  78%  { opacity: 1; clip-path: inset(0 0 0 0); filter: blur(0); }
  100% { opacity: 1; clip-path: inset(0 0 0 0); filter: blur(0); }
}
@keyframes csCometScanSweep {
  0%   { opacity: 0; transform: translateY(-4px); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(100%); }
}
.cs-comet__tag.is-glitching .cs-comet__tag-inner {
  animation: csCometGlitchIn 520ms cubic-bezier(0.16,1,0.3,1) forwards;
}
.cs-comet__tag.is-glitching .cs-comet__tag-scan {
  animation: csCometScanSweep 520ms cubic-bezier(0.16,1,0.3,1) forwards;
}
.cs-comet__tag-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #FF4500;
  margin-bottom: 4px;
  display: block;
}
.cs-comet__tag-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  margin-bottom: 8px;
}
.cs-comet__tag-desc {
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255,255,255,0.7);
  white-space: normal;
}

/* SVG connector layer (kept for future use, currently unused) */
.cs-comet__connectors {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
}

/* Hidden scrub control — driven by ScrollTrigger */
.cs-comet__scrub {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Mobile fallback — collapse HUD column to bottom overlay, single active row */
@media (max-width: 768px) {
  .cs-comet__stage { grid-template-columns: 1fr; }
  .cs-comet__hud {
    position: absolute;
    bottom: 16px; left: 16px; right: 16px;
    grid-column: 1; grid-row: 1;
    align-self: end;
    padding: 12px 14px;
    background: rgba(8,8,10,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-left: none;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 2px;
    max-height: 220px;
    overflow: hidden;
  }
  .cs-comet__hud-row:not(.is-active) { display: none; }
  .cs-comet__tag { width: 200px; padding: 8px 10px 10px; }
}
