/* ── Project Base ─────────────────────────────────────────────────────────────
   Shared chrome for every full-screen audio-reactive project page.
   Each project links this file first, then its own style.css for overrides.

   Override these CSS custom properties in :root inside your style.css:
     --project-accent       highlight colour (buttons, seek-bar thumb, etc.)
     --project-accent-glow  rgba version of the accent used for glow box-shadows
──────────────────────────────────────────────────────────────────────────────── */

:root {
    --project-accent:      #cc2222;
    --project-accent-glow: rgba(204,34,34,0.3);
}

/* ── Skip-to-content link ─────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: var(--project-accent);
    color: #000;
    font-weight: 700;
    border-radius: 0 0 4px 4px;
    text-decoration: none;
    transition: top 0.1s;
}
.skip-link:focus { top: 0; }

/* ── Keyboard focus styles ────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--project-accent);
    outline-offset: 3px;
    border-radius: 3px;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── Page ─────────────────────────────────────────────────────────────────── */
html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    background: #000;
    cursor: default;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    touch-action: none;
}

/* ── Canvas ───────────────────────────────────────────────────────────────── */
/* Covers the full viewport. Projects that use Three.js (war, psychedelic)
   append their canvas via JS; Three.js sets inline width/height so the CSS
   width/height here are effectively overridden by the inline styles, which is
   fine — position: fixed + top/left still apply correctly. */
canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* ── Start overlay ────────────────────────────────────────────────────────── */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
    transition: opacity 0.8s;
}

#overlay.hidden { opacity: 0; pointer-events: none; }

/* ── Transport bar ────────────────────────────────────────────────────────── */
#transport-bar {
    position: fixed;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 50;
    background: rgba(5,5,15,0.88);
    border: 1px solid #2a2a40;
    border-radius: 8px;
    padding: 8px 16px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: default;
    max-width: calc(100vw - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    touch-action: manipulation;
    transition: opacity 0.5s ease;
}

#transport-bar.visible { display: flex; }
#transport-bar.faded   { opacity: 0; pointer-events: none; }

/* ── Transport buttons ────────────────────────────────────────────────────── */
.t-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #444;
    background: rgba(10,10,20,0.9);
    color: #999;
    font-size: 16px;
    font-family: monospace;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    flex-shrink: 0;
}

.t-btn:hover,
.t-btn:active { border-color: var(--project-accent); color: var(--project-accent); }

/* Home button — separated from playback controls by a vertical rule */
#t-home { position: relative; margin-right: 12px; }
#t-home::after {
    content: '';
    display: block;
    position: absolute;
    right: -8px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: #2a2a40;
}

/* ── Seek bar ─────────────────────────────────────────────────────────────── */
#seek-bar {
    width: clamp(80px, 30vw, 400px);
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #1a1a30;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    border: 1px solid #2a2a40;
    touch-action: none;
    min-width: 60px;
    flex: 1 1 auto;
}

#seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: var(--project-accent);
    border-radius: 50%;
    cursor: pointer;
}

#seek-bar::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--project-accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* ── Time display ─────────────────────────────────────────────────────────── */
#time-display {
    font-size: clamp(10px, 2.5vw, 12px);
    font-family: monospace;
    color: #666;
    letter-spacing: 1px;
    min-width: 70px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Responsive transport bar ─────────────────────────────────────────────── */
@media (max-width: 540px) {
    #transport-bar {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 6px 8px;
        padding: 8px 12px;
        border-radius: 6px;
    }
    .t-btn          { width: 40px; height: 40px; font-size: 14px; }
    #seek-bar       { order: 10; flex: 1 1 auto; min-width: 0; height: 10px; }
    #seek-bar::-webkit-slider-thumb { width: 26px; height: 26px; }
    #seek-bar::-moz-range-thumb     { width: 26px; height: 26px; }
    #time-display   { order: 11; flex: 0 0 auto; }
}

@media (max-height: 420px) and (orientation: landscape) {
    #transport-bar {
        bottom: calc(4px + env(safe-area-inset-bottom, 0px));
        padding: 4px 12px;
    }
    .t-btn { width: 34px; height: 34px; font-size: 12px; }
}
