/* ==========================================================================
   Spec Studio — Obsidian & Plasma
   Near-black surface, one plasma accent, editorial serif over mono spec text.
   ========================================================================== */

:root {
  --void:      #08090B;
  --void-2:    #0E1013;
  --void-3:    #14171B;
  --ink:       #EDEEF0;
  --ink-2:     #8A8F98;
  --ink-3:     #565C66;
  --line:      rgba(237, 238, 240, 0.08);
  --line-2:    rgba(237, 238, 240, 0.14);
  --plasma:    #D8FF57;
  --plasma-dim: rgba(216, 255, 87, 0.16);
  --ember:     #FF6B3D;

  --serif: "Instrument Serif", Georgia, serif;
  --sans:  "Instrument Sans", system-ui, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rail-w: 400px;
}

*, *::before, *::after { box-sizing: border-box; }

/* Several elements below set display explicitly, which would otherwise win. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.mode-studio { overflow: hidden; }

a { color: inherit; }

::selection { background: var(--plasma); color: #0A0B0D; }

/* --- atmosphere ---------------------------------------------------------- */

.grain {
  position: fixed; inset: -50%;
  pointer-events: none; z-index: 2; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(120% 90% at 72% 18%, rgba(216, 255, 87, 0.05), transparent 55%),
    radial-gradient(100% 100% at 50% 120%, rgba(0, 0, 0, 0.6), transparent 60%);
}

/* --- topbar -------------------------------------------------------------- */

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(20px, 4vw, 56px);
  mix-blend-mode: normal;
}

.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.16em;
  text-transform: uppercase; text-decoration: none; color: var(--ink);
}
.wordmark-mark {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--plasma);
  box-shadow: 0 0 14px rgba(216, 255, 87, 0.7);
}
.topbar-link {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em;
  color: var(--ink-3); text-decoration: none; transition: color 0.25s;
}
.topbar-link:hover { color: var(--ink-2); }

body.mode-studio .topbar { opacity: 0; pointer-events: none; }
.topbar { transition: opacity 0.4s; }

/* --- the orb layer ------------------------------------------------------- */

#orbLayer {
  position: fixed; z-index: 5; pointer-events: none;
  transition: left 0.95s var(--ease), top 0.95s var(--ease),
              width 0.95s var(--ease), height 0.95s var(--ease);
  will-change: left, top, width, height;
}
#orbLayer.no-anim { transition: none; }
#orbCanvas { width: 100%; height: 100%; display: block; pointer-events: auto; cursor: pointer; }

.orb-slot { width: 100%; aspect-ratio: 1; }

/* --- landing ------------------------------------------------------------- */

#landing { position: relative; z-index: 10; }
body.mode-studio #landing { display: none; }

.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(24px, 5vw, 80px);
  padding: 140px clamp(20px, 4vw, 56px) 90px;
  max-width: 1500px; margin: 0 auto;
}

.hero-copy { max-width: 640px; }

.eyebrow {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--plasma); margin: 0 0 24px;
}

h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(46px, 6.4vw, 92px);
  line-height: 0.96; letter-spacing: -0.02em;
  margin: 0 0 30px;
}
h1 em { font-style: italic; color: var(--ink-2); }

.lede {
  font-size: clamp(16px, 1.15vw, 18px);
  color: var(--ink-2); max-width: 48ch; margin: 0 0 38px;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.cta {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--sans); font-size: 15px; font-weight: 500;
  padding: 15px 28px; border: 0; border-radius: 999px;
  background: var(--plasma); color: #0A0B0D; cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
  box-shadow: 0 0 0 rgba(216, 255, 87, 0);
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(216, 255, 87, 0.22); }
.cta:active { transform: translateY(0); }
.cta:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }
.cta-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #0A0B0D;
  animation: cta-pulse 2.4s ease-in-out infinite;
}
@keyframes cta-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 14px;
  padding: 13px 22px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink);
  cursor: pointer; text-decoration: none;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.ghost-btn:hover { border-color: var(--ink-3); background: rgba(255, 255, 255, 0.03); }
.ghost-btn--accent { border-color: var(--plasma-dim); color: var(--plasma); }
.ghost-btn--accent:hover { border-color: var(--plasma); background: rgba(216, 255, 87, 0.06); }

