/* ============================================
   PXN Ventures – North West Portfolio Map
   Brand-aligned styles (Official Brand Guidelines)
   ============================================ */

:root {
    /* PXN Brand Guidelines – Official Palette */
    --plum: #180b2b;
    --lavender: #c9a0ff;
    --teal: #00a89e;
    --aqua: #b9f6e1;
    --pumpkin: #fc9160;
    --olive-green: #464336;
    --off-white: #f3f0ea;
    --charcoal: #0d0b0d;
    --white: #ffffff;

    /* Semantic tokens (light mode defaults) */
    --bg-primary: var(--off-white);
    --bg-surface: var(--white);
    --bg-header: var(--plum);
    --text-primary: var(--charcoal);
    --text-secondary: #555;
    --text-muted: #999;
    --border-color: #eee;
    --shadow-color: rgba(0, 0, 0, 0.12);

    --panel-width: 520px;
    --header-height: 56px;
    --stats-height: 60px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-pill: 9999px;
}

/* ======= DARK MODE ======= */
body.dark-mode {
    --bg-primary: #121212;
    --bg-surface: #1e1e1e;
    --bg-header: #0a0612;
    --text-primary: #e8e6ea;
    --text-secondary: #aaa;
    --text-muted: #777;
    --border-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --off-white: #2a2a2a;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.3px;
}

/* ======= SPLASH SCREEN ======= */
.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--lavender);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.8s ease;
}

.splash.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-logo {
    width: min(420px, 70vw);
    animation: splashIn 0.6s ease-out both;
}

@keyframes splashIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

/* ======= HEADER ======= */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-header);
    z-index: 100;
    display: flex;
    align-items: center;
}

.header-inner {
    width: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--white);
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.logo span {
    font-weight: 400;
    color: var(--lavender);
}

.tagline {
    color: var(--lavender);
    font-size: 0.85rem;
    opacity: 0.7;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.header-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ======= SEARCH ======= */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-pill);
    padding: 0 12px;
    height: 34px;
    width: 220px;
    transition: background 0.2s, width 0.3s;
}

.search-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.2);
    width: 280px;
}

.search-icon {
    color: var(--lavender);
    flex-shrink: 0;
    opacity: 0.7;
}

.search-input {
    background: none;
    border: none;
    outline: none;
    color: var(--white);
    font-family: inherit;
    font-size: 0.82rem;
    padding: 0 8px;
    width: 100%;
    letter-spacing: -0.2px;
}

.search-input::placeholder {
    color: rgba(201, 160, 255, 0.5);
}

.search-clear {
    background: none;
    border: none;
    color: var(--lavender);
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    display: none;
    line-height: 1;
}

.search-clear.visible {
    display: block;
}

/* Search results dropdown */
.search-results {
    position: fixed;
    top: var(--header-height);
    right: 60px;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-surface);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: 0 8px 30px var(--shadow-color);
    z-index: 99;
    display: none;
}

.search-results.open {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--off-white);
}

.search-result-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.search-result-meta {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.search-no-results {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ======= DARK MODE TOGGLE ======= */
.dark-mode-toggle {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--lavender);
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.dark-mode-toggle .icon-moon { display: none; }
body.dark-mode .dark-mode-toggle .icon-sun { display: none; }
body.dark-mode .dark-mode-toggle .icon-moon { display: block; }

/* ======= PARTNERSHIP STAMP ======= */
.partnership-stamp {
    position: fixed;
    bottom: calc(var(--stats-height) + 16px + 44px + 10px);
    left: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(24,11,43,0.92);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 8px 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    z-index: 45;
    border: 1px solid rgba(255,255,255,0.1);
}

.partnership-stamp img {
    height: 22px;
    object-fit: contain;
}

.stamp-x {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    line-height: 1;
}

/* ======= CTA BUTTON ======= */
.cta-button {
    position: fixed;
    bottom: calc(var(--stats-height) + 16px);
    left: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--lavender);
    color: var(--plum);
    border-radius: var(--radius-pill);
    text-decoration: none;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    box-shadow: 0 4px 20px rgba(201, 160, 255, 0.4);
    z-index: 45;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(201, 160, 255, 0.5);
    background: #d4b3ff;
}

.cta-button strong {
    font-weight: 800;
}

.cta-button svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.cta-text {
    white-space: nowrap;
}

/* ======= STATS BAR ======= */
.stats-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--stats-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 1.05rem;
    color: var(--text-secondary);
    letter-spacing: 0;
}

