/* ==========================================================================
   LIMINAL ENGINE — surface

   Palette: near-black, parchment, one gold. No glow, no blur. Soft dark backings sit behind text over the metal (see the legibility pass at the end).
   Type:    EB Garamond for the visitor. IBM Plex Mono for the curator.
   ========================================================================== */

:root {
    --black: #050506;
    --ink: #e9e2d3;          /* parchment */
    --ink-dim: rgba(233, 226, 211, 0.55);
    --ink-faint: rgba(233, 226, 211, 0.28);
    --gold: #cfa54a;
    --rule: rgba(233, 226, 211, 0.18);
    --serif: 'EB Garamond', Georgia, 'Times New Roman', serif;
    --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--black);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 18px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'kern', 'liga', 'onum';
}

body.kiosk-locked { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body.kiosk-locked textarea { user-select: text; -webkit-user-select: text; }

#canvas-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    cursor: none;
    opacity: 1;
    transition: opacity 2.8s var(--ease);
}
#canvas-container canvas { display: block; width: 100% !important; height: 100% !important; }
body:not(.kiosk-locked) #canvas-container { cursor: default; }

body.pre-orb #canvas-container { opacity: 0; pointer-events: none; }
body.pre-orb #mark { opacity: 0; }
body.pre-orb .sound-btn { opacity: 0; pointer-events: none; }

/* ---------------- small caps helper ---------------- */
.caps {
    font-variant-caps: all-small-caps;
    letter-spacing: 0.12em;
}

/* ---------------- persistent mark ---------------- */
#mark {
    position: fixed;
    top: 22px;
    left: 26px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ink-dim);
    pointer-events: none;
    transition: opacity 2.8s var(--ease);
}
#mark .mark-title {
    font-variant-caps: all-small-caps;
    letter-spacing: 0.16em;
    font-size: 15px;
}

/* ---------------- layers ---------------- */
.layer {
    position: fixed;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s var(--ease);
}
.layer.is-visible { opacity: 1; pointer-events: auto; }
.layer-passive.is-visible { pointer-events: none; }
.layer-passive.is-visible button { pointer-events: auto; }

/* Attract: live 3D sphere in the centre, inscription at top, title & invitation at bottom */
#attract {
    justify-content: space-between;
    padding: 7vh 24px 6.5vh;
    background: transparent;
}
.attract-block {
    text-align: center;
    padding: 0 28px;
    margin-top: auto;
}
.attract-title {
    margin: 0 0 8px;
    font-weight: 400;
    font-variant-caps: all-small-caps;
    letter-spacing: 0.22em;
    font-size: clamp(28px, 3.4vw, 42px);
    color: var(--ink);
    text-shadow: 0 2px 18px rgba(5, 5, 6, 0.95);
}
.attract-sub {
    margin: 0 0 22px;
    font-style: italic;
    font-size: clamp(17px, 1.75vw, 22px);
    color: var(--ink-dim);
    text-shadow: 0 2px 14px rgba(5, 5, 6, 0.95);
}

/* Hands-free stillness dwell bar on Attract */
.dwell-wrap {
    margin: 18px auto 0;
    max-width: 280px;
    transition: opacity 0.6s var(--ease);
}
.dwell-wrap[hidden] { display: none; }
.dwell-label {
    margin: 0 0 7px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    text-shadow: 0 1px 8px rgba(5, 5, 6, 0.95);
}
.dwell-track {
    height: 2px;
    width: 100%;
    background: rgba(233, 226, 211, 0.14);
    overflow: hidden;
}
.dwell-bar {
    height: 100%;
    width: 100%;
    background: var(--gold);
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.1s linear;
}

