/* ============================================================
   AJATTELUANI — tech-fluid HUD styling
   ============================================================ */

:root {
    --ink:        #02090e;
    --deep:       #04141d;
    --accent:     #6ef3ff;
    --accent-dim: rgba(110, 243, 255, 0.38);
    --accent-faint: rgba(110, 243, 255, 0.14);
    --text:       #b9dbe2;
    --text-hi:    #eefdff;
    --warm:       #ffd9c2;
    --panel-bg:   rgba(3, 18, 25, 0.72);
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--ink);
    font-family: var(--mono);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ---------- 3D stage ---------- */
#stage {
    position: fixed;
    inset: 0;
    cursor: grab;
}
#stage:active { cursor: grabbing; }
#stage canvas { display: block; }
/* phones: a pinch zooms the 3D view (toward the monkey), never the page
   itself — that would blow the HUD up and leave it misaligned. Panels and
   pop-ups still scroll normally. */
html.touch body { touch-action: pan-x pan-y; }
html.touch #stage, html.touch .tag { touch-action: none; }

/* ---------- film grade: vignette + scanlines ---------- */
#grade {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 30;
    background:
        radial-gradient(ellipse 120% 90% at 50% 42%, transparent 55%, rgba(1, 6, 10, 0.55) 100%);
}
#grade::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.022) 0px,
        rgba(255, 255, 255, 0.022) 1px,
        transparent 1px,
        transparent 4px
    );
    mix-blend-mode: overlay;
    opacity: 0.6;
}

/* ---------- HUD chrome ---------- */
.hud {
    position: fixed;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 22px 26px;
    z-index: 40;
    pointer-events: none;
}
#hud-top    { top: 0; }
#hud-bottom { bottom: 0; align-items: flex-end; }

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
    color: var(--accent);
    font-size: 15px;
    text-shadow: 0 0 12px var(--accent-dim);
    animation: markPulse 3.2s ease-in-out infinite;
}
@keyframes markPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}
.brand-name {
    font-weight: 800;
    letter-spacing: 0.34em;
    font-size: 15px;
    color: var(--text-hi);
    text-shadow: 0 0 18px rgba(110, 243, 255, 0.25);
}
.brand-sub {
    font-size: 10px;
    letter-spacing: 0.22em;
    color: rgba(185, 219, 226, 0.55);
}
.hint {
    font-size: 11px;
    letter-spacing: 0.12em;
    color: rgba(185, 219, 226, 0.6);
    pointer-events: none;
}
.hint-key {
    color: var(--accent);
    border: 1px solid var(--accent-dim);
    padding: 2px 6px;
    font-size: 10px;
    background: rgba(110, 243, 255, 0.05);
}

/* ---------- button ---------- */
.btn {
    pointer-events: auto;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--accent);
    background: rgba(3, 22, 30, 0.65);
    border: 1px solid var(--accent-dim);
    padding: 10px 16px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.25s, box-shadow 0.25s, color 0.25s;
}
.btn:hover {
    background: rgba(110, 243, 255, 0.12);
    box-shadow: 0 0 24px rgba(110, 243, 255, 0.25), inset 0 0 12px rgba(110, 243, 255, 0.08);
    color: var(--text-hi);
}
.btn-bracket { opacity: 0.55; }

/* ============================================================
   LABELS — tech callouts with leader lines
   ============================================================ */

#wires {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}
#wires .wire { opacity: 0.55; }
#wires path {
    fill: none;
    stroke: var(--accent);
    stroke-linecap: round;
    stroke-linejoin: round;
}
#wires .wire-line { stroke-width: 1; }
/* the glow: two faint, wider strokes under the line (cheaper than a filter) */
#wires .wire-glow { stroke-width: 3.5; opacity: 0.22; }
#wires .wire-glow-outer { stroke-width: 8; opacity: 0.07; }
#wires .wire.dim { opacity: 0.28; }
/* anchor zoomed off screen (labels.js) — beats the inline dim/show opacity */
#wires .wire.off { opacity: 0 !important; }

#labels {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 21;
}

/* one callout */
.callout {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    will-change: transform, opacity;
}
.callout.show { opacity: 1; }
.callout.off { opacity: 0 !important; }
.callout.off .tag { pointer-events: none; }

