/* The Studio: Tidavo's 8-bit newsroom (/studio). The scene is a 320 × 200 canvas scaled up without smoothing;
   speech bubbles are HTML on top of it so their words stay sharp at any size. */
.studio-page { max-width: 1560px; margin: 0 auto; padding: 1.2rem 16px 3rem; }
.studio-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .6rem 1.5rem; margin-bottom: .9rem; }
.studio-head h1 { margin: .1rem 0 .3rem; font-size: clamp(1.6rem, 3.4vw, 2.4rem); line-height: 1.1; }
.studio-deck { margin: 0; max-width: 46rem; color: var(--muted, #666); }
.studio-status {
    margin: 0; padding: .45rem .75rem; border: 2px solid currentColor; border-radius: 0;
    font: 700 .82rem/1.3 "Courier New", ui-monospace, monospace; box-shadow: 3px 3px 0 currentColor; max-width: 30rem;
}
.studio-stage {
    position: relative; width: 100%; aspect-ratio: 320 / 200; background: #1d1b26; margin-inline: auto;
    /* As big as the column allows, but never taller than the screen. */
    max-width: calc((100vh - 6.5rem) * 1.6); max-width: calc((100svh - 6.5rem) * 1.6);
    border: 4px solid #1d1b26; box-shadow: 0 0 0 4px #57536b, 6px 6px 0 4px rgba(0, 0, 0, .25); overflow: hidden;
}
.studio-stage canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.studio-bubbles { position: absolute; inset: 0; pointer-events: none; }
/* Each bubble's wrapper spans the scene and is moved with a transform (no layout work while people walk). */
.studio-bubble-at { position: absolute; left: 0; top: 0; width: 100%; height: 0; will-change: transform; }
.studio-bubble {
    position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); max-width: min(15em, 40%); width: max-content;
    padding: .22em .5em .28em; background: #fffdf2; color: #1d1b26; border: 2px solid #1d1b26; box-shadow: 2px 2px 0 #1d1b26;
    font: 700 clamp(8px, 1.15vw, 13px)/1.25 "Courier New", ui-monospace, monospace; text-align: left;
    animation: studio-pop .18s steps(3) both;
}
.studio-bubble::after {
    content: ""; position: absolute; left: 50%; bottom: -7px; width: 8px; height: 8px; margin-left: -4px;
    background: #fffdf2; border-right: 2px solid #1d1b26; border-bottom: 2px solid #1d1b26; transform: rotate(45deg);
}
.studio-bubble b { display: block; font-size: .78em; letter-spacing: .04em; text-transform: uppercase; }
.studio-bubble.thought { border-style: dashed; background: #f1f4ff; }
.studio-bubble.thought::after { background: #f1f4ff; border-style: dashed; }
.studio-bubble.leaving { animation: studio-out .2s steps(2) both; }
@keyframes studio-pop { from { opacity: 0; transform: translate(-50%, -80%) scale(.6); } to { opacity: 1; transform: translate(-50%, -100%) scale(1); } }
@keyframes studio-out { to { opacity: 0; transform: translate(-50%, -110%); } }

/* Layout: the scene and the chat on the left, the person picked and the team on the right. */
.studio-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.2rem; align-items: start; }
.studio-main { min-width: 0; }
.studio-side { display: grid; gap: 1rem; position: sticky; top: 5rem; }
.studio-side h2, .studio-chatter h2 { margin: 0 0 .5rem; font: 700 .8rem/1.2 "Courier New", ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
.studio-frame, .studio-chatter, .studio-cast, .studio-card { border: 3px solid #1d1b26; box-shadow: 0 0 0 2px #57536b, 4px 4px 0 2px rgba(0, 0, 0, .2); background: var(--paper, transparent); }

/* Overheard: a framed, scrolling window with the last lines, newest on top. */
.studio-chatter { margin-top: 1.2rem; padding: .7rem .8rem .5rem; }
.studio-chatter ol { list-style: none; margin: 0; padding: 0 .3rem 0 0; max-height: 15.5rem; overflow-y: auto; scrollbar-width: thin; font: .86rem/1.4 "Courier New", ui-monospace, monospace; }
.studio-chatter li { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); gap: .5rem; padding: .3rem 0; border-bottom: 1px dashed rgba(127, 127, 127, .35); }
.studio-chatter li:first-child { animation: studio-line .3s steps(3) both; }
.studio-chatter time { color: var(--muted, #777); }
.studio-chatter .to { color: var(--muted, #777); font-weight: 400; }
.studio-chatter .who { padding: 0; border: 0; background: none; font: inherit; font-weight: 700; cursor: pointer; }
.studio-chatter .who:hover { text-decoration: underline; }
.studio-chatter ol:empty::before { content: "Listening…"; color: var(--muted, #777); }
@keyframes studio-line { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* The team: each person is a button; the one picked is lit. */
.studio-cast { padding: .7rem .6rem .5rem; }
.studio-cast ul { list-style: none; margin: 0; padding: 0; font: .84rem/1.35 "Courier New", ui-monospace, monospace; }
.studio-cast button {
    display: grid; grid-template-columns: .9rem auto minmax(0, 1fr); align-items: baseline; gap: .1rem .5rem; width: 100%; padding: .35rem .4rem;
    border: 0; border-bottom: 1px dashed rgba(127, 127, 127, .35); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.studio-cast button:hover { background: rgba(127, 127, 127, .12); }
.studio-cast button.picked { background: rgba(255, 209, 102, .28); box-shadow: inset 3px 0 0 #ffd166; }
.studio-cast i { grid-row: span 2; width: .9rem; height: .9rem; align-self: start; margin-top: .15rem; box-shadow: 1px 1px 0 rgba(0, 0, 0, .4); }
.studio-cast b { font-weight: 700; }
.studio-cast small { color: var(--muted, #777); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-cast span { grid-column: 2 / -1; font-size: .78rem; }
.studio-cast button.busy span { font-weight: 700; }
.studio-cast button.busy span::before { content: "▶ "; }

/* The card of the person picked: a big portrait, who they are, what they do and think right now. */
.studio-card { position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: .5rem .8rem; padding: .8rem; border-color: var(--who, #1d1b26); }
.studio-card[hidden] { display: none; }
.studio-face { width: 76px; height: auto; image-rendering: pixelated; background: repeating-linear-gradient(0deg, rgba(127, 127, 127, .12) 0 4px, transparent 4px 8px); border: 2px solid var(--who, #1d1b26); }
.studio-card h2 { margin: .1rem 0 0; font-size: 1.05rem; letter-spacing: .06em; color: var(--who, inherit); }
.studio-card-role { margin: 0 0 .35rem; font: 700 .72rem/1.2 "Courier New", ui-monospace, monospace; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #777); }
.studio-card-text p:last-child { margin: 0; font-size: .82rem; line-height: 1.35; }
.studio-card dl { grid-column: 1 / -1; margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .25rem .6rem; font: .84rem/1.35 "Courier New", ui-monospace, monospace; }
.studio-card dt { font-weight: 700; text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; padding-top: .12rem; }
.studio-card dd { margin: 0; }
.studio-card-thought { font-style: italic; }
.studio-card-stats { grid-column: 1 / -1; margin: 0; font-size: .74rem; color: var(--muted, #777); }
.studio-card-think { grid-column: 1 / -1; justify-self: start; padding: .3rem .7rem; border: 2px solid currentColor; background: none; color: inherit; font: 700 .78rem/1.2 "Courier New", ui-monospace, monospace; cursor: pointer; box-shadow: 2px 2px 0 currentColor; }
.studio-card-think:active { transform: translate(2px, 2px); box-shadow: none; }
.studio-card-close { position: absolute; top: .25rem; right: .35rem; padding: 0 .3rem; border: 0; background: none; color: inherit; font: 700 1.2rem/1 "Courier New", monospace; cursor: pointer; }

/* Medium screens: the scene takes the full width; the card and the team sit under it, side by side. */
@media (max-width: 1100px) {
    .studio-layout { grid-template-columns: 1fr; }
    .studio-side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
    .studio-cast ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); column-gap: .8rem; }
}
/* Phones: the scene runs edge to edge, bubbles shrink, the words around it get out of its way. */
@media (max-width: 760px) {
    .studio-page { padding-top: .8rem; }
    .studio-head { margin-bottom: .7rem; }
    .studio-head h1 { font-size: 1.5rem; }
    .studio-deck { font-size: .92rem; }
    .studio-status { max-width: none; width: 100%; font-size: .74rem; box-shadow: 2px 2px 0 currentColor; }
    .studio-stage { width: 100vw; max-width: none; margin-inline: calc(50% - 50vw); border-width: 2px 0; box-shadow: none; }
    .studio-chatter { margin-top: .9rem; }
    .studio-chatter ol { max-height: 12rem; font-size: .8rem; }
    .studio-chatter li { grid-template-columns: 2.7rem minmax(0, 1fr); gap: .35rem; }
    .studio-side { grid-template-columns: 1fr; }
    .studio-cast ul { grid-template-columns: 1fr; }
    .studio-bubble { max-width: 46%; padding: .12em .3em .16em; border-width: 1px; box-shadow: 1px 1px 0 #1d1b26; font-size: clamp(7px, 2.3vw, 11px); }
    .studio-bubble::after { width: 6px; height: 6px; bottom: -5px; margin-left: -3px; border-width: 1px; }
    .studio-bubble b { display: none; }
}
/* A phone held sideways: the scene fits the screen's height. */
@media (max-height: 520px) and (orientation: landscape) {
    .studio-stage { width: auto; max-width: calc((100vh - 1rem) * 1.6); max-width: calc((100svh - 1rem) * 1.6); margin-inline: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .studio-bubble, .studio-bubble.leaving, .studio-chatter li:first-child { animation: none; }
}

/* Links to the story just published: in the status box and in the chat. */
.studio-status a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.studio-chatter a.read { font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
