/* ═══════════════════════════════════════════════════════
   JOGA — STYLE SYSTEM
   Cyber-Tribal / Kojima x Yves Tumor / Hardgroove
   ═══════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────── */
:root {
    --black:        #000000;
    --black-rich:   #050507;
    --anthracite:   #1a1a1e;
    --steel:        #2a2a30;
    --chrome:       #8a8a96;
    --chrome-light: #c0c0cc;

    --neon-cyan:    #00f0ff;
    --neon-magenta: #ff0066;
    --neon-red:     #ff1a1a;
    --neon-blue:    #0040ff;
    --laser-blue:   #4488ff;

    --font-display: 'Bebas Neue', 'Chakra Petch', sans-serif;
    --font-body:    'Chakra Petch', sans-serif;
    --font-mono:    'JetBrains Mono', 'Courier New', monospace;

    --scanner-radius: 140px;
    --mouse-x: 50%;
    --mouse-y: 50%;

    /* Safe area insets for notched devices */
    --sai-top:    env(safe-area-inset-top, 0px);
    --sai-bottom: env(safe-area-inset-bottom, 0px);
    --sai-left:   env(safe-area-inset-left, 0px);
    --sai-right:  env(safe-area-inset-right, 0px);

    /* Dynamic viewport height — fallback for older browsers */
    --vh-full: 100vh;
    --vh-full: 100dvh;
}

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

html {
    width: 100%;
    height: 100%;
    height: -webkit-fill-available;
    overflow: hidden;
}

body {
    width: 100%;
    height: 100%;
    height: -webkit-fill-available;
    overflow: hidden;
    background: var(--black);
    color: var(--chrome-light);
    font-family: var(--font-body);
    cursor: crosshair;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    /* NO touch-action on body — let children decide */
}

/* ── LAYER 0.5 : Tattoo Background ────────────────── */
#tattoo-layer {
    position: fixed;
    inset: 0;
    background-image: url('../assets/background/background%20tatoo.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: invert(1) grayscale(1);
    opacity: 0.05;
    mix-blend-mode: screen;
    z-index: 2;
    pointer-events: none;
}

/* ── LAYER 1 : Neon Magma ─────────────────────────── */
#neon-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(255, 0, 102, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 240, 255, 0.35) 0%, transparent 45%),
        radial-gradient(ellipse at 60% 80%, rgba(0, 64, 255, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 30%, rgba(255, 26, 26, 0.25) 0%, transparent 40%),
        var(--black);
    animation: magmaPulse 8s ease-in-out infinite alternate;
}

@keyframes magmaPulse {
    0%   { filter: hue-rotate(0deg) saturate(1.2) brightness(0.8); }
    33%  { filter: hue-rotate(-15deg) saturate(1.5) brightness(1); }
    66%  { filter: hue-rotate(10deg) saturate(1.3) brightness(0.9); }
    100% { filter: hue-rotate(-5deg) saturate(1.4) brightness(1.1); }
}

/* ── LAYER 3 : Metal Overlay (Visceral Scanner) ───── */
#metal-layer {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: var(--black-rich);
    -webkit-mask-image: radial-gradient(
        circle var(--scanner-radius) at var(--mouse-x) var(--mouse-y),
        transparent 0%, transparent 60%, black 100%
    );
    mask-image: radial-gradient(
        circle var(--scanner-radius) at var(--mouse-x) var(--mouse-y),
        transparent 0%, transparent 60%, black 100%
    );
}

.metal-grain {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.06;
    mix-blend-mode: overlay;
}

/* ── LAYER 4 : Three.js Canvas ────────────────────── */
#three-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
}

/* ── LAYER 5 : UI Overlay ─────────────────────────── */
#ui-overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ── Top Bar ──────────────────────────────────────── */
#top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    padding-top: calc(16px + var(--sai-top));
    pointer-events: auto;
    touch-action: manipulation;
    background: rgba(10, 10, 14, 0.55);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-bottom: 1px solid rgba(138, 138, 150, 0.12);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sys-tag { color: var(--neon-cyan); font-weight: 500; }
.sys-divider { color: var(--steel); }
.sys-status { color: var(--chrome); opacity: 0.6; }

.top-bar-nav {
    display: flex;
    gap: 6px;
}

