/* ============================================================
   LIBRA STUDIOS — universe "IDE / dev-tool"
   Dark violet-black world. A code-editor hero, an API console,
   an editorial city index, a CRT arcade screen.
   Loaded after style-v2.css on /technology/.
   ============================================================ */

/* ---------- Token remap ---------- */
.theme-terminal {
  --bg: oklch(15.5% 0.02 285);
  --bg-raise: oklch(18.5% 0.024 285);
  --bg-sunk: oklch(12.5% 0.018 285);
  --ink: oklch(94% 0.01 88);
  --text: oklch(81% 0.015 85);
  --text-dim: oklch(69% 0.018 82);
  --text-faint: oklch(56% 0.02 80);
  --line: oklch(94% 0.01 88 / 0.12);
  --line-strong: oklch(94% 0.01 88 / 0.26);
  --gold-deep: oklch(72% 0.125 86);
  --mint: oklch(74% 0.12 165);
  --peach: oklch(78% 0.1 60);
  --violet: oklch(70% 0.12 300);
  --shadow-soft: 0 1px 2px oklch(0% 0 0 / 0.3), 0 12px 40px -12px oklch(0% 0 0 / 0.5);
  --shadow-lift: 0 2px 4px oklch(0% 0 0 / 0.35), 0 24px 64px -16px oklch(0% 0 0 / 0.6);

  background: var(--bg);
  color: var(--text);
}
.theme-terminal .lede { color: var(--text-dim); }
.theme-terminal .lede strong { color: var(--ink); }

/* mono eyebrow variant */
.eyebrow--mono {
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--gold-bright);
}

/* ---------- Section tag — replaces the classic split head ---------- */
.sec-tag { max-width: 46rem; margin-bottom: var(--space-block); }
.sec-tag .eyebrow { margin-bottom: 1.4rem; }
.sec-tag h2 { color: var(--ink); }
.sec-tag .lede { margin-top: 1.4rem; max-width: 52ch; }

/* window dots — shared by editor + console chrome */
.win-dots { display: inline-flex; gap: 0.45rem; flex: none; }
.win-dots i {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: oklch(94% 0.01 88 / 0.18);
}
.win-dots i:first-child { background: oklch(62% 0.14 25 / 0.85); }
.win-dots i:nth-child(2) { background: oklch(72% 0.125 86 / 0.85); }
.win-dots i:nth-child(3) { background: oklch(66% 0.12 165 / 0.85); }

/* blinking block caret (typing + prompts) */
.tl-caret {
  display: inline-block;
  width: 0.55ch;
  height: 1.05em;
  translate: 0 0.15em;
  border-radius: 1px;
  background: var(--gold-bright);
  animation: caret-blink 1.1s steps(1) infinite;
}

/* ============================================================
   HERO — centered manifesto over a live code editor
   ============================================================ */
.ide-hero {
  position: relative;
  padding-top: clamp(10rem, 9rem + 6vw, 15rem);
  padding-bottom: clamp(4.5rem, 3.5rem + 4vw, 7.5rem);
  isolation: isolate;
  overflow: clip;
}
.ide-hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(52rem 30rem at 50% -18%, oklch(42% 0.09 300 / 0.5), transparent 62%),
    radial-gradient(36rem 24rem at 92% 96%, oklch(34% 0.07 165 / 0.3), transparent 58%),
    radial-gradient(30rem 22rem at 4% 88%, oklch(48% 0.12 86 / 0.16), transparent 55%);
}
.ide-hero-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(oklch(94% 0.01 88 / 0.04) 1px, transparent 1px),
    linear-gradient(90deg, oklch(94% 0.01 88 / 0.04) 1px, transparent 1px);
  background-size: clamp(3.5rem, 6vw, 5.5rem) clamp(3.5rem, 6vw, 5.5rem);
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 38%, #000 25%, transparent 75%);
          mask-image: radial-gradient(ellipse 85% 75% at 50% 38%, #000 25%, transparent 75%);
}
.ide-hero-head { text-align: center; max-width: 64rem; margin-inline: auto; }
.ide-hero .eyebrow { justify-content: center; margin-bottom: 1.8rem; }
.ide-hero h1 {
  color: var(--ink);
  font-size: clamp(2.6rem, 1.6rem + 4.4vw, 5rem);
  text-wrap: balance;
  margin-inline: auto;
}
.ide-hero h1 .caret {
  display: inline-block;
  width: 0.55ch;
  height: 0.85em;
  margin-left: 0.12ch;
  translate: 0 0.08em;
  background: var(--gold-bright);
  animation: caret-blink 1.1s steps(1) infinite;
}
.ide-hero .lede { margin: 1.8rem auto 0; max-width: 56ch; }

/* chips — mono data tags */
.ide-hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 2.4rem;
}
.chip {
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.55rem 0.9rem;
  transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease;
}
.chip:hover { border-color: var(--gold-line); background: oklch(94% 0.01 88 / 0.04); }
.chip strong { color: var(--gold-bright); font-weight: 600; }

/* ---------- Editor window ---------- */
.editor {
  max-width: 54rem;
  margin: clamp(3rem, 5.5vw, 5rem) auto 0;
  border: 1px solid var(--line-strong);
  border-radius: 0.9rem;
  background: oklch(12% 0.018 285 / 0.9);
  box-shadow: var(--shadow-lift), 0 0 90px -30px oklch(52% 0.12 300 / 0.5);
  overflow: clip;
}
.editor-bar {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.75rem 1.1rem 0;
  border-bottom: 1px solid var(--line);
}
.editor-bar .win-dots { padding-bottom: 0.75rem; }
.editor-tabs { display: flex; gap: 0.3rem; align-self: flex-end; }
.editor-tab {
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--text-faint);
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 0.45rem 0.45rem 0 0;
}
.editor-tab.is-active {
  color: var(--ink);
  background: oklch(15.5% 0.02 285);
  border-color: var(--line);
  box-shadow: inset 0 2px 0 var(--gold-bright);
}
.editor-code {
  padding: clamp(1.1rem, 2.5vw, 1.6rem) clamp(1rem, 3vw, 1.7rem) clamp(1.2rem, 2.5vw, 1.7rem);
  font-family: ui-monospace, Menlo, monospace;
  font-size: clamp(0.7rem, 0.62rem + 0.5vw, 0.92rem);
  line-height: 1.8;
  color: var(--text);
  overflow: hidden;
}
.tl {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  width: 0;
  animation: type-line 0.55s steps(24) var(--d, 0s) forwards;
}
@keyframes type-line { to { width: calc(var(--ch, 40) * 1ch); } }

/* syntax palette */
.tk-c { color: var(--text-faint); font-style: italic; }
.tk-k { color: var(--gold-bright); }
.tk-p { color: var(--mint); }
.tk-s { color: var(--peach); }
.tk-n { color: oklch(80% 0.14 86); font-weight: 600; }
.tk-b { color: var(--violet); }
.tk-f { color: oklch(80% 0.13 165); }

.editor-status {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1.2rem;
  border-top: 1px solid var(--line);
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: var(--text-faint);
  background: oklch(13.5% 0.019 285);
}
.editor-branch { color: var(--mint); }

/* ============================================================
   FBO FINDER — API console
   ============================================================ */
.console {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raise);
  box-shadow: var(--shadow-soft);
  overflow: clip;
}
.console-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--line);
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: var(--text-faint);
  background: oklch(13.5% 0.019 285);
}
.console-title { color: var(--text-dim); }
.console-live {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--mint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.console-live i {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--mint);
  animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 oklch(74% 0.12 165 / 0.5); }
  50% { opacity: 0.45; box-shadow: 0 0 0 5px oklch(74% 0.12 165 / 0); }
}
.console-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(1.8rem, 3.5vw, 3.5rem);
  padding: clamp(1.4rem, 3vw, 2.6rem);
}
.console-cmd {
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-sm);
  color: var(--text-dim);
  margin-bottom: 1.1rem;
  word-break: break-all;
}
.console-cmd em { font-style: normal; color: var(--mint); margin-right: 0.5rem; }
.console-json {
  font-family: ui-monospace, Menlo, monospace;
  font-size: clamp(0.78rem, 0.72rem + 0.3vw, 0.9rem);
  line-height: 2;
  color: var(--text-dim);
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
}
.console-json .tk-n [data-count] { font: inherit; color: inherit; }

/* routes — features as API endpoints */
.routes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); align-self: start; }
.route {
  display: grid;
  grid-template-columns: 3.4rem 6.5rem minmax(0, 1fr);
  gap: 0.4rem 1.1rem;
  align-items: baseline;
  padding: 1.05rem 0.6rem;
  border-bottom: 1px solid var(--line);
  transition: background var(--duration-fast) ease, padding-left var(--duration) var(--ease-out);
}
.route:hover { background: oklch(94% 0.01 88 / 0.03); padding-left: 1.1rem; }
.route-verb {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: center;
  border: 1px solid;
  border-radius: 0.3rem;
  padding: 0.22rem 0;
}
.route-verb.get { color: var(--mint); border-color: oklch(74% 0.12 165 / 0.4); }
.route-verb.post { color: var(--gold-bright); border-color: oklch(72% 0.125 86 / 0.45); }
.route-path {
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-sm);
  color: var(--ink);
}
.route-info strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}
.route-info small { color: var(--text-dim); font-size: var(--text-sm); line-height: 1.55; display: block; }

@media (max-width: 900px) {
  .console-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .route { grid-template-columns: 3.4rem minmax(0, 1fr); }
  .route-info { grid-column: 2; }
  .console-title { display: none; }
}

/* ============================================================
   BKK LIFESTYLE — editorial city index
   ============================================================ */
.bkk-index { border-top: 1px solid var(--line); }
.bkk-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 0.5rem clamp(1.5rem, 4vw, 4rem);
  align-items: baseline;
  padding: clamp(1.9rem, 3.5vw, 3rem) clamp(0.2rem, 1vw, 0.8rem);
  border-bottom: 1px solid var(--line);
  overflow: clip;
  isolation: isolate;
  transition: background var(--duration) ease;
}
.bkk-row:hover { background: oklch(94% 0.01 88 / 0.025); }
.bkk-path {
  grid-column: 1 / -1;
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--gold-bright);
  margin-bottom: 0.7rem;
}
.bkk-row h3 {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
  color: var(--ink);
  transition: color var(--duration) ease, translate var(--duration) var(--ease-out);
}
.bkk-row:hover h3 { color: var(--gold-bright); translate: 0.4rem 0; }
.bkk-row p {
  color: var(--text-dim);
  font-size: var(--text-sm);
  max-width: 42ch;
  justify-self: end;
}
.bkk-ghost {
  position: absolute;
  z-index: -1;
  right: 0;
  top: 50%;
  translate: 0 -50%;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(4rem, 9vw, 8rem);
  line-height: 1;
  color: oklch(94% 0.01 88 / 0.05);
  pointer-events: none;
  transition: color var(--duration-slow) ease;
}
.bkk-row:hover .bkk-ghost { color: oklch(72% 0.125 86 / 0.09); }
@media (max-width: 700px) {
  .bkk-row { grid-template-columns: 1fr; gap: 0.6rem; }
  .bkk-row p { justify-self: start; }
}

/* ============================================================
   KARGAN — CRT arcade screen
   ============================================================ */
