/* ============================================================================
   TODAY PAIN SECTION
   Dark navy ops-board. Red scan line is the team scrambling — it never stops.
   Each pass uncovers more dysfunction: censor, severity tags, cover-up quotes
   with real role attributions. By pass 3 the section is a war room of red.
   "OUR SYSTEMS FIX THIS." cuts through the center.
   ============================================================================ */

.today-pain {
  background: var(--color-bg-dark);
  padding: var(--space-3xl) 0;
  width: 100%;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 rgba(239, 68, 68, 0);
  transition: box-shadow 2s var(--ease-default);
}

/* Red vignette intensifies with chaos */
.today-pain--pass-2 {
  box-shadow: inset 0 0 100px rgba(239, 68, 68, 0.03);
}

.today-pain--pass-3 {
  box-shadow: inset 0 0 200px rgba(239, 68, 68, 0.09);
}

/* Red ambient glow — warning lights casting down, always present */
.today-pain::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(239, 68, 68, 0.08) 0%, transparent 100%);
  pointer-events: none;
  transition: background 1.5s var(--ease-default);
}

/* Pass 3 CLIMAX — crisis level red */
.today-pain--pass-3::before {
  background: radial-gradient(ellipse 100% 70% at 50% 0%, rgba(239, 68, 68, 0.18) 0%, transparent 100%);
}

/* --------------------------------------------------------------------------
   GRID BLEED — Testament lattice rendered in red via canvas.
   Same 52px cells, icons, labels — but failing. Sides only.
   -------------------------------------------------------------------------- */

#today-pain-grid-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
}

/* --------------------------------------------------------------------------
   SCAN LINE — The team scrambling. Gets more intense each pass.
   -------------------------------------------------------------------------- */

/* GPU-composited: animates transform (not top) so zero layout thrash.
   --pain-h is set from JS to the section's actual pixel height. */
.today-pain--visible::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(239, 68, 68, 0.2) 15%,
    rgba(239, 68, 68, 0.6) 50%,
    rgba(239, 68, 68, 0.2) 85%,
    transparent 100%);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3), 0 0 4px rgba(239, 68, 68, 0.5);
  will-change: transform, opacity;
  animation: today-pain-scan 4s linear 3 forwards;
  pointer-events: none;
  z-index: 1;
  transition: box-shadow 0.5s;
}

/* Scan intensifies with each pass */
.today-pain--pass-2::after {
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4), 0 0 8px rgba(239, 68, 68, 0.6);
}

.today-pain--pass-3::after {
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.5), 0 0 12px rgba(239, 68, 68, 0.7);
}

@keyframes today-pain-scan {
  0% { transform: translateY(0); opacity: 0; }
  5% { opacity: 1; }
  95% { opacity: 1; }
  100% { transform: translateY(var(--pain-h, 100vh)); opacity: 0; }
}

.today-pain__content {
  max-width: var(--max-width-full);
  margin: 0 auto;
  padding: 0 var(--space-md);
  position: relative;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   HEADLINE — "TODAY."
   -------------------------------------------------------------------------- */

.today-pain__headline {
  font-family: 'NewPanamSkyline', var(--font-sans);
  font-size: var(--text-5xl);
  font-weight: var(--weight-black);
  color: var(--color-text-inverse);
  text-transform: uppercase;
  letter-spacing: var(--tracking-tighter);
  line-height: var(--leading-none);
  margin: 0;
  opacity: 0;
  transform: translateY(16px);
}

.today-pain--visible .today-pain__headline {
  animation: today-pain-reveal 0.6s var(--ease-snappy) forwards;
}

/* Red pulsing period — alert LED */
.today-pain__dot {
  display: inline-block;
  color: #ef4444;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.6), 0 0 40px rgba(239, 68, 68, 0.3);
  animation: today-pain-dot-pulse 2s ease-in-out infinite;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Micro-interaction: dot flares when scan line crosses it */
.today-pain__dot--hit {
  transform: scale(1.8);
}

@keyframes today-pain-dot-pulse {
  0%, 100% { text-shadow: 0 0 20px rgba(239, 68, 68, 0.6), 0 0 40px rgba(239, 68, 68, 0.3); }
  50% { text-shadow: 0 0 30px rgba(239, 68, 68, 0.9), 0 0 60px rgba(239, 68, 68, 0.5), 0 0 80px rgba(239, 68, 68, 0.2); }
}

/* --------------------------------------------------------------------------
   SUBHEAD — Frames the chaos. Makes it personal.
   -------------------------------------------------------------------------- */

.today-pain__subhead {
  font-size: var(--text-lg);
  font-weight: var(--weight-light);
  color: var(--color-text-muted);
  margin: var(--space-sm) 0 var(--space-2xl);
  opacity: 0;
  transform: translateY(12px);
}

.today-pain--visible .today-pain__subhead {
  animation: today-pain-reveal 0.5s var(--ease-snappy) 0.2s forwards;
}

/* --------------------------------------------------------------------------
   PAIN CARDS — Ops dashboard rows
   -------------------------------------------------------------------------- */

.today-pain__cards {
  display: flex;
  flex-direction: column;
}

.today-pain__card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
  border-bottom: 1px solid var(--color-border-dark);
  opacity: 0;
  transform: translateY(12px);
  transition: border-color 0.6s var(--ease-default);
}

.today-pain__card:first-child {
  border-top: 1px solid var(--color-border-dark);
}

.today-pain__card:last-child {
  border-bottom: none;
}

/* CLIMAX — borders flare red, section at crisis level */
.today-pain--pass-3 .today-pain__card {
  border-color: rgba(239, 68, 68, 0.3);
}

/* Card reveal — controlled by TS for sequential pacing */
.today-pain__card--active {
  animation: today-pain-reveal 0.5s var(--ease-snappy) forwards;
}

@keyframes today-pain-reveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   ICON COLUMN — Pictogram + system code badge
   -------------------------------------------------------------------------- */

.today-pain__icon-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  width: 5rem;
}

