/* ============================================================
   timecode-calculator — knowledge guides
   Layered on top of styles.css tokens.
   ============================================================ */

.topic-section {
  scroll-margin-top: 86px;
  padding-top: 56px;
}

.topic-rail-wrap {
  padding-top: 42px;
}

.topic-rail {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 auto;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(420px 120px at 12% 0%, var(--amber-soft), transparent 70%),
    var(--panel);
}

.topic-rail > span {
  margin-right: 4px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topic-rail a {
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  background: var(--chip-bg);
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.topic-rail a:hover {
  color: var(--amber-bright);
  border-color: var(--amber-line);
}

/* ---------- two-column body ---------- */

.topic-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 26px;
  align-items: start;
}

.topic-copy {
  min-width: 0;
}

.topic-answer {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.66;
}

.topic-answer strong {
  color: var(--text);
  font-weight: 600;
}

.topic-answer code {
  padding: 1px 5px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85em;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--field);
}

.topic-points {
  display: grid;
  gap: 0;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.topic-points li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.62;
  border-top: 1px solid var(--line-soft);
}

.topic-points li:last-child {
  border-bottom: 1px solid var(--line-soft);
}

.topic-points .pt-n {
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  line-height: 1.9;
}

.topic-points strong {
  color: var(--text);
  font-weight: 600;
}

.topic-formula {
  margin-top: 14px;
  padding: 11px 13px;
  overflow-x: auto;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.topic-related {
  margin-top: 14px;
  color: var(--dim);
  font-size: 12.5px;
}

.topic-related a {
  color: var(--amber-bright);
  border-bottom: 1px solid var(--amber-line);
}

.topic-related a:hover {
  color: var(--text);
}

/* ---------- visual shells ---------- */

.topic-visual {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(360px 180px at 84% 0%, var(--amber-soft), transparent 72%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
}

.tv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tv-head b {
  color: var(--amber);
  font-weight: 500;
  letter-spacing: 0.1em;
}

.tv-caption {
  margin-top: 12px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.06em;
}

/* ---------- 01 · place value ---------- */

.tv-stack {
  display: grid;
  gap: 5px;
}

.tv-stack-row {
  display: grid;
  grid-template-columns: 44px 38px minmax(0, 1fr) 60px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--field);
}

.tv-stack-row span {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tv-stack-row b {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tv-stack-row i {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-style: normal;
  letter-spacing: 0.04em;
}

.tv-stack-row em {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-style: normal;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tv-stack-row.total {
  margin-top: 4px;
  grid-template-columns: 44px 62px minmax(0, 1fr) 96px;
  border-color: var(--amber-line);
  background: var(--amber-soft);
}

.tv-stack-row.total span,
.tv-stack-row.total i {
  color: var(--amber);
}

.tv-stack-row.total b {
  color: var(--amber-bright);
  font-size: 17px;
}

.tv-stack-row.total em {
  color: var(--text);
  font-size: 12.5px;
}

/* ---------- 02 · transport carriers ---------- */

.tv-signals {
  display: grid;
  gap: 6px;
}

.tv-signal {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--field);
}

.tv-signal > b {
  align-self: center;
  color: var(--amber-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.tv-signal span {
  display: block;
  margin-bottom: 5px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tv-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 16px;
}

.tv-wave i {
  width: 3px;
  height: var(--h, 40%);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--ice), rgba(124, 199, 255, 0.35));
  animation: tv-pulse 1.9s var(--ease) infinite alternate;
  animation-delay: var(--d, 0ms);
}

.tv-vitc {
  display: flex;
  gap: 3px;
  height: 16px;
}

.tv-vitc i {
  flex: 1;
  border-radius: 2px;
  background: repeating-linear-gradient(
    90deg,
    rgba(194, 240, 106, 0.55) 0 2px,
    transparent 2px 5px
  );
}

.tv-mtc {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 16px;
}

.tv-mtc i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0.25;
  animation: tv-blink 1.4s steps(1, end) infinite;
  animation-delay: var(--d, 0ms);
}

.tv-tagline {
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-align: center;
}

@keyframes tv-pulse {
  from {
    transform: scaleY(0.55);
    opacity: 0.55;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes tv-blink {
  0%,
  60% {
    opacity: 1;
  }
  61%,
  100% {
    opacity: 0.2;
  }
}

/* ---------- 03 · drop-frame grid ---------- */

.tv-switch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.tv-switch button {
  height: 26px;
  padding: 0 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.tv-switch button[aria-pressed="true"] {
  color: var(--ink-on-accent);
  background: var(--amber);
}

.tv-minutes {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
}

.tv-min {
  padding: 7px 3px 6px;
  text-align: center;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--field);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}

.tv-min b {
  display: block;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.tv-min span {
  display: block;
  margin-top: 4px;
  color: var(--amber-bright);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tv-min.kept {
  border-color: rgba(194, 240, 106, 0.4);
  background: rgba(194, 240, 106, 0.07);
}

.tv-min.kept span {
  color: var(--mint);
}

.tv-df-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.tv-df-foot b {
  color: var(--amber-bright);
  font-weight: 500;
}

/* ---------- 04 · pulldown ---------- */

.tv-pd {
  display: grid;
  gap: 8px;
}

.tv-pd-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.tv-pd-row > span {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tv-pd-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
}

.tv-pd-strip.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tv-pd-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: var(--field);
}

.tv-pd-cell.repeat {
  color: var(--amber-bright);
  border-color: var(--amber-line);
  background: var(--amber-soft);
}

.tv-pd-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  margin-top: 8px;
}

.tv-pd-fields span {
  padding: 4px 0;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-align: center;
  border: 1px dashed var(--line-soft);
  border-radius: 4px;
}

/* ---------- 05 · carry steps ---------- */

.tv-arith-head {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--field);
  font-family: var(--font-mono);
  font-size: 13.5px;
}

.tv-arith-head code {
  color: var(--text);
  font-family: inherit;
}

.tv-arith-head span {
  color: var(--amber);
}

.tv-steps {
  display: grid;
  gap: 5px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.tv-steps li {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  opacity: 0.5;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--field);
  transition: opacity 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.tv-steps li.active {
  opacity: 1;
  border-color: var(--amber-line);
  background: var(--amber-soft);
}

.tv-steps b {
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tv-steps span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
}

.tv-steps li.active span {
  color: var(--text);
}

.tv-btn {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: 9px;
  color: var(--amber-bright);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--amber-line);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.tv-btn:hover {
  color: var(--ink-on-accent);
  background: var(--amber);
}

/* ---------- 06 · drift meter ---------- */

.tv-drift {
  display: grid;
  gap: 11px;
}

.tv-drift-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 9px;
}

.tv-drift-row span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.tv-drift-row b {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tv-drift-track {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--field);
  border: 1px solid var(--line-soft);
}

.tv-drift-track i {
  display: block;
  width: var(--w, 0%);
  min-width: 2px;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--amber), var(--amber-bright));
}

.tv-drift-track i.safe {
  background: linear-gradient(90deg, rgba(194, 240, 106, 0.5), var(--mint));
}

.tv-drift-note {
  padding-top: 2px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

/* ---------- per-section FAQ ---------- */

.topic-faq {
  display: grid;
  gap: 7px;
  margin-top: 24px;
}

.topic-q {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel);
}

.topic-q summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 15px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
}