.text-btn {
  background: none; border: 0; color: var(--ink-3); cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; padding: 8px 4px;
  text-decoration: underline; text-underline-offset: 3px;
  transition: color 0.2s;
}
.text-btn:hover { color: var(--ink-2); }

.cta-note {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-3);
  letter-spacing: 0.04em; margin: 18px 0 0;
}

.restore {
  margin-top: 34px; padding: 20px 22px;
  border: 1px solid var(--line-2); border-left: 2px solid var(--plasma);
  border-radius: 4px; background: rgba(216, 255, 87, 0.03);
  display: flex; flex-wrap: wrap; gap: 16px;
  align-items: center; justify-content: space-between;
}
.restore-title { margin: 0 0 4px; font-size: 15px; }
.restore-meta { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.restore-actions { display: flex; align-items: center; gap: 10px; }

.hero-orb { display: flex; justify-content: center; align-items: center; }
/* Height-aware, or a short laptop viewport clips the bottom of the orb. */
#orbSlotLanding { max-width: min(540px, 56svh); }

/* --- explainer ----------------------------------------------------------- */

.explain {
  max-width: 1180px; margin: 0 auto;
  padding: 40px clamp(20px, 4vw, 56px) 120px;
}

.section-title {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 400;
  margin: 0 0 34px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}

.steps {
  list-style: none; margin: 0 0 110px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 44px 40px;
}
.steps li { position: relative; padding-top: 6px; }
.step-n {
  font-family: var(--mono); font-size: 11px; color: var(--plasma);
  letter-spacing: 0.1em; display: block; margin-bottom: 14px;
}
.steps h3 {
  font-family: var(--serif); font-weight: 400; font-size: 25px;
  line-height: 1.2; margin: 0 0 10px;
}
.steps p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.steps em { color: var(--ink); font-style: italic; }

.honesty { margin-bottom: 110px; }
.honesty > p {
  font-size: clamp(17px, 1.6vw, 21px); line-height: 1.6;
  color: var(--ink-2); max-width: 62ch; margin: 0 0 40px;
}
.honesty strong { color: var(--ink); font-weight: 500; }

.honesty-demo {
  display: grid; gap: 12px; max-width: 560px;
  padding: 26px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--void-2);
}
.demo-item {
  display: flex; gap: 13px; align-items: flex-start;
  font-family: var(--mono); font-size: 13px; line-height: 1.5;
  padding: 12px 14px; border-radius: 3px;
}
.demo-item--confirmed { border: 1px solid var(--line-2); }
.demo-item--proposed {
  border: 1px dashed var(--line-2); color: var(--ink-2);
  animation: breathe 3.4s ease-in-out infinite;
}
.tick, .box {
  flex: 0 0 auto; width: 14px; height: 14px; margin-top: 3px; border-radius: 2px;
}
.tick { background: var(--plasma); position: relative; }
.tick::after {
  content: ""; position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px; border: solid #0A0B0D;
  border-width: 0 1.5px 1.5px 0; transform: rotate(42deg);
}
.box { border: 1px dashed var(--ink-3); }
.why { display: block; margin-top: 5px; font-size: 11px; color: var(--ink-3); font-style: italic; }

@keyframes breathe { 0%, 100% { opacity: 0.72; } 50% { opacity: 1; } }

.about > p {
  font-size: 17px; color: var(--ink-2); max-width: 60ch; margin: 0 0 28px;
}
.about a { color: var(--plasma); text-decoration-color: var(--plasma-dim); text-underline-offset: 3px; }

.site-foot {
  border-top: 1px solid var(--line);
  padding: 30px clamp(20px, 4vw, 56px);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-3);
  max-width: 1180px; margin: 0 auto;
}
.site-foot a { color: var(--ink-2); }

/* --- studio -------------------------------------------------------------- */

#studio {
  position: fixed; inset: 0; z-index: 12;
  display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr);
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s var(--ease) 0.25s;
}
body.mode-studio #studio { opacity: 1; pointer-events: auto; }
#studio[hidden] { display: none; }

.rail {
  display: flex; flex-direction: column; min-height: 0;
  padding: 28px 26px 22px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.012), transparent 40%);
}

.rail-top { display: flex; flex-direction: column; align-items: center; }
#orbSlotStudio { max-width: 210px; }