.today-pain__icon {
  width: 3rem;
  height: 3rem;
  opacity: 0.6;
  /* Red tint via CSS filter — maps black SVG paths to red */
  filter: invert(28%) sepia(90%) saturate(2000%) hue-rotate(340deg) brightness(95%);
  transition: opacity 0.6s var(--ease-default), filter 0.6s var(--ease-default);
}

.today-pain__icon svg {
  width: 100%;
  height: 100%;
}

/* Icons intensify as chaos mounts */
.today-pain--pass-2 .today-pain__icon {
  opacity: 0.7;
}

.today-pain--pass-3 .today-pain__icon {
  opacity: 0.85;
  filter: invert(28%) sepia(90%) saturate(2500%) hue-rotate(340deg) brightness(100%);
}

.today-pain__badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: rgba(239, 68, 68, 0.6);
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 0.1em 0.5em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: today-pain-badge-pulse 3s ease-in-out infinite;
}

.today-pain__badge--empty {
  color: var(--color-border-dark);
  border-color: var(--color-border-dark);
  animation: none;
}

@keyframes today-pain-badge-pulse {
  0%, 100% { border-color: rgba(239, 68, 68, 0.25); box-shadow: none; }
  50% { border-color: rgba(239, 68, 68, 0.45); box-shadow: 0 0 12px rgba(239, 68, 68, 0.08); }
}

/* --------------------------------------------------------------------------
   TEXT — Quote + cost
   -------------------------------------------------------------------------- */

.today-pain__text {
  flex: 1;
  min-width: 0;
}

.today-pain__quote {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  color: var(--color-text-inverse);
  line-height: var(--leading-snug);
  margin: 0;
}

/* --------------------------------------------------------------------------
   SYSTEM TAGS — [SEV-0], [BLAME: SUPPLIER], etc.
   Monospace red badges, revealed by scan passes
   -------------------------------------------------------------------------- */

.today-pain__tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: rgba(239, 68, 68, 0.8);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.1em 0.4em;
  margin-left: var(--space-sm);
  display: inline-block;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.3s var(--ease-default), transform 0.3s var(--ease-snappy);
  white-space: nowrap;
}

/* Geometry-triggered reveals — JS adds .tp-revealed at scan intersection */
[data-pass].tp-revealed {
  opacity: 1;
  transform: translateX(0);
}

/* --------------------------------------------------------------------------
   COVER-UP QUOTES — Staff hiding shit from management.
   Role attribution makes it personal. Bold red treatment.
   -------------------------------------------------------------------------- */

.today-pain__coverup {
  font-size: var(--text-base);
  font-style: italic;
  font-weight: var(--weight-medium);
  color: rgba(239, 68, 68, 0.7);
  margin: var(--space-sm) 0 0;
  padding-left: var(--space-md);
  border-left: 2px solid rgba(239, 68, 68, 0.35);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.4s var(--ease-default), transform 0.4s var(--ease-snappy);
}

.today-pain__coverup-role {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-style: normal;
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: rgba(239, 68, 68, 0.45);
  margin-right: var(--space-xs);
}

/* --------------------------------------------------------------------------
   KINETIC TYPOGRAPHY — Word-by-word speech reveal
   -------------------------------------------------------------------------- */

.tpw {
  opacity: 0;
  display: inline;
  transition: opacity 0.08s var(--ease-default);
}

.tpw--visible {
  opacity: 1;
}

/* Letter-by-letter emphasis — spaced out for staccato punch */
.tpw--letter {
  margin-right: 0.06em;
  font-weight: var(--weight-bold);
}

/* Stress words — slightly bolder delivery */
.tpw--stress {
  color: rgba(255, 255, 255, 0.95);
}

/* Cost lines — hidden until quote finishes typing */
.today-pain__cost {
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
  margin: var(--space-xs) 0 0;
  opacity: 0;
  transition: opacity 0.3s var(--ease-default);
}