.stat-item strong {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.stat-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

/* ======= MAP ======= */
#map {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: var(--stats-height);
}

/* ======= MAP TOOLTIP (hover popup) ======= */
.map-tooltip .mapboxgl-popup-content {
    background: var(--plum);
    color: var(--white);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.map-tooltip .mapboxgl-popup-tip {
    border-top-color: var(--plum);
}

/* ======= PULSE ANIMATION (active marker) ======= */
@keyframes pulseRing {
    0% { opacity: 0.6; r: 22; }
    100% { opacity: 0; r: 40; }
}

/* ======= SIDE PANEL ======= */
.panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: var(--panel-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-surface);
    box-shadow: -4px 0 30px var(--shadow-color);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 50;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.panel.open {
    transform: translateX(0);
}

/* Scrollbar */
.panel::-webkit-scrollbar { width: 4px; }
.panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb { background: var(--lavender); border-radius: 4px; }

.panel-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(24, 11, 43, 0.75);
    backdrop-filter: blur(8px);
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 51;
    transition: background 0.2s, transform 0.2s;
    line-height: 1;
}

.panel-close:hover {
    background: var(--lavender);
    transform: scale(1.1);
}

/* Panel hero */
.panel-hero {
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.panel-hero-gradient {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: -1px;
    text-align: center;
    padding: 16px;
}

/* Company logo overlay on hero */
.panel-hero-logo {
    position: absolute;
    top: 14px;
    left: 14px;
    height: auto;
    width: auto;
    max-height: 32px;
    max-width: 40%;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.panel-hero img:not(.panel-hero-logo) {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Image carousel dots */
.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
}

.carousel-dot.active {
    background: var(--white);
}

/* Panel body */
#panel-content {
    flex: 1;
    overflow-y: auto;
}

.panel-body {
    padding: 24px;
}

.company-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--plum);
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 12px;
}

body.dark-mode .company-name {
    color: var(--lavender);
}

/* Founder section */
.founder-row {
    margin-bottom: 16px;
}

.founder-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.founder-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(201, 160, 255, 0.3);
}

.founder-card img {
    width: 100%;
    display: block;
}

.founder-card-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 14px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    color: #fff;
}

.founder-card-label .meta-label {
    color: rgba(255, 255, 255, 0.7);
    min-width: auto;
    margin-bottom: 2px;
    display: block;
}

.founder-card-label strong {
    color: #fff;
    font-size: 0.95rem;
}

/* Founder lightbox overlay */
.founder-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.founder-lightbox.open {
    opacity: 1;
    pointer-events: auto;
}

