/* =========================================================
   GLOBAL STYLES & RESET
   ========================================================= */

:root {
    color-scheme: dark;
    --bg: #090a10;
    --surface: #13141f;
    --surface-light: rgba(255, 255, 255, .045);
    --border: rgba(255, 255, 255, .10);
    --text: #f6f5fb;
    --muted: #a4a5b7;
    --green: #00ff9d;
    --violet: #9b5cff;
    --radius: 18px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    width: 100%;
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--bg);
}

body {
    display: block;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;

    color: var(--text);
    background:
        radial-gradient(ellipse at 10% 0%, rgba(117, 0, 196, .17), transparent 38%),
        radial-gradient(ellipse at 90% 75%, rgba(0, 255, 157, .055), transparent 35%),
        var(--bg);

    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Force normal page scrolling on the main studio dashboard when AR is inactive */
body:not(.ar-active) {
    overflow-y: auto !important;
    height: auto !important;
    position: static !important;
    touch-action: pan-y !important;
}

body:not(.ar-active) .studio, 
body:not(.ar-active) #app, 
body:not(.ar-active) main {
    overflow-y: visible !important;
    height: auto !important;
    position: static !important;
}

body.ar-active {
    overflow: hidden !important;
    overscroll-behavior: none;
    background: transparent !important;
    background-color: transparent !important;
}

body.ar-active .studio {
    visibility: hidden;
    pointer-events: none;
}

h2, h3, h4, h5, p {
    margin: 0;
    padding: 0;
}

button, input, select, textarea {
    font: inherit;
    box-sizing: border-box;
}

button {
    color: inherit;
    cursor: pointer;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 3px;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}


/* =========================================================
   STUDIO LAYOUT & HEADER
   ========================================================= */

.studio {
    width: min(100%, 1440px);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.header {
    min-height: 76px;
    padding: 14px clamp(16px, 4vw, 48px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(9, 10, 16, .76);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(0, 255, 157, .3);
    border-radius: 14px;
    color: var(--green);
    background: rgba(0, 255, 157, .07);
    font-size: 19px;
}

.brand-name {
    margin: 0;
    font-size: 16px;
    font-weight: 850;
    letter-spacing: 1.5px;
}

.brand-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1.8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}


/* =========================================================
   BUTTONS & FORM CONTROLS
   ========================================================= */

.studio button {
    box-sizing: border-box;
    width: auto;
    min-width: 0;
    min-height: 42px;
    height: auto;
    padding: 0 14px;

    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;

    font-size: inherit;
    text-transform: none;
    line-height: 1.35;
    border-radius: 12px;
}

.icon-button {
    width: 42px;
    padding: 0;
}

.primary-button {
    color: #06110c;
    background: var(--green);
    border: 1px solid var(--green);
    font-weight: 800;
}

.primary-button:hover {
    background: #65ffbd;
}

.secondary-button,
.icon-button {
    color: var(--text);
    background: var(--surface-light);
    border: 1px solid var(--border);
}

.icon-button:hover,
.secondary-button:hover {
    border-color: rgba(0, 255, 157, .4);
    background: rgba(0, 255, 157, .06);
}

.studio input,
.studio select,
.studio textarea {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 12px;
    color: var(--text);
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 11px;
}


/* =========================================================
   MAIN CONTENT & SECTIONS
   ========================================================= */

main {
    flex: 1 0 auto;
    width: 100%;
    padding: clamp(22px, 5vw, 58px) clamp(16px, 4vw, 48px) 36px;
    overflow: visible;
}

.intro {
    max-width: 760px;
    margin-bottom: 32px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--green);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.intro h1 {
    margin: 0 0 12px;
    font-size: clamp(27px, 4vw, 43px);
    line-height: 1.13;
    letter-spacing: -1.2px;
}

.intro p {
    max-width: 600px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.75;
}

/* Location Hero */
.location-hero {
    position: relative;
    isolation: isolate;
    min-height: 190px;
    padding: clamp(22px, 4vw, 36px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    overflow: hidden;
    border: 1px solid rgba(0, 255, 157, .24);
    border-radius: 24px;
    background:
        radial-gradient(ellipse at 90% 20%, rgba(0, 255, 157, .13), transparent 48%),
        linear-gradient(115deg, rgba(16, 35, 30, .92), rgba(19, 20, 31, .96) 65%);
    box-shadow: 0 20px 65px rgba(0, 0, 0, .18);
}

.location-copy h2 {
    margin: 0 0 10px;
    font-size: clamp(21px, 3vw, 29px);
}

.location-copy p {
    max-width: 500px;
    margin: 0;
    color: #b9c9c2;
    font-size: 13px;
    line-height: 1.7;
}

.location-icon {
    width: 54px;
    height: 54px;
    margin-bottom: 17px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(0, 255, 157, .28);
    border-radius: 17px;
    background: rgba(0, 255, 157, .08);
    color: var(--green);
    font-size: 23px;
}

.location-action {
    flex: 0 0 auto;
    min-height: 48px;
    padding: 0 18px;
}

/* Mode Grid */
.section {
    margin-top: 38px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 17px;
}

.section-heading h2 {
    margin: 0;
    font-size: 17px;
}

.section-description {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
    padding: 10px;
    min-height: 300px;
}

.mode-card {
    width: 100%;
    height: 200px;
    min-height: 148px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 13px;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .018));
    cursor: pointer;
    transition: border-color .18s, background .18s, transform .18s;
}

.mode-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 255, 157, .35);
    background: rgba(0, 255, 157, .045);
}

