/**
 * TimelineItem / kore-timeline-item — Flagship Enterprise CUBE CSS (Apple HIG Standard).
 * CLEANED: Applied Cube CSS Deep Cleanup – tokens, single declarations, unlayered sovereignty.
 * Timeline Step Node with Precision Marker Alignment, Motion Staging, and Card Sub-Consoles.
 *
 * @package WP_Kore
 */

@keyframes timelineItemRise {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

:is(.oxy-kore-timeline-item-container, div[class*="oxy-kore-timeline-item-container"], div[class*="oxy-kore-timeline-item"]) {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:is(.timeline-item, .oxy-kore-timeline-item-container > .timeline-item) {
  /* ── Local Control Panel ── */
  --local-col-marker: 2.5rem;
  --local-gap: var(--space-md);
  --local-item-cols: var(--local-col-marker) 1fr;
  --local-content-pad: clamp(var(--space-md), 2.5vw, var(--space-lg));
  --local-intent: var(--brand);

  --local-dot-size: 2.25rem;
  --local-dot-bg: var(--surface-elevated);
  --local-dot-color: var(--text-muted);
  --local-dot-border: 2px solid var(--surface-border);
  --local-dot-shadow: none;
  --local-dot-scale: scale(1);

  --local-content-bg: var(--surface-elevated);
  --local-content-border: 1px solid var(--surface-border);
  --local-content-shadow: inset 0 1px 0 0 oklch(100% 0 0 / 15%), var(--shadow-sm);
  --local-content-transform: translateY(0);

  display: grid;
  grid-template-columns: var(--local-item-cols);
  gap: var(--local-gap);
  align-items: start;
  width: 100%;
  position: relative;
  box-sizing: border-box;
  outline: none;
  animation: timelineItemRise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Staggered Entrance Motion */
.timeline-item:nth-child(1) { animation-delay: 0.05s; }
.timeline-item:nth-child(2) { animation-delay: 0.12s; }
.timeline-item:nth-child(3) { animation-delay: 0.19s; }
.timeline-item:nth-child(4) { animation-delay: 0.26s; }
.timeline-item:nth-child(5) { animation-delay: 0.33s; }
.timeline-item:nth-child(6) { animation-delay: 0.40s; }
.timeline-item:nth-child(7) { animation-delay: 0.47s; }
.timeline-item:nth-child(8) { animation-delay: 0.54s; }

/* Hide raw meta column when embedded in single-track card mode */
:is(.timeline-item__meta, .timeline-meta) {
  display: none;
}

/* ── COLUMN 1: MARKER NODE & LED DIODE ── */
:is(.timeline-item__marker, .timeline-marker) {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  align-self: start;
  padding-top: var(--space-2xs);
  position: relative;
  z-index: 10;
}

:is(.timeline-item__dot, .timeline-dot) {
  width: var(--local-dot-size);
  height: var(--local-dot-size);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  background-color: var(--local-dot-bg);
  color: var(--local-dot-color);
  border: var(--local-dot-border);
  box-shadow: var(--local-dot-shadow);
  transform: var(--local-dot-scale);
  transition: transform var(--motion), box-shadow var(--motion), background-color var(--motion);
}

:is(.timeline-dot__svg, .kore-dot-svg) {
  width: 1rem;
  height: 1rem;
}

/* Status Staging & LED Diodes */
.timeline.timeline-accent .timeline-item {
  /* ── 1. CONTROL PANEL — SINGLE SOURCE OF TRUTH ── */
  --local-intent: var(--brand-accent);
}

.timeline.timeline-inverse .timeline-item {
  --local-intent: var(--brand-accent);
}

/* Completed Node */
.timeline-item[data-status="completed"] {
  --local-dot-bg: var(--local-intent);
  --local-dot-color: var(--brand-on);
  --local-dot-border: 2px solid var(--local-intent);
  --local-dot-shadow: var(--shadow-sm);
}

/* Active Node (Focal Stage) */
.timeline-item[data-status="active"] {
  --local-dot-bg: var(--local-intent);
  --local-dot-color: var(--brand-on);
  --local-dot-border: 2px solid var(--surface);
  --local-dot-shadow: 0 0 0 0.125rem var(--surface), 0 0 0 0.25rem var(--local-intent), var(--shadow-md);
  --local-dot-scale: scale(1.1);
  --local-content-border: 1px solid var(--local-intent);
  --local-content-shadow: var(--shadow-md);
}

/* Upcoming Node */
.timeline-item[data-status="upcoming"] {
  --local-dot-bg: var(--surface-elevated);
  --local-dot-border: 2px solid var(--surface-border);
  --local-dot-color: var(--text-muted);
}

/* ── COLUMN 2: APPLE HIG GLASS CONTENT CARD ── */
:is(.timeline-item__content, .timeline-content) {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  background-color: var(--local-content-bg);
  color: var(--text-main);
  border: var(--local-content-border);
  border-radius: var(--radius-brand);
  padding: var(--local-content-pad);
  box-shadow: var(--local-content-shadow);
  transform: var(--local-content-transform);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: var(--space-sm);
  transition: transform var(--motion), border-color var(--motion), box-shadow var(--motion);
}

:is(.timeline-item__kicker, .timeline-kicker) {
  display: block;
  max-width: 100%;
}

:is(.timeline-item__kicker, .timeline-kicker) .badge {
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

:is(.timeline-item__title, .timeline-title) {
  font-family: var(--font-display);
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-semibold);
  color: var(--text-main);
  margin: 0;
  line-height: var(--leading-heading);
}

:is(.timeline-item__content, .timeline-content) p {
  font-size: var(--font-size-body);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
  margin: 0;
}

/* ── HOVER & FOCUS STATES ── */
.timeline-item:hover {
  --local-content-transform: translateY(-2px);
  --local-content-shadow: var(--shadow-md);
  --local-content-border: 1px solid var(--brand-border);
}

.timeline-item:focus-visible,
:is(.timeline-item__content, .timeline-content):focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

/* ── SUB-CONSOLE (QUESTION FOR SELLER / PROMPT BOX) ── */
:is(.timeline-item__content, .timeline-content) :is(.seller-question-box, .timeline-sub-console, [class*="seller-question-box"], .card-surface) {
  background-color: var(--surface);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: calc(var(--radius-brand) * 0.5);
  padding: var(--space-md);
  margin-top: var(--space-2xs);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

:is(.seller-question-box, .timeline-sub-console, [class*="seller-question-box"]) :is(span, .kicker) {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0em;
  text-transform: uppercase;
  color: var(--brand);
}

:is(.seller-question-box, .timeline-sub-console, [class*="seller-question-box"]) p {
  font-family: var(--font-display);
  font-size: var(--font-size-body);
  font-style: italic;
  color: var(--text-main);
}

/* ── MOBILE RESPONSIVE IMMUNIZATION (<48rem) ── */
@container (max-width: 48rem) {
  .timeline-item {
    --local-col-marker: 2rem;
    --local-gap: var(--space-xs) var(--space-sm);
    --local-dot-size: 1.75rem;
  }
}

/* ── REDUCED MOTION GUARD ── */
@media (prefers-reduced-motion: reduce) {
  .timeline-item,
  .timeline-item *,
  .timeline-item *::before,
  .timeline-item *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
  }
}