/* the anchor dot (placed at the 3D anchor) */
.anchor {
    position: absolute;
    left: 0;
    top: 0;
    width: 7px;
    height: 7px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent), 0 0 20px var(--accent-dim);
}
.anchor::after {
    content: "";
    position: absolute;
    inset: -7px;
    border: 1px solid var(--accent-dim);
    border-radius: 50%;
    animation: ringPulse 2.4s ease-out infinite;
}
@keyframes ringPulse {
    0%   { transform: scale(0.45); opacity: 0.9; }
    70%  { transform: scale(1.5);  opacity: 0; }
    100% { transform: scale(1.5);  opacity: 0; }
}

/* label box */
.tag {
    position: relative;
    display: inline-block;
    background: rgba(2, 16, 23, 0.62);
    border: 1px solid var(--accent-dim);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    padding: 8px 12px 7px;
    white-space: nowrap;
    box-shadow: 0 0 22px rgba(2, 10, 14, 0.55), inset 0 0 18px rgba(110, 243, 255, 0.05);
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
/* corner brackets */
.tag::before,
.tag::after {
    content: "";
    position: absolute;
    width: 9px;
    height: 9px;
    border-color: var(--accent);
    border-style: solid;
    transition: all 0.2s;
}
.tag::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.tag::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.tag:hover, .callout.active .tag {
    background: rgba(110, 243, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 28px rgba(110, 243, 255, 0.22), inset 0 0 14px rgba(110, 243, 255, 0.1);
}
.tag:hover::before, .tag:hover::after,
.callout.active .tag::before, .callout.active .tag::after {
    width: 14px; height: 14px;
}

.tag-index {
    display: block;
    font-size: 9px;
    letter-spacing: 0.22em;
    color: rgba(110, 243, 255, 0.65);
    margin-bottom: 3px;
}
.tag-name {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--text-hi);
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(110, 243, 255, 0.35);
}
.tag-sub {
    display: block;
    font-size: 9.5px;
    letter-spacing: 0.16em;
    color: rgba(185, 219, 226, 0.55);
    text-transform: uppercase;
    margin-top: 2px;
}

/* the big main callout: "Sörki aivojani." */
.callout.main .tag {
    padding: 14px 20px 13px;
    background: rgba(2, 16, 23, 0.55);
}
.callout.main .tag-name {
    font-size: 19px;
    letter-spacing: 0.1em;
}
.callout.main .cursor {
    display: inline-block;
    width: 9px;
    height: 1.1em;
    margin-left: 6px;
    vertical-align: text-bottom;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   SIDE PANEL — part info (placeholder for future works)
   ============================================================ */

#panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(390px, 88vw);
    z-index: 45;
    transform: translateX(105%);
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.3, 1);
    pointer-events: none;
}
#panel.open { transform: translateX(0); pointer-events: auto; }