/* ── Nav Links — Chromatic Aberration ─────────────── */
.nav-link {
    position: relative;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--chrome);
    padding: 6px 14px;
    border: 1px solid rgba(138, 138, 150, 0.15);
    transition: all 0.3s ease;
    overflow: hidden;
    touch-action: manipulation;
}

.nav-link::before,
.nav-link::after {
    content: attr(data-glitch);
    position: absolute;
    top: 6px;
    left: 14px;
    opacity: 0;
    transition: opacity 0.15s;
}

.nav-link::before {
    color: var(--neon-cyan);
    transform: translate(-2px, -1px);
}

.nav-link::after {
    color: var(--neon-magenta);
    transform: translate(2px, 1px);
}

.nav-link:hover {
    color: #fff;
    border-color: rgba(0, 240, 255, 0.3);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

.nav-link:hover::before,
.nav-link:hover::after {
    opacity: 0.6;
    animation: glitchFlicker 0.3s steps(2) infinite;
}

@keyframes glitchFlicker {
    0%   { opacity: 0.6; }
    25%  { opacity: 0; }
    50%  { opacity: 0.4; }
    75%  { opacity: 0; }
    100% { opacity: 0.6; }
}

/* ── Switch button in nav ────────────────────────── */
.nav-link--switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    cursor: pointer;
    outline: none;
    -webkit-user-select: none;
    user-select: none;
}

.nav-link--switch .switch-icon {
    font-size: 12px;
    color: var(--neon-cyan);
    opacity: 0.7;
    line-height: 1;
}

.nav-link--switch #switch-status {
    color: var(--neon-cyan);
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   FREE SAMPLE — Bottom center, raised, LIGHT-REACTIVE
   Accent color driven by --sr/--sg/--sb/--s-bright
   set in JS from the same light rig as the 3D logo.
   ═══════════════════════════════════════════════════════ */

#free-sample-zone {
    --sr: 0;
    --sg: 180;
    --sb: 200;
    --s-bright: 0.5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    touch-action: manipulation;
    padding-bottom: calc(20px + var(--sai-bottom));
    margin-bottom: 48px;
}

/* Decorative scanline above button — reactive */
.sample-scanline {
    width: 200px;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(var(--sr), var(--sg), var(--sb), 0.06) 15%,
        rgba(var(--sr), var(--sg), var(--sb), 0.25) 50%,
        rgba(var(--sr), var(--sg), var(--sb), 0.06) 85%,
        transparent 100%
    );
    opacity: var(--s-bright);
    animation: scanlinePulse 3s ease-in-out infinite;
}

@keyframes scanlinePulse {
    0%, 100% { transform: scaleX(1);   }
    50%      { transform: scaleX(1.2); }
}

/* The button */
.sample-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 28px;
    min-height: 48px;
    background: rgba(10, 10, 14, 0.7);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(var(--sr), var(--sg), var(--sb), 0.15);
    color: var(--chrome);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.35s ease, transform 0.15s ease;
    outline: none;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    box-shadow:
        0 0 calc(20px * var(--s-bright)) rgba(var(--sr), var(--sg), var(--sb), 0.04),
        inset 0 0 calc(30px * var(--s-bright)) rgba(var(--sr), var(--sg), var(--sb), 0.02);
}

/* Horizontal scan sweep — reactive color */
.sample-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(var(--sr), var(--sg), var(--sb), 0.04) 40%,
        rgba(var(--sr), var(--sg), var(--sb), calc(0.1 * var(--s-bright))) 50%,
        rgba(var(--sr), var(--sg), var(--sb), 0.04) 60%,
        transparent 100%
    );
    animation: sweepScan 4s linear infinite;
    pointer-events: none;
}

@keyframes sweepScan {
    0%   { left: -100%; }
    100% { left: 100%; }
}

/* Corner brackets — reactive */
.sample-btn::after {
    content: '';
    position: absolute;
    inset: 3px;
    border: 1px solid transparent;
    border-top-color: rgba(var(--sr), var(--sg), var(--sb), calc(0.15 * var(--s-bright)));
    border-left-color: rgba(var(--sr), var(--sg), var(--sb), calc(0.15 * var(--s-bright)));
    pointer-events: none;
    transition: border-color 0.3s ease;
}