.topic-q summary::-webkit-details-marker {
  display: none;
}

.topic-q summary::after {
  content: "+";
  flex: none;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 14px;
}

.topic-q[open] summary::after {
  content: "−";
}

.topic-q summary:hover {
  color: var(--amber-bright);
}

.topic-q p {
  padding: 0 15px 13px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.66;
}

.topic-q p strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .topic-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 740px) {
  .topic-section {
    padding-top: 44px;
  }

  .topic-rail {
    padding: 10px 12px;
    gap: 6px;
  }

  .topic-rail > span {
    width: 100%;
    margin-bottom: 2px;
  }

  .topic-minutes {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
  }

  .topic-visual {
    padding: 13px;
  }
}

@media (max-width: 520px) {
  .topic-formula {
    white-space: normal;
    line-height: 1.8;
  }
}

@media (max-width: 420px) {
  .tv-stack-row {
    grid-template-columns: 40px 32px minmax(0, 1fr) 52px;
  }

  .tv-stack-row b {
    font-size: 14px;
  }

  .tv-drift-row {
    grid-template-columns: 70px minmax(0, 1fr) 52px;
  }

  .tv-pd-row {
    grid-template-columns: 46px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tv-wave i,
  .tv-mtc i {
    animation: none;
  }
}

/* ---------- restraint pass ---------- */

.topic-rail > span,
.tv-head,
.tv-steps b {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
}

.tv-stack-row span,
.tv-signal span,
.tv-pd-row > span {
  font-size: 10.5px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.topic-rail,
.topic-visual {
  background: var(--panel);
}
