/* ============ Interactive Chart — TriPhase style ============ */

.ic-section {
  padding: 140px 0 160px;
  position: relative;
  border-top: 1px solid var(--line);
}

.ic-head {
  max-width: 760px;
  margin-bottom: 56px;
}
.ic-head .h-section { margin: 12px 0 16px; }

/* Phase switcher — three horizontal cards at top */
.ic-phases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-bottom: none;
  background: var(--bg-2);
}
.ic-phase {
  position: relative;
  padding: 22px 120px 24px 24px;
  cursor: pointer;
  border-right: 1px solid var(--line);
  transition: background 0.25s ease;
  text-align: left;
  font-family: inherit;
  background: transparent;
  border-top: none;
  border-bottom: none;
  border-left: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  min-height: 96px;
}
.ic-phase:last-child { border-right: none; }
.ic-phase:hover { background: color-mix(in oklab, var(--accent) 4%, transparent); }
.ic-phase.active {
  background: color-mix(in oklab, var(--accent) 7%, transparent);
}
.ic-phase.active::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--phase-color, var(--accent));
}
.ic-phase-num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-mute);
  text-transform: uppercase;
}
.ic-phase-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}
.ic-phase-name-en {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.1;
}
.ic-phase.active .ic-phase-name-en {
  color: var(--phase-color, var(--accent));
}
.ic-phase-name-vi {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  color: var(--fg-mute);
  line-height: 1.1;
}
.ic-phase-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--fg-mute);
  text-transform: uppercase;
  margin-top: 2px;
}

/* Phase mini-sparkline drawn behind each card */
.ic-phase-spark {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 84px;
  height: 38px;
  opacity: 0.45;
  pointer-events: none;
}
.ic-phase.active .ic-phase-spark { opacity: 1; }

/* Symbol / meta bar */
.ic-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom: none;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.ic-symbol {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--fg);
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.ic-symbol-exch {
  color: var(--fg-mute);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.14em;
}
.ic-tf-pills {
  display: flex;
  gap: 2px;
}
.ic-tf-pills .pill {
  font-size: 10px;
  font-weight: 500;
  color: var(--fg-mute);
  padding: 4px 8px;
  border-radius: 2px;
  letter-spacing: 0.1em;
}
.ic-tf-pills .pill.active {
  background: color-mix(in oklab, var(--fg) 10%, transparent);
  color: var(--fg);
}
.ic-ohlc {
  display: flex;
  gap: 14px;
  margin-left: auto;
  font-size: 10px;
  flex-wrap: wrap;
}
.ic-ohlc .pair { display: flex; gap: 4px; }
.ic-ohlc .lbl { color: var(--fg-mute); letter-spacing: 0.1em; }
.ic-ohlc .val { color: var(--fg); font-weight: 500; }
.ic-ohlc .val.up { color: oklch(0.78 0.16 155); }
.ic-ohlc .val.dn { color: oklch(0.7 0.2 25); }

/* Chart shell */
.ic-shell {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
  height: 520px;
  overflow: hidden;
}
.ic-canvas {
  display: block;
  width: 100% !important;
  height: 520px !important;
  cursor: crosshair;
}
.ic-overlay-tag {
  position: absolute;
  top: 14px; left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg);
  pointer-events: none;
  z-index: 2;
}
.ic-overlay-tag .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--phase-color, var(--accent));
  box-shadow: 0 0 12px var(--phase-color, var(--accent));
  animation: ic-pulse 1.8s ease-in-out infinite;
}
@keyframes ic-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.ic-zoom {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  gap: 4px;
  z-index: 2;
}
.ic-zoom button {
  width: 28px;
  height: 28px;
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}
.ic-zoom button:hover {
  background: var(--bg-2);
  color: var(--fg);
  border-color: var(--line-strong);
}

/* Caption strip */
.ic-caption {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-top: none;
  border-left: 3px solid var(--line);
  transition: border-left-color 0.4s ease;
}
.ic-caption.tp {
  border-left-color: oklch(0.82 0.16 85);
}
.ic-step-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--fg-mute);
  background: var(--bg);
  padding: 5px 10px;
  border: 1px solid var(--line);
}
.ic-caption.tp .ic-step-num {
  background: oklch(0.82 0.16 85);
  color: var(--bg);
  border-color: oklch(0.82 0.16 85);
}
.ic-step-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.ic-step-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.ic-step-sub {
  font-size: 13px;
  color: var(--fg-dim);
  line-height: 1.5;
}
.ic-total {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: oklch(0.82 0.16 85);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Player */
.ic-player {
  margin-top: 16px;
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  gap: 10px;
  align-items: center;
}
.ic-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  padding: 9px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.ic-btn:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--fg);
  background: color-mix(in oklab, var(--fg) 4%, transparent);
}
.ic-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.ic-btn.play {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
  padding: 9px 22px;
}
.ic-btn.play:hover:not(:disabled) {
  background: color-mix(in oklab, var(--accent) 90%, white);
  color: var(--bg);
}
.ic-btn.play.playing {
  background: var(--bg);
  color: var(--accent);
}
.ic-btn .icon {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Step scrubber */
.ic-scrub {
  display: flex;
  gap: 3px;
  padding: 4px 0;
}
.ic-scrub-cell {
  flex: 1;
  height: 8px;
  background: color-mix(in oklab, var(--fg) 6%, transparent);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.ic-scrub-cell:hover { background: color-mix(in oklab, var(--fg) 12%, transparent); }
.ic-scrub-cell.past { background: color-mix(in oklab, var(--phase-color, var(--accent)) 30%, transparent); }
.ic-scrub-cell.current {
  background: var(--phase-color, var(--accent));
  height: 12px;
  margin-top: -2px;
  box-shadow: 0 0 14px color-mix(in oklab, var(--phase-color, var(--accent)) 60%, transparent);
}
.ic-scrub-cell.current.tp { background: oklch(0.82 0.16 85); box-shadow: 0 0 14px oklch(0.82 0.16 85 / 0.6); }

/* Legend */
.ic-legend {
  margin-top: 18px;
  display: flex;
  gap: 22px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg-mute);
  flex-wrap: wrap;
  text-transform: uppercase;
}
.ic-legend .item { display: inline-flex; align-items: center; gap: 8px; }
.ic-legend .swatch {
  width: 10px; height: 10px;
  border-radius: 999px;
}
.ic-legend .swatch.dash {
  width: 18px; height: 0;
  border-top: 2px dashed currentColor;
  background: transparent !important;
  border-radius: 0;
}

/* Hint footer */
.ic-hint {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--fg-mute);
  text-transform: uppercase;
}
.ic-hint kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  margin: 0 2px;
  color: var(--fg-dim);
}

/* Light mode override */
html.light .ic-shell,
html.light .ic-meta,
html.light .ic-canvas {
  background: #ffffff;
}
html.light .ic-caption {
  background: #fafaf9;
}

/* Mobile */
@media (max-width: 900px) {
  .ic-section { padding: 80px 0; }
  .ic-phases { grid-template-columns: 1fr; }
  .ic-phase { border-right: none; border-bottom: 1px solid var(--line); }
  .ic-phase:last-child { border-bottom: none; }
  .ic-phase-spark { width: 60px; height: 28px; right: 10px; }
  .ic-shell { height: 380px; }
  .ic-canvas { height: 380px !important; }
  .ic-caption { grid-template-columns: 1fr; }
  .ic-total { margin-top: 4px; }
  .ic-player { grid-template-columns: auto auto auto; }
  .ic-scrub { grid-column: 1/-1; margin-top: 8px; }
  .ic-ohlc { font-size: 9px; gap: 8px; }
}