.panel-inner {
    height: 100%;
    background: var(--panel-bg);
    border-left: 1px solid var(--accent-dim);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 26px 26px 26px 30px;
    box-shadow: -30px 0 60px rgba(0, 4, 8, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
}
.panel-scroll {
    flex: 1;
    overflow-y: auto;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel-tag {
    font-size: 10px;
    letter-spacing: 0.24em;
    color: var(--accent);
}
.panel-close {
    background: none;
    border: 1px solid var(--accent-dim);
    color: var(--accent);
    width: 30px; height: 30px;
    font-family: var(--mono);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.panel-close:hover { background: var(--accent); color: var(--ink); }

/* ---------- video tabs + drawer — pull out to watch, click again to close ---------- */
.panel-wing {
    position: absolute;
    top: 66px;
    left: 0;
    transform: translateX(-100%);
    display: flex;
    align-items: flex-start;
}
.panel-tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}
.panel-tab {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: rgba(3, 22, 30, 0.8);
    border: 1px solid var(--accent-dim);
    white-space: nowrap;
    padding: 10px 14px;
    text-align: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.panel-tab:hover { background: rgba(110, 243, 255, 0.12); color: var(--text-hi); }
.panel-tab.active {
    background: var(--accent);
    color: var(--ink);
    box-shadow: 0 0 22px rgba(110, 243, 255, 0.35);
}
/* max-width (not width) is what's animated: it lets each media type
   size itself to its own content — a 16:9 embed, a portrait clip, a
   pair of stills — instead of every tab sharing one fixed-size canvas
   with empty space around whatever doesn't fill it */
.video-drawer {
    max-width: 0;
    overflow: hidden;
    transition: max-width 0.5s cubic-bezier(0.22, 1, 0.3, 1);
}
.video-drawer.open { max-width: 800px; margin-right: 10px; }
.video-drawer-inner { display: block; position: relative; }

/* the embedded youtube case film — the one type that's a real 16:9
   frame regardless of what's inside it */
.video-drawer-inner.media-youtube {
    width: 720px;
    aspect-ratio: 16 / 9;
    background: #000;
    border: 1px solid var(--accent-dim);
    box-shadow: 0 0 30px rgba(0, 4, 8, 0.6), 0 0 50px rgba(110, 243, 255, 0.12);
}
.video-drawer-inner.media-youtube iframe { width: 100%; height: 100%; border: 0; display: block; }

/* a portrait-format local clip — bordered directly, sized to its own
   aspect ratio, no surrounding black canvas */
.video-drawer-inner.media-video video {
    display: block;
    height: 405px;
    width: auto;
    border: 1px solid var(--accent-dim);
    box-shadow: 0 0 30px rgba(0, 4, 8, 0.6), 0 0 50px rgba(110, 243, 255, 0.12);
}

/* stills — each still is an "exhibit card": an opaque dark panel with the
   callout tags' corner brackets, the image inset, and (when there is one)
   a caption strip in the tag typography. Opaque so neither the artwork nor
   the caption has to compete with the 3D scene behind the drawer. */
.video-drawer-inner.media-gallery {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.media-gallery-item,
.video-drawer-inner.media-image {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 8px;
    background: rgb(4, 11, 15);
    border: 1px solid var(--accent-dim);
    box-shadow: 0 0 30px rgba(0, 4, 8, 0.6), 0 0 50px rgba(110, 243, 255, 0.12);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.media-gallery-item::before, .media-gallery-item::after,
.video-drawer-inner.media-image::before, .video-drawer-inner.media-image::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border-color: var(--accent);
    border-style: solid;
    pointer-events: none;
    transition: width 0.2s, height 0.2s;
}
.media-gallery-item::before, .video-drawer-inner.media-image::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.media-gallery-item::after,  .video-drawer-inner.media-image::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }
.media-gallery-item:hover {
    border-color: var(--accent);
    box-shadow: 0 0 28px rgba(110, 243, 255, 0.22), 0 0 50px rgba(110, 243, 255, 0.12);
}
.media-gallery-item:hover::before, .media-gallery-item:hover::after { width: 16px; height: 16px; }
/* every still in a set shares one height, width following its own shape
   (from the width/height attrs), so a set reads as matched without
   cropping anything: 9:16 posters and taller rollups both fit whole */
.media-gallery-item img {
    display: block;
    height: 356px;
    width: auto;
}
.video-drawer-inner.media-image img {
    display: block;
    height: 389px;
    width: auto;
}
.media-caption {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 4px 2px;
    border-top: 1px solid rgba(110, 243, 255, 0.14);
    margin-top: 8px;
}
.media-kicker {
    font-size: 9px;
    letter-spacing: 0.22em;
    color: rgba(110, 243, 255, 0.65);
}
.media-name {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-hi);
    text-shadow: 0 0 14px rgba(110, 243, 255, 0.35);
}

/* stills open full-screen; a small badge on the card says so */
.zoomable { cursor: zoom-in; }
.zoom-hint {
    position: absolute;
    z-index: 2;
    top: 14px;
    right: 14px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: rgba(3, 22, 30, 0.82);
    border: 1px solid var(--accent-dim);
    backdrop-filter: blur(6px);
    pointer-events: none;   /* the click lands on the image underneath */
    transition: background 0.2s, color 0.2s;
}
.zoom-hint svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: square; }
.media-gallery-item:hover .zoom-hint,
.video-drawer-inner.media-image:hover .zoom-hint { background: var(--accent); color: var(--ink); }

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 9, 14, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: zoom-out;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox-frame {
    position: relative;
    padding: 8px;
    background: rgb(4, 11, 15);
    border: 1px solid var(--accent-dim);
    box-shadow: 0 0 40px rgba(0, 4, 8, 0.7), 0 0 60px rgba(110, 243, 255, 0.14);
    transform: scale(0.96);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.3, 1);
}
.lightbox.open .lightbox-frame { transform: none; }
.lightbox-frame::before,
.lightbox-frame::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: var(--accent);
    border-style: solid;
}
.lightbox-frame::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.lightbox-frame::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }
.lightbox-frame img {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100vw - 66px);
    max-height: calc(100vh - 66px);
    max-height: calc(100dvh - 66px);
}
.lightbox-close { position: absolute; top: 16px; right: 16px; }