.sample-btn:hover {
    color: var(--chrome-light);
    border-color: rgba(var(--sr), var(--sg), var(--sb), 0.4);
    box-shadow:
        0 0 30px rgba(var(--sr), var(--sg), var(--sb), 0.08),
        inset 0 0 30px rgba(var(--sr), var(--sg), var(--sb), 0.04);
    text-shadow: 0 0 8px rgba(var(--sr), var(--sg), var(--sb), 0.35);
}

.sample-btn:hover::after {
    border-top-color: rgba(var(--sr), var(--sg), var(--sb), 0.35);
    border-left-color: rgba(var(--sr), var(--sg), var(--sb), 0.35);
}

.sample-btn:active {
    transform: scale(0.97);
}

/* Icon — reactive color */
.sample-icon {
    font-size: 16px;
    color: rgb(var(--sr), var(--sg), var(--sb));
    opacity: var(--s-bright);
    transition: opacity 0.3s ease;
}

.sample-label {
    opacity: 0.8;
    font-weight: 500;
}

/* Status — reactive color */
.sample-status {
    color: rgb(var(--sr), var(--sg), var(--sb));
    font-weight: 500;
    opacity: var(--s-bright);
    min-width: 32px;
    text-align: right;
    font-size: 10px;
}

/* Active state — playing */
.sample-btn.active {
    box-shadow:
        0 0 35px rgba(var(--sr), var(--sg), var(--sb), 0.1),
        inset 0 0 40px rgba(var(--sr), var(--sg), var(--sb), 0.04);
}

.sample-btn.active .sample-icon {
    animation: iconPulse 1.2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { opacity: 0.7; }
    50%      { opacity: 1; }
}

/* Hint text below button */
.sample-hint {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--chrome);
    opacity: 0.2;
    pointer-events: none;
    animation: hintFade 4s ease-in-out infinite;
    text-align: center;
    padding: 0 16px;
}

@keyframes hintFade {
    0%, 100% { opacity: 0.2; }
    50%      { opacity: 0.08; }
}

/* ═══════════════════════════════════════════════════════
   MODALS — Glassmorphism Clinical
   ═══════════════════════════════════════════════════════ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-panel {
    position: relative;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    max-height: 80dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    background: rgba(10, 10, 14, 0.75);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border: 1px solid rgba(138, 138, 150, 0.12);
    padding: 0;
    animation: modalSlideIn 0.4s ease forwards;
}

.modal-panel--wide {
    max-width: 600px;
}

.modal.hidden .modal-panel {
    animation: none;
    transform: translateY(10px) scale(0.98);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Modal Header ─────────────────────────────────── */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(138, 138, 150, 0.1);
    position: sticky;
    top: 0;
    background: rgba(10, 10, 14, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1;
}

.modal-tag {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--neon-cyan);
    opacity: 0.6;
}

.modal-close {
    background: none;
    border: 1px solid rgba(138, 138, 150, 0.15);
    color: var(--chrome);
    font-family: var(--font-mono);
    font-size: 12px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    touch-action: manipulation;
}

.modal-close:hover {
    color: #fff;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
}

/* ── Modal Body ───────────────────────────────────── */
.modal-body {
    padding: 28px 24px 32px;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 42px;
    letter-spacing: 0.2em;
    font-weight: 400;
    color: var(--chrome-light);
    line-height: 1;
}

.modal-divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(138, 138, 150, 0.15) 20%,
        rgba(0, 240, 255, 0.1) 50%,
        rgba(138, 138, 150, 0.15) 80%,
        transparent 100%
    );
    margin: 18px 0;
}

.modal-text {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 300;
    line-height: 1.9;
    letter-spacing: 0.04em;
    color: var(--chrome);
}

.modal-tagline {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--chrome);
    opacity: 0.35;
}

/* ═══════════════════════════════════════════════════════
   SETS ENTRIES
   ═══════════════════════════════════════════════════════ */

.set-entries {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.set-entry {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 16px;
    border: 1px solid rgba(138, 138, 150, 0.06);
    background: rgba(255, 255, 255, 0.015);
    transition: all 0.3s ease;
}

.set-entry:hover {
    background: rgba(0, 240, 255, 0.03);
    border-color: rgba(0, 240, 255, 0.1);
}

.set-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
    gap: 1px;
}

