/* ============================================================
   see-it.css — the look of every "See it" page
   ============================================================
   You do NOT need to read this file.
   It styles the step-by-step animation frame made by see-it.js.
   ============================================================ */

:root {
  --si-bg: #FCFCFC;
  --si-ink: #000000;
  --si-dim: #525252;
  --si-line: #E4E4E4;
  --si-blue: #2D62EF;
  --si-blue-soft: #EAF0FE;
  --si-amber: #FFAF04;
  --si-amber-soft: #FFF5DC;
  --si-green: #1F9D55;
  --si-green-soft: #E6F6ED;
  --si-red: #E54B4F;
  --si-red-soft: #FDECEC;
  --si-code-bg: #FFFFFF;
}

.si-scene {
  font-family: Arial, sans-serif;
  color: var(--si-ink);
  max-width: 1180px;
  margin: 0 auto;
}

/* ---------- control bar ---------- */
.si-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.si-btn {
  font: inherit;
  font-size: 15px;
  padding: 8px 16px;
  border: 1px solid var(--si-line);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--si-ink);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}
.si-btn:hover { background: #F2F2F2; }
.si-btn:active { transform: scale(0.96); }
.si-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.si-btn-main { background: var(--si-blue); border-color: var(--si-blue); color: #FFFFFF; font-weight: bold; }
.si-btn-main:hover { background: #1F4FD6; }

.si-counter {
  margin-left: auto;
  color: var(--si-dim);
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
}

.si-progress {
  height: 4px;
  background: var(--si-line);
  border-radius: 2px;
  margin: 10px 0 14px;
  overflow: hidden;
}
.si-progress-fill {
  height: 100%;
  width: 0;
  background: var(--si-blue);
  transition: width 0.4s ease;
}

/* ---------- panels ---------- */
.si-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 820px) {
  .si-panels { grid-template-columns: 1fr; }
}

.si-panel {
  position: relative;
  border: 1px solid var(--si-line);
  border-radius: 10px;
  background: var(--si-code-bg);
  padding: 12px 14px;
  min-width: 0;
}

.si-panel-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: bold;
  color: var(--si-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- code panel ---------- */
.si-code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.7;
  max-height: 560px;
  overflow: auto;
}

.si-line {
  display: flex;
  border-radius: 4px;
  color: #9A9A9A;
  transition: background-color 0.3s, color 0.3s;
}
.si-line.is-read { color: var(--si-ink); }
.si-line.is-current {
  background: var(--si-amber-soft);
  color: var(--si-ink);
  box-shadow: inset 3px 0 0 var(--si-amber);
}

.si-ln {
  flex: 0 0 32px;
  text-align: right;
  padding-right: 12px;
  color: #B5B5B5;
  user-select: none;
}

.si-src { white-space: pre; }
.si-line.is-read .si-tok-tag,
.si-line.is-current .si-tok-tag { color: var(--si-blue); }
.si-line.is-read .si-tok-comment,
.si-line.is-current .si-tok-comment { color: var(--si-green); }

.si-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--si-red);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: bold;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.si-badge.is-on { opacity: 1; transform: none; }

/* ---------- tree panel ---------- */
.si-tree-box {
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  max-height: 560px;
  overflow: auto;
}

.si-tree,
.si-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.si-tree ul {
  margin-left: 14px;
  padding-left: 18px;
  border-left: 2px solid var(--si-line);
}
.si-tree li {
  position: relative;
  padding: 3px 0;
}
.si-tree ul > li::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 17px;
  width: 14px;
  border-top: 2px solid var(--si-line);
}

.si-node {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  border: 2px solid var(--si-blue);
  background: var(--si-blue-soft);
  color: #1A3FA8;
  font-weight: bold;
  white-space: nowrap;
}
/* a long label (many attributes) may wrap instead of making the panel scroll sideways */
.si-node-element {
  white-space: normal;
  overflow-wrap: anywhere;
}
.si-node-doc { background: var(--si-ink); border-color: var(--si-ink); color: #FFFFFF; }
.si-node-text { background: var(--si-green-soft); border: 2px dashed var(--si-green); color: #136B39; font-weight: normal; }
.si-node-comment { background: #F2F2F2; border: 2px dashed #9A9A9A; color: var(--si-dim); font-weight: normal; }

.si-node.is-new { animation: si-pop 0.45s ease-out; }
.si-node.is-marked {
  outline: 3px solid var(--si-amber);
  outline-offset: 2px;
  animation: si-pulse 1.2s ease-in-out infinite;
}

.si-ghost {
  position: fixed;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

@keyframes si-pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes si-pulse {
  0%, 100% { outline-color: var(--si-amber); }
  50% { outline-color: transparent; }
}

.si-empty {
  margin: 0;
  color: #9A9A9A;
  font-style: italic;
  font-family: Arial, sans-serif;
}

/* ---------- caption ---------- */
.si-caption {
  margin-top: 16px;
  padding: 14px 18px;
  border-left: 4px solid var(--si-blue);
  background: #FFFFFF;
  border-radius: 0 10px 10px 0;
  font-size: 18px;
  line-height: 1.5;
  min-height: 56px;
}
.si-caption code,
.si-caption b code {
  font-family: Consolas, "Courier New", monospace;
  background: #F2F2F2;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.92em;
}

/* ---------- console panel ---------- */
.si-console-panel { margin-top: 16px; background: #1E1E1E; border-color: #1E1E1E; }
.si-console-panel .si-panel-title { color: #B5B5B5; }
.si-console {
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  max-height: 160px;
  overflow: auto;
}
.si-log { padding: 3px 6px; border-bottom: 1px solid #333333; color: #E4E4E4; white-space: pre-wrap; }
.si-log-ok { color: #7EE2A8; }
.si-log-error { color: #FF9A9C; background: rgba(229, 75, 79, 0.15); }
.si-log-info { color: #E4E4E4; }
.si-console-panel .si-empty { color: #777777; }

/* ---------- "On the page" panel (console: "screen") ---------- */
.si-screen-panel { margin-top: 16px; }
.si-screen-panel .si-console { max-height: 200px; }
.si-screen-panel .si-log {
  font-family: Arial, sans-serif;
  font-size: 20px;
  color: var(--si-ink);
  background: none;
  border-bottom: 1px dashed var(--si-line);
  padding: 8px 6px;
}
.si-screen-panel .si-log-old { color: #B5B5B5; font-size: 15px; }
.si-screen-panel .si-log-error { color: var(--si-red); }
.si-screen-panel img { height: 96px; vertical-align: middle; margin-right: 10px; }

/* ---------- people who asked for less motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .si-scene *,
  .si-scene *::before,
  .si-scene *::after {
    animation: none !important;
    transition: none !important;
  }
  .si-node.is-marked { outline-color: var(--si-amber); }
}