/* phones: tab content opens in this pop-up over the panel instead of the
   inline drawers (desktop never opens it) */
.media-modal {
    position: fixed;
    inset: 0;
    z-index: 92;
    display: grid;
    place-items: center;
    padding: 14px;
    background: rgba(2, 9, 14, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.media-modal.open { opacity: 1; visibility: visible; }
.media-modal-frame {
    width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transform: translateY(14px);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.3, 1);
}
.media-modal.open .media-modal-frame { transform: none; }
.media-modal-head { display: flex; align-items: center; justify-content: space-between; }
.media-modal-title { font-size: 10px; letter-spacing: 0.24em; color: var(--accent); }
.media-modal-body {
    min-height: 0;
    overflow: auto;
    display: flex;
    justify-content: center;
}
/* under a video on an upright touch phone: you can rotate for full screen */
.media-modal-hint {
    display: none;
    text-align: center;
    font-size: 9px;
    letter-spacing: 0.22em;
    color: rgba(110, 243, 255, 0.6);
}
@media (orientation: portrait) {
    html.touch .media-modal[data-media="youtube"] .media-modal-hint,
    html.touch .media-modal[data-media="wide-image"] .media-modal-hint { display: block; }
}

/* the turn-your-phone overlay on a YouTube (or wide image) pop-up: a phone outline swings
   sideways twice, then the whole thing fades out. Taps pass straight
   through to the player underneath. */
.rotate-hint {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    place-items: center;
    align-content: center;
    gap: 8px;
    background: rgba(2, 9, 14, 0.6);
    pointer-events: none;
    animation: rhFade 4.4s ease forwards;
}
@media (orientation: portrait) {
    html.touch .media-modal .rotate-hint { display: grid; }
}
.rotate-hint-icon {
    position: relative;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
}
.rh-phone {
    width: 22px;
    height: 36px;
    fill: rgba(110, 243, 255, 0.08);
    stroke: var(--accent);
    stroke-width: 1.6;
    filter: drop-shadow(0 0 6px rgba(110, 243, 255, 0.6));
    animation: rhTurn 2s cubic-bezier(0.6, 0, 0.3, 1) 2;
}
.rh-arc {
    position: absolute;
    inset: 0;
    fill: none;
    stroke: rgba(110, 243, 255, 0.55);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.rotate-hint-label { font-size: 9px; letter-spacing: 0.24em; color: var(--accent); }
@keyframes rhTurn { 0%, 20% { transform: rotate(0deg); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
@keyframes rhFade { 0% { opacity: 0; } 8%, 82% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
/* both content surfaces live in the body; only the active kind shows */
.media-modal[data-kind="video"] #clients-cloud,
.media-modal[data-kind="clients"] #video-drawer-inner { display: none; }

/* ---------- product stage (e.g. Kieku "Pakkaus" tab) ----------
   A scanning bay: holo deck receding into the dark, a rotating HUD
   reticle behind the product. All site cyan; --stage-glow can retint
   per item. */
.product-stage {
    --stage-glow: 110, 243, 255;
    position: relative;
    width: 400px;
    height: 405px;
    overflow: hidden;
    perspective: 900px;
    background:
        radial-gradient(circle at 50% 44%, rgba(var(--stage-glow), 0.2) 0%, rgba(var(--stage-glow), 0.06) 34%, transparent 60%),
        rgb(4, 11, 15);
    border: 1px solid var(--accent-dim);
    box-shadow: 0 0 30px rgba(0, 4, 8, 0.6), 0 0 50px rgba(110, 243, 255, 0.12);
}
/* corner brackets, same as the exhibit cards and callout tags */
.product-stage::before,
.product-stage::after {
    content: "";
    position: absolute;
    z-index: 4;
    width: 12px;
    height: 12px;
    border-color: var(--accent);
    border-style: solid;
    pointer-events: none;
}
.product-stage::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.product-stage::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }
.stage-hud {
    position: absolute;
    z-index: 3;
    top: 13px;
    left: 14px;
    font-size: 9px;
    letter-spacing: 0.22em;
    color: rgba(110, 243, 255, 0.65);
    pointer-events: none;
}
/* faint flat grid on the back wall */
.stage-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(110, 243, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(110, 243, 255, 0.06) 1px, transparent 1px);
    background-size: 22px 22px;
    background-position: center;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}
/* holo deck: a perspective grid floor sliding toward the viewer */
.stage-deck {
    position: absolute;
    left: -40%;
    right: -40%;
    bottom: -8%;
    height: 62%;
    transform-origin: 50% 100%;
    transform: rotateX(72deg);
    background-image:
        linear-gradient(rgba(110, 243, 255, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(110, 243, 255, 0.5) 1px, transparent 1px);
    background-size: 34px 34px;
    -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%);
    mask-image: linear-gradient(to top, #000 10%, transparent 85%);
    animation: stageDeck 4s linear infinite;
}
/* HUD reticle behind the product: dashed ring, tick ring, accent arcs */
.stage-reticle {
    position: absolute;
    left: 50%;
    top: 44%;
    width: 380px;
    height: 380px;
    margin: -190px 0 0 -190px;
    border-radius: 50%;
    border: 1px dashed rgba(110, 243, 255, 0.35);
    animation: stageSpin 60s linear infinite;
}
.stage-ticks,
.stage-arcs {
    position: absolute;
    border-radius: 50%;
}
.stage-ticks {
    inset: 12px;
    background: repeating-conic-gradient(rgba(110, 243, 255, 0.6) 0deg 0.8deg, transparent 0.8deg 6deg);
    -webkit-mask-image: radial-gradient(circle, transparent 0 calc(100% - 9px), #000 calc(100% - 8px));
    mask-image: radial-gradient(circle, transparent 0 calc(100% - 9px), #000 calc(100% - 8px));
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    opacity: 0.7;
    animation: stageSpin 40s linear infinite reverse;
}
.stage-arcs {
    inset: 28px;
    border: 2px solid transparent;
    border-top-color: rgba(110, 243, 255, 0.85);
    border-bottom-color: rgba(110, 243, 255, 0.4);
    filter: drop-shadow(0 0 6px rgba(110, 243, 255, 0.6));
    animation: stageSpin 9s linear infinite;
}
/* contact shadow + holo ring on the deck, breathing with the float */
.stage-floor {
    position: absolute;
    left: 50%;
    bottom: 20px;
    width: 300px;
    height: 46px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6), transparent 70%);
    transform: translateX(-50%);
    animation: stageFloor 6s ease-in-out infinite;
}
.stage-floor::after {
    content: "";
    position: absolute;
    inset: 6px 14px;
    border-radius: 50%;
    border: 1px solid rgba(110, 243, 255, 0.5);
    box-shadow: 0 0 18px rgba(110, 243, 255, 0.3), inset 0 0 14px rgba(110, 243, 255, 0.18);
}
.stage-float {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    animation: stageBob 6s ease-in-out infinite;
}
.stage-tilt {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.3, 1);
    will-change: transform;
}
.stage-product {
    display: block;
    height: 318px;
    width: auto;
    filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 22px rgba(var(--stage-glow), 0.25));
    animation: stageIn 0.8s cubic-bezier(0.22, 1, 0.3, 1) both;
}
@keyframes stageSpin      { to { transform: rotate(360deg); } }
@keyframes stageDeck      { to { background-position: 0 34px; } }
@keyframes stageBob       { 0%, 100% { transform: translateY(-5px); } 50% { transform: translateY(5px); } }
@keyframes stageFloor     { 0%, 100% { transform: translateX(-50%) scale(0.9); opacity: 0.75; }
                            50%      { transform: translateX(-50%) scale(1);   opacity: 1; } }
@keyframes stageIn        { from { opacity: 0; transform: translateY(16px) scale(0.94); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .stage-deck, .stage-reticle, .stage-ticks, .stage-arcs, .stage-float, .stage-floor,
    .stage-product { animation: none; }
}

/* ---------- bottle turntable (Malmgård "Pullo" tab) ---------- */
.bottle-viewer {
    position: relative;
    width: 300px;
    height: 405px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    background:
        radial-gradient(ellipse 85% 55% at 50% 66%, rgba(46, 230, 255, 0.11), transparent 70%),
        rgb(4, 11, 15);
    border: 1px solid var(--accent-dim);
    box-shadow: 0 0 30px rgba(0, 4, 8, 0.6), 0 0 50px rgba(110, 243, 255, 0.12);
}
/* corner brackets, same as the callout tags */
.bottle-viewer::before,
.bottle-viewer::after {
    content: "";
    position: absolute;
    z-index: 2;
    width: 12px;
    height: 12px;
    border-color: var(--accent);
    border-style: solid;
    pointer-events: none;
}
.bottle-viewer::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.bottle-viewer::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }
.bottle-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}
.bottle-canvas:active { cursor: grabbing; }
.bottle-index,
.bottle-hint {
    position: absolute;
    left: 14px;
    pointer-events: none;
}
.bottle-index {
    top: 13px;
    font-size: 9px;
    letter-spacing: 0.22em;
    color: rgba(110, 243, 255, 0.65);
}
.bottle-hint {
    top: 30px;
    font-size: 9px;
    letter-spacing: 0.1em;
    color: rgba(185, 219, 226, 0.5);
}
.bottle-hint .hint-key { font-size: 8px; padding: 1px 4px; }
/* the fade keeps the name + arrows legible when zoomed onto the label */
.bottle-nav {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 12px 12px;
    background: linear-gradient(to top, rgba(4, 11, 15, 0.92) 30%, rgba(4, 11, 15, 0));
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}
.bottle-arrow {
    pointer-events: auto;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: rgba(3, 22, 30, 0.8);
    border: 1px solid var(--accent-dim);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.bottle-arrow:hover {
    background: var(--accent);
    color: var(--ink);
    box-shadow: 0 0 22px rgba(110, 243, 255, 0.35);
}
.bottle-arrow svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.bottle-name {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-hi);
    text-shadow: 0 0 14px rgba(110, 243, 255, 0.35);
}

.clients-drawer {
    width: 0;
    overflow: hidden;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.3, 1);
}
.clients-drawer.open { width: 560px; margin-right: 10px; }
.clients-drawer-inner {
    position: relative;
    width: 560px;
    overflow: hidden;
    /* near-opaque — this is its own little diagram, not a window onto
       the busy 3D scene behind it */
    background: rgb(4, 11, 15);
    border: 1px solid var(--accent-dim);
    box-shadow: 0 0 30px rgba(0, 4, 8, 0.6), 0 0 50px rgba(110, 243, 255, 0.12);
}
/* height only applies while open: on desktop the wing is taken out of
   flow (position: absolute) so a stray height there is invisible, but
   on mobile it sits inline — an unconditional height would leave a
   dead gap above the panel text even while the drawer is collapsed */
