/* Shared structure for the Grand Theatre stand-in. Each prototype's theme.css sets the tokens and
 * overrides composition. Token names follow the Talven scene tokens where one exists
 * (ground, ink, accent, sheet, voice font) so a look maps to Theatre configuration later. */
:root {
  --ground: #090F1B; --ink: #EAF0F8; --ink-2: #A9B6C8; --accent: #3EE8B4; --accent-ink: #04120D; --accent-2: #57A3F8;
  --panel: rgba(18, 26, 46, .82); --panel-solid: #121A2E; --line: rgba(160, 180, 210, .22); --sheet: #FFFFFF; --sheet-ink: #0A1220;
  --focus: #FFD166; --danger: #FF8A8A; --radius: 14px;
  --font-head: system-ui, sans-serif; --font-body: system-ui, sans-serif; --font-mono: ui-monospace, Menlo, monospace;
  --bg-image: none; --pad: clamp(16px, 3vw, 40px);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-body); background: var(--ground); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.eyebrow { font: 600 11px/1.2 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.fine { font-size: 12.5px; color: var(--ink-2); margin: 10px 0 0; }

/* ---- Theatre frame */
.th { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; background: var(--ground); color: var(--ink); animation: thin .5s ease both; }
.th.closed { display: none; }
@keyframes thin { from { opacity: 0; transform: scale(1.012); } to { opacity: 1; transform: none; } }
.th-bg, .th-scrim { position: absolute; inset: 0; pointer-events: none; }
.th-bg { background: var(--bg-image) center / cover no-repeat; }
.th > header, .th > main, .th > footer { position: relative; z-index: 2; }
.th-top { display: flex; align-items: center; gap: 14px; padding: 14px var(--pad); flex-wrap: wrap; }
.th-brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.th-word { font: 700 20px/1 var(--font-head); letter-spacing: -.01em; }
.th-sub { font: 500 11px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.th-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); align-self: center; }
.th-sc26 { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font: 600 12px/1 var(--font-mono); letter-spacing: .06em; }
.th-sc26 i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.th-tools { display: flex; gap: 6px; }
.th-btn { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 13px; }
.th-btn:hover { background: var(--panel); }

.th-main { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; padding: 0 var(--pad); }
.th[data-phase=open] .th-talk { display: none; }
.th[data-phase=talk] .th-voice { display: none; }
.th-voice { align-self: center; max-width: 780px; padding: 12px 0 24px; }
.th-voice h1 { font: 700 clamp(34px, 5.4vw, 64px)/1.04 var(--font-head); letter-spacing: -.02em; margin: 0 0 16px; }
.th-voice h1 em { font-style: normal; color: var(--accent); }
.th-voice h1 .th-h1-sub { display: block; margin-top: 10px; font: italic 400 clamp(15px, 2vw, 20px)/1.35 var(--font-head); letter-spacing: 0; color: var(--link, var(--accent)); }
.th-lede { font-size: clamp(16px, 1.6vw, 19px); color: var(--ink-2); max-width: 60ch; margin: 0 0 20px; }
.th-entries { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.th-entry { padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 14px; }
.th-entry.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.th-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.th-tile { text-align: left; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); display: grid; gap: 6px; backdrop-filter: blur(8px); transition: transform .15s, border-color .15s; }
.th-tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.th-tile b { font: 650 15px/1.25 var(--font-head); }
.th-tile span { font-size: 13px; color: var(--ink-2); }

.th-talk { min-height: 0; display: grid; grid-template-columns: minmax(300px, .8fr) minmax(0, 1.5fr); gap: 20px; padding-bottom: 8px; }
.th-log, .th-stage { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.th-log { display: flex; flex-direction: column; gap: 10px; padding: 4px 4px 12px 0; }
.bub { max-width: 92%; padding: 11px 15px; border-radius: 16px; font-size: 15px; }
.bub p { margin: 0; white-space: pre-wrap; }
.bub.you { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; font-weight: 500; }
.bub.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; backdrop-filter: blur(8px); }
.dots i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--ink-2); animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.th-stage.in .st-views > * { animation: rise .45s ease both; }
.th-stage.in .st-views > *:nth-child(2) { animation-delay: .08s; } .th-stage.in .st-views > *:nth-child(3) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.st-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.st-trail i { font: 500 11px var(--font-mono); font-style: normal; color: var(--ink-2); margin-right: 10px; }
.st-trail i::before { content: "\2190 "; }
.st-views { display: grid; gap: 14px; align-content: start; padding-bottom: 12px; }