/* Buttons the visitor is meant to see */
.big-btn {
    font-family: var(--serif);
    font-size: clamp(18px, 1.7vw, 22px);
    letter-spacing: 0.04em;
    color: var(--gold);
    background: rgba(5, 5, 6, 0.6);
    border: 1px solid var(--gold);
    padding: 14px 40px;
    cursor: pointer;
    transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.big-btn:hover, .big-btn:focus-visible { background: var(--gold); color: var(--black); outline: none; }
.big-btn:disabled { opacity: 0.4; cursor: default; }

/* Story: one line at a time, in the dark. No curtain — the body is already black. */
#story { justify-content: center; background: transparent; }
.story-line {
    width: min(22em, calc(100vw - 56px));
    margin: 0;
    text-align: center;
    font-style: italic;
    font-size: clamp(22px, 2.8vw, 34px);
    line-height: 1.4;
    color: var(--ink);
    opacity: 0;
    transition: opacity 1.4s var(--ease);
}
.story-line.is-visible { opacity: 0.92; }
.story-cue {
    position: absolute;
    left: 0; right: 0;
    bottom: 9vh;
    margin: 0;
    text-align: center;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
    opacity: 0;
    transition: opacity 1.2s var(--ease);
}
.story-cue.is-visible { opacity: 1; animation: cue-breathe 3.2s ease-in-out infinite; }
@keyframes cue-breathe {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}

/* Threshold: the sphere is on screen; the invitation sits beneath it */
#threshold { justify-content: flex-end; padding-bottom: 9vh; transition-duration: 2.4s; }
.threshold-block { text-align: center; padding: 0 28px; }
.threshold-line {
    margin: 0 0 26px;
    font-style: italic;
    font-size: clamp(18px, 1.9vw, 24px);
    color: var(--ink-dim);
    text-shadow: 0 0 18px rgba(5, 5, 6, 1), 0 2px 8px rgba(5, 5, 6, 0.9);
}

/* Choose: in the dark, before the sphere. Centred; nothing else on screen. */
#choose { justify-content: center; transition-duration: 1.6s; }
.choose-block, .intro-block {
    width: min(760px, calc(100vw - 40px));
    text-align: center;
    padding: 30px 32px 28px;
    background: rgba(5, 5, 6, 0.84);
    border: 1px solid var(--rule);
}
.choose-block {
    width: min(1040px, calc(100vw - 40px));
    padding: 18px 24px 12px;
    background: transparent;
    border-color: transparent;
}
.choose-block .threshold-line { margin-bottom: 8px; font-size: clamp(22px, 2.4vw, 32px); color: var(--ink); text-shadow: none; }
.choose-block .choose-sub { margin-bottom: 26px; font-size: 16px; color: var(--ink-dim); }
.choose-block .tone-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.choose-block .tone { padding: 18px 10px 16px; gap: 8px; }
.choose-block .tone .swatch { width: 34px; height: 34px; }
.choose-block .tone .tone-hz { font-size: 20px; }
.choose-block .tone .tone-name { font-size: 13px; }
.choose-block .tone .tone-feel { font-size: 13px; max-width: 18ch; }
.choose-block .choose-row { justify-content: center; }
.step-label {
    margin: 0 0 8px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
.choose-title {
    margin: 0 0 8px;
    font-weight: 400;
    font-size: clamp(26px, 2.8vw, 34px);
}
.choose-sub {
    margin: 0 auto 18px;
    max-width: 52ch;
    font-size: 16px;
    color: var(--ink-faint);
}
.tone-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.tone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px 14px;
    background: transparent;
    border: 1px solid var(--rule);
    color: var(--ink);
    font-family: var(--serif);
    cursor: pointer;
    transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.tone:hover { border-color: var(--ink-dim); }
.tone[aria-checked="true"] { border-color: var(--gold); background: rgba(207, 165, 74, 0.08); }
.tone .swatch { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.18); }
.tone .tone-hz { font-size: 20px; letter-spacing: 0.02em; }
.tone .tone-name { font-size: 14px; color: var(--ink-dim); font-variant-caps: all-small-caps; letter-spacing: 0.1em; }
.tone .tone-feel {
    font-size: 13px;
    font-style: italic;
    color: var(--ink-dim);
    line-height: 1.35;
    max-width: 18ch;
}
.choose-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--serif);
    font-size: 17px;
    color: var(--ink-dim);
    background: none;
    border: 0;
    padding: 8px 4px;
    cursor: pointer;
}
.toggle-btn .toggle-mark { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--ink-dim); }
.toggle-btn[aria-pressed="true"] { color: var(--ink); }
.toggle-btn[aria-pressed="true"] .toggle-mark { background: var(--gold); border-color: var(--gold); }

