/* Buttons */
.btn {
  --bg-btn: transparent;
  --fg-btn: var(--text);
  --border-btn: var(--border-soft);
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  font-weight: 500;
  letter-spacing: -0.005em;
  background: var(--bg-btn);
  color: var(--fg-btn);
  border: 1px solid var(--border-btn);
  position: relative;
  isolation: isolate;
  transition:
    transform 160ms var(--ease-out-expo),
    background-color 200ms var(--ease-out-expo),
    border-color 200ms var(--ease-out-expo),
    box-shadow 240ms var(--ease-out-expo),
    color 200ms var(--ease-out-expo);
  will-change: transform;
}

.btn .arrow {
  display: inline-flex;
  width: 14px;
  height: 14px;
  transition: transform 200ms var(--ease-out-expo);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    border-color: var(--border);
  }
  .btn:hover .arrow {
    transform: translateX(3px);
  }
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  --bg-btn: var(--accent);
  --fg-btn: #08182E;
  --border-btn: var(--accent);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    --bg-btn: var(--accent-2);
    --border-btn: var(--accent-2);
    box-shadow: 0 0 0 1px var(--accent), 0 0 28px -8px rgba(34, 173, 254, 0.7);
  }
}

.btn-ghost {
  --border-btn: transparent;
  color: var(--text-muted);
}

@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover {
    --border-btn: var(--border-soft);
    color: var(--text);
  }
}

/* Service cards */
.service-card {
  --card-border: var(--hairline);
  background: linear-gradient(180deg, rgba(26, 45, 85, 0.32) 0%, rgba(20, 36, 69, 0.18) 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-3);
  padding: var(--space-6);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition:
    border-color 240ms var(--ease-out-expo),
    background-color 240ms var(--ease-out-expo),
    box-shadow 320ms var(--ease-out-expo);
}

.service-card .index {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.service-card h3 {
  font-size: var(--fs-28);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
}

.service-card p {
  color: var(--text-muted);
  font-size: var(--fs-16);
  margin-bottom: var(--space-5);
}

.service-card ul {
  list-style: none;
  display: grid;
  gap: var(--space-2);
}

.service-card li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: var(--space-3);
  align-items: baseline;
  font-size: var(--fs-14);
  color: var(--text-muted);
}

.service-card li::before {
  content: "";
  width: 6px;
  height: 1px;
  background: var(--border);
  margin-top: 0.65em;
}

@media (hover: hover) and (pointer: fine) {
  .service-card:hover {
    --card-border: var(--border-soft);
    box-shadow:
      0 0 0 1px rgba(34, 173, 254, 0.15) inset,
      0 0 60px -30px rgba(34, 173, 254, 0.4);
  }
}

/* Marquee — quiet trust strip */
.marquee {
  --gap: var(--space-7);
  display: flex;
  gap: var(--gap);
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee-track {
  display: flex;
  gap: var(--gap);
  flex-shrink: 0;
  will-change: transform;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: var(--gap);
  font-family: var(--font-mono);
  font-size: var(--fs-14);
  letter-spacing: 0.04em;
  color: var(--text-dim);
  white-space: nowrap;
}

.marquee-item::after {
  content: "·";
  color: var(--text-dim);
  opacity: 0.6;
}

/* Work cards — base styling shared between vertical and hscroll modes. */
.work-card {
  --card-border: var(--hairline);
  position: relative;
  isolation: isolate;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-3);
  background: linear-gradient(160deg, rgba(26, 45, 85, 0.32) 0%, rgba(20, 36, 69, 0.14) 100%);
  transition: border-color 240ms var(--ease-out-expo), background 240ms var(--ease-out-expo);
}

/* Vertical work-card layout (used outside .hscroll-track if any remain). */
.work-card:not(.hscroll-card) {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-7);
  align-items: end;
  padding: var(--space-7) var(--space-6);
}

/* Horizontal big-card layout. */
.hscroll-card {
  flex: 0 0 auto;
  width: min(72vw, 880px);
  min-height: 48vh;
  max-height: 70vh;
  padding: clamp(24px, 3vw, 48px);
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: var(--space-4);
  overflow: hidden;
}

.hscroll-card .card-num {
  font-family: var(--font-mono);
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 400;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.04em;
  margin-bottom: var(--space-3);
}

.hscroll-card .codename {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.hscroll-card .problem {
  font-size: clamp(var(--fs-28), 3.6vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--text);
  max-width: 22ch;
}

.hscroll-card .card-detail {
  color: var(--text-muted);
  font-size: var(--fs-16);
  line-height: 1.55;
  max-width: 48ch;
  align-self: end;
}

.hscroll-card .card-foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--hairline);
}