.clients-drawer.open .clients-drawer-inner { height: 420px; }
/* a little neural net: client names drifting and tethered to their
   nearest neighbours, echoing the brain concept instead of another
   grid of boxes */
.cloud-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    filter: drop-shadow(0 0 2px rgba(110, 243, 255, 0.3));
}
.cloud-lines line { stroke: var(--accent); stroke-width: 1; stroke-linecap: round; }
.cloud-nodes { position: absolute; inset: 0; }
.cloud-node {
    position: absolute;
    left: 0;
    top: 0;     /* placed by its `translate`, set per frame in main.js */
    display: flex;
    align-items: center;
    gap: 6px;
    transform: translate(-50%, -50%);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(185, 219, 226, 0.8);
    text-shadow: 0 0 10px rgba(110, 243, 255, 0.25);
    white-space: nowrap;
    padding: 3px 5px;
    cursor: default;
    transition: color 0.25s, text-shadow 0.25s, transform 0.25s, opacity 0.25s;
}
/* the neuron cell body — a small glowing soma each label hangs off of */
.cloud-node::before {
    content: "";
    flex: none;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent), 0 0 14px rgba(110, 243, 255, 0.55);
    transition: width 0.25s, height 0.25s, box-shadow 0.25s;
}
.cloud-node.hovered {
    color: var(--text-hi);
    text-shadow: 0 0 18px rgba(110, 243, 255, 0.75), 0 0 36px rgba(110, 243, 255, 0.35);
    transform: translate(-50%, -50%) scale(1.4);
    z-index: 5;
}
.cloud-node.hovered::before {
    width: 7px;
    height: 7px;
    box-shadow: 0 0 10px var(--accent), 0 0 22px rgba(110, 243, 255, 0.8);
}
.cloud-nodes.has-hover .cloud-node:not(.hovered) { opacity: 0.35; }