/* Intro steps */
.intro-steps {
    max-width: 48ch;
    margin: 6px auto 26px;
    padding-left: 1.4em;
    text-align: left;
    font-size: clamp(18px, 1.8vw, 22px);
    line-height: 1.5;
}
.intro-steps li { margin: 0 0 0.6em; }
.intro-steps li::marker { color: var(--gold); }
.intro-block .small { margin: 16px 0 0; font-size: 14px; color: var(--ink-faint); }

/* Return sub, question sub */
.return-sub { margin: 10px 0 0; font-size: 17px; color: var(--ink-dim); }
.question-sub { margin: -12px 0 18px; font-size: 15px; color: var(--ink-dim); }

/* Guide voice during the work */
.voice {
    position: absolute;
    left: 50%;
    top: 52%;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: min(36ch, calc(100vw - 48px));
    margin: 0;
    text-align: center;
    font-style: italic;
    font-size: clamp(20px, 2.2vw, 28px);
    line-height: 1.35;
    color: var(--ink);
    opacity: 0;
    transition: opacity 0.9s var(--ease);
    pointer-events: none;
    text-shadow:
        0 0 28px rgba(5, 5, 6, 1),
        0 0 12px rgba(5, 5, 6, 1),
        0 2px 8px rgba(5, 5, 6, 0.95);
}
.voice.is-visible { opacity: 0.95; }
.voice.is-command {
    font-style: normal;
    font-variant-caps: all-small-caps;
    letter-spacing: 0.18em;
    font-size: clamp(24px, 2.8vw, 34px);
}

#fan-boundary {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    width: min(96vw, 96vh);
    height: min(96vw, 96vh);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(207, 165, 74, 0.14);
    box-shadow: 0 0 0 9999px #000000;
    z-index: 15;
    pointer-events: none;
}

body.fan-mode {
    background: #000000;
}
body.fan-mode #fan-boundary {
    display: block;
}
body.fan-mode #mark,
body.fan-mode .note,
body.fan-mode .progress-track,
body.fan-mode .sound-btn {
    opacity: 0 !important;
    pointer-events: none;
}
body.fan-mode #attract {
    justify-content: center;
    padding: 0;
}
body.fan-mode .attract-block {
    margin-top: 0;
    max-width: min(64vw, 64vh);
}
body.fan-mode .attract-title { font-size: clamp(20px, 3vmin, 30px); }
body.fan-mode .attract-sub { font-size: clamp(14px, 2vmin, 18px); margin-bottom: 14px; }
body.fan-mode #attract-begin { display: none; }
body.fan-mode .inscription {
    position: absolute;
    top: calc(50% - min(34vw, 34vh));
    max-width: min(56vw, 56vh);
    font-size: clamp(14px, 2vmin, 17px);
}
body.fan-mode #reflect {
    justify-content: center;
    padding-bottom: 0;
}
body.fan-mode .reflect-panel {
    width: min(68vw, 68vh);
    border-radius: 50%;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12%;
    background: rgba(0, 0, 0, 0.88);
}

.intro-warn {
    margin: 0 auto 22px;
    max-width: 42ch;
    font-size: 14px;
    line-height: 1.45;
    color: var(--ink-faint);
}
.intro-warn em { color: var(--ink-dim); font-style: normal; }

.leave-btn {
    position: absolute;
    top: 22px;
    right: 26px;
    z-index: 4;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    background: none;
    border: 0;
    border-bottom: 1px solid transparent;
    padding: 8px 2px;
    cursor: pointer;
    transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
    pointer-events: auto;
}
.leave-btn:hover, .leave-btn:focus-visible {
    color: var(--ink-dim);
    border-bottom-color: var(--rule);
    outline: none;
}