.set-day {
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1;
    letter-spacing: 0.05em;
    color: var(--chrome-light);
}

.set-month {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    color: var(--neon-cyan);
    opacity: 0.7;
}

.set-year {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.1em;
    color: var(--chrome);
    opacity: 0.35;
}

.set-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.set-venue {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--chrome-light);
}

.set-address {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.06em;
    color: var(--chrome);
    opacity: 0.5;
}

.set-status {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 3px 8px;
    border: 1px solid;
    white-space: nowrap;
}

.set-status--live {
    color: var(--neon-cyan);
    border-color: rgba(0, 240, 255, 0.3);
    animation: statusPulse 2s ease-in-out infinite;
}

.set-status--past {
    color: var(--chrome);
    border-color: rgba(138, 138, 150, 0.15);
    opacity: 0.5;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 rgba(0, 240, 255, 0); }
    50%      { opacity: 0.7; box-shadow: 0 0 12px rgba(0, 240, 255, 0.15); }
}

/* ═══════════════════════════════════════════════════════
   CONTACT GRID
   ═══════════════════════════════════════════════════════ */

.contact-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 44px;
}

.contact-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--chrome);
    opacity: 0.4;
    min-width: 40px;
}

.contact-value {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--chrome-light);
    text-decoration: none;
    transition: all 0.25s ease;
    border-bottom: 1px solid transparent;
    padding: 8px 0;
}

.contact-value:hover {
    color: var(--neon-cyan);
    border-bottom-color: rgba(0, 240, 255, 0.3);
}

/* ═══════════════════════════════════════════════════════
   GLITCH FLASH (Logo Swap)
   ═══════════════════════════════════════════════════════ */

.glitch-flash {
    animation: glitchSwap 0.4s steps(4) forwards;
}

@keyframes glitchSwap {
    0%   { filter: brightness(1) hue-rotate(0deg); }
    25%  { filter: brightness(3) hue-rotate(90deg); }
    50%  { filter: brightness(0.2) hue-rotate(-45deg); }
    75%  { filter: brightness(2.5) hue-rotate(180deg); }
    100% { filter: brightness(1) hue-rotate(0deg); }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ═══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    #top-bar {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
        padding-top: calc(12px + var(--sai-top));
    }

    .top-bar-left {
        font-size: 9px;
    }

    .top-bar-nav {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
    }

    .nav-link {
        font-size: 10px;
        padding: 8px 12px;
        min-height: 36px;
        display: flex;
        align-items: center;
    }

    /* FREE SAMPLE — slightly smaller on mobile */
    .sample-btn {
        padding: 12px 20px;
        font-size: 11px;
        gap: 10px;
    }

    #free-sample-zone {
        margin-bottom: 36px;
    }

    .sample-scanline {
        width: 160px;
    }

    .sample-hint {
        font-size: 7px;
        letter-spacing: 0.12em;
    }

    .modal-panel {
        width: 95%;
        max-width: none;
        max-height: calc(85vh - var(--sai-top) - var(--sai-bottom));
        max-height: calc(85dvh - var(--sai-top) - var(--sai-bottom));
    }

    .modal-title {
        font-size: 32px;
    }

    .set-entry {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px;
    }

    .set-venue {
        font-size: 12px;
    }

    :root {
        --scanner-radius: 80px;
    }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — SMALL PHONES (iPhone SE etc.)
   ═══════════════════════════════════════════════════════ */

@media (max-width: 380px) {
    .top-bar-left .sys-status {
        display: none;
    }

    .top-bar-left .sys-divider {
        display: none;
    }

    .sample-btn {
        padding: 10px 16px;
        font-size: 10px;
    }

    .sample-label {
        letter-spacing: 0.08em;
    }

    .nav-link--switch .switch-icon {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════
   LANDSCAPE PHONES — prevent overlap
   ═══════════════════════════════════════════════════════ */

@media (max-height: 500px) {
    #free-sample-zone {
        padding-bottom: 8px;
        margin-bottom: 20px;
    }

    .sample-scanline {
        display: none;
    }

    .sample-hint {
        display: none;
    }
}