.mode-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(155, 92, 255, .24);
    border-radius: 13px;
    background: rgba(155, 92, 255, .09);
    color: #c6a5ff;
    font-size: 18px;
}

.mode-card h3 {
    margin: 0 0 5px;
    font-size: 14px;
}

.mode-card p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
}


/* =========================================================
   FOOTER & PANELS / DIALOGS
   ========================================================= */

.footer {
    width: 100%;
    min-height: 50px;
    padding: 18px clamp(16px, 4vw, 48px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
    background: transparent;
}

.footer strong {
    color: var(--text);
    font-weight: 700;
}

.footer-links {
    display: flex;
    gap: 17px;
}

.footer a {
    color: var(--muted);
    text-decoration: none;
}

.footer a:hover {
    color: var(--green);
}

.float-panel {
    position: fixed;
    z-index: 1000;
    top: 50%;
    left: 50%;
    width: min(420px, calc(100vw - 28px));
    max-height: min(85dvh, 720px);
    padding: 26px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    gap: 12px;
    background: rgba(15, 15, 24, .97);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .4);
    transform: translate(-50%, -50%);
}

.float-panel.visible {
    display: flex;
}

.float-panel h2 {
    margin: 0 0 20px;
    text-align: center;
}

.panel-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
}

.sparkle-btn {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 11px;
    background: var(--green);
    color: #06110c;
    font-weight: 800;
    cursor: pointer;
}


/* =========================================================
   MEDIA QUERIES
   ========================================================= */

@media (max-width: 760px) {
    .header {
        min-height: 66px;
        padding: 12px 16px;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .brand-name {
        font-size: 14px;
    }

    .icon-button {
        width: 38px;
        min-height: 38px;
    }

    .location-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 22px;
        padding: 22px;
    }

    .location-action {
        width: 100%;
    }

    .mode-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .mode-card {
        min-height: 135px;
        padding: 15px;
    }

    .footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding-bottom: max(18px, env(safe-area-inset-bottom));
    }
}

/* =========================================================
   FULL-PAGE AR OVERLAYS & CONTAINERS
   ========================================================= */

/* Main AR Screen / Container covering the entire home page */
#location-ar-screen,
#ar-container,
#container {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    z-index: 9999 !important;
    background: #000 !important;
    isolation: isolate;
}

/* Full-page cover overlay for the Start AR button */
#ar-start-overlay {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: rgba(0, 0, 0, 0.85) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 100000 !important;
    touch-action: auto !important;
}

/* Centered Start AR Button styling */
#ar-start-btn {
    padding: 16px 32px;
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
    background: #007aff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.4);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

#ar-start-btn:active {
    transform: scale(0.95);
    background: #005bb5;
}

/* AR Controls Overlay Container */
#arControls {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    pointer-events: none !important; /* Let touches pass through to the 3D scene */
    z-index: 10001 !important;
    background: transparent !important;
}

/* Re-enable pointer events for interactive elements inside controls */
#arControls button, 
#arControls .ar-ui-element {
    pointer-events: auto !important;
}

/* Hide main studio dashboard completely when AR mode is active */
body.ar-active .studio {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.ar-active,
body.ar-active html,
body.ar-active #container {
    background: transparent !important;
    background-color: transparent !important;
}

body.ar-active #3dview {
    background: transparent !important;
    position: absolute !important;
    inset: 0 !important;
}

#container {
    position: fixed;
    inset: 0;
}

#arControls {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 100000;
}

#arControls button,
#arControls #ARButton {
    pointer-events: auto;
    position: relative;
    margin: auto;
    transform: none;
    padding: 14px 28px;
    border: 1px solid #00ff9d;
    border-radius: 12px;
    background: rgba(5, 15, 20, 0.92);
    color: #00ff9d;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.2);
}

#arControls button:active {
    background: #00ff9d;
    color: #050f14;
}

#ar-container {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    background: #000 !important;
    isolation: isolate;
    z-index: 9999;
}

#ar-camera-feed {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    z-index: 0 !important; /* Camera feed at the very back */
}

/* Ensure Three.js canvas is transparent and sits above the video */
#ar-container canvas {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 2 !important; /* 3D layer on top */
    pointer-events: none;
    background: transparent !important;
}