.founder-lightbox img {
    max-width: min(480px, 85vw);
    max-height: min(480px, 80vh);
    border-radius: var(--radius-md);
    object-fit: contain;
    border: 4px solid var(--lavender);
    box-shadow: 0 12px 60px rgba(201, 160, 255, 0.4);
    transform: scale(0.6);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.founder-lightbox.open img {
    transform: scale(1);
}

/* Badges */
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-stage {
    background: var(--off-white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* Meta info */
.meta-row {
    display: flex;
    align-items: baseline;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.meta-row strong {
    color: var(--text-primary);
}

.meta-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    min-width: 68px;
    margin-right: 6px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

.description {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Social links */
.social-links {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.social-link {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--off-white);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    border: 1px solid var(--border-color);
}

.social-link:hover {
    background: var(--lavender);
    color: var(--white);
    border-color: var(--lavender);
    transform: scale(1.1);
}

.social-link svg {
    width: 16px;
    height: 16px;
}

/* Links */
.links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--off-white);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 500;
    transition: background 0.2s, transform 0.15s;
    border: 1px solid transparent;
    line-height: 1.3;
}

.link-item:hover {
    background: #e8ddf5;
    border-color: var(--lavender);
    transform: translateX(2px);
}

body.dark-mode .link-item:hover {
    background: #2d1f45;
}

.link-icon {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
    color: white;
    font-weight: 700;
}

.link-label {
    flex: 1;
    min-width: 0;
}

.link-label small {
    display: block;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 400;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.gallery-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
}

.gallery-img:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px var(--shadow-color);
}

.gallery-img:only-child {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 9;
}

/* Video section (collapsible) */
.video-section {
    margin-bottom: 20px;
}

.video-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: var(--off-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.2s;
}

.video-toggle:hover {
    background: #e8ddf5;
}

body.dark-mode .video-toggle:hover {
    background: #2d1f45;
}

.video-toggle-icon {
    transition: transform 0.3s;
    flex-shrink: 0;
}

.video-toggle-icon.expanded {
    transform: rotate(180deg);
}

.video-toggle-count {
    margin-left: auto;
    background: var(--lavender);
    color: var(--plum);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
}

.video-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-list.expanded {
    max-height: 2000px;
}

.video-list .video-wrapper:first-child {
    margin-top: 12px;
}

.video-wrapper {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.video-wrapper iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    display: block;
}

/* ======= PANEL NAVIGATION (prev/next) ======= */
.panel-nav {
    display: flex;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-surface);
}

.panel-nav-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.panel-nav-btn:hover {
    background: var(--off-white);
    color: var(--text-primary);
}

.panel-nav-btn:first-child {
    border-right: 1px solid var(--border-color);
}

.panel-nav-btn svg {
    flex-shrink: 0;
}

/* ======= LEGEND ======= */
.legend {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    left: 16px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: 0 2px 16px var(--shadow-color);
    z-index: 40;
    min-width: 200px;
}

.legend-item span {
    white-space: nowrap;
}

.legend h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 3px 0;
    font-size: 0.84rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: opacity 0.2s;
    user-select: none;
}

.legend-item.dimmed {
    opacity: 0.3;
}

.legend-item:hover {
    opacity: 1;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.legend-item:hover .legend-color {
    transform: scale(1.3);
}

/* ======= MOBILE BOTTOM SHEET ======= */
@media (max-width: 768px) {
    :root {
        --panel-width: 100%;
        --header-height: 48px;
    }

    .tagline { display: none; }

    .search-wrapper {
        width: 140px;
    }

    .search-wrapper:focus-within {
        width: 180px;
    }

    .stats-bar {
        font-size: 0.65rem;
        gap: 8px;
        height: 36px;
        padding: 0 8px;
    }

    .stat-item strong {
        font-size: 0.68rem;
    }

    #map {
        bottom: 36px;
    }

    .search-results {
        right: 10px;
        left: 10px;
        width: auto;
    }

    .legend {
        top: calc(var(--header-height) + 10px);
        left: 10px;
        padding: 12px 16px;
    }

    .partnership-stamp {
        bottom: calc(36px + 48px + 8px);
        left: 10px;
        padding: 6px 10px;
        gap: 8px;
    }

    .partnership-stamp img {
        height: 18px;
    }

    .cta-button {
        bottom: calc(36px + 8px);
        left: 10px;
        right: auto;
        justify-content: center;
        font-size: 0.76rem;
        padding: 8px 14px;
    }

    .cta-text {
        white-space: normal;
        text-align: center;
    }

    /* Bottom sheet behavior */
    .panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 75vh;
        max-height: 75vh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        transform: translateY(100%);
        box-shadow: 0 -4px 30px var(--shadow-color);
    }

    .panel.open {
        transform: translateY(0);
    }

    /* Swipe handle */
    .panel::before {
        content: '';
        position: sticky;
        top: 0;
        display: block;
        width: 36px;
        height: 4px;
        background: var(--border-color);
        border-radius: 2px;
        margin: 10px auto 6px;
        z-index: 52;
        flex-shrink: 0;
    }

    .panel-close {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
    }

    .panel-body { padding: 20px; }
    .company-name { font-size: 1.2rem; }
}

/* ======= MARKER ENTRANCE ANIMATION ======= */
.mapboxgl-canvas-container.markers-entering {
    animation: markersReveal 0.8s ease-out both;
}

@keyframes markersReveal {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.mapboxgl-ctrl-logo {
    display: none !important;
}