.panel-title {
    margin-top: 18px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-hi);
    text-transform: uppercase;
    text-shadow: 0 0 22px rgba(110, 243, 255, 0.3);
}
.panel-sub {
    margin-top: 5px;
    font-size: 11px;
    letter-spacing: 0.22em;
    color: rgba(185, 219, 226, 0.55);
    text-transform: uppercase;
}
.panel-rule {
    margin: 20px 0 16px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-dim), transparent);
}
.panel-blurb {
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--text);
}
.panel-blurb p { margin-bottom: 14px; }
.panel-blurb p:last-child { margin-bottom: 0; }
.panel-blurb--pending { color: rgba(185, 219, 226, 0.5); }
.work-awards {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.work-award {
    font-size: 9.5px;
    letter-spacing: 0.08em;
    color: rgba(185, 219, 226, 0.75);
    border: 1px solid rgba(110, 243, 255, 0.22);
    padding: 3px 7px;
}
.panel-audio {
    display: block;
    margin-top: 26px;
    width: 100%;
    text-align: center;
}
.panel-audio[hidden] { display: none; }

/* ---------- contact card — photo + two actions, sits in the blurb slot ---------- */
.contact-block {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.contact-photo {
    display: block;
    width: 100%;
    aspect-ratio: 660 / 848;
    object-fit: cover;
    filter: grayscale(0.25) contrast(1.06);
    border: 1px solid var(--accent-dim);
    box-shadow: 0 0 30px rgba(0, 4, 8, 0.6), 0 0 40px rgba(110, 243, 255, 0.1);
}
.contact-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.contact-btn {
    width: 100%;
    text-align: center;
    text-decoration: none;
    display: block;
}

/* ============================================================
   LOADER
   ============================================================ */

#loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 40%, #06222e 0%, var(--ink) 75%);
    transition: opacity 0.9s ease, visibility 0.9s;
}
#loader.done { opacity: 0; visibility: hidden; }

.loader-box { width: min(420px, 84vw); }
.loader-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.4em;
    color: var(--text-hi);
    text-shadow: 0 0 30px rgba(110, 243, 255, 0.4);
    margin-bottom: 26px;
}
.loader-line {
    font-size: 11px;
    letter-spacing: 0.22em;
    color: var(--accent);
    margin-bottom: 10px;
}
.dots::after {
    content: "";
    animation: dots 1.4s steps(4) infinite;
}
@keyframes dots {
    0% { content: ""; } 25% { content: "."; }
    50% { content: ".."; } 75% { content: "..."; }
}
.loader-bar {
    height: 2px;
    background: rgba(110, 243, 255, 0.12);
    overflow: hidden;
}
.loader-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent);
    transition: width 0.25s ease;
}
.loader-pct {
    margin-top: 8px;
    font-size: 10px;
    letter-spacing: 0.3em;
    color: rgba(185, 219, 226, 0.6);
    text-align: right;
}
.loader-log {
    margin-top: 22px;
    font-size: 9.5px;
    line-height: 1.9;
    letter-spacing: 0.1em;
    color: rgba(185, 219, 226, 0.38);
    min-height: 90px;
}
.loader-log .ok { color: rgba(110, 243, 255, 0.75); }