.today-pain__cost--visible {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   SELF-CENSORING — "fuck" → "f***"
   -------------------------------------------------------------------------- */

.today-pain__censor {
  position: relative;
  display: inline;
}

.today-pain__censor--flash {
  background: rgba(239, 68, 68, 0.4);
  animation: today-pain-censor-glitch 0.2s steps(3) forwards;
}

.today-pain__censor--done {
  color: var(--color-text-muted);
}

@keyframes today-pain-censor-glitch {
  0% { opacity: 1; background: rgba(239, 68, 68, 0.4); }
  33% { opacity: 0.3; background: rgba(239, 68, 68, 0.6); }
  66% { opacity: 1; background: rgba(239, 68, 68, 0.2); }
  100% { opacity: 1; background: transparent; }
}

/* --------------------------------------------------------------------------
   BRIDGE — Belief shift. Calm voice cutting through the chaos.
   -------------------------------------------------------------------------- */

.today-pain__bridge {
  font-size: var(--text-xl);
  font-weight: var(--weight-light);
  color: var(--color-text-inverse);
  text-align: center;
  margin: var(--space-2xl) auto 0;
  max-width: var(--max-width-prose);
  line-height: var(--leading-snug);
  opacity: 0;
  transform: translateY(12px);
}

.today-pain__bridge--visible {
  animation: today-pain-reveal 0.8s var(--ease-snappy) forwards;
}

/* Blue beam — expanding underline, mirrors the red scan aesthetic */
.today-pain__bridge::after {
  content: '';
  display: block;
  height: 2px;
  margin: var(--space-md) auto 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.2) 15%,
    rgba(59, 130, 246, 0.6) 50%,
    rgba(59, 130, 246, 0.2) 85%,
    transparent 100%);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3), 0 0 4px rgba(59, 130, 246, 0.5);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.today-pain__bridge--beam::after {
  transform: scaleX(1);
}

/* --------------------------------------------------------------------------
   FIX HEADLINE — "MINDFRONT FIXES THIS." centered
   -------------------------------------------------------------------------- */

.today-pain__fix {
  font-family: 'NewPanamSkyline', var(--font-sans);
  font-size: var(--text-5xl);
  font-weight: var(--weight-black);
  color: var(--color-text-inverse);
  text-transform: uppercase;
  letter-spacing: var(--tracking-tighter);
  line-height: var(--leading-none);
  margin: var(--space-2xl) 0 0;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
}

.today-pain__fix--visible {
  animation: today-pain-fix-reveal 0.8s var(--ease-snappy) forwards;
}

@keyframes today-pain-fix-reveal {
  0% { opacity: 0; transform: translateY(12px); text-shadow: 0 0 0 transparent; }
  40% { opacity: 1; transform: translateY(0); text-shadow: 0 0 60px rgba(59, 130, 246, 0.5), 0 0 120px rgba(59, 130, 246, 0.25); }
  100% { opacity: 1; transform: translateY(0); text-shadow: 0 0 40px rgba(59, 130, 246, 0.15); }
}

/* Hanging punctuation — dot doesn't shift the visual center of the text */
.today-pain__fix-dot {
  display: inline-block;
  width: 0;
  overflow: visible;
  margin-left: 0.25rem;
  color: #3b82f6;
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.6), 0 0 40px rgba(59, 130, 246, 0.3);
  animation: today-pain-fix-dot-pulse 2s ease-in-out infinite;
}

@keyframes today-pain-fix-dot-pulse {
  0%, 100% { text-shadow: 0 0 20px rgba(59, 130, 246, 0.6), 0 0 40px rgba(59, 130, 246, 0.3); }
  50% { text-shadow: 0 0 30px rgba(59, 130, 246, 0.9), 0 0 60px rgba(59, 130, 246, 0.5), 0 0 80px rgba(59, 130, 246, 0.2); }
}


/* --------------------------------------------------------------------------
   MOBILE — 768px
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .today-pain {
    padding: var(--space-3xl) 0;
  }

  #today-pain-grid-canvas {
    display: none;
  }

  .today-pain__headline {
    font-size: var(--text-4xl);
  }

  .today-pain__subhead {
    font-size: var(--text-base);
    margin-bottom: var(--space-2xl);
  }

  .today-pain__card {
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-lg) 0;
  }

  .today-pain__icon-col {
    flex-direction: row;
    width: auto;
    gap: var(--space-sm);
  }

  .today-pain__icon {
    width: 2rem;
    height: 2rem;
  }

  .today-pain__quote {
    font-size: var(--text-base);
  }

  .today-pain__cost {
    font-size: var(--text-sm);
  }

  .today-pain__tag {
    display: block;
    margin-left: 0;
    margin-top: var(--space-xs);
    width: fit-content;
  }

  .today-pain__coverup {
    font-size: var(--text-sm);
  }

  .today-pain__bridge {
    font-size: var(--text-lg);
    margin-top: var(--space-2xl);
  }

  .today-pain__bridge::after {
    height: 1px;
    margin-top: var(--space-sm);
  }

  .today-pain__fix {
    font-size: var(--text-4xl);
    margin-top: var(--space-lg);
  }
}
