/* LEVCHYK UGS · STUDIO — Clay-only styles
   Tokens map directly to the repository-root DESIGN.md clay system.
   Sections: tokens · fonts · base · header · shelf · world · program · anatomy · proof
             · call · product · adaptation · drawer · lightbox · responsive · motion */

/* ── tokens ─────────────────────────────────────────────────────────────── */
:root {
  --canvas: #fffaf0;
  --surface: #faf5e8;
  --surface-2: #f5f0e0;
  --surface-strong: #ebe6d6;
  --surface-dark: #0a1a1a;
  --hair: #e5e5e5;
  --hair-2: #d5d0c3;
  --ink: #0a0a0a;
  --body: #3a3a3a;
  --muted: #6a6a6a;
  --accent: #1a3a3a;
  --product: #ffb084;
  --pink: #ff4d8b;
  --lavender: #b8a4ed;
  --ochre: #e8b94a;
  --mint: #a4d4c5;
  --coral: #ff6b5a;
  --ok: #15803d;
  --warn: #a16207;
  --bad: #dc2626;

  --display: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --prose: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  --fade: 160ms;
  --slide: 240ms;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1400px;
  --drawer-w: min(760px, 100vw);
  --radius: 16px;
  --radius-xl: 24px;
}

/* ── base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--canvas); color: var(--body); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  font: 400 16px/1.55 var(--prose);
  background: var(--canvas); color: var(--body);
  -webkit-font-smoothing: antialiased;
}
b, strong { font-weight: 600; color: var(--ink); }
h1, h2, h3, h4 { font-weight: 600; margin: 0; color: var(--ink); letter-spacing: -.03em; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }
code, kbd, .mono { font-family: var(--mono); font-size: 13px; }
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--ink); }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--canvas); padding: 6px 10px; }
.skip:focus { left: 8px; }

.display { font-family: var(--display); letter-spacing: -.02em; }
.kicker {
  font-family: var(--display); text-transform: uppercase; font-weight: 600; font-size: 12px; letter-spacing: 1.5px;
  color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; line-height: 1.5;
}
.kicker > * { white-space: nowrap; }
.kicker::after { content: ''; flex: 1; height: 1px; background: var(--hair); }
.kicker.tight::after { display: none; }
.kicker .n { color: var(--ink); }
.title { font-family: var(--display); letter-spacing: -.04em; line-height: 1.04; }
.title-xl { font-size: clamp(40px, 5vw, 64px); letter-spacing: -.05em; font-weight: 500; }
.title-l { font-size: clamp(28px, 3.6vw, 40px); }
.title-m { font-size: 24px; }
.muted { color: var(--muted); }
.ink { color: var(--ink); }
.accent { color: var(--accent); }
.prose { font-family: var(--prose); font-size: 17px; line-height: 1.55; }
.prose-s { font-family: var(--prose); font-size: 15px; line-height: 1.5; }
.serif-i { font-style: italic; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 12px; line-height: 1;
  padding: 5px 8px; border: 1px solid var(--hair-2); border-radius: 999px;
  color: var(--body); white-space: nowrap;
}
.chip.accent { border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--accent); }
.chip.solid { background: var(--accent); color: var(--canvas); border-color: var(--accent); }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 60%, transparent); }
.chip.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 600; font-size: 14px;
  padding: 12px 20px; min-height: 44px; border: 1px solid var(--hair-2); border-radius: 12px; color: var(--ink);
  transition: border-color var(--fade), transform var(--fade), background var(--fade);
}
.btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn:disabled, .btn.disabled { background: #e5e5e5; color: var(--muted); border-color: #e5e5e5; cursor: not-allowed; transform: none; }

.tok {
  font-family: var(--mono); font-size: .86em; color: var(--accent);
  border-bottom: 1px dotted color-mix(in srgb, var(--accent) 60%, transparent); cursor: pointer;
}
.tok:hover { color: var(--ink); border-bottom-style: solid; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: 72px 0 24px; }
.section > .kicker { margin-bottom: 22px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 48px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.card {
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 24px; transition: transform var(--fade), border-color var(--fade), background var(--fade);
}
a.card:hover, button.card:hover { transform: translateY(-2px); border-color: var(--hair-2); background: var(--surface-2); box-shadow: 0 12px 30px rgba(26,58,58,.08); }
.callout {
  border-left: 2px solid var(--accent); background: var(--surface); padding: 14px 18px; border-radius: 0 var(--radius) var(--radius) 0;
}
.empty { color: var(--muted); font-style: italic; }

.err-banner {
  position: fixed; left: 0; right: 0; top: 0; z-index: 200; background: #5a1f1f; color: #fff;
  padding: 8px 12px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap;
}

/* ── header ─────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--canvas) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
}
.wordmark { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }
.wordmark .dot { color: var(--accent); }
.nav { display: flex; gap: 22px; }
.nav a { font-family: var(--display); font-size: 14px; font-weight: 500; color: var(--muted); padding: 4px 0; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.jobs-toggle, .user-toggle {
  min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px;
  border: 1px solid var(--hair-2); border-radius: 999px; font: 600 12px/1 var(--display); color: var(--body);
}
.jobs-toggle:hover, .jobs-toggle.active { border-color: var(--accent); color: var(--ink); }
.jobs-toggle b { min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border-radius: 99px; background: var(--surface-strong); font: 11px/1 var(--mono); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.jobs-toggle.active .live-dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 50%, transparent); animation: livepulse 1.8s ease-in-out infinite; }
.user-toggle { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-family: var(--mono); }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); padding-top: 18px; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--hair-2); }

/* ── shelf ──────────────────────────────────────────────────────────────── */
.intent { font-size: clamp(20px, 2.2vw, 26px); line-height: 1.35; color: var(--ink); max-width: 62ch; margin: 44px 0 36px; }
.intent em { color: var(--muted); }
.posters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.poster {
  position: relative; display: block; aspect-ratio: 9 / 16; overflow: hidden; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--hair);
  transition: transform var(--fade), border-color var(--fade), box-shadow var(--fade);
}
.poster:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 60%, var(--hair)); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.poster img { width: 100%; height: 100%; object-fit: cover; object-position: center top; filter: saturate(.92); transition: transform 600ms var(--ease); }
.poster:hover img { transform: scale(1.03); }
.poster .veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11, 11, 12, .55) 0%, rgba(11, 11, 12, 0) 26%, rgba(11, 11, 12, 0) 42%, rgba(11, 11, 12, .82) 68%, rgba(11, 11, 12, .96) 100%);
}
.poster .p-top { position: absolute; left: 14px; right: 14px; top: 12px; display: flex; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--ink); }
.poster .p-top > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poster .p-top > span:last-child { flex: none; }
.poster .p-top .n { color: var(--accent); }
.poster .p-bottom { position: absolute; left: 14px; right: 14px; bottom: 14px; }
.poster .p-fn { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: clamp(20px, 1.9vw, 27px); line-height: .98; color: var(--ink); margin-bottom: 8px; }
.poster .p-mech { font-family: var(--prose); font-size: 14.5px; line-height: 1.35; color: var(--body); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 10px; }
.poster .chips { margin-bottom: 10px; }
.poster .chip { padding: 4px 7px; font-size: 11px; background: rgba(11, 11, 12, .45); }
.poster .p-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); border-top: 1px solid var(--hair); padding-top: 8px; white-space: nowrap; }
.poster .p-foot > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.poster .p-foot .n { color: var(--accent); }
.poster .no-still { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-family: var(--mono); font-size: 12px; }