/* ---------- responsive ---------- */
/* phones — including a phone turned sideways (wide but short + touch) */
@media (max-width: 720px), (pointer: coarse) and (max-height: 520px) {
    .hud { padding: 16px 16px; }
    .brand-sub { display: none; }
    .callout.main .tag-name { font-size: 15px; }
    .tag { padding: 6px 9px 5px; }
    .tag-index { font-size: 8px; margin-bottom: 2px; }
    .tag-name { font-size: 11px; }
    .tag-sub  { display: none; }

    /* bottom bar: a two-line hint on the left and a compact one-line
       button on the right, side by side rather than piled on each other */
    #hud-bottom { align-items: flex-end; gap: 12px; }
    .hint { display: flex; flex-direction: column; gap: 6px; font-size: 10px; }
    .hint-sep { display: none; }
    .hint-key { font-size: 9px; }
    #assemble-btn {
        flex: none;
        font-size: 10px;
        letter-spacing: 0.16em;
        padding: 9px 12px;
        white-space: nowrap;
    }

    /* the tabs stay in the panel above the text; what they open shows in
       the pop-up (.media-modal), so the drawers never open inline here */
    .panel-wing {
        position: static;
        transform: none;
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 16px;
    }
    .panel-tabs { flex-direction: row; flex-wrap: wrap; }
    .panel-tab { width: auto; padding: 8px 12px; }

    .lightbox { padding: 12px; }
    .lightbox-frame img { max-width: calc(100vw - 42px); max-height: calc(100dvh - 42px); }

    /* ---- each tab type inside the pop-up ---- */
    /* full width, except the single-image card, which hugs its image */
    .media-modal .video-drawer-inner:not(.media-image) { width: 100%; }
    .media-modal .video-drawer-inner.media-video { display: flex; justify-content: center; }
    .media-modal .video-drawer-inner.media-video video {
        height: auto;
        width: auto;
        max-width: 100%;
        max-height: calc(100dvh - 110px);
    }
    .media-modal .video-drawer-inner.media-image img {
        height: auto;
        width: auto;
        max-width: calc(100vw - 46px);
        max-height: calc(100dvh - 130px);
    }
    /* a set splits the pop-up's width into equal columns: two posters or
       three rollups side by side, each still tappable to go full-screen */
    .media-modal .video-drawer-inner.media-gallery { gap: 10px; }
    .media-gallery-item { flex: 1 1 0; min-width: 0; padding: 6px; }
    .media-gallery-item img { width: 100%; height: auto; }
    .zoom-hint { top: 10px; right: 10px; width: 20px; height: 20px; }
    .media-name { font-size: 11px; }
    .media-modal .bottle-viewer { width: 100%; height: min(72dvh, 560px); }
    .media-modal .product-stage { --rs: min(56dvh, 340px); width: 100%; height: min(66dvh, 460px); }
    .stage-product { height: min(42dvh, 300px); }
    .stage-reticle { width: var(--rs); height: var(--rs); margin: calc(var(--rs) / -2) 0 0 calc(var(--rs) / -2); }
    .stage-ticks { inset: 3.2%; }
    .stage-arcs { inset: 7.4%; }
    .stage-floor { width: 66%; bottom: 18px; }
    /* the client cloud gets a real, settled box before it lays out */
    .media-modal .clients-drawer-inner { width: 100%; height: min(66dvh, 560px); }
    .cloud-node { font-size: 9px; gap: 4px; padding: 2px 4px; }
    .cloud-node::before { width: 4px; height: 4px; }
}