/* Persistent sound control, bottom-right on every screen */
.sound-btn {
    position: fixed;
    right: 26px;
    bottom: 22px;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    background: rgba(5, 5, 6, 0.35);
    border: 1px solid transparent;
    padding: 7px 10px;
    cursor: pointer;
    transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.sound-btn:hover, .sound-btn:focus-visible { color: var(--ink-dim); border-color: var(--rule); outline: none; }
.sound-btn .sound-cross { display: none; }
.sound-btn[aria-pressed="true"] { color: var(--gold); }
.sound-btn[aria-pressed="true"] .sound-waves { display: none; }
.sound-btn[aria-pressed="true"] .sound-cross { display: block; }

/* Camera check on the intro screen */
.cam-test { margin: -6px auto 20px; width: min(520px, 100%); text-align: left; }
.cam-test-btn { font-size: 15px; }
.cam-test-btn[aria-expanded="true"] { color: var(--ink); }
.cam-test-btn[aria-expanded="true"] .toggle-mark { background: var(--gold); border-color: var(--gold); }
.cam-panel {
    display: grid;
    grid-template-columns: 168px 1fr;
    gap: 16px;
    align-items: center;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--rule);
    background: rgba(5, 5, 6, 0.6);
}
.cam-panel[hidden] { display: none; }
.cam-preview {
    width: 168px;
    height: 126px;
    object-fit: cover;
    background: #000;
    transform: scaleX(-1);          /* a mirror, like the sphere */
    filter: grayscale(1) contrast(1.1);
    border: 1px solid var(--rule);
}
.cam-preview.is-off { opacity: 0.25; }
.cam-readout { min-width: 0; }
.cam-status { margin: 0 0 10px; font-size: 15px; line-height: 1.4; color: var(--ink-dim); }
.cam-status strong { color: var(--ink); font-weight: 400; }
.cam-meter { height: 3px; background: rgba(233, 226, 211, 0.12); }
.cam-meter > div { height: 100%; width: 100%; background: var(--gold); transform-origin: left; transform: scaleX(0); transition: transform 0.1s linear; }
.cam-legend { display: flex; justify-content: space-between; margin: 5px 0 0; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--ink-faint); }
.cam-readout .text-btn { margin-top: 8px; }
.cam-readout .text-btn[hidden] { display: none; }

body.fan-mode .quiet-btn { opacity: 0 !important; }
/* Leave stays visible even in fan mode — the escape hatch */
body.fan-mode .stage { opacity: 0 !important; }
body.fan-mode .attract-block .attract-title,
body.fan-mode .attract-block .attract-sub { text-shadow: none; }

.hint {
    position: absolute;
    left: 0; right: 0;
    bottom: 9vh;
    margin: 0;
    text-align: center;
    font-style: italic;
    font-size: clamp(17px, 1.8vw, 22px);
    color: var(--ink);
    opacity: 0;
    transition: opacity 1.2s var(--ease);
}
.hint.is-visible { opacity: 0.85; }
.inscription {
    max-width: 62ch;
    margin: 0 24px 26px;
    text-align: center;
    font-style: italic;
    font-size: 17px;
    color: var(--ink-dim);
    opacity: 0;
    transition: opacity 1.4s var(--ease);
}
.inscription.is-visible { opacity: 1; }
.note {
    position: absolute;
    bottom: 18px;
    left: 0; right: 0;
    margin: 0;
    text-align: center;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
}

/* Intro / reflect placement */
#intro { justify-content: center; }
#reflect { justify-content: flex-end; padding-bottom: 6vh; }

/* HUD */
.stage {
    position: absolute;
    left: 26px;
    bottom: 26px;
    font-variant-caps: all-small-caps;
    letter-spacing: 0.18em;
    font-size: 17px;
    color: var(--ink-dim);
    opacity: 0;
    transition: opacity 2.4s var(--ease);
}
.stage.is-visible { opacity: 1; }
.progress-track {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: rgba(233, 226, 211, 0.08);
}
.progress {
    height: 100%;
    background: var(--gold);
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.9s linear;
}
.quiet-btn {
    position: absolute;
    right: 26px;
    bottom: 22px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    background: none;
    border: 0;
    padding: 6px 4px;
    cursor: pointer;
}
.quiet-btn:hover { color: var(--ink-dim); }

/* Return / thanks */
.return-line {
    margin: 0;
    padding: 0 28px;
    text-align: center;
    font-style: italic;
    font-size: clamp(26px, 3.2vw, 38px);
}

/* ---------------- panels ---------------- */
.panel {
    background: var(--black);
    border: 1px solid var(--rule);
    color: var(--ink);
}

