/* ==========================================================================
   Interactive Dual-World Portal (/)
   Apple-inspired sliding split window, 3D perspective glass, dual-world canvas
   ========================================================================== */

:root {
    --dev-bg: #060913;
    --dev-accent: #38bdf8;
    --dev-cobalt: #3b82f6;
    --dev-glow: rgba(56, 189, 248, 0.24);
    --dev-text: #f1f5f9;
    --dev-muted: rgba(203, 213, 225, 0.8);

    --music-bg: #120e0a;
    --music-accent: #d9b980;
    --music-amber: #c9a66b;
    --music-glow: rgba(217, 185, 128, 0.24);
    --music-text: #f8f3ea;
    --music-muted: rgba(235, 225, 208, 0.8);

    --font-display: 'Outfit', system-ui, -apple-system, sans-serif;
    --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-surface: rgba(255, 255, 255, 0.05);
}

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

html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background-color: #060913;
    overscroll-behavior: none;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background-color: #120e0a;
    color: #f8fafc;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
    overscroll-behavior: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    font-size: inherit;
}

:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 3px;
}

/* ==========================================================================
   Floating Minimal Top Chrome
   ========================================================================== */
.portal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.25rem;
    pointer-events: none;
    transition: opacity 320ms ease, transform 320ms ease;
}

@media (min-width: 900px) {
    .portal-header {
        padding: 1.5rem 2.25rem;
    }
}

.portal-brand {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    white-space: nowrap;
    color: #f8fafc;
    transition: opacity 160ms ease;
}

.portal-brand:hover,
.portal-brand:focus-visible {
    opacity: 0.85;
}

.brand-mark {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(135deg, #38bdf8, #d9b980);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.35), 0 0 8px rgba(217, 185, 128, 0.35);
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #f8fafc;
}

.lang-switcher {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(10, 12, 18, 0.46);
    border: 1px solid rgba(255, 255, 255, 0.13);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.lang-btn {
    background: transparent;
    border: none;
    color: rgba(241, 245, 249, 0.66);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 0.34rem 0.62rem;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1;
    transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.lang-btn:hover,
.lang-btn:focus-visible {
    color: #ffffff;
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   Portal Stage & Live Dual-World Canvas
   ========================================================================== */
.portal-stage {
    position: relative;
    width: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
    isolation: isolate;
}

.portal-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100lvh;
    z-index: 1;
    pointer-events: none;
    display: block;
}

/* ==========================================================================
   World Layers (Mobile Vertical Diptych by default)
   ========================================================================== */
.world-layer {
    position: relative;
    z-index: 2;
    flex: 1 1 50%;
    min-height: 50dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5.5rem 1.25rem 2.75rem;
}

.world-layer--music {
    padding: 2.75rem 1.25rem 4.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.world-layer--dev::before,
.world-layer--music::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.world-layer--dev::before {
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at 45% 50%, rgba(0, 0, 0, 0.85) 0%, transparent 78%);
    -webkit-mask-image: radial-gradient(circle at 45% 50%, rgba(0, 0, 0, 0.85) 0%, transparent 78%);
}

.world-layer--music::before {
    background: radial-gradient(ellipse at 55% 45%, rgba(201, 166, 107, 0.09) 0%, transparent 68%);
}

.world-card-slot {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 430px;
    perspective: 1200px;
}

/* ==========================================================================
   Tactile Glassmorphic Centerpiece Cards
   ========================================================================== */
.portal-card {
    --rx: 0deg;
    --ry: 0deg;
    --mx: 50%;
    --my: 50%;
    --sheen: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 300px;
    border-radius: 26px;
    padding: 2rem 1.65rem;
    overflow: hidden;
    transform-style: preserve-3d;
    transform: rotateX(var(--rx)) rotateY(var(--ry));
    transition:
        transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
        border-color 240ms ease,
        box-shadow 260ms ease,
        opacity 260ms ease;
}

.portal-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: var(--sheen, 0);
    transition: opacity 150ms ease;
}

body.is-hovering-node {
    cursor: grab;
}

body.is-dragging-node,
body.is-dragging-node * {
    cursor: grabbing !important;
    user-select: none;
    -webkit-user-select: none;
}

.portal-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.15) 100%);
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.15) 100%);
}

.portal-card--dev {
    background: linear-gradient(150deg, rgba(14, 22, 42, 0.72) 0%, rgba(7, 11, 24, 0.62) 100%);
    border: 1px solid rgba(125, 211, 252, 0.18);
    backdrop-filter: blur(22px) saturate(130%);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(56, 189, 248, 0.06) inset,
        0 1px 0 rgba(255, 255, 255, 0.14) inset;
}

.portal-card--dev::before {
    background: radial-gradient(
        420px circle at var(--mx) var(--my),
        rgba(56, 189, 248, 0.18),
        rgba(59, 130, 246, 0.06) 42%,
        transparent 72%
    );
}