.rail { padding: 64px 0 80px; }
.rail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.pcard { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; --accent: var(--product); }
.pcard .jar { width: 96px; aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.pcard .jar img { width: 100%; height: 100%; object-fit: cover; }
.pcard h3 { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 22px; line-height: 1; margin-bottom: 8px; }
.pcard .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 12px; }
.pcard .meta .n { color: var(--product); }
.pcard.add { border-style: dashed; border-color: var(--hair-2); grid-template-columns: 1fr; background: transparent; }
.pcard.add h3 { color: var(--muted); }
.pcard.add code { font-size: 12px; color: var(--body); display: block; white-space: pre; line-height: 1.6; }
.pcard.add p { font-size: 15px; margin: 0 0 6px; }

/* ── world: marquee + masthead ──────────────────────────────────────────── */
.world { --accent: var(--accent); }
.strip-wrap { margin: 18px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--hair-2) transparent; }
.strip { display: flex; gap: 6px; padding: 10px 0 14px; width: max-content; }
.still { flex: none; display: block; height: 232px; position: relative; border-radius: 3px; overflow: hidden; background: var(--surface); cursor: zoom-in; border: 1px solid var(--hair); transition: transform var(--fade), border-color var(--fade); }
.still:hover { transform: translateY(-2px); border-color: var(--accent); }
.still img { height: 100%; width: auto; display: block; }
.still .t { position: absolute; left: 6px; bottom: 6px; font-family: var(--mono); font-size: 11px; color: #fff; background: rgba(11, 11, 12, .78); padding: 2px 6px; border-radius: 3px; }
.still .n { position: absolute; left: 6px; top: 6px; font-family: var(--mono); font-size: 11px; color: #fff; text-shadow: 0 1px 3px #000; }
.strip-note { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: -4px; }

.masthead { padding: 22px 0 8px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px 56px; align-items: end; }
.masthead .kicker { margin-bottom: 12px; }
.masthead .title-rest { font-family: var(--prose); font-style: italic; font-size: 20px; color: var(--muted); margin-top: 8px; text-transform: none; letter-spacing: 0; line-height: 1.3; }
.identity { font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: var(--muted); margin-top: 14px; }
.identity b { color: var(--body); }
.identity .sep { color: var(--hair-2); margin: 0 6px; }
.story { font-size: 19px; line-height: 1.45; color: var(--body); margin: 0; }
.story::first-letter { color: var(--accent); }

/* ── machine ─────────────────────────────────────────────────────────────── */
.machine .mech { column-count: 2; column-gap: 48px; }
.machine .mech p { margin-bottom: 1em; }
.sig-wrap { margin-top: 28px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); }
.sig { font-family: var(--mono); font-size: 13px; line-height: 2; word-break: break-word; }
.sig-fn { color: var(--ink); font-size: 15px; letter-spacing: .02em; }
.sig-paren, .sig-sep { color: var(--muted); }
.sig-arrow { color: var(--accent); margin: 0 6px; }
.sig-ret { color: var(--body); font-style: normal; }
.slot {
  display: inline-block; font-family: var(--mono); font-size: 12px; line-height: 1;
  padding: 5px 7px; margin: 2px 0; border: 1px solid var(--hair-2); border-radius: 4px; color: var(--body);
  transition: border-color var(--fade), color var(--fade), background var(--fade), transform var(--fade);
}
.slot:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-1px); }
.slot[aria-pressed="true"] { background: var(--accent); color: var(--canvas); border-color: var(--accent); }
.sig-note { font-family: var(--prose); font-size: 15px; color: var(--muted); margin: 12px 0 0; }
.sig-count { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.slot-panel { margin-top: 14px; border-top: 1px solid var(--hair); padding-top: 14px; display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 18px; }
.slot-panel .lbl { font-family: var(--display); text-transform: uppercase; letter-spacing: 2px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.slot-panel .val { font-family: var(--prose); font-size: 15.5px; line-height: 1.45; color: var(--body); }
.slot-panel .head { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; }
.slot-panel .head .mono { color: var(--ink); font-size: 14px; }
.slot-panel .x { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.slot-panel .x:hover { color: var(--ink); }
.pre { margin-top: 24px; }
.pre .lbl { font-family: var(--display); text-transform: uppercase; letter-spacing: 2px; font-size: 11px; color: var(--accent); margin-bottom: 6px; }
.pre p:last-child { margin-bottom: 0; }

/* ── program ─────────────────────────────────────────────────────────────── */
.bar { display: flex; gap: 2px; height: 56px; align-items: stretch; }
.seg {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 6px 6px 5px; min-width: 0;
  background: var(--surface-2); border-top: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 2px;
  text-align: left; overflow: hidden; transition: background var(--fade), border-color var(--fade), transform var(--fade);
}
.seg:hover, .seg[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); border-top-color: var(--accent); }
.seg[aria-pressed="true"] { transform: translateY(-2px); }
.seg .n { font-family: var(--mono); font-size: 11px; color: var(--ink); line-height: 1; }
.seg .nm { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 11px; color: var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg .pc { font-family: var(--mono); font-size: 10px; color: var(--muted); line-height: 1; }
.seg.opt { flex: 0 0 14px; border-top-style: dashed; background: transparent; border: 1px dashed var(--hair-2); border-top: 1px dashed var(--accent); }
.seg.opt .n { writing-mode: vertical-rl; font-size: 10px; color: var(--muted); }
.ticks { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 6px; }
.acts { display: flex; gap: 2px; margin-top: 10px; height: 22px; }
.act { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 8px; min-width: 0; background: var(--surface); border-radius: 2px; font-family: var(--display); text-transform: uppercase; letter-spacing: 1.5px; font-size: 11px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.act > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.act b { flex: none; color: var(--accent); font-family: var(--mono); letter-spacing: 0; text-transform: none; font-size: 11px; }
.stage-note { font-family: var(--prose); font-size: 15px; color: var(--muted); margin-top: 10px; }
.stage-detail { margin-top: 18px; display: grid; grid-template-columns: minmax(180px, .6fr) 1.4fr 1fr 1fr; gap: 18px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); min-height: 120px; }
.stage-detail .lbl { font-family: var(--display); text-transform: uppercase; letter-spacing: 2px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.stage-detail .val { font-family: var(--prose); font-size: 15.5px; line-height: 1.45; }
.stage-detail .big { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 26px; line-height: 1; color: var(--ink); }
.stage-detail .big .n { color: var(--accent); margin-right: 8px; }
.stage-detail .pct { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 8px; }
.stage-detail .slots { display: flex; flex-wrap: wrap; gap: 4px; }

.invariants { list-style: none; margin: 34px 0 0; padding: 0; counter-reset: inv; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 40px; }
.inv { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hair); }
.inv .n { font-family: var(--mono); font-size: 12px; color: var(--accent); padding-top: 4px; }
.inv .t { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 17px; line-height: 1.1; color: var(--ink); margin-bottom: 6px; }
.inv .x { font-size: 15.5px; line-height: 1.45; color: var(--body); margin: 0 0 8px; }
.inv .tchips { display: flex; flex-wrap: wrap; gap: 5px; }
.tchip { font-family: var(--mono); font-size: 11px; padding: 3px 7px; border-radius: 3px; background: var(--surface-2); color: var(--accent); border: 1px solid transparent; transition: border-color var(--fade), transform var(--fade); }
.tchip:hover { border-color: var(--accent); transform: translateY(-1px); }
.tchip.shot { color: var(--muted); }

/* ── anatomy ─────────────────────────────────────────────────────────────── */
.clusters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.cluster > .kicker { margin-bottom: 12px; }
.cluster .ecard { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 10px; }
.cluster .ecard.cast { grid-template-columns: 44px 1fr; align-items: start; }
.mono-gram { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 18px; letter-spacing: 1px; color: var(--canvas); background: var(--accent); }
.ecard h4 { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 19px; line-height: 1.05; }
.ecard .sub { font-family: var(--prose); font-style: italic; font-size: 14px; color: var(--muted); line-height: 1.3; }
.ecard .one { font-family: var(--prose); font-size: 14.5px; line-height: 1.4; color: var(--body); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ecard .foot { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.ecard .foot .st { color: var(--ok); }

/* ── proof & DNA ─────────────────────────────────────────────────────────── */
.proof-list { list-style: none; margin: 0; padding: 0; }
.proof-list li { padding: 10px 0; border-top: 1px solid var(--hair); font-size: 15.5px; line-height: 1.45; }
.proof-list li b { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 15px; color: var(--ink); display: block; margin-bottom: 2px; }
.dna .d { padding: 10px 0; border-top: 1px solid var(--hair); font-size: 15.5px; line-height: 1.45; }
.dna .d b { font-family: var(--display); text-transform: uppercase; letter-spacing: 2px; font-size: 12px; color: var(--accent); display: block; margin-bottom: 4px; }
.never { margin-top: 40px; }
.never ul { list-style: none; margin: 0; padding: 0; column-count: 2; column-gap: 48px; }
.never li { break-inside: avoid; padding: 8px 0 8px 22px; position: relative; font-size: 15px; line-height: 1.45; border-top: 1px solid var(--hair); }
.never li::before { content: '×'; position: absolute; left: 0; top: 7px; font-family: var(--mono); color: var(--bad); }
.never li b { color: var(--ink); }
.fallback-md { font-size: 15.5px; }

/* ── call it with a product ──────────────────────────────────────────────── */
.picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.pick { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--hair-2); border-radius: 999px; font-family: var(--display); text-transform: uppercase; letter-spacing: 1.5px; font-size: 13px; color: var(--body); }
.pick img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.pick[aria-pressed="true"] { border-color: var(--product); color: var(--ink); }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.vcard { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 14px; }
.vcard .thumb { width: 96px; aspect-ratio: 9 / 16; border-radius: 4px; overflow: hidden; background: linear-gradient(160deg, var(--surface-2), var(--canvas)); border: 1px solid var(--hair); display: grid; place-items: center; }
.vcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.vcard .thumb .ph { font-family: var(--mono); font-size: 10px; color: var(--muted); text-align: center; padding: 6px; }
.vcard > div { min-width: 0; }
.vcard h4 { overflow-wrap: anywhere; font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 20px; line-height: 1.05; margin-bottom: 4px; }
.vcard .v { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.vcard .hook { font-family: var(--prose); font-size: 15px; line-height: 1.4; color: var(--body); margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vcard .triple { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.vcard .triple .chip { font-size: 10.5px; padding: 3px 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 1.2; }
.vcard .stat { display: flex; flex-wrap: wrap; gap: 6px 10px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.vcard .stat .st { color: var(--ok); }
.vcard .stat .st.draft, .vcard .stat .st.progress { color: var(--warn); }
.vcard .stat .st.refused { color: var(--bad); }
.files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.files .f { font-family: var(--mono); font-size: 10px; padding: 2px 5px; border-radius: 3px; background: var(--surface-2); color: var(--muted); }
.files .f.on { color: var(--body); border: 1px solid var(--hair-2); }
.newcard { border-style: dashed; border-color: var(--hair-2); background: transparent; grid-column: span 2; }
.newcard h4 { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 20px; margin-bottom: 10px; }
.angle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-bottom: 14px; }
.angle .lbl { font-family: var(--display); text-transform: uppercase; letter-spacing: 2px; font-size: 11px; color: var(--muted); }
.angle .val { font-size: 15px; line-height: 1.4; }
.invoke { position: relative; background: var(--canvas); border: 1px solid var(--hair); border-radius: 4px; padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: var(--body); margin: 0; }
.invoke .k { color: var(--product); }
.copy { position: absolute; right: 8px; top: 8px; font-family: var(--mono); font-size: 11px; padding: 4px 8px; border: 1px solid var(--hair-2); border-radius: 3px; color: var(--muted); background: var(--surface); }
.copy:hover { color: var(--ink); border-color: var(--product); }
.conv { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 10px; }

.evidence { margin: 56px 0 80px; padding-top: 22px; border-top: 1px solid var(--hair); }
.evidence .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.evidence a.card h4 { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 18px; margin-bottom: 4px; }
.evidence a.card p { font-size: 14.5px; line-height: 1.4; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── product ─────────────────────────────────────────────────────────────── */
.product { --accent: var(--product); }
.phead { display: grid; grid-template-columns: 1fr 220px; gap: 32px; align-items: end; padding: 22px 0 8px; }
.phead .jar { width: 220px; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--hair); }
.phead .jar img { width: 100%; height: 100%; object-fit: cover; }
.phead .intro { font-size: 19px; line-height: 1.45; margin: 14px 0 0; max-width: 60ch; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--hair); margin-top: 36px; }
.tab { font-family: var(--display); text-transform: uppercase; letter-spacing: 2px; font-size: 13px; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-body { padding: 26px 0 8px; max-width: 960px; }
.tab-body .md > div > p, .tab-body .md li { max-width: 78ch; }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.asset { display: block; aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: var(--surface); border: 1px solid var(--hair); cursor: zoom-in; position: relative; }
.asset img { width: 100%; height: 100%; object-fit: cover; }
.asset .cap { position: absolute; left: 6px; bottom: 6px; font-family: var(--mono); font-size: 10px; color: var(--ink); background: rgba(11, 11, 12, .7); padding: 2px 5px; border-radius: 3px; }
.by-world { margin-bottom: 26px; }
.by-world .kicker { margin-bottom: 12px; }

/* ── adaptation ──────────────────────────────────────────────────────────── */
.ahead { padding: 22px 0 8px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 24px 56px; align-items: start; }
.ahead .links { display: flex; flex-wrap: wrap; gap: 8px 18px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 14px; }
.ahead .links a { color: var(--body); border-bottom: 1px solid var(--hair-2); }
.ahead .links a:hover { color: var(--ink); border-bottom-color: var(--accent); }
.scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 18px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); }
.score .lbl { font-family: var(--display); text-transform: uppercase; letter-spacing: 1.5px; font-size: 10.5px; color: var(--muted); display: flex; justify-content: space-between; }
.score .lbl b { font-family: var(--mono); color: var(--ink); letter-spacing: 0; text-transform: none; font-size: 11px; }
.score .meter { height: 3px; background: var(--surface-2); margin-top: 6px; border-radius: 2px; overflow: hidden; }
.score .meter i { display: block; height: 100%; background: var(--accent); }
.credits { grid-column: 1 / -1; font-family: var(--mono); font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; border-top: 1px solid var(--hair); padding-top: 10px; }
.logline { font-size: 21px; line-height: 1.4; color: var(--ink); margin: 26px 0 6px; max-width: 70ch; }
.hookline { font-size: 18px; font-style: italic; color: var(--body); margin: 0; max-width: 70ch; }
.hookline::before { content: '« '; color: var(--accent); }
.hookline::after { content: ' »'; color: var(--accent); }
.progress-note { margin-top: 26px; }
.progress-note .steps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.progress-note .steps .chip.on { color: var(--ink); border-color: var(--accent); }
.progress-note .steps .chip.now { background: var(--accent); color: var(--canvas); border-color: var(--accent); }

.boards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.board { display: block; text-align: left; }
.board .frame { position: relative; aspect-ratio: 9 / 16; border-radius: 4px; overflow: hidden; background: var(--surface); border: 1px solid var(--hair); container-type: inline-size; cursor: zoom-in; transition: transform var(--fade), border-color var(--fade); }
.board .frame.a45 { aspect-ratio: 4 / 5; }
.board .frame.a34 { aspect-ratio: 3 / 4; }
.board:hover .frame { transform: translateY(-2px); border-color: var(--accent); }
.board .frame img { width: 100%; height: 100%; object-fit: cover; }
.board .ph { position: absolute; inset: 0; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(160deg, var(--surface-2), var(--canvas)); }
.board .ph .st { font-family: var(--mono); font-size: 10.5px; color: var(--warn); }
.board .ph .pr { font-family: var(--prose); font-size: 13px; line-height: 1.35; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 14; -webkit-box-orient: vertical; }
.pill-wrap { position: absolute; left: 6%; right: 6%; bottom: 24%; display: flex; justify-content: center; pointer-events: none; }
.pill { font-family: var(--mono); font-size: 4.6cqw; line-height: 1.25; background: #fff; color: #0b0b0c; padding: .38em .85em; border-radius: 1.2em; text-align: center; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.board .b-stage { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 14px; color: var(--ink); margin-top: 10px; display: flex; justify-content: space-between; gap: 8px; }
.board .b-stage .n { color: var(--accent); font-family: var(--mono); letter-spacing: 0; font-size: 11px; }
.board .vo { font-family: var(--prose); font-size: 14.5px; line-height: 1.4; color: var(--body); margin: 4px 0 0; }
.board .en { font-family: var(--prose); font-style: italic; font-size: 13.5px; line-height: 1.35; color: var(--muted); margin: 2px 0 0; }

.cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.passport { display: block; text-align: left; align-self: start; }
.passport .pic { aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden; background: var(--surface); border: 1px solid var(--hair); display: grid; place-items: center; cursor: zoom-in; }
.passport .pic img { width: 100%; height: 100%; object-fit: cover; }
.passport .pic .ph { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 10px; text-align: center; }
.passport h4 { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 19px; margin-top: 10px; line-height: 1.05; }
.passport .role { font-family: var(--mono); font-size: 11.5px; color: var(--accent); margin-top: 2px; }
.passport .reg { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.passport .ck { font-family: var(--prose); font-size: 14px; line-height: 1.4; color: var(--body); margin-top: 6px; }

.docs details { border-top: 1px solid var(--hair); }
.docs details:last-of-type { border-bottom: 1px solid var(--hair); }
.docs summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 16px 0; font-family: var(--display); text-transform: uppercase; letter-spacing: 1.5px; font-size: 18px; color: var(--ink); }
.docs summary::-webkit-details-marker { display: none; }
.docs summary::before { content: '+'; font-family: var(--mono); color: var(--accent); width: 14px; }
.docs details[open] summary::before { content: '−'; }
.docs summary .meta { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: 0; text-transform: none; }
.docs .doc-body { padding: 0 0 26px; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; }
.docs .doc-body.single { grid-template-columns: minmax(0, 1fr); }
.subnav { position: sticky; top: 76px; align-self: start; font-family: var(--mono); font-size: 11.5px; line-height: 1.7; color: var(--muted); border-left: 1px solid var(--hair); padding-left: 12px; max-height: calc(100vh - 100px); overflow: auto; }
.subnav a { display: block; }
.subnav a:hover { color: var(--ink); }
.doc-md { max-width: 80ch; }
.refstrip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 14px; }
.refstrip img { height: 150px; width: auto; border-radius: 3px; border: 1px solid var(--hair); cursor: zoom-in; }
.rawlinks { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 80px; }
.rawlinks a { font-family: var(--mono); font-size: 12px; padding: 6px 10px; border: 1px solid var(--hair-2); border-radius: 4px; color: var(--body); }
.rawlinks a:hover { border-color: var(--accent); color: var(--ink); }
.rawlinks a.off { color: var(--muted); border-style: dashed; pointer-events: none; }

/* ── markdown (drawer + inline documents) ────────────────────────────────── */
.md { font-family: var(--prose); font-size: 17px; line-height: 1.55; color: var(--body); }
.md h1 { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 30px; line-height: 1.05; margin: 0 0 16px; }
.md h2 { font-family: var(--display); text-transform: uppercase; letter-spacing: 2px; font-size: 14px; color: var(--accent); margin: 34px 0 10px; padding-top: 14px; border-top: 1px solid var(--hair); }
.md h3 { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 18px; margin: 24px 0 8px; }
.md h4 { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; font-size: 15px; margin: 18px 0 6px; color: var(--body); }
.md p { margin: 0 0 1em; }
.md ul, .md ol { padding-left: 1.4em; margin: 0 0 1em; }
.md li { margin-bottom: .35em; }
.md blockquote { margin: 0 0 1em; padding: 6px 16px; border-left: 2px solid var(--accent); color: var(--muted); font-style: italic; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 3px; color: var(--ink); }
.md pre { background: var(--canvas); border: 1px solid var(--hair); border-radius: 4px; padding: 12px 14px; overflow: auto; font-size: 12px; line-height: 1.55; }
.md pre code { background: none; padding: 0; font-size: 12px; }
.md img { border-radius: 4px; border: 1px solid var(--hair); margin: 6px 0 12px; max-height: 70vh; }
.md a { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.md a:hover { color: var(--ink); border-bottom-color: var(--accent); }
.md a.ext::after { content: ' ↗'; font-family: var(--mono); font-size: .75em; }
.md .dead-link { color: var(--muted); border-bottom: 1px dotted var(--hair-2); }
.md hr { border: 0; border-top: 1px solid var(--hair); margin: 24px 0; }
.md em { color: var(--ink); }
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--hair); border-radius: 4px; scrollbar-width: thin; }
.md table { border-collapse: collapse; font-family: var(--prose); font-size: 14.5px; line-height: 1.4; min-width: 100%; }
.md th, .md td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--hair); border-right: 1px solid var(--hair); }
.md th { font-family: var(--display); text-transform: uppercase; letter-spacing: 1.5px; font-size: 11px; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
.md tr:last-child td { border-bottom: 0; }
.md td:last-child, .md th:last-child { border-right: 0; }
.md tr.hl td { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.md td code, .md th code { white-space: nowrap; }
.fm { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }

/* ── drawer ──────────────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity var(--slide); }
.scrim.on { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: var(--drawer-w);
  background: var(--surface); border-left: 1px solid var(--hair); box-shadow: -20px 0 60px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--slide) var(--ease);
}
.drawer.on { transform: translateX(0); }
.drawer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--hair); background: var(--surface); }
.drawer-crumb { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.drawer-crumb a:hover { color: var(--ink); }
.drawer-crumb .sep { color: var(--hair-2); margin: 0 6px; }
.drawer-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.drawer-raw { color: var(--muted); font-size: 12px; }
.drawer-raw:hover { color: var(--ink); }
.drawer-close { width: 34px; height: 34px; border: 1px solid var(--hair-2); border-radius: 50%; font-size: 20px; line-height: 1; color: var(--body); display: grid; place-items: center; }
.drawer-close:hover { border-color: var(--accent); color: var(--ink); }
.drawer-body { flex: 1; overflow: auto; padding: 22px 26px 60px; overscroll-behavior: contain; }
.drawer-body .loading { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.drawer-body .md-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.drawer-body .md-nav a { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 3px 7px; border: 1px solid var(--hair); border-radius: 3px; }
.drawer-body .md-nav a:hover { color: var(--ink); border-color: var(--accent); }

/* ── lightbox ────────────────────────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(5, 5, 6, .94); display: grid; grid-template-columns: 64px 1fr 64px; grid-template-rows: 1fr auto; align-items: center; opacity: 0; transition: opacity var(--fade); }
.lightbox.on { opacity: 1; }
.lb-stage { grid-column: 2; grid-row: 1; display: flex; justify-content: center; align-items: center; gap: 18px; height: calc(100vh - 96px); padding: 24px 0 0; }
.lb-stage figure { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.lb-stage img { max-height: calc(100% - 26px); max-width: 100%; width: auto; object-fit: contain; border-radius: 3px; box-shadow: 0 20px 80px rgba(0, 0, 0, .7); }
.lb-stage figcaption { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.lb-stage figcaption b { color: var(--ink); }
.lb-stage .lb-ph { height: 100%; aspect-ratio: 9 / 16; max-width: 100%; background: var(--surface); border: 1px solid var(--hair-2); border-radius: 4px; padding: 20px; overflow: auto; font-family: var(--prose); font-size: 15px; color: var(--body); }
.lb-stage .lb-ph .st { font-family: var(--mono); font-size: 11px; color: var(--warn); margin-bottom: 10px; }
.lb-stage .frame { position: relative; height: calc(100% - 26px); }
.lb-stage .frame img { height: 100%; max-height: none; }
.lb-stage .frame .pill-wrap { left: 6%; right: 6%; }
.lb-stage .frame .pill { font-size: clamp(11px, 2.4vh, 22px); }
.lb-foot { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 14px 24px 22px; font-family: var(--mono); font-size: 12.5px; color: var(--body); flex-wrap: wrap; text-align: center; }
.lb-foot b { color: var(--ink); }
.lb-foot .cmp { font-family: var(--display); text-transform: uppercase; letter-spacing: 1.5px; font-size: 12px; padding: 7px 12px; border: 1px solid var(--hair-2); border-radius: 999px; color: var(--body); }
.lb-foot .cmp[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 20%, transparent); }
.lb-prev, .lb-next { grid-row: 1; font-size: 44px; color: var(--muted); height: 100%; display: grid; place-items: center; }
.lb-prev { grid-column: 1; } .lb-next { grid-column: 3; }
.lb-prev:hover, .lb-next:hover { color: var(--ink); }
.lb-close { position: absolute; right: 18px; top: 14px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--hair-2); font-size: 24px; color: var(--body); display: grid; place-items: center; z-index: 2; }
.lb-close:hover { color: var(--ink); border-color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 70; background: var(--ink); color: var(--canvas); padding: 8px 14px; border-radius: 999px; font-size: 12px; }

/* ── clay system mapping + Studio orchestration ─────────────────────────── */
.title-rest, .story, .mech, .logline, .hookline, .md { font-family: var(--prose); }
.title-rest { font-style: normal !important; }
.poster { border-radius: 24px; }
.poster .p-fn, .poster .p-top, .poster .p-bottom, .poster .p-mech, .poster .p-foot { color: #fff; }
.poster .chip { color: #fff; border-color: rgba(255,255,255,.5); background: rgba(10,26,26,.54); }
.poster .veil { background: linear-gradient(180deg, rgba(10,26,26,.62) 0%, transparent 32%, transparent 44%, rgba(10,26,26,.78) 70%, rgba(10,26,26,.96) 100%); }
.poster:hover { box-shadow: 0 18px 40px rgba(26,58,58,.16); }
.pcard, .sig-wrap, .scores, .detail-card, .empty-narratives { border-radius: 24px; }
.still { border-radius: 12px; }
.still .t, .asset .cap { color: #fff; background: rgba(10,26,26,.76); border-radius: 6px; }
.ecard h4, .pcard h3, .vcard h4, .newcard h4, .passport h4, .board .b-stage, .docs summary,
.stage-detail .big, .inv .t, .md h1, .md h2, .md h3, .md h4 { text-transform: none; letter-spacing: -.02em; }
.md h2 { font-size: 22px; color: var(--ink); }
.md h3 { font-size: 18px; }
.md th { color: var(--body); letter-spacing: .04em; }
.lightbox { background: rgba(10,26,26,.96); color: #fff; }
.lightbox .lb-foot, .lightbox .lb-stage figcaption, .lightbox .lb-stage figcaption b,
.lightbox .lb-close, .lightbox .lb-prev, .lightbox .lb-next { color: #fff; }
.lightbox .cmp { color: #fff; border-color: rgba(255,255,255,.4); }
.drawer { box-shadow: -18px 0 44px rgba(26,58,58,.12); }

.nav { align-items: center; }
.lang-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px; border: 1px solid var(--hair); border-radius: 999px; font: 600 12px/1 var(--display); }
.lang-toggle i { width: 1px; height: 13px; background: var(--hair-2); }
.lang-toggle span { color: var(--muted); }
.lang-toggle span.on { color: var(--ink); }

.world-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 24px 0 0; border-top: 1px solid var(--hair); margin-top: 24px; }
.world-tabs a { min-height: 40px; padding: 10px 16px; border-radius: 999px; color: var(--muted); font: 500 14px/1.3 var(--display); }
.world-tabs a:hover { background: var(--surface); color: var(--ink); }
.world-tabs a[aria-current="page"] { background: var(--surface-strong); color: var(--ink); }

.original { padding-top: 40px; }
.original-grid { display: grid; grid-template-columns: minmax(320px,.85fr) minmax(420px,1.15fr); gap: 48px; align-items: start; }
.original-video, .original-missing { width: 100%; max-height: 72vh; aspect-ratio: 9/16; object-fit: contain; background: var(--surface-dark); border-radius: 24px; overflow: hidden; margin-top: 16px; }
.original-video { display: block; }
.original-missing { position: relative; display: block; }
.original-missing img { width: 100%; height: 100%; object-fit: cover; }
.original-missing > span { position: absolute; left: 16px; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; background: #fffaf0e8; color: var(--ink); border-radius: 12px; }
.original-missing small { color: var(--muted); }
.source-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.signed-note { padding: 16px; margin-top: 16px; border-radius: 12px; background: var(--surface); color: var(--body); font-size: 14px; }
.metrics-strip { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-bottom: 16px; }
.metric { min-height: 120px; border-radius: 24px; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; background: var(--surface-strong); color: var(--ink); }
.metric.pink { background: var(--pink); color: #fff; }
.metric.ochre { background: var(--ochre); }
.metric.lavender { background: var(--lavender); }
.metric.mint { background: var(--mint); }
.metric strong { color: inherit; font: 500 clamp(34px,4vw,54px)/1 var(--display); letter-spacing: -.05em; }
.metric span { font: 600 12px/1.3 var(--display); text-transform: uppercase; letter-spacing: .08em; }
.detail-card { background: var(--surface); padding: 24px; }
.detail-card .kicker { margin-bottom: 16px; }
.detail-card table { width: 100%; border-collapse: collapse; font-size: 14px; }
.detail-card th, .detail-card td { padding: 10px 8px; border-bottom: 1px solid var(--hair); text-align: left; vertical-align: top; }
.detail-card th { width: 34%; color: var(--muted); font-weight: 500; }
.ad-copy { max-height: 180px; overflow: auto; white-space: pre-wrap; }

.call { padding-top: 40px; }
.picker { border: 0; margin: 0 0 28px; padding: 0; }
.pick { background: var(--surface); border-color: var(--hair); border-radius: 999px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.pick[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.fixture-note { display: inline-flex; padding: 8px 12px; border-radius: 8px; background: var(--lavender); color: var(--ink); font-size: 13px; margin-bottom: 20px; }
.state-head { display: flex; align-items: flex-start; gap: 16px; margin: 0 0 20px; }
.state-head > div { flex: 1; }
.state-head h2 { font-size: clamp(26px,3vw,40px); line-height: 1.08; font-weight: 500; }
.state-head p { color: var(--muted); margin: 6px 0 0; max-width: 72ch; }
.step-no, .narrative-index { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--ink); color: #fff; font: 600 13px/1 var(--mono); }
.status-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 6px 10px; border-radius: 999px; background: var(--surface-strong); color: var(--body); font: 600 12px/1 var(--display); white-space: nowrap; }
.status-pill.ok, .status-pill.done { background: #dcfce7; color: #166534; }
.status-pill.warn, .status-pill.queued { background: #fef3c7; color: #854d0e; }
.status-pill.bad { background: #fee2e2; color: #991b1b; }
.status-pill.todo { background: var(--surface-strong); color: var(--muted); }
.adapt-catalog { display: grid; grid-template-columns: repeat(auto-fit,minmax(300px,1fr)); gap: 20px; }
.adapt-product-card { background: var(--product); border: 0; border-radius: 24px; }
.product-mini { display: flex; align-items: center; gap: 14px; }
.product-mini img { width: 72px; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; }
.product-mini h3 { font-size: 22px; }
.angle.compact { grid-template-columns: 1fr 1fr; margin: 18px 0; }
.angle.compact > div { border-color: rgba(10,10,10,.14); }
.angle.compact b { font-size: 12px; }
.angle.compact p { margin: 4px 0 0; font-size: 13px; }

.brain-panel { background: var(--surface-strong); border-radius: 24px; padding: 28px; margin-bottom: 56px; }
.brain-pages { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 10px; }
.brain-page { display: flex; flex-direction: column; gap: 4px; min-height: 84px; padding: 16px; border-radius: 12px; background: var(--canvas); border: 1px solid var(--hair); }
.brain-page:hover { transform: translateY(-2px); }
.brain-page span { font-weight: 600; }
.brain-page small { color: var(--muted); }
.empty-narratives { display: flex; gap: 20px; background: var(--lavender); border: 0; padding: 32px; }
.empty-narratives h2 { font-size: 28px; }
.flow-stage { padding: 0 0 64px; }
.stage-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.head-action { flex: none; }
.head-action .job-spec { max-width: 440px; }
.narrative-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.narrative-card { min-height: 300px; display: flex; flex-direction: column; }
.narrative-card:nth-child(1) { background: var(--surface); }
.narrative-card:nth-child(2) { background: #f2eafc; }
.narrative-card:nth-child(3) { background: #fce6dd; }
.narrative-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.narrative-card h3 { font-size: 22px; line-height: 1.2; }
.narrative-card blockquote { margin: 12px 0; padding-left: 12px; border-left: 2px solid var(--ink); font-weight: 500; }
.narrative-card > p { color: var(--body); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.concept-card { min-height: 520px; border: 2px solid transparent; }
.concept-card.selected { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10,10,10,.08); }
.concept-card > .concept-summary { display: block; overflow: visible; margin: 14px 0 0; line-height: 1.55; }
.concept-preview { margin-top: 18px; padding: 14px; border-radius: 12px; background: rgba(255,250,240,.74); border: 1px solid rgba(10,10,10,.1); }
.concept-preview b { display: block; margin-bottom: 5px; font: 600 11px/1.3 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.concept-preview p { margin: 0; color: var(--body); font-size: 13px; line-height: 1.5; }
.concept-triple { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 14px; }
.concept-triple .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.narrative-actions { margin-top: auto; padding-top: 16px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.select-story.selected { background: var(--ink); color: #fff; border-color: var(--ink); }
.approval { display: inline-flex; min-height: 44px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--surface-strong); font-weight: 600; font-size: 13px; }
.approval.approved { color: #166534; background: #dcfce7; }
.package-callout { display: grid; grid-template-columns: minmax(240px,1fr) minmax(320px,1fr); gap: 24px; align-items: start; padding: 24px; margin-bottom: 12px; border-radius: 16px; background: var(--lavender); }
.package-callout > div > b { font-size: 18px; }
.package-callout p { margin: 6px 0 0; color: var(--body); }
.locked-stage { padding: 24px; margin-bottom: 24px; border: 1px dashed var(--hair-2); border-radius: 16px; background: var(--surface); }
.locked-stage .state-head { margin-bottom: 0; }
.preview-list { display: grid; gap: 12px; }
.preview-row { display: grid; grid-template-columns: 190px minmax(200px,.8fr) minmax(320px,1.2fr); gap: 20px; align-items: start; padding: 24px; border-radius: 16px; background: var(--surface); }
.preview-row > div:first-child { display: flex; gap: 8px; align-items: center; }
.preview-kind { font-size: 18px; font-weight: 600; }
.preview-row p { color: var(--muted); margin: 4px 0 0; }
.preview-actions { display: flex; flex-direction: column; gap: 8px; }
.job-control { min-width: 0; }
.job-control > .btn { width: fit-content; }
.job-spec { margin-top: 8px; }
.job-spec summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.job-spec pre, .job-result { max-height: 260px; overflow: auto; margin: 8px 0 0; padding: 14px; border-radius: 12px; background: var(--surface-dark); color: #fff; font: 11px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
.job-result { border: 2px solid var(--mint); }

/* ── auth + durable jobs ───────────────────────────────────────────────── */
.login-dialog { width: min(520px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 24px; background: var(--canvas); color: var(--body); box-shadow: 0 28px 100px rgba(10,26,26,.28); }
.login-dialog::backdrop { background: rgba(10,26,26,.64); backdrop-filter: blur(6px); }
.login-card { display: grid; gap: 18px; padding: clamp(28px, 6vw, 52px); }
.login-card h1 { font: 500 clamp(34px, 7vw, 52px)/1 var(--display); letter-spacing: -.05em; }
.login-card p { color: var(--muted); }
.login-card label { display: grid; gap: 6px; font: 600 12px/1.4 var(--display); text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.login-card input { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--hair-2); border-radius: 10px; background: #fff; color: var(--ink); font: 15px/1.3 var(--mono); }
.login-error { padding: 10px 12px; border-left: 2px solid var(--bad); background: color-mix(in srgb, var(--bad) 7%, var(--surface)); color: var(--bad) !important; }

.jobs-scrim { position: fixed; inset: 0; z-index: 74; background: rgba(10,26,26,.22); opacity: 0; transition: opacity var(--slide) var(--ease); }
.jobs-scrim.on { opacity: 1; }
.jobs-panel { position: fixed; z-index: 75; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); overflow-y: auto; padding: 28px; background: var(--canvas); border-left: 1px solid var(--hair); box-shadow: -20px 0 60px rgba(10,26,26,.16); transform: translateX(102%); transition: transform var(--slide) var(--ease); }
.jobs-panel.on { transform: translateX(0); }
.jobs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--hair); }
.jobs-head h2 { margin-top: 8px; font: 500 42px/1 var(--display); letter-spacing: -.05em; }
.usage-strip { margin: 16px 0; padding: 11px 13px; border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 11px; }
.jobs-list { display: grid; gap: 12px; }
.job-card { padding: 18px; border: 1px solid var(--hair); border-radius: 14px; background: #fff; }
.job-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.job-title > div { min-width: 0; display: grid; }
.job-title b { font: 600 17px/1.2 var(--display); }
.job-title span { overflow: hidden; text-overflow: ellipsis; color: var(--muted); font: 11px/1.5 var(--mono); }
.job-state { flex: none; padding: 5px 8px; border: 1px solid var(--hair-2); border-radius: 999px; font: 11px/1 var(--mono) !important; }
.job-state.running, .job-state.queued { color: var(--warn); border-color: color-mix(in srgb, var(--ochre) 65%, var(--hair)); }
.job-state.succeeded { color: var(--ok); border-color: var(--mint); }
.job-state.failed { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--hair)); }
.job-progress { height: 4px; margin: 13px 0 8px; overflow: hidden; border-radius: 4px; background: var(--surface-strong); }
.job-progress i { display: block; height: 100%; background: var(--accent); transition: width 300ms var(--ease); }
.job-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; }
.job-error { margin: 12px 0 0; padding: 9px 10px; border-radius: 8px; background: color-mix(in srgb, var(--bad) 6%, #fff); color: var(--bad); font: 11px/1.45 var(--mono); }
.job-events { list-style: none; padding: 0; margin: 13px 0 0; display: grid; gap: 5px; }
.job-events li { display: grid; grid-template-columns: 76px 1fr; gap: 8px; font: 11px/1.45 var(--mono); color: var(--body); }
.job-events time { color: var(--muted); }
.job-detail { margin-top: 12px; color: var(--accent); font: 600 12px/1.3 var(--display); }
.job-full { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hair); }
.job-full-head { display: flex; justify-content: space-between; gap: 10px; }
.job-full-head .mono { max-width: 260px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 10px; }
.job-events.full { max-height: 300px; overflow-y: auto; padding: 10px; background: var(--surface-dark); color: #fff; border-radius: 10px; }
.job-events.full li, .job-events.full b { color: #fff; }
.job-outputs { display: grid; gap: 7px; margin-top: 14px; font: 11px/1.4 var(--mono); }
.job-outputs > b { font-family: var(--display); font-size: 13px; }
.job-outputs a { padding: 8px 9px; border: 1px solid var(--hair); border-radius: 7px; overflow-wrap: anywhere; }
.job-outputs a:hover { border-color: var(--accent); }

@keyframes livepulse { 50% { opacity: .45; } }


/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .posters { grid-template-columns: repeat(3, 1fr); }
  .clusters { grid-template-columns: repeat(2, 1fr); }
  .boards { grid-template-columns: repeat(3, 1fr); }
  .stage-detail { grid-template-columns: 1fr 1fr; }
  .slot-panel { grid-template-columns: 1fr 1fr; }
  .original-grid { grid-template-columns: minmax(280px,.8fr) minmax(380px,1.2fr); gap: 28px; }
  .narrative-grid { grid-template-columns: 1fr 1fr; }
  .stage-heading { display: block; }
  .head-action { margin: -4px 0 24px 60px; }
  .preview-row { grid-template-columns: 150px 1fr; }
  .preview-actions { grid-column: 1/-1; }
  .package-callout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .posters { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .masthead, .grid-2, .ahead, .phead { grid-template-columns: 1fr; }
  .phead .jar { width: 160px; }
  .machine .mech, .never ul { column-count: 1; }
  .invariants { grid-template-columns: 1fr; gap: 0; }
  .boards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .evidence .row { grid-template-columns: 1fr; }
  .docs .doc-body { grid-template-columns: 1fr; }
  .subnav { position: static; max-height: none; border-left: 0; padding-left: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
  .newcard { grid-column: auto; }
  .angle { grid-template-columns: 1fr; }
  .scores { grid-template-columns: 1fr 1fr; }
  .still { height: 168px; }
  .original-grid { grid-template-columns: 1fr; }
  .original-video, .original-missing { max-height: 68vh; }
  .narrative-grid { grid-template-columns: 1fr; }
  .concept-card { min-height: 0; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .top { padding: 12px 16px; gap: 10px; }
  .wordmark { font-size: 14px; letter-spacing: 2px; }
  .nav { gap: 10px; }
  .nav a { font-size: 12px; }
  .user-toggle { display: none; }
  .jobs-toggle { padding: 5px 8px; }
  .jobs-panel { padding: 18px 14px 40px; }
  .intent { font-size: 19px; margin: 28px 0 22px; }
  .posters { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .poster .p-fn { font-size: 17px; }
  .poster .p-mech { display: none; }
  .poster .p-top, .poster .p-bottom { left: 10px; right: 10px; }
  .poster .chip { font-size: 10px; padding: 3px 5px; }
  .poster .p-foot > span:last-child { display: none; }
  .clusters { grid-template-columns: 1fr; }
  .boards { grid-template-columns: 1fr 1fr; }
  .stage-detail, .slot-panel { grid-template-columns: 1fr; }
  .bar { height: 44px; }
  .seg .nm { display: none; }
  .seg .pc { display: none; }
  .act { padding: 0 5px; letter-spacing: .5px; font-size: 10px; }
  .seg.narrow .n { display: none; }
  .act .muted { display: none; }
  .vcard { grid-template-columns: 76px 1fr; }
  .pcard { grid-template-columns: 76px 1fr; }
  .pcard .jar { width: 76px; }
  .section { padding: 40px 0 8px; }
  .title-xl { font-size: 34px; }
  .story { font-size: 17px; }
  .still { height: 140px; }
  .lightbox { grid-template-columns: 40px 1fr 40px; }
  .lb-prev, .lb-next { font-size: 32px; }
  .lb-stage { padding-top: 60px; height: calc(100vh - 110px); }
  .drawer-body { padding: 16px 16px 60px; }
  .rail { padding: 40px 0 60px; }
  .cast { grid-template-columns: 1fr 1fr; gap: 12px; }
  .world-tabs { flex-wrap: nowrap; overflow-x: auto; margin-left: -4px; }
  .world-tabs a { white-space: nowrap; padding: 9px 12px; font-size: 13px; }
  .original { padding-top: 24px; }
  .metrics-strip { gap: 8px; }
  .metric { min-height: 104px; padding: 16px; border-radius: 16px; }
  .metric strong { font-size: 34px; }
  .detail-card { padding: 16px; border-radius: 16px; }
  .detail-card th, .detail-card td { display: block; width: 100%; }
  .detail-card th { padding-bottom: 2px; border-bottom: 0; }
  .detail-card td { padding-top: 2px; }
  .brain-panel { padding: 20px; margin-bottom: 40px; }
  .brain-pages { grid-template-columns: 1fr 1fr; }
  .state-head { gap: 12px; }
  .step-no { width: 38px; height: 38px; }
  .state-head h2 { font-size: 27px; }
  .empty-narratives { padding: 20px; }
  .head-action { margin-left: 50px; }
  .preview-row { grid-template-columns: 1fr; padding: 18px; }
  .preview-actions { grid-column: auto; }
  .angle.compact { grid-template-columns: 1fr; }
  .nav a { display: none; }
}

/* ── motion ──────────────────────────────────────────────────────────────── */
.nomotion *, .nomotion *::before, .nomotion *::after { transition: none !important; animation: none !important; }
.view { animation: fade var(--fade) var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  html { scroll-behavior: auto; }
}