.hscroll-card .outcome {
  font-size: var(--fs-18);
}

.hscroll-card-tail {
  background:
    radial-gradient(700px circle at 0% 0%, rgba(34, 173, 254, 0.16), transparent 60%),
    linear-gradient(160deg, rgba(26, 45, 85, 0.4) 0%, rgba(20, 36, 69, 0.2) 100%);
}

.hscroll-card-tail .card-num {
  font-size: clamp(64px, 9vw, 128px);
}

.hscroll-card-tail .card-foot {
  border-top: 0;
  padding-top: 0;
}

@media (hover: hover) and (pointer: fine) {
  .hscroll-card:hover {
    --card-border: var(--border-soft);
    background: linear-gradient(160deg, rgba(34, 173, 254, 0.12) 0%, rgba(20, 36, 69, 0.18) 100%);
  }
}

@media (max-width: 768px) {
  .hscroll-card {
    width: auto;
    min-height: auto;
    max-height: none;
  }
}

.work-card .codename {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.18em;
  color: var(--text-dim);
  margin-bottom: var(--space-3);
}

.work-card .problem {
  font-size: clamp(var(--fs-22), 2.4vw, var(--fs-36));
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.18;
  color: var(--text);
  margin-bottom: var(--space-5);
}

.work-card .outcome {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-14);
  color: var(--accent);
  margin-bottom: var(--space-5);
}

.work-card .outcome .from {
  color: var(--text-dim);
  text-decoration: line-through;
  text-decoration-color: rgba(122, 155, 194, 0.4);
}

.work-card .arrow {
  width: 12px;
  color: var(--text-dim);
}

.work-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.work-card .tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-1);
}

.work-card .detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 360ms var(--ease-out-expo);
  color: var(--text-muted);
  font-size: var(--fs-16);
  align-self: end;
}

.work-card .detail > div {
  overflow: hidden;
  min-height: 0;
}

.work-card .detail .inner {
  padding-top: var(--space-3);
  border-top: 1px solid var(--hairline);
}

@media (hover: hover) and (pointer: fine) {
  .work-card:hover {
    --card-border: var(--border-soft);
  }
  .work-card:hover .detail {
    grid-template-rows: 1fr;
  }
}

@media (max-width: 768px) {
  .work-card {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
  .work-card .detail {
    grid-template-rows: 1fr;
  }
}

/* Why tiles */
.why-tile .label {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.why-tile h3 {
  font-size: var(--fs-22);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-top: var(--space-2);
}

.why-tile p {
  color: var(--text-muted);
  font-size: var(--fs-14);
  line-height: 1.55;
  margin-top: auto;
  padding-top: var(--space-4);
}

.why-tile.feature {
  background:
    radial-gradient(800px circle at 0% 0%, rgba(34, 173, 254, 0.08), transparent 60%),
    var(--bg);
}

.why-tile.feature h3 {
  font-size: var(--fs-28);
  letter-spacing: -0.02em;
}

/* Form */
.form {
  display: grid;
  gap: var(--space-5);
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 600px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.field label {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-2);
  padding: 14px 16px;
  font-size: var(--fs-16);
  font-family: var(--font-sans);
  color: var(--text);
  transition: border-color 200ms var(--ease-out-expo), background-color 200ms var(--ease-out-expo);
  width: 100%;
}

.field textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(34, 173, 254, 0.04);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-dim);
}

.field-error {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.06em;
  color: #ff8da6;
  min-height: 1.4em;
  opacity: 0;
  transition: opacity 160ms var(--ease-out-expo);
}

.field[data-invalid="true"] input,
.field[data-invalid="true"] select,
.field[data-invalid="true"] textarea {
  border-color: rgba(255, 141, 166, 0.55);
}

.field[data-invalid="true"] .field-error {
  opacity: 1;
}

.form-foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.form-foot .submit-row {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.form-foot .fallback {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.form-foot .fallback a {
  color: var(--text-muted);
  border-bottom: 1px solid var(--hairline);
  transition: color 200ms var(--ease-out-expo), border-color 200ms var(--ease-out-expo);
}

.form-foot .fallback a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Contact intro */
.contact-intro h2 {
  font-size: clamp(var(--fs-36), 4vw, var(--fs-64));
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.contact-intro p {
  color: var(--text-muted);
  margin-top: var(--space-5);
  max-width: 38ch;
  font-size: var(--fs-18);
}

.contact-intro .meta {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--hairline);
}

.contact-intro .meta .row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: var(--space-3);
  align-items: baseline;
  font-size: var(--fs-14);
}

.contact-intro .meta .label {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Footer */
.site-footer .brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-28);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
}

