/* Tango pour simulator (tango-sim.html): the unit on a counter, the kiosk screen beside it, the steps under.
   The white pages' language (body.hub: white, ink, one gold) around a stage that stays dark - the scale's
   coloured light and the kiosk's own dark UI only read on dark, the way they do on a real counter at night.
   Only this page loads it. */

.tsim { padding: clamp(36px, 5vw, 64px) 0 88px; }
.tsim [hidden] { display: none !important; }
.tsim__back {
    display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 10px 18px 10px 14px;
    border: 1px solid var(--hub-line); border-radius: 999px; color: var(--hub-muted); text-decoration: none;
    font-size: 15px; font-weight: 500; line-height: 1; background: #fff;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}
.tsim__back:hover, .tsim__back:focus-visible { color: var(--hub-gold); border-color: var(--hub-gold); background: var(--hub-tint); }
.tsim__head { max-width: 900px; margin: 0 auto 34px; text-align: center; }
.tsim__head .hub-h2 { margin-bottom: 18px; }
.tsim__head .hub-lede { max-width: 66ch; font-size: clamp(16px, 1.35vw, 19px); margin-bottom: 0; }

/* Controls row: white pills, gold when touched; Pause is the solid gold one. */
.tsim__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin: 0 0 22px; }
.tsim__ctl {
    -webkit-appearance: none; appearance: none; font: inherit; font-size: 15px; font-weight: 500; color: var(--hub-ink);
    background: #fff; border: 1px solid var(--hub-line); border-radius: 999px; padding: 11px 20px; cursor: pointer;
    box-shadow: 0 1px 2px rgba(20, 20, 26, .05);
    transition: border-color .2s, background-color .2s, color .2s, box-shadow .2s, transform .12s ease;
}
.tsim__ctl:hover, .tsim__ctl:focus-visible {
    border-color: var(--hub-gold); background: var(--hub-tint); outline: none;
    box-shadow: 0 8px 18px -12px rgba(142, 108, 48, .6);
}
.tsim__ctl:active { transform: scale(.97); }
.tsim__ctl--primary { background: var(--hub-gold); color: #fff; border-color: var(--hub-gold); font-weight: 600; min-width: 96px; }
.tsim__ctl--primary:hover, .tsim__ctl--primary:focus-visible { background: #8e6c30; border-color: #8e6c30; }
.tsim__ctl.on { border-color: var(--hub-gold); color: var(--hub-gold); background: var(--hub-tint); }
.tsim__ctl.rec.on { border-color: #d0453a; color: #d0453a; background: #fdf1ef; }
select.tsim__ctl {
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23a9833c' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 17px center; background-size: 12px 8px;
}

/* Stage + side */
.tsim__layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 22px; align-items: start; }
/* The stage stays dark: it is the counter at night, set into the white page like a screen. */
.tsim__stage {
    position: relative; width: 100%; aspect-ratio: 16 / 10; min-height: 340px; border-radius: 24px; overflow: hidden;
    background: #121214; touch-action: none; cursor: grab;
    box-shadow: 0 34px 70px -38px rgba(20, 20, 26, .55), 0 0 0 1px rgba(20, 20, 26, .06);
}
.tsim__stage:active { cursor: grabbing; }
.tsim__stage canvas { display: block; width: 100%; height: 100%; }
.tsim__loading {
    position: absolute; inset: 0; display: grid; place-items: center; background: #121214;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: #e3c07b;
}
.tsim__hint {
    position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
    padding: 7px 15px; border-radius: 999px; background: rgba(10,10,13,.6); font-size: 12.5px; color: rgba(242,242,242,.75);
}
.tsim__side { display: grid; gap: 14px; min-width: 0; }
.tsim__card {
    border: 1px solid var(--hub-line); border-radius: 22px; padding: 18px; background: #fff;
    box-shadow: 0 1px 2px rgba(20, 20, 26, .04), 0 18px 36px -30px rgba(20, 20, 26, .35);
}
.tsim__card h3, .tsim__label {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
    font-weight: 500; color: var(--hub-muted); margin: 0 0 12px; display: flex; justify-content: space-between; gap: 8px;
}
.tsim__label #kstep { color: var(--hub-gold); }
/* The kiosk keeps its own dark UI, framed like the device it is. */
.tsim__kiosk canvas { width: 100%; max-width: 100%; aspect-ratio: 16 / 9.25; display: block; border-radius: 12px; background: #000; box-shadow: 0 0 0 5px #1a1a1d; }
.tsim__kiosk { padding-bottom: 22px; }
.tsim__led { display: flex; align-items: center; gap: 12px; color: var(--hub-ink); font-size: 16px; }
.tsim__dot { width: 16px; height: 16px; border-radius: 50%; background: #0bb; box-shadow: 0 0 10px #0bb; transition: background .25s, box-shadow .25s; flex: none; }
.tsim__led b { font-weight: 600; } .tsim__led span { color: var(--hub-muted); }
.tsim__legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--hub-muted); font-size: 13px; margin-top: 10px; }
.tsim__legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.tsim__steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.tsim__steps li {
    display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px;
    color: var(--hub-muted); font-size: 15px; cursor: pointer; font-variant-numeric: tabular-nums;
    transition: background-color .2s, color .2s;
}
.tsim__steps li:hover { background: var(--hub-tint); color: var(--hub-ink); }
.tsim__steps li .n { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--hub-line); display: grid; place-items: center; font-size: 11px; }
.tsim__steps li.done { color: var(--hub-ink); } .tsim__steps li.done .n { border-color: var(--hub-gold); color: var(--hub-gold); }
.tsim__steps li.now { background: var(--hub-tint); color: var(--hub-ink); font-weight: 600; } .tsim__steps li.now .n { background: var(--hub-gold); border-color: var(--hub-gold); color: #fff; }
.tsim__steps li .d { font-size: 12.5px; font-weight: 400; color: var(--hub-muted); }

/* Timeline */
.tsim__time { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-top: 22px; color: var(--hub-ink); }
.tsim__time input[type=range] { width: 100%; accent-color: var(--hub-gold); cursor: pointer; }
.tsim__now { font-weight: 600; }
.tsim__clock { font-variant-numeric: tabular-nums; color: var(--hub-muted); min-width: 92px; text-align: right; }
.tsim__note { margin: 34px auto 0; max-width: 760px; text-align: center; color: var(--hub-muted); font-size: 14px; line-height: 1.6; }
.tsim__note a { color: var(--hub-gold); }

/* Frame-dump mode (?render=1): the stage alone at 1920×1080, used to produce the demo videos. */
body.render .tsim { padding: 0; } body.render .tsim__bar, body.render .tsim__side, body.render .tsim__time, body.render .tsim__head, body.render .tsim__back, body.render .tsim__note, body.render .hub-nav, body.render .hub-foot { display: none !important; }
body.render .tsim__layout { display: block; } body.render .tsim__stage { width: 1920px; height: 1080px; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
body.render .tsim__wrap { width: auto; }

/* Wide screens: the stage takes the room, the side column keeps its width, and the stage's height stays under
   the viewport so the kiosk panel beside it is never pushed off screen. */
@media (min-width: 1301px) {
    .tsim__wrap { width: min(1760px, calc(100% - 64px)); }
    .tsim__layout { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 24px; }
    .tsim__stage { max-height: calc(100vh - var(--hub-nav-h) - 200px); }
}
@media (max-width: 900px) {
    .tsim { padding-top: 28px; }
    .tsim__wrap { width: calc(100% - 32px); }
    .tsim__layout { grid-template-columns: 1fr; }
    .tsim__stage { aspect-ratio: 4 / 3; min-height: 0; border-radius: 20px; }   /* a min-height here forced the width past the screen */
    .tsim__time { grid-template-columns: 1fr auto; } .tsim__now { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .tsim__dot, .tsim__ctl, .tsim__steps li { transition: none; } }

/* ?embed=1 (nightlife.html's pour section): the stage alone, filling the frame, on a light counter; the kiosk
   screen rides in the top corner the way the recordings show it. Everything else on the page is hidden. */
html.tsim-embed, html.tsim-embed body { background: #f3efe7; margin: 0; height: 100%; overflow: hidden; }
html.tsim-embed .hub-nav, html.tsim-embed .hub-foot, html.tsim-embed .tsim__back, html.tsim-embed .tsim__head,
html.tsim-embed .tsim__bar, html.tsim-embed .tsim__time, html.tsim-embed .tsim__note, html.tsim-embed .tsim__hint,
html.tsim-embed .tsim__side > :not(.tsim__kiosk), html.tsim-embed .tsim__label { display: none !important; }
html.tsim-embed .tsim { padding: 0; }
html.tsim-embed .tsim__layout { display: block; position: fixed; inset: 0; }
html.tsim-embed .tsim__stage {
    position: absolute; inset: 0; width: auto; aspect-ratio: auto; min-height: 0; border-radius: 0; box-shadow: none;
    background: #f3efe7; touch-action: pan-y; cursor: grab;
}
html.tsim-embed .tsim__loading { background: #f3efe7; color: var(--hub-gold); }
html.tsim-embed .tsim__side { position: absolute; top: 4%; right: 3%; width: min(33%, 400px); display: block; pointer-events: none; }
html.tsim-embed .tsim__kiosk { padding: 0; border: 0; background: none; box-shadow: none; border-radius: 0; }
html.tsim-embed .tsim__kiosk canvas { border-radius: 10px; box-shadow: 0 0 0 4px #1a1a1d, 0 18px 34px -16px rgba(20, 20, 26, .55); }
@media (max-width: 560px) {
    html.tsim-embed .tsim__side { width: 46%; top: 4%; right: 4%; }
    html.tsim-embed .tsim__kiosk canvas { border-radius: 6px; box-shadow: 0 0 0 3px #1a1a1d, 0 10px 20px -10px rgba(20, 20, 26, .55); }
}