.agent-state {
  display: flex; align-items: center; gap: 9px; margin-top: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3);
}
.state-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3);
  transition: background 0.3s, box-shadow 0.3s;
}
body[data-agent="listening"] .state-dot { background: var(--plasma); box-shadow: 0 0 10px var(--plasma); }
body[data-agent="speaking"]  .state-dot { background: #fff; box-shadow: 0 0 10px #fff; }
body[data-agent="thinking"]  .state-dot { background: var(--ink-2); animation: cta-pulse 1s infinite; }

.lang-badge {
  font-size: 10px; letter-spacing: 0.1em; padding: 2px 6px;
  border: 1px solid var(--line-2); border-radius: 2px; color: var(--ink-2);
}

.timer {
  font-family: var(--mono); font-size: 22px; letter-spacing: 0.04em;
  color: var(--ink-2); margin-top: 12px; font-variant-numeric: tabular-nums;
}
.timer.is-low { color: var(--ember); animation: cta-pulse 1.2s infinite; }

.modes {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  margin: 22px 0 18px; padding: 4px;
  border: 1px solid var(--line); border-radius: 3px;
}
.mode-btn {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 9px 4px;
  background: none; border: 0; border-radius: 2px;
  color: var(--ink-3); cursor: pointer; transition: background 0.2s, color 0.2s;
}
.mode-btn:hover { color: var(--ink-2); }
.mode-btn.is-active { background: var(--plasma); color: #0A0B0D; }

.transcript {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 4px 4px 20px; scrollbar-width: thin;
  mask-image: linear-gradient(180deg, transparent, #000 28px);
}
.line { font-size: 14px; line-height: 1.5; }
.line-role {
  display: block; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 4px;
}
.line--model { color: var(--ink); }
.line--model .line-role { color: var(--plasma); }
.line--user { color: var(--ink-2); padding-left: 12px; border-left: 1px solid var(--line-2); }
.line--note {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-3);
  border-left: 1px solid var(--ember); padding-left: 12px;
}

.typebar { display: flex; gap: 8px; margin-bottom: 12px; }
.typebar input {
  flex: 1; min-width: 0; background: var(--void-2); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 3px;
  padding: 11px 13px; font-family: var(--sans); font-size: 14px;
}
.typebar input:focus { outline: none; border-color: var(--plasma-dim); }

.rail-controls { display: flex; gap: 8px; }
.ctrl {
  flex: 1; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 11px 6px;
  background: transparent; border: 1px solid var(--line-2); border-radius: 3px;
  color: var(--ink-2); cursor: pointer; transition: all 0.2s;
}
.ctrl:hover { border-color: var(--ink-3); color: var(--ink); }
.ctrl.is-on { background: var(--ink); color: var(--void); border-color: var(--ink); }
.ctrl--end:hover { border-color: var(--ember); color: var(--ember); }

.icon-btn {
  background: transparent; border: 1px solid var(--line-2); border-radius: 3px;
  color: var(--ink-2); cursor: pointer; width: 38px; height: 38px;
  font-size: 15px; line-height: 1; flex: 0 0 auto; transition: all 0.2s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }

/* --- the board ----------------------------------------------------------- */

.board { display: flex; flex-direction: column; min-height: 0; min-width: 0; }

.board-head {
  display: flex; align-items: flex-start; gap: 24px;
  padding: 30px clamp(22px, 3vw, 44px) 22px;
  border-bottom: 1px solid var(--line);
}
.board-title { flex: 1; min-width: 0; }
.board-title h2 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.6vw, 38px);
  line-height: 1.1; margin: 0 0 6px; letter-spacing: -0.01em;
}
.board-title h2.untitled { color: var(--ink-3); font-style: italic; }
.board-title p { margin: 0; color: var(--ink-2); font-size: 14.5px; max-width: 62ch; }

.readiness { text-align: right; flex: 0 0 auto; }
.readiness-num {
  font-family: var(--mono); font-size: 34px; line-height: 1;
  color: var(--plasma); font-variant-numeric: tabular-nums;
}
.readiness-num small { font-size: 15px; opacity: 0.6; }
.readiness-label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 6px;
}

.board-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 10px clamp(22px, 3vw, 44px) 80px;
}

.sections { display: flex; flex-direction: column; }

.sec { border-bottom: 1px solid var(--line); padding: 22px 0; scroll-margin-top: 20px; }
.sec.is-focused .sec-name { color: var(--plasma); }