.site-footer .footer-tag {
  margin-top: var(--space-5);
  color: var(--text-muted);
  font-size: var(--fs-14);
  max-width: 36ch;
}

.site-footer .col h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--space-4);
}

.site-footer .col ul {
  list-style: none;
  display: grid;
  gap: var(--space-3);
}

.site-footer .col a {
  color: var(--text-muted);
  font-size: var(--fs-14);
  position: relative;
  transition: color 180ms var(--ease-out-expo);
}

.site-footer .col a:hover {
  color: var(--text);
}

/* Logo placeholder slot — keep a square so layout doesn't shift when SVG drops in */
.logo {
  width: 74px;
  height: 74px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Magnetic CTA wrap so transform inside .btn is independent of parent translate */
.magnetic {
  display: inline-block;
  will-change: transform;
}

/* ──────────────────────────────────────────────────────────────────────
   Hero IDE — self-typing code editor + terminal pane in the hero's right
   column. Replaces the old hero-meta stat list. JS: scripts/hero-ide.js.
   ────────────────────────────────────────────────────────────────────── */
.hero-ide {
  --ide-fg: #c9d6ea;
  --ide-fg-dim: #6f88aa;
  --ide-fg-muted: #4f6e96;
  --ide-bg: #0c1830;
  --ide-bg-2: #08122a;
  --ide-bg-3: #060e22;
  --ide-rule: rgba(230, 240, 250, 0.06);

  font-family: var(--font-mono);
  color: var(--ide-fg);
  background: var(--ide-bg);
  border: 1px solid var(--ide-rule);
  border-radius: var(--radius-3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-self: end;
  height: clamp(460px, 72vh, 720px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 32px 100px -32px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(34, 173, 254, 0.06) inset;
}

.hero-ide__chrome {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.18));
  border-bottom: 1px solid var(--ide-rule);
  flex-shrink: 0;
}

.hero-ide__dots {
  display: inline-flex;
  gap: 8px;
}
.hero-ide__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ide-fg-muted);
}
.hero-ide__dot--r { background: #ff5f56; }
.hero-ide__dot--y { background: #ffbd2e; }
.hero-ide__dot--g { background: #27c93f; }

.hero-ide__title {
  flex: 1;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ide-fg-dim);
  text-transform: uppercase;
}

.hero-ide__meta {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #4cd964;
  position: relative;
  padding-left: 14px;
}
.hero-ide__meta::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4cd964;
  box-shadow: 0 0 8px rgba(76, 217, 100, 0.7);
  animation: hero-ide-live-blink 2.4s ease-in-out infinite;
}

@keyframes hero-ide-live-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* Editor pane */
.hero-ide__editor {
  flex: 3;
  min-height: 0;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero-ide__code {
  flex: 1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.05vw, 16px);
  line-height: 1.7;
  color: var(--ide-fg);
  white-space: pre-wrap;
  overflow: hidden;
}

/* Token colors — match the why-us IDE so the visual language is consistent. */
.hero-ide-k  { color: #a3c8ff; }
.hero-ide-v  { color: #ffd479; }
.hero-ide-s  { color: #7ee29c; }
.hero-ide-b  { color: #ff8da6; }
.hero-ide-c  { color: var(--ide-fg-muted); font-style: italic; }
.hero-ide-t  { color: #d4b8ff; }
.hero-ide-ok { color: #7ee29c; }

.hero-ide__status {
  margin-top: 14px;
  font-size: clamp(11px, 0.85vw, 12.5px);
  letter-spacing: 0.04em;
  color: var(--ide-fg-muted);
  opacity: 0;
  transition: opacity 240ms cubic-bezier(0.22, 1, 0.36, 1);
  flex-shrink: 0;
}
.hero-ide__status.is-shown { opacity: 1; }

/* Terminal pane */
.hero-ide__terminal {
  flex: 3;
  min-height: 0;
  background: var(--ide-bg-3);
  border-top: 1px solid var(--ide-rule);
  display: flex;
  flex-direction: column;
}

.hero-ide__term-head {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ide-fg-muted);
  padding: 9px 18px;
  border-bottom: 1px solid var(--ide-rule);
  flex-shrink: 0;
}

.hero-ide__term-body {
  flex: 1;
  margin: 0;
  padding: 14px 18px 16px;
  font-family: var(--font-mono);
  font-size: clamp(11px, 0.95vw, 14px);
  line-height: 1.6;
  color: var(--ide-fg);
  white-space: pre-wrap;
  overflow: hidden;
}

.hero-ide-tp  { color: var(--accent); margin-right: 6px; }
.hero-ide-td  { color: #a3c8ff; }
.hero-ide-tf  { color: var(--ide-fg-muted); }
.hero-ide-tcm { color: var(--ide-fg-muted); font-style: italic; }
.hero-ide-tok { color: #7ee29c; }

/* Inline cursor used by both editor and terminal. The non-breaking space
   inside keeps it visible at non-zero width even when adjacent to no
   text. Pure CSS blink. */
.hero-ide__cursor {
  display: inline-block;
  width: 0.55em;
  margin-left: 0.04em;
  background: var(--ide-fg);
  color: transparent;
  vertical-align: text-bottom;
  animation: hero-ide-blink 1.05s steps(2) infinite;
}

@keyframes hero-ide-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (max-width: 1100px) {
  .hero-ide {
    height: clamp(420px, 64vh, 600px);
  }
}

@media (max-width: 900px) {
  .hero-ide {
    height: clamp(380px, 58vh, 520px);
    align-self: stretch;
  }
}

@media (max-width: 600px) {
  .hero-ide {
    display: none;
  }
}

/* ──────────────────────────────────────────────────────────────────────
   IDE — Why TAGS section.
   Mimics a code editor: chrome with traffic-light dots, file sidebar,
   tabbed editor pane with syntax-highlighted "files", terminal at the
   bottom with accumulating log lines. Active file index is driven by
   scroll progress through the section (see scripts/scroll.js).
   ────────────────────────────────────────────────────────────────────── */
.ide {
  --ide-fg: #c9d6ea;
  --ide-fg-dim: #6f88aa;
  --ide-fg-muted: #4f6e96;
  --ide-bg: #0c1830;
  --ide-bg-2: #08122a;
  --ide-bg-3: #060e22;
  --ide-rule: rgba(230, 240, 250, 0.06);
  --ide-active: rgba(34, 173, 254, 0.14);
  --ide-active-bar: var(--accent);

  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ide-fg);
  background: var(--ide-bg);
  border: 1px solid var(--ide-rule);
  border-radius: var(--radius-3);
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 24px 80px -32px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(34, 173, 254, 0.08) inset;
  display: grid;
  grid-template-rows: auto 1fr auto;

  /* Pinned for the duration of the section so the user has to scroll
     through all 6 pages before the section releases. */
  position: sticky;
  top: clamp(72px, 8vh, 96px);
  height: min(720px, calc(100vh - clamp(96px, 12vh, 140px)));
}

/* ── Window chrome ── */
.ide__chrome {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-4);
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.18));
  border-bottom: 1px solid var(--ide-rule);
}

.ide__dots {
  display: inline-flex;
  gap: 8px;
}

.ide__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ide-fg-muted);
  display: inline-block;
}
.ide__dot--r { background: #ff5f56; }
.ide__dot--y { background: #ffbd2e; }
.ide__dot--g { background: #27c93f; }

.ide__title {
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ide-fg-dim);
  text-transform: uppercase;
}

.ide__title-mark {
  color: var(--ide-fg);
}

.ide__crumbs {
  font-size: 11px;
  color: var(--ide-fg-muted);
  letter-spacing: 0.04em;
}

/* ── Body: sidebar + editor ── */
.ide__body {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}

.ide__sidebar {
  background: var(--ide-bg-2);
  border-right: 1px solid var(--ide-rule);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.ide__pane-head {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ide-fg-muted);
  padding: 0 16px;
}

.ide__pane-head--minor {
  margin-top: var(--space-3);
}

.ide__files,
.ide__outline {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.ide__file {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 5px 16px;
  cursor: default;
  color: var(--ide-fg-dim);
  border-left: 2px solid transparent;
  transition:
    background-color 200ms var(--ease-out-expo),
    color 200ms var(--ease-out-expo),
    border-color 200ms var(--ease-out-expo);
}

.ide__file.is-active {
  background: var(--ide-active);
  color: var(--ide-fg);
  border-left-color: var(--ide-active-bar);
}

.ide__file.is-active .ide__caret {
  color: var(--accent);
}

.ide__caret {
  font-size: 10px;
  color: var(--ide-fg-muted);
  transition: transform 200ms var(--ease-out-expo), color 200ms var(--ease-out-expo);
}

.ide__file.is-active .ide__caret {
  transform: rotate(90deg);
}

.ide__name {
  font-size: 12px;
  letter-spacing: 0.01em;
}

.ide__outline li {
  font-size: 11px;
  color: var(--ide-fg-muted);
  padding: 3px 16px 3px 28px;
  position: relative;
}

.ide__outline li::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 4px;
  height: 1px;
  background: var(--ide-fg-muted);
}

/* ── Editor ── */
.ide__editor {
  background: var(--ide-bg);
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.ide__tabs {
  display: flex;
  border-bottom: 1px solid var(--ide-rule);
  background: var(--ide-bg-3);
  overflow-x: auto;
  scrollbar-width: none;
}
.ide__tabs::-webkit-scrollbar { display: none; }

.ide__tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 11px;
  color: var(--ide-fg-muted);
  border-right: 1px solid var(--ide-rule);
  position: relative;
  flex-shrink: 0;
  transition: color 200ms var(--ease-out-expo), background-color 200ms var(--ease-out-expo);
}

.ide__tab.is-active {
  color: var(--ide-fg);
  background: var(--ide-bg);
}

.ide__tab.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--accent);
}

.ide__tab-x {
  font-size: 13px;
  color: var(--ide-fg-muted);
  opacity: 0.6;
}

.ide__pages {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* Track is now a passive container; pages stack absolutely so the active
   page's code is always left-aligned at the editor's origin (no slide,
   no mid-position partial pages). Active page fades in over the others. */
.ide__pages-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.ide__doc {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 24px clamp(16px, 3vw, 36px);
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.2vw, 15px);
  line-height: 1.7;
  color: var(--ide-fg);
  white-space: pre;
  overflow: auto;
  scrollbar-width: none;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 320ms var(--ease-out-expo),
    transform 320ms var(--ease-out-expo);
  pointer-events: none;
}
.ide__doc::-webkit-scrollbar { display: none; }

.ide__doc.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.ide__ln {
  display: inline-block;
  width: 2.5ch;
  color: var(--ide-fg-muted);
  margin-right: 1ch;
  text-align: right;
  user-select: none;
}

/* Token colors */
.ide__doc .k       { color: #a3c8ff; }                /* keyword */
.ide__doc .v       { color: #ffd479; }                /* identifier */
.ide__doc .s       { color: #7ee29c; }                /* string */
.ide__doc .b       { color: #ff8da6; }                /* bool/literal */
.ide__doc .c       { color: var(--ide-fg-muted); font-style: italic; } /* comment */
.ide__doc .md-h    { color: var(--accent); font-weight: 500; }
.ide__doc .md-em   { color: #ffd479; }
.ide__doc .diff-plus  { color: #7ee29c; }
.ide__doc .diff-minus { color: #ff8da6; }

/* ── Terminal ── */
.ide__terminal {
  background: var(--ide-bg-3);
  border-top: 1px solid var(--ide-rule);
  font-size: 12px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.ide__term-head {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ide-fg-muted);
  padding: 8px 16px;
  border-bottom: 1px solid var(--ide-rule);
}

.ide__term-body {
  padding: 12px 16px 16px;
}

.ide__term-cmd {
  color: var(--ide-fg);
}

.ide__prompt {
  color: var(--accent);
  margin-right: 8px;
}

.ide__log {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.ide__log-line {
  color: var(--ide-fg-dim);
  opacity: 0;
  transform: translateX(-6px);
  transition:
    opacity 280ms var(--ease-out-expo),
    transform 280ms var(--ease-out-expo);
}

.ide__log-line.is-shown {
  opacity: 1;
  transform: translateX(0);
}

.ide__log-time {
  color: var(--ide-fg-muted);
}

.ide__log-ok {
  color: #7ee29c;
  display: inline-block;
  width: 4ch;
  text-align: left;
  margin-right: 4px;
}

.ide__log-ok--done {
  color: var(--accent);
}

.ide__cursor {
  display: inline-block;
  color: var(--accent);
  animation: ide-cursor 1.05s steps(2) infinite;
  margin-left: 4px;
}

@keyframes ide-cursor {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ── Mobile fallback: stack to a list, no pin ── */
@media (max-width: 900px) {
  .ide {
    position: static;
    height: auto;
    top: auto;
  }
  .ide__body {
    grid-template-columns: 1fr;
  }
  .ide__sidebar {
    display: none;
  }
  .ide__tabs {
    overflow-x: auto;
  }
  .ide__pages {
    min-height: 220px;
  }
  .ide__doc {
    font-size: 12px;
    line-height: 1.6;
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .ide__chrome {
    grid-template-columns: auto 1fr;
  }
  .ide__crumbs {
    display: none;
  }
  .ide__title {
    text-align: left;
  }
}