/* (html.touch = real touch device, or the tester's ?touch=1)
   a video pop-up on a phone turned sideways goes edge to edge: black,
   no frame or title, the video filling the screen. Turning the phone back
   upright drops these rules and it's the normal pop-up again — the same
   player element just resizes, so playback carries on uninterrupted. */
@media (orientation: landscape) and (max-height: 520px) {
    html.touch .media-modal[data-media="youtube"],
    html.touch .media-modal[data-media="video"],
    html.touch .media-modal[data-media="wide-image"] {
        padding: 0;
        background: #000;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    html.touch .media-modal[data-media="youtube"] .media-modal-frame,
    html.touch .media-modal[data-media="video"] .media-modal-frame,
    html.touch .media-modal[data-media="wide-image"] .media-modal-frame {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        gap: 0;
        transform: none;
    }
    html.touch .media-modal[data-media="youtube"] .media-modal-head,
    html.touch .media-modal[data-media="video"] .media-modal-head,
    html.touch .media-modal[data-media="wide-image"] .media-modal-head { display: none; }
    html.touch .media-modal[data-media="youtube"] .media-modal-body,
    html.touch .media-modal[data-media="video"] .media-modal-body,
    html.touch .media-modal[data-media="wide-image"] .media-modal-body { flex: 1; overflow: hidden; align-items: stretch; }
    html.touch .media-modal .video-drawer-inner.media-youtube {
        width: 100%;
        height: 100%;
        aspect-ratio: auto;
        border: 0;
        box-shadow: none;
    }
    html.touch .media-modal .video-drawer-inner.media-video { width: 100%; height: 100%; align-items: center; }
    html.touch .media-modal .video-drawer-inner.media-video video {
        height: 100%;
        max-height: none;
        width: auto;
        border: 0;
        box-shadow: none;
    }
    /* a wide image: the whole billboard, as large as fits, on black */
    html.touch .media-modal[data-media="wide-image"] .video-drawer-inner.media-image {
        width: 100%;
        height: 100%;
        padding: 0;
        justify-content: center;
        align-items: center;
        background: #000;
        border: 0;
        box-shadow: none;
    }
    html.touch .media-modal[data-media="wide-image"] .video-drawer-inner.media-image::before,
    html.touch .media-modal[data-media="wide-image"] .video-drawer-inner.media-image::after,
    html.touch .media-modal[data-media="wide-image"] .zoom-hint { display: none; }
    html.touch .media-modal[data-media="wide-image"] .video-drawer-inner.media-image img {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: contain;
    }
}

.nojs {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    background: var(--ink); color: var(--text);
    font-size: 14px; letter-spacing: 0.1em; padding: 40px; text-align: center;
}


/* visually hidden, still read by search engines and screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