.portal-card--dev:hover {
    border-color: rgba(125, 211, 252, 0.36);
    box-shadow:
        0 30px 76px rgba(2, 6, 23, 0.65),
        0 0 42px rgba(56, 189, 248, 0.14),
        0 1px 0 rgba(255, 255, 255, 0.22) inset;
}

.portal-card--music {
    background: linear-gradient(150deg, rgba(30, 22, 15, 0.74) 0%, rgba(18, 13, 9, 0.64) 100%);
    border: 1px solid rgba(217, 185, 128, 0.2);
    backdrop-filter: blur(22px) saturate(125%);
    -webkit-backdrop-filter: blur(22px) saturate(125%);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.52),
        0 0 0 1px rgba(217, 185, 128, 0.06) inset,
        0 1px 0 rgba(255, 243, 218, 0.15) inset;
}

.portal-card--music::before {
    background: radial-gradient(
        420px circle at var(--mx) var(--my),
        rgba(232, 198, 136, 0.19),
        rgba(180, 138, 72, 0.06) 42%,
        transparent 72%
    );
}

.portal-card--music:hover {
    border-color: rgba(232, 198, 136, 0.4);
    box-shadow:
        0 30px 76px rgba(10, 7, 4, 0.68),
        0 0 42px rgba(201, 166, 107, 0.16),
        0 1px 0 rgba(255, 243, 218, 0.24) inset;
}

.card-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    margin: 0 0 0.85rem;
    line-height: 1.06;
}

.card-title--dev {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--dev-text);
}

.card-title--music {
    font-family: var(--font-serif);
    font-size: clamp(2.25rem, 4.4vw, 3.35rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--music-text);
}

.card-desc {
    margin: 0 0 1.85rem;
    font-size: 0.93rem;
    line-height: 1.58;
}

.card-desc--dev {
    color: var(--dev-muted);
}

.card-desc--music {
    color: var(--music-muted);
}

/* Magnetic Pill CTA Buttons */
.portal-cta {
    position: relative;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    margin-top: auto;
    gap: 0.7rem;
    padding: 0.82rem 1.45rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition:
        transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
        background-color 220ms ease,
        border-color 220ms ease,
        box-shadow 220ms ease;
    will-change: transform;
}

.portal-cta--dev {
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(125, 211, 252, 0.42);
    color: #e0f2fe;
    box-shadow: 0 10px 28px rgba(14, 165, 233, 0.16);
}

.portal-cta--dev:hover,
.portal-cta--dev:focus-visible {
    background: rgba(56, 189, 248, 0.24);
    border-color: rgba(186, 230, 253, 0.72);
    color: #ffffff;
    box-shadow: 0 14px 36px rgba(56, 189, 248, 0.3);
}

.portal-cta--music {
    background: rgba(217, 185, 128, 0.14);
    border: 1px solid rgba(232, 198, 136, 0.44);
    color: #fbf3e4;
    box-shadow: 0 10px 28px rgba(201, 166, 107, 0.16);
}

.portal-cta--music:hover,
.portal-cta--music:focus-visible {
    background: rgba(217, 185, 128, 0.24);
    border-color: rgba(246, 226, 179, 0.75);
    color: #ffffff;
    box-shadow: 0 14px 36px rgba(217, 185, 128, 0.3);
}