.reflect-panel {
    width: min(560px, calc(100vw - 40px));
    padding: 34px 36px 26px;
}
.question {
    margin: 0 0 22px;
    font-size: clamp(21px, 2.2vw, 25px);
    line-height: 1.4;
}
#reflect-input {
    display: block;
    width: 100%;
    resize: none;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--rule);
    padding: 6px 0 10px;
    color: var(--ink);
    font-family: var(--serif);
    font-style: italic;
    font-size: 20px;
    line-height: 1.5;
    outline: none;
    caret-color: var(--gold);
}
#reflect-input:focus { border-bottom-color: var(--gold); }
.reflect-voice-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
}
.reflect-voice-row[hidden] { display: none; }
.voice-status {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--gold);
}
.actions {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 22px;
}

.text-btn {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--ink-dim);
    background: none;
    border: 0;
    border-bottom: 1px solid transparent;
    padding: 6px 2px;
    cursor: pointer;
    transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.text-btn:hover, .text-btn:focus-visible { color: var(--ink); border-bottom-color: var(--rule); outline: none; }
.text-btn.primary { color: var(--gold); text-transform: none; font-family: var(--serif); font-size: 19px; letter-spacing: 0.01em; }
.text-btn.primary:hover { border-bottom-color: var(--gold); }
.text-btn.is-on { color: var(--gold); }

/* ---------------- modals (curator, plaque) ---------------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 6, 0.72);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s var(--ease);
}
.modal.is-visible { opacity: 1; pointer-events: auto; }

.curator-panel {
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 20px 24px 18px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink);
}
.c-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 10px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--rule);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 11.5px;
    color: var(--ink-dim);
}
.c-head.sub { margin-top: 22px; }
.c-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 26px;
}
.c-grid label { display: flex; flex-direction: column; gap: 5px; color: var(--ink-dim); }
.c-grid label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); }
.curator-panel select,
.curator-panel input[type="range"] {
    width: 100%;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--ink);
    background: var(--black);
    border: 1px solid var(--rule);
    padding: 6px 8px;
    outline: none;
}
.curator-panel select:focus { border-color: var(--gold); }
.curator-panel input[type="range"] { padding: 0; border: 0; accent-color: var(--gold); height: 24px; }
.curator-panel input[type="checkbox"] { accent-color: var(--gold); width: 14px; height: 14px; margin: 0; }
.c-row-btns { display: flex; gap: 22px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--rule); }
.c-monitor {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    margin-top: 14px;
    color: var(--ink-dim);
}
.c-monitor span { color: var(--ink); }
.meter { height: 1px; background: rgba(233, 226, 211, 0.12); }
.meter > div { height: 100%; width: 100%; background: var(--gold); transform-origin: left; transform: scaleX(0); transition: transform 0.12s linear; }
.c-list { max-height: 180px; overflow: auto; }
.c-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(233, 226, 211, 0.08);
    font-family: var(--serif);
    font-style: italic;
    font-size: 15px;
}
.c-row button { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); background: none; border: 0; cursor: pointer; white-space: nowrap; }
.c-row button:hover { color: var(--ink); }
.c-empty { color: var(--ink-faint); padding: 8px 0; }
.c-keys { margin: 18px 0 0; color: var(--ink-faint); font-size: 11px; letter-spacing: 0.04em; }

.plaque-panel {
    width: min(620px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 40px 44px 30px;
}
.plaque-title {
    margin: 0 0 6px;
    font-variant-caps: all-small-caps;
    letter-spacing: 0.18em;
    font-size: 24px;
}
.plaque-meta {
    margin: 0 0 26px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--rule);
    color: var(--ink-dim);
    font-size: 15px;
    line-height: 1.5;
}
.plaque-body p { margin: 0 0 1em; font-size: 17.5px; line-height: 1.55; }
.plaque-panel .text-btn { margin-top: 6px; }

/* ---------------- toast ---------------- */
#toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%) translateY(6px);
    z-index: 30;
    padding: 8px 14px;
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.06em;
    color: var(--ink);
    background: var(--black);
    border: 1px solid var(--rule);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
#toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- small screens ---------------- */
@media (max-width: 640px) {
    html, body { font-size: 16px; }
    #mark { top: 16px; left: 18px; }
    .stage { left: 18px; bottom: 20px; font-size: 15px; }
    .sound-btn { right: 14px; bottom: 14px; }
    .cam-panel { grid-template-columns: 1fr; }
    .cam-preview { width: 100%; height: 150px; }
    .leave-btn { top: 16px; right: 18px; }
    .quiet-btn { right: 18px; bottom: 16px; }
    .reflect-panel { padding: 26px 22px 20px; }
    .choose-block, .intro-block { padding: 22px 18px 20px; }
    .tone-grid, .choose-block .tone-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .choose-block .tone .tone-feel { display: none; }
    .tone { padding: 12px 6px 10px; }
    .choose-row { flex-direction: column; align-items: stretch; }
    .c-grid { grid-template-columns: 1fr; }
    .plaque-panel { padding: 30px 24px 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .layer, .inscription, .stage, .modal, .story-line, .story-cue, #canvas-container { transition-duration: 0.01ms; }
    .story-cue.is-visible { animation: none; }
}


/* ==========================================================================
   LEGIBILITY PASS (9 Nov 2026)
   The metal is bright and moves behind the words. These rules put a soft dark
   backing behind text that sits over it, lift the faint greys, and nudge the
   smallest sizes up. Fan mode is pure black, so the backings are hidden there.
   ========================================================================== */
:root {
    --ink-dim: rgba(233, 226, 211, 0.84);
    --ink-faint: rgba(233, 226, 211, 0.68);
}

/* Attract: title and invitation sit on a dark rise at the bottom, the inscription on one at the top */
#attract::before, #attract::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    pointer-events: none;
    z-index: -1;
}
#attract::before { top: 0; height: 24vh; background: linear-gradient(to bottom, rgba(5, 5, 6, 0.66), rgba(5, 5, 6, 0)); }
#attract::after  { bottom: 0; height: 48vh; background: linear-gradient(to top, rgba(5, 5, 6, 0.86), rgba(5, 5, 6, 0)); }
body.fan-mode #attract::before, body.fan-mode #attract::after { display: none; }

.inscription { font-size: 19px; text-shadow: 0 1px 12px rgba(5, 5, 6, 0.95), 0 0 3px rgba(5, 5, 6, 0.8); }
.note { font-size: 12.5px; text-shadow: 0 1px 10px rgba(5, 5, 6, 0.95); }
.dwell-label { font-size: 12px; }
.dwell-track { background: rgba(233, 226, 211, 0.24); }

/* Choose: the tone cards sit on a panel instead of floating over the sphere */
.choose-block { background: rgba(5, 5, 6, 0.82); border-color: var(--rule); }
.choose-block .tone .tone-name { font-size: 14px; }
.choose-block .tone .tone-feel { font-size: 14.5px; }
.choose-block .choose-sub { font-size: 17px; }

/* Small print */
.step-label { font-size: 12.5px; }
.story-cue { font-size: 12.5px; }
.intro-block .small { font-size: 15.5px; }
.intro-warn { font-size: 15.5px; }
.cam-legend { font-size: 11px; }
.leave-btn, .quiet-btn, .sound-btn { font-size: 12.5px; }
.sound-btn, .leave-btn { text-shadow: 0 1px 8px rgba(5, 5, 6, 0.95); }
.sound-btn { background: rgba(5, 5, 6, 0.55); }

/* Words laid over the sphere during the sitting */
.voice {
    /* soft pool of dark, no hard box: the words sit in the piece, not on a label */
    background: radial-gradient(ellipse at center, rgba(5, 5, 6, 0.72) 0%, rgba(5, 5, 6, 0.5) 55%, rgba(5, 5, 6, 0) 100%);
    border-radius: 50%;
    padding: 0.9em 2em;
}
.voice.is-visible { opacity: 1; }
.hint { text-shadow: 0 0 18px rgba(5, 5, 6, 1), 0 2px 8px rgba(5, 5, 6, 0.95); }
.hint.is-visible { opacity: 1; }
.stage { text-shadow: 0 1px 12px rgba(5, 5, 6, 0.95); }
#mark { text-shadow: 0 1px 10px rgba(5, 5, 6, 0.95); }
.story-line { text-shadow: 0 0 22px rgba(5, 5, 6, 0.95), 0 2px 8px rgba(5, 5, 6, 0.9); }
.story-line.is-visible { opacity: 1; }
.return-line { text-shadow: 0 0 24px rgba(5, 5, 6, 0.95), 0 2px 8px rgba(5, 5, 6, 0.9); }