.sec-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 4px;
}
.sec-name {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-2); transition: color 0.3s;
}
.sec-hint { font-size: 12.5px; color: var(--ink-3); flex: 1; min-width: 0; }
.sec-bar {
  flex: 0 0 84px; height: 2px; background: var(--line-2); border-radius: 2px; overflow: hidden;
}
.sec-bar i {
  display: block; height: 100%; width: 0; background: var(--plasma);
  transition: width 0.8s var(--ease);
}

.sec-items { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 7px; }
.sec-empty {
  font-family: var(--mono); font-size: 12px; color: var(--ink-3);
  margin: 10px 0 0; font-style: italic;
}

.item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 13px; border-radius: 3px;
  border: 1px solid var(--line); background: var(--void-2);
  transition: border-color 0.25s, background 0.25s, opacity 0.25s;
}
.item:hover { border-color: var(--line-2); }
.item--proposed {
  border-style: dashed; background: transparent;
  animation: breathe 3.4s ease-in-out infinite;
}
.item.is-new { animation: land 0.6s var(--ease); }
@keyframes land {
  from { opacity: 0; transform: translateY(-6px) scale(0.985); border-color: var(--plasma); }
  to   { opacity: 1; transform: none; }
}

.item-check {
  flex: 0 0 auto; width: 15px; height: 15px; margin-top: 3px; padding: 0;
  border-radius: 2px; cursor: pointer; background: transparent;
  border: 1px dashed var(--ink-3); position: relative; transition: all 0.2s;
}
.item-check:hover { border-color: var(--plasma); }
.item--confirmed .item-check { background: var(--plasma); border: 1px solid var(--plasma); }
.item--confirmed .item-check::after {
  content: ""; position: absolute; left: 4.5px; top: 1px;
  width: 4px; height: 8px; border: solid #0A0B0D;
  border-width: 0 1.5px 1.5px 0; transform: rotate(42deg);
}

.item-body { flex: 1; min-width: 0; }
.item-text {
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
  display: block; outline: none; word-break: break-word;
}
.item-text:focus { border-bottom: 1px solid var(--plasma); }
.item--proposed .item-text { color: var(--ink-2); }
.item-why {
  display: block; margin-top: 5px; font-size: 11px; font-style: italic;
  color: var(--ink-3);
}
.item-tag {
  display: inline-block; margin-top: 6px; margin-right: 6px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 2px 6px; border-radius: 2px;
  border: 1px solid var(--line-2); color: var(--ink-3);
}
.item-tag--custom { border-color: rgba(255, 107, 61, 0.35); color: var(--ember); }

.item-del {
  flex: 0 0 auto; background: none; border: 0; color: var(--ink-3);
  cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 4px;
  opacity: 0; transition: opacity 0.2s, color 0.2s;
}
.item:hover .item-del, .item-del:focus { opacity: 1; }
.item-del:hover { color: var(--ember); }

/* --- unknowns ------------------------------------------------------------ */

.unknowns { margin-top: 42px; padding: 24px 26px 26px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--void-2); }
.unknowns-head {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink); font-weight: 400; margin: 0 0 16px;
  display: flex; align-items: center; gap: 10px;
}
.count {
  font-size: 10px; min-width: 20px; text-align: center; padding: 2px 6px;
  border-radius: 999px; background: var(--plasma); color: #0A0B0D;
}
.count.is-zero { background: var(--line-2); color: var(--ink-3); }
.unknowns-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.unknowns-empty { font-size: 12.5px; color: var(--ink-3); margin: 0; font-style: italic; }

.q { padding-left: 16px; border-left: 1px solid var(--plasma); transition: opacity 0.4s; }
.q-text { font-size: 14px; line-height: 1.45; }
.q-why { display: block; margin-top: 4px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.q.is-resolved { border-left-color: var(--ink-3); opacity: 0.4; }
.q.is-resolved .q-text { text-decoration: line-through; color: var(--ink-3); }

/* --- overlay / export ---------------------------------------------------- */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 5, 6, 0.82);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(16px, 4vw, 48px);
  animation: fade 0.35s var(--ease);
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: min(880px, 100%); max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--void-2); border: 1px solid var(--line-2); border-radius: 6px;
  overflow: hidden;
}
.sheet-head {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 28px 30px 22px; border-bottom: 1px solid var(--line);
}
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head h2 {
  font-family: var(--serif); font-weight: 400; font-size: 32px;
  margin: 0 0 8px; line-height: 1.1;
}
.sheet-sub { margin: 0; color: var(--ink-2); font-size: 14.5px; max-width: 62ch; }

.spec-md {
  flex: 1; min-height: 0; overflow: auto; margin: 0;
  padding: 26px 30px; background: var(--void);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  color: var(--ink-2); white-space: pre-wrap; word-break: break-word;
}

.sheet-foot {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 20px 30px; border-top: 1px solid var(--line);
}
.sheet-foot .text-btn { margin-left: auto; }

/* --- toast / spark ------------------------------------------------------- */

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 90; padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: var(--void);
  font-size: 13.5px; font-weight: 500;
  animation: toast-in 0.3s var(--ease);
}
.toast[hidden] { display: none; }
.toast.is-warn { background: var(--ember); color: #170A05; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

#sparkLayer { position: fixed; inset: 0; pointer-events: none; z-index: 55; }
.spark {
  position: fixed; width: 7px; height: 7px; border-radius: 50%;
  background: var(--plasma); box-shadow: 0 0 14px var(--plasma);
  transition: transform 0.62s var(--ease), opacity 0.62s ease-in;
}

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

@media (max-width: 1080px) {
  :root { --rail-w: 330px; }
  .hero { grid-template-columns: 1fr; padding-top: 118px; }
  .hero-orb { order: -1; }
  #orbSlotLanding { max-width: 320px; }
  h1 { font-size: clamp(40px, 9vw, 62px); }
}

@media (max-width: 860px) {
  #studio { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .rail {
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 14px 18px 12px;
  }
  /* Lay the orb, state and timer out on one line — stacked, they cost half
     the screen before the board gets any. */
  .rail-top { flex-direction: row; align-items: center; gap: 14px; }
  #orbSlotStudio { flex: 0 0 68px; width: 68px; max-width: 68px; }
  .agent-state { margin-top: 0; }
  .timer { margin-top: 0; margin-left: auto; font-size: 19px; }
  .modes { margin: 14px 0 12px; }
  .transcript {
    flex: 0 1 auto; max-height: 108px; min-height: 64px;
    padding-bottom: 10px; mask-image: none;
  }
  .board-head { padding: 16px 20px 14px; gap: 14px; flex-wrap: wrap; }
  .board-title h2 { font-size: 23px; }
  .readiness-num { font-size: 27px; }
  .board-scroll { padding: 6px 20px 60px; }
  .sheet-foot { flex-direction: column; align-items: stretch; }
  .sheet-foot .text-btn { margin-left: 0; }
  .cta, .ghost-btn { justify-content: center; }
}

@media (max-width: 560px) {
  /* The hint squeezes into a two-word column next to the label — drop it. */
  .sec-hint { display: none; }
  .restore { flex-direction: column; align-items: stretch; }
  .restore-actions { flex-direction: column; align-items: stretch; }
  .site-foot { flex-direction: column; }
}

/* --- reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #orbLayer { transition: none; }
}

/* --- language switch ----------------------------------------------------- */

.topbar-right { display: flex; align-items: center; gap: 18px; }

.lang-switch {
  display: inline-flex; align-items: center; gap: 1px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  border: 1px solid var(--line); border-radius: 3px; overflow: hidden;
}
.lang-switch a, .lang-switch span {
  padding: 5px 9px; text-decoration: none; color: var(--ink-3);
  transition: color 0.2s, background 0.2s;
}
.lang-switch a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }
.lang-switch .is-current { background: var(--plasma); color: #0A0B0D; }

@media (max-width: 560px) {
  .topbar-right { gap: 12px; }
  .topbar-link { display: none; }
}

/* --- Cyrillic fitting ---------------------------------------------------- */

/* Instrument Serif's Cyrillic italic sets noticeably wider than its Latin, so
   the Bulgarian headline needs a little less size to keep its line breaks and
   leave the call to action above the fold. */
html[lang="bg"] h1 { font-size: clamp(38px, 5.1vw, 72px); }
html[lang="bg"] .steps h3 { font-size: 23px; }
html[lang="bg"] .board-title h2 { font-size: clamp(23px, 2.2vw, 32px); }
html[lang="bg"] .sheet-head h2 { font-size: 28px; }