.cta-arrow {
    display: inline-flex;
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.portal-cta:hover .cta-arrow,
.portal-cta:focus-visible .cta-arrow {
    transform: translateX(4px);
}

/* ==========================================================================
   Static Luminous Center Seam (Desktop >= 900px)
   ========================================================================== */
.world-seam {
    display: none;
}

/* ==========================================================================
   Mobile Single-Screen Fit (No Scroll on Portrait Phones, >= 540px tall)
   Falls back to normal vertical scroll on landscape or tiny viewports
   ========================================================================== */
@media (max-width: 899px) and (min-height: 540px) {
    body {
        height: 100dvh;
        overflow: hidden;
        overscroll-behavior: none;
    }

    .portal-stage {
        height: 100dvh;
        min-height: 100dvh;
        overflow: hidden;
        touch-action: none;
        overscroll-behavior: none;
    }

    .portal-header {
        padding: calc(0.65rem + env(safe-area-inset-top, 0px)) calc(1rem + env(safe-area-inset-right, 0px)) 0.65rem calc(1rem + env(safe-area-inset-left, 0px));
    }

    .portal-cta,
    .portal-header,
    .lang-btn {
        touch-action: manipulation;
    }

    .world-layer {
        flex: 1 1 0;
        min-height: 0;
        padding: 0.55rem calc(1rem + env(safe-area-inset-right, 0px)) 0.55rem calc(1rem + env(safe-area-inset-left, 0px));
    }

    .world-layer--dev {
        padding-top: calc(3.55rem + env(safe-area-inset-top, 0px));
    }

    .world-layer--music {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    }

    .world-card-slot {
        max-width: 420px;
    }

    .portal-card {
        min-height: 0;
        border-radius: 22px;
        padding: clamp(0.95rem, 2.3vh, 1.5rem) clamp(1.05rem, 4vw, 1.45rem);
    }

    .card-title {
        margin-bottom: clamp(0.35rem, 0.9vh, 0.65rem);
    }

    .card-title--dev {
        font-size: clamp(1.42rem, 4.4vw, 1.95rem);
    }

    .card-title--music {
        font-size: clamp(1.62rem, 5vw, 2.2rem);
    }

    .card-desc {
        font-size: clamp(0.8rem, 2.2vw, 0.9rem);
        line-height: 1.42;
        margin-bottom: clamp(0.75rem, 1.8vh, 1.3rem);
    }

    .portal-cta {
        padding: clamp(0.55rem, 1.3vh, 0.74rem) clamp(1.05rem, 3.5vw, 1.35rem);
        font-size: 0.84rem;
    }
}

/* ==========================================================================
   Desktop Fixed 50/50 Dual-World Layout (>= 900px)
   ========================================================================== */
@media (min-width: 900px) {
    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    .portal-stage {
        display: grid;
        grid-template-columns: 1fr 1fr;
        height: 100dvh;
        overflow: hidden;
    }

    .world-layer {
        position: relative;
        padding: 0 2.5rem;
        min-height: 0;
        border-top: none;
        transition: opacity 280ms ease;
    }

    .world-card-slot {
        width: min(440px, 100%);
        max-width: 440px;
    }

    .portal-card {
        padding: 2.5rem 2.35rem;
        min-height: 330px;
    }

    .world-seam {
        display: block;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 50%;
        width: 1px;
        transform: translateX(-50%);
        z-index: 15;
        pointer-events: none;
        background: linear-gradient(
            180deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(186, 230, 253, 0.28) 28%,
            rgba(255, 255, 255, 0.42) 50%,
            rgba(246, 226, 179, 0.28) 72%,
            rgba(255, 255, 255, 0) 100%
        );
        box-shadow:
            -6px 0 24px rgba(56, 189, 248, 0.16),
            6px 0 24px rgba(217, 185, 128, 0.16);
        transition: opacity 240ms ease;
    }
}

/* Smooth Exit & Slide-Over Transition */
.portal-canvas {
    transition: opacity 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.portal-curtain {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    opacity: 0;
    background-color: var(--curtain-bg, #060913);
    background-image: radial-gradient(ellipse 75% 420px at 50% -100px, var(--curtain-glow, rgba(56, 189, 248, 0.12)), transparent 72%);
    background-repeat: no-repeat;
    will-change: transform, opacity;
    transition:
        transform 430ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.portal-curtain--dev {
    transform: translate3d(0, -36%, 0);
    box-shadow: 0 2px 32px var(--curtain-edge, rgba(56, 189, 248, 0.35));
}

.portal-curtain--music {
    transform: translate3d(0, 36%, 0);
    box-shadow: 0 -2px 32px var(--curtain-edge, rgba(217, 185, 128, 0.35));
}

@media (min-width: 900px) {
    .portal-curtain--dev {
        transform: translate3d(-52%, 0, 0);
        border-right: 1px solid var(--curtain-edge, rgba(56, 189, 248, 0.4));
        box-shadow: 14px 0 48px var(--curtain-edge, rgba(56, 189, 248, 0.25));
    }

    .portal-curtain--music {
        transform: translate3d(52%, 0, 0);
        border-left: 1px solid var(--curtain-edge, rgba(217, 185, 128, 0.4));
        box-shadow: -14px 0 48px var(--curtain-edge, rgba(217, 185, 128, 0.25));
    }
}

.portal-curtain.is-active {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

.portal-stage.is-transitioning .portal-canvas {
    opacity: 0;
}

.portal-stage.is-transitioning .portal-header {
    opacity: 0;
    pointer-events: none;
}

.portal-stage.is-transitioning--dev .world-seam {
    left: 100%;
    opacity: 0;
    transition: left 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 340ms ease;
}

.portal-stage.is-transitioning--music .world-seam {
    left: 0%;
    opacity: 0;
    transition: left 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 340ms ease;
}

.portal-stage.is-transitioning--dev .world-layer--music,
.portal-stage.is-transitioning--music .world-layer--dev {
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.portal-stage.is-transitioning--dev .portal-card--dev,
.portal-stage.is-transitioning--music .portal-card--music {
    transform: scale(1.025);
    opacity: 0;
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), opacity 240ms ease;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .portal-card,
    .portal-cta {
        transition: none !important;
    }
}