.crt {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: clip;
  isolation: isolate;
  background:
    radial-gradient(38rem 22rem at 78% 122%, oklch(52% 0.14 45 / 0.55), transparent 60%),
    radial-gradient(30rem 20rem at 8% -5%, oklch(42% 0.07 60 / 0.5), transparent 55%),
    linear-gradient(180deg, oklch(19% 0.03 300), oklch(13% 0.02 290) 78%);
}
/* scanlines — slow vertical drift */
.crt::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, oklch(94% 0.01 88 / 0.03) 0 1px, transparent 1px 4px);
  animation: scan-drift 0.9s linear infinite;
}
@keyframes scan-drift { to { background-position: 0 4px; } }
/* travelling glow band + vignette */
.crt::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 0%, oklch(94% 0.01 88 / 0.05) 48%, oklch(94% 0.01 88 / 0.08) 50%, oklch(94% 0.01 88 / 0.05) 52%, transparent 100%),
    radial-gradient(ellipse 120% 105% at 50% 50%, transparent 62%, oklch(8% 0.015 285 / 0.55) 100%);
  background-size: 100% 16rem, 100% 100%;
  background-repeat: no-repeat;
  animation: crt-band 7s linear infinite;
}
@keyframes crt-band {
  from { background-position: 0 -18rem, 0 0; }
  to { background-position: 0 120%, 0 0; }
}
.crt-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding: clamp(2rem, 5vw, 4rem);
  animation: crt-flicker 8s steps(1) infinite;
}
@keyframes crt-flicker {
  0%, 91%, 94.5%, 100% { opacity: 1; }
  92% { opacity: 0.86; }
  93.5% { opacity: 0.95; }
}
.crt-stage {
  display: grid;
  place-items: center;
  min-height: 14rem;
}
.crt-sprite {
  width: clamp(7rem, 12vw, 10rem);
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 14px 28px oklch(55% 0.15 45 / 0.5));
  animation: pixel-bob 1.7s steps(2, jump-none) infinite, sprite-glow 3.2s ease-in-out infinite;
}
@keyframes pixel-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes sprite-glow {
  0%, 100% { filter: drop-shadow(0 14px 28px oklch(55% 0.15 45 / 0.5)); }
  50% { filter: drop-shadow(0 18px 38px oklch(62% 0.16 55 / 0.65)); }
}
.crt-title {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-style: italic;
  color: var(--gold-bright);
  margin-bottom: 1rem;
}
.glitch { animation: glitch 4.6s steps(1) infinite; }
@keyframes glitch {
  0%, 88%, 93%, 100% { text-shadow: none; transform: none; }
  89% { text-shadow: -2px 0 oklch(66% 0.18 15 / 0.8), 2px 0 oklch(72% 0.13 195 / 0.8); transform: translateX(1px); }
  91% { text-shadow: 2px 0 oklch(66% 0.18 15 / 0.8), -2px 0 oklch(72% 0.13 195 / 0.8); transform: translateX(-1px); }
}
.crt-story { color: var(--plate-dim); font-size: var(--text-sm); max-width: 46ch; }
.kargan-tags { margin-top: 1.4rem; display: flex; gap: 0.55rem; flex-wrap: wrap; }
.kargan-tags span {
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--plate-dim);
  border: 1px solid var(--plate-line);
  border-radius: 0.3rem;
  padding: 0.4rem 0.7rem;
}
.crt-prompt {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.6rem;
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mint);
}
.kargan-cta { margin-top: 1.8rem; display: flex; gap: 1.4rem; flex-wrap: wrap; align-items: center; }
.btn-pixel {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: oklch(15% 0.02 285);
  background: var(--gold-bright);
  padding: 0.85rem 1.5rem;
  box-shadow: 4px 4px 0 oklch(48% 0.16 28 / 0.9);
  transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.btn-pixel:hover, .btn-pixel:focus-visible { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 oklch(48% 0.16 28 / 0.95); }
.btn-pixel:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 oklch(48% 0.16 28 / 0.9); }
.kargan-domain {
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-sm);
  letter-spacing: 0.03em;
  color: var(--gold-bright);
  border-bottom: 1px solid oklch(72% 0.125 86 / 0.4);
  padding-bottom: 0.2rem;
  transition: color var(--duration-fast) ease;
}
.kargan-domain:hover { color: var(--plate-text); }

/* game menu — select-screen list with ▸ cursor */
.kargan-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: clip;
  margin-top: var(--space-block);
}
.km-item {
  display: flex;
  gap: 1rem;
  background: var(--bg);
  padding: clamp(1.5rem, 2.5vw, 2.3rem);
  transition: background var(--duration-fast) ease;
}
.km-item:hover { background: var(--bg-raise); }
.km-cursor {
  flex: none;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--gold-bright);
  opacity: 0.35;
  translate: -4px 0;
  transition: opacity var(--duration-fast) ease, translate var(--duration-fast) var(--ease-out);
}
.km-item:hover .km-cursor { opacity: 1; translate: 0 0; }
.km-item h3 {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  margin-bottom: 0.55rem;
}
.km-item p { font-size: var(--text-sm); color: var(--text-dim); }
@media (max-width: 720px) {
  .crt-inner { grid-template-columns: 1fr; text-align: center; }
  .crt-stage { min-height: 11rem; order: -1; }
  .crt-story { margin-inline: auto; }
  .kargan-cta, .kargan-tags { justify-content: center; }
  .crt-prompt { justify-content: center; }
  .kargan-menu { grid-template-columns: 1fr; }
}

/* section actions */
.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2rem;
  align-items: center;
  margin-top: var(--space-block);
}

/* ---------- Pull quote — commit ---------- */
.theme-terminal .band-atmo {
  background:
    radial-gradient(56rem 26rem at 50% 118%, oklch(42% 0.09 300 / 0.45), transparent 65%),
    radial-gradient(40rem 22rem at 50% -30%, oklch(34% 0.07 165 / 0.3), transparent 60%);
}
.theme-terminal .pull-quote { color: var(--ink); }
.theme-terminal .pull-quote em { color: var(--gold-bright); }

/* ---------- QA mode (?qa=1) ---------- */
.qa .tl { animation: none; width: auto; }

/* ---------- Reduced motion (studios) ---------- */
@media (prefers-reduced-motion: reduce) {
  .tl { animation: none; width: auto; }
  .ide-hero h1 .caret,
  .tl-caret,
  .console-live i,
  .crt::before,
  .crt::after,
  .crt-inner,
  .crt-sprite,
  .glitch { animation: none; }
}