.th-channel { padding: 8px var(--pad) 14px; }
.th-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; min-height: 0; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 13.5px; }
.chip:hover { border-color: var(--accent); }
.chip.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
/* A link styled as a chip (the happy-hour RSVP) must read like the button chips, not like a text link. */
:where(.v-card) a.chip { text-decoration: none; display: inline-flex; align-items: center; } :where(.v-card) a.chip.primary { color: var(--accent-ink); }
.th-composer { display: flex; gap: 8px; }
.th-composer input { flex: 1; min-width: 0; padding: 14px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-solid); font-size: 16px; }
.th-send { padding: 0 24px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.th-note { margin: 8px 4px 0; font-size: 12px; color: var(--ink-2); }

/* ---- Views (cards float on the scene; forms sit on an opaque sheet) */
.v-card { padding: 18px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); }
.v-card h3 { font: 650 20px/1.25 var(--font-head); margin: 0 0 8px; }
.v-card h4 { font: 650 15px/1.3 var(--font-head); margin: 0 0 4px; }
.v-card p { margin: 0 0 8px; }
.v-card .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.src { font: 500 11px var(--font-mono); color: var(--ink-2); }
.lv { font: 600 10.5px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); }
.lv-offered, .lv-stated { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.lv-brief { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 50%, transparent); }
.lv-held, .lv-none { color: var(--ink); border-style: dashed; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.tile, .opt { text-align: left; display: grid; gap: 6px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel-solid) 70%, transparent); }
.tile span, .opt span { font-size: 13px; color: var(--ink-2); }
.opt small { font: 600 10px var(--font-mono); letter-spacing: .14em; color: var(--ink-2); margin-top: 4px; }
.opt em { font-style: normal; font-size: 13px; }
.opt .n { font: 600 11px var(--font-mono); color: var(--accent-2); letter-spacing: .12em; }
.opt.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.opt.static { cursor: default; }
.pk { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: pk; }
.pk li { padding-left: 38px; position: relative; counter-increment: pk; }
.pk li::before { content: counter(pk); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--font-mono); border: 1px solid var(--accent); color: var(--accent); }
.v-photo { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--panel-solid); }
.v-photo img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.v-photo figcaption { padding: 8px 14px; font-size: 12px; color: var(--ink-2); }
.pill { display: inline-block; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); font: 500 12px var(--font-mono); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.ticks { margin: 8px 0; padding-left: 18px; } .ticks li { margin: 4px 0; }
.steps { margin: 10px 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
dt { font: 600 11px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding-top: 2px; }
dd { margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; vertical-align: top; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { font: 600 10.5px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; border-left: 2px solid var(--line); }
.tl li { padding-left: 16px; position: relative; } .tl li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.tl p { margin: 2px 0; } .tl small { color: var(--ink-2); }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sheet { background: var(--sheet); color: var(--sheet-ink); border-color: transparent; }
.sheet .fine, .sheet label { color: #33405a; }
.v-form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.v-form input, .v-form textarea { padding: 10px 12px; border: 1px solid #b9c3d3; border-radius: 8px; background: #fff; color: #0A1220; }
.v-form .chip { border-color: #b9c3d3; background: #fff; color: #0A1220; }
.v-form .chip.primary { background: var(--accent); color: var(--accent-ink); }

/* ---- Review drawer */
.th-review { position: absolute; z-index: 5; right: 0; top: 0; bottom: 0; width: min(380px, 100%); background: var(--panel-solid); border-left: 1px solid var(--line); overflow-y: auto; padding: 14px 18px 24px; }
.th-review[hidden] { display: none; }
.rv-tabs { display: flex; gap: 4px; margin-bottom: 12px; position: sticky; top: -14px; padding: 14px 0 8px; background: var(--panel-solid); }
.rv-tabs button { background: none; border: 0; padding: 6px 10px; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.rv-tabs [aria-selected=true] { background: var(--panel); color: var(--ink); }
.rv-x { margin-left: auto; font-size: 20px; line-height: 1; }
.rv-body h4 { margin: 16px 0 4px; font: 650 14px var(--font-head); }
.rv-body ol { padding-left: 18px; } .rv-body li { margin: 4px 0; }
.rv-body li button { text-align: left; background: none; border: 0; padding: 2px 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.rv-body pre { white-space: pre-wrap; font: 12px var(--font-mono); background: var(--panel); padding: 10px; border-radius: 8px; }
.trace { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.trace li { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.trace b { font: 600 11px var(--font-mono); color: var(--accent); } .trace span { font-size: 13px; }

/* ---- Responsive */
@media (max-width: 899px) {
  .th-main { overflow-y: auto; }
  .th-voice { align-self: start; padding-top: 6px; }
  .th-talk { grid-template-columns: 1fr; display: block; }
  .th[data-phase=talk] .th-talk { display: block; }
  .th-log, .th-stage { overflow: visible; }
  .th-stage { margin-top: 12px; }
  .th-sub, .th-btn[data-act=reset] { display: none; }
  .th-sc26 { margin-left: 0; font-size: 11px; padding: 6px 12px; }
  .th-tools { margin-left: auto; }
  .th-top { gap: 8px; padding: 10px var(--pad); }
  .th-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; }
  .th-chips .chip { white-space: nowrap; flex: none; }
  .th-note { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- Minimal website shell behind the Theatre */
.site { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.site header, .site footer { padding: 18px var(--pad); display: flex; align-items: center; gap: 16px; }
.site main { padding: 8vh var(--pad); max-width: 900px; }
.site h1 { font: 700 clamp(32px, 5vw, 56px)/1.05 var(--font-head); letter-spacing: -.02em; margin: 0 0 16px; }
.site-launch { padding: 14px 22px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; }
html.th-open body { overflow: hidden; }

.th.no-anim, .th.no-anim * { animation: none !important; transition: none !important; }

.v-ledger, .v-support { overflow-x: auto; }

.th-bgvideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---- Conversation turns */
.turn { display: flex; flex-direction: column; gap: 10px; }
.th-oldtoggle { display: none; align-self: flex-start; background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--ink-2); }
.th-log, .th-stage, .th-main { overscroll-behavior: contain; }

/* ---- Phones: compact header, 44px targets, safe areas, older turns collapsed */
@media (max-width: 899px) {
  .th-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 10px;
    padding: max(10px, env(safe-area-inset-top)) max(var(--pad), env(safe-area-inset-right)) 8px max(var(--pad), env(safe-area-inset-left)); }
  .th-brand { grid-column: 1; } .th-tools { grid-column: 2; grid-row: 1; margin-left: 0; }
  .th-sc26 { grid-column: 1 / -1; grid-row: 2; justify-content: center; width: 100%; min-height: 40px; }
  .th-btn { min-height: 40px; padding: 8px 12px; }
  .chip, .th-entry, .th-oldtoggle { min-height: 44px; display: inline-flex; align-items: center; }
  .tile, .opt, .th-tile, .ckb, .seg { min-height: 44px; }
  .th-composer input { min-height: 48px; }
  .th-send { min-width: 76px; min-height: 48px; }
  .th-channel { padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .th-main { padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right)); scroll-padding-top: 8px; }
  .th-log.has-old .th-oldtoggle { display: inline-flex; }
  .th-log:not(.show-old) .turn.old { display: none; }
  .bub { max-width: 96%; }
  .v-card { padding: 16px; }
  .v-card h3 { font-size: 18px; }
  .th-review { width: 100%; }
}
@media (max-width: 380px) {
  .th-voice h1 { font-size: 30px; }
  .th-word { font-size: 18px; }
  .grid4, .grid3, .grid2 { grid-template-columns: 1fr; }
}

/* Phones: tables become labelled stacked rows instead of scrolling sideways */
@media (max-width: 899px) {
  .v-ledger table, .v-support table { display: block; }
  .v-ledger thead, .v-support thead { display: none; }
  .v-ledger tbody, .v-support tbody { display: block; }
  .v-ledger tr, .v-support tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .v-ledger td, .v-support td { display: block; border: 0; padding: 3px 0; }
  .v-ledger td::before, .v-support td::before { content: attr(data-label); display: block; font: 600 10.5px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-top: 4px; }
}
@media (max-width: 380px) {
  .th-btn { font-size: 12.5px; padding: 8px 9px; }
  .th-word { font-size: 17px; white-space: nowrap; }
  .th-brand { min-width: 0; }
}

/* Phones: definition lists stack (label above value) so values get the full width */
@media (max-width: 899px) {
  dl { grid-template-columns: 1fr; gap: 2px; }
  dt { padding-top: 10px; }
}

/* Optional aside beside the opening voice (a prototype may fill it) */
.th-aside { display: none; }

/* Home page navigation to the light pages */
.site-nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { color: inherit; text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: 14px; }
.site-nav a:hover { background: rgba(127, 127, 127, .18); }
@media (max-width: 899px) { .site header { flex-wrap: wrap; } .site-nav { width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; } .site-nav a { white-space: nowrap; min-height: 40px; display: inline-flex; align-items: center; } }

/* Readiness board: shared by every look. Colours come from the card's own text colour so it reads on dark, paper and white cards. */
.v-board .bd { list-style: none; margin: 14px 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.v-board .node { width: 100%; height: 100%; text-align: left; display: grid; gap: 4px; padding: 11px 12px; border-radius: 10px; color: inherit; cursor: pointer;
  border: 1px solid color-mix(in srgb, currentColor 28%, transparent); background: color-mix(in srgb, currentColor 6%, transparent); }
.v-board .node .n { font: 600 11px var(--font-mono, ui-monospace, monospace); color: var(--accent-text, var(--accent-2)); }
.v-board .node b { font: 600 13.5px/1.25 var(--font-head, inherit); }
.v-board .node small { font: 500 10px var(--font-mono, ui-monospace, monospace); letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.v-board .node.past { opacity: .62; }
.v-board .node.now { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.v-board .node.sel { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.v-board .bd-detail { border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent); padding-top: 12px; }
.v-board .bd-detail p { margin: 0 0 6px; }
@media (max-width: 899px) { .v-board .bd { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* v3: film card in the assistant's working area. */
.v-film video { display: block; width: 100%; aspect-ratio: 16 / 9; margin-top: 10px; border-radius: 10px; background: #0A1220; }
.v-film .note { font-size: 12px; opacity: .75; margin: 8px 0 0; }

a.th-brand { text-decoration: none; color: inherit; cursor: pointer; } a.th-brand:focus-visible { outline: 2px solid var(--link, #1F5FC0); outline-offset: 3px; border-radius: 6px; }