/* Attract text backing (9 Nov 2026): keep title/sub readable over the bright sphere, incl. fan mode */
body.fan-mode .attract-block {
  background: radial-gradient(ellipse at center, rgba(5, 5, 6, 0.78) 0%, rgba(5, 5, 6, 0.62) 55%, rgba(5, 5, 6, 0) 100%);
  padding: 22px 34px;
  border-radius: 12px;
}
body.fan-mode .attract-block .attract-title,
body.fan-mode .attract-block .attract-sub,
body.fan-mode .attract-block .attract-hint {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.9);
}
/* Camera note is tappable to retry when the camera failed (9 Nov 2026) */
#sensor-note { pointer-events: auto; z-index: 5; }
body.fan-mode #sensor-note { pointer-events: none; }

/* ==========================================================================
   EXPERIENCE PASS (9 Nov 2026): presence cue, softer transitions, phone polish
   ========================================================================== */
.presence {
    position: fixed;
    left: 26px;
    bottom: 22px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 12px;
    border-radius: 999px;
    background: rgba(5, 5, 6, 0.55);
    border: 1px solid rgba(233, 226, 211, 0.16);
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.06em;
    color: var(--ink-dim);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), border-color 0.4s;
    pointer-events: none;
}
.presence.is-on { opacity: 1; transform: none; }
.presence-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #c9a85e;
    box-shadow: 0 0 10px rgba(201, 168, 94, 0.7);
    transition: transform 0.12s linear, background 0.4s, box-shadow 0.4s;
}
.presence[data-mode="moving"] { border-color: rgba(201, 168, 94, 0.55); color: var(--ink); }
.presence[data-mode="moving"] .presence-dot { background: #f0d890; box-shadow: 0 0 16px rgba(240, 216, 144, 0.95); }
.presence[data-mode="still"] .presence-dot { background: #aeb8c4; box-shadow: 0 0 10px rgba(174, 184, 196, 0.7); }
body.fan-mode .presence { display: none; }

/* Screens drift in and out instead of just fading */
.layer > * { transition: transform 1.4s var(--ease); transform: translateY(14px); }
.layer.is-visible > * { transform: none; }
.layer > .note, .layer > .inscription { transform: none; }
/* The voice line centres itself with a transform, so the drift rule above must not replace it */
.layer > .voice, .layer.is-visible > .voice { transform: translate(-50%, -50%); transition: opacity 0.9s var(--ease); }

/* Phones and tablets */
@supports (padding: max(0px)) {
    #mark { top: max(16px, env(safe-area-inset-top)); left: max(18px, env(safe-area-inset-left)); }
    .sound-btn { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); }
    #attract { padding-bottom: max(6.5vh, calc(env(safe-area-inset-bottom) + 20px)); }
}
button, .tone, .text-btn { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (max-width: 640px) {
    .presence { left: 50%; bottom: 58px; transform: translate(-50%, 6px); font-size: 11px; }
    .presence.is-on { transform: translate(-50%, 0); }
    .attract-title { font-size: clamp(24px, 8vw, 32px); }
    .attract-sub { font-size: 17px; margin-bottom: 16px; }
    .big-btn { min-height: 48px; }
    .tone { min-height: 64px; }
}
@media (max-height: 480px) and (orientation: landscape) {
    .attract-block { margin-top: 0; }
    .attract-sub { margin-bottom: 10px; }
    #attract { padding-top: 4vh; padding-bottom: 4vh; }
    .presence { bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .layer > *, .presence { transition-duration: 0.01ms; transform: none; }
}
@media (max-width: 640px) {
    .presence { left: auto; right: 14px; top: max(14px, env(safe-area-inset-top)); bottom: auto; transform: translateY(-6px); }
    .presence.is-on { transform: none; }
}
@media (max-width: 640px) {
    .presence { padding: 7px; gap: 0; }
    .presence-text { display: none; }
    .presence-dot { width: 10px; height: 10px; }
    #attract { padding-bottom: max(112px, calc(env(safe-area-inset-bottom) + 100px)); }
    .note { bottom: max(56px, calc(env(safe-area-inset-bottom) + 44px)); padding: 0 22px; line-height: 1.5; }
}