/*
 * Style sheet modeled on ~/src/kurapa/test/gabon-cultural-graph (Tailwind +
 * index.css). Tailwind utilities used by that project are translated here as
 * vanilla CSS so we keep a no-build PHP/JS stack. Colors and spacings mirror
 * Tailwind's defaults so the visual feel matches.
 */

:root {
    color-scheme: dark;
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --bg:           #0a0a1a;
    --bg-panel:     rgba(15, 15, 35, 0.9);
    --fg:           #e0e0e0;
    --white-90:     rgba(255, 255, 255, 0.9);
    --gray-300:     #d1d5db;
    --gray-400:     #9ca3af;
    --gray-500:     #6b7280;
    --border-5:     rgba(255, 255, 255, 0.05);
    --border-10:    rgba(255, 255, 255, 0.1);
    --bg-white-5:   rgba(255, 255, 255, 0.05);
    --bg-white-10:  rgba(255, 255, 255, 0.1);
    --accent:       #ff7ab6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* === App shell — map + persistent side panel ============================ */

.map-app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

@media (min-width: 768px) {
    .map-app { flex-direction: row; }
}

.globe-area {
    flex: 1;
    position: relative;
    min-height: 50vh;
}

@media (min-width: 768px) {
    .globe-area { min-height: 100%; }
}

.globe {
    width: 100%;
    height: 100%;
    background: #05060f;
}

/* Title overlay sits inside the globe area, top-left. */
.title-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    pointer-events: none;
    z-index: 5;
}

.title-overlay h1 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--white-90);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
    letter-spacing: -0.005em;
}

@media (min-width: 768px) {
    .title-overlay h1 { font-size: 1.25rem; }
}

.title-overlay .subtitle {
    font-size: 0.75rem;
    color: var(--gray-400);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
}

/* === Side panel ========================================================= */

.side-panel {
    width: 100%;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-5);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    max-height: 50vh;
}

@media (min-width: 768px) {
    .side-panel {
        width: 340px;
        max-height: 100%;
        border-top: 0;
        border-left: 1px solid var(--border-5);
    }
}

@media (min-width: 1024px) {
    .side-panel { width: 380px; }
}

/* Tabs */

.tab-bar {
    display: flex;
    border-bottom: 1px solid var(--border-10);
    flex-shrink: 0;
}

.tab {
    flex: 1;
    padding: 0.7rem 0.5rem;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--gray-400);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: color 150ms, border-color 150ms;
    margin-bottom: -1px;
    text-align: center;
}

.tab:hover { color: var(--gray-300); }

.tab.is-active {
    color: #fff;
    border-bottom-color: var(--accent);
}

.panel-pane {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.panel-section {
    padding: 1rem;
    border-bottom: 1px solid var(--border-10);
}

.panel-section:last-child { border-bottom: 0; }

.panel-section-label {
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
}

/* Controls */

.panel-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin-bottom: -0.1rem;
}

.select-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-white-5);
    border: 1px solid var(--border-10);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #fff;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--gray-400) 50%),
                      linear-gradient(135deg, var(--gray-400) 50%, transparent 50%);
    background-position: calc(100% - 0.95rem) 50%, calc(100% - 0.65rem) 50%;
    background-size: 0.3rem 0.3rem, 0.3rem 0.3rem;
    background-repeat: no-repeat;
    padding-right: 1.75rem;
    outline: none;
    transition: border-color 150ms;
}

.select-input:focus { border-color: rgba(255, 255, 255, 0.3); }
.select-input option { background: var(--bg-panel); color: #fff; }

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-white-5);
    border: 1px solid var(--border-10);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #fff;
    outline: none;
    transition: border-color 150ms;
}

.search-input::placeholder { color: var(--gray-500); }
.search-input:focus { border-color: rgba(255, 255, 255, 0.3); }

.ghost-btn {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-white-5);
    border: 1px solid var(--border-10);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-300);
    transition: background-color 150ms;
}

.ghost-btn:hover { background: var(--bg-white-10); }

/* Legend */

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--gray-300);
    transition: color 150ms;
    user-select: none;
}

.legend-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.legend-item:hover { color: #fff; }

.legend-swatch {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 0.125rem;
    border: 1px solid currentColor;
    flex-shrink: 0;
    transition: background-color 150ms, opacity 150ms;
}

.legend-item.is-on .legend-swatch  { background: currentColor; }
.legend-item.is-off                { opacity: 0.5; }
.legend-item.is-off .legend-swatch { background: transparent; opacity: 0.4; }

.legend-count {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}

/* Info panel */

.panel-info {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.info-empty h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1rem;
}

.info-stats {
    font-size: 0.875rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
    line-height: 1.625;
}

.info-hint {
    font-size: 0.875rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
    line-height: 1.625;
}

.info-detail h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    padding-right: 1rem;
}

.type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 1rem;
    letter-spacing: 0.01em;
}

.detail-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-10);
}

.detail-grid dt {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    align-self: start;
    padding-top: 0.05rem;
}

.detail-grid dd { color: #fff; word-break: break-word; }
.detail-grid dd a { color: var(--accent); }
.detail-grid dd a:hover { text-decoration: underline; }

.info-osm-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-white-10);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #fff;
    transition: background-color 150ms;
}

.info-osm-link:hover { background: rgba(255, 255, 255, 0.18); }

/* Embedded Google Maps for the selected point + fullscreen toggle. */
.info-map {
    position: relative;
    width: 100%;
    height: 220px;
    margin: 1rem 0 0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-10);
}

.info-map .map-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.map-expand {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2.1rem;
    height: 2.1rem;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.3rem;
    color: #fff;
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background-color 150ms;
}

.map-expand:hover { background: rgba(0, 0, 0, 0.88); }

.info-map:fullscreen,
.info-map:-webkit-full-screen {
    border-radius: 0;
    border: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
}

.info-map:fullscreen .map-frame,
.info-map:-webkit-full-screen .map-frame {
    width: 100%;
    height: 100%;
}

.info-map:fullscreen .map-expand,
.info-map:-webkit-full-screen .map-expand {
    top: 1rem;
    right: 1rem;
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.2rem;
}

/* Data tab — source cards */

.source-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.source {
    padding: 0;
}

.source-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.source-description {
    font-size: 0.8rem;
    color: var(--gray-300);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.source-attribution {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.panel-btn {
    display: inline-block;
    padding: 0.45rem 0.8rem;
    background: var(--accent);
    color: #1a0816;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.panel-btn:hover { background: #ff95c5; }

.panel-link {
    color: var(--accent);
    font-size: 0.8rem;
}

.panel-link:hover { text-decoration: underline; }

/* Team tab — member list */

.team-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.team-member {
    padding: 0.75rem 0.85rem;
    background: var(--bg-white-5);
    border: 1px solid var(--border-10);
    border-radius: 0.5rem;
}

.member-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.2rem;
}

.member-role {
    font-size: 0.75rem;
    color: var(--gray-300);
    margin-bottom: 0.15rem;
}

.member-affiliation {
    font-size: 0.7rem;
    color: var(--gray-500);
}

/* About tab */

.about-text {
    font-size: 0.85rem;
    color: var(--gray-300);
    line-height: 1.625;
    margin-bottom: 0.75rem;
}

.about-meta {
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.about-attribution {
    font-size: 0.7rem;
    color: var(--gray-500);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-10);
}

/* === Globe.gl tooltip ==================================================== */

.globe-tooltip {
    background: rgba(20, 24, 36, 0.92);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    line-height: 1.4;
    max-width: 280px;
    pointer-events: none;
}

.globe-tooltip-rich {
    display: block;
    max-width: 340px;
    padding: 0.85rem 1rem;
    background: rgba(15, 15, 35, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    line-height: 1.45;
    color: #fff;
    font-size: 0.8rem;
}

.globe-tooltip-rich .tt-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
}

.globe-tooltip-rich .tt-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.65rem;
    letter-spacing: 0.02em;
}

.globe-tooltip-rich .tt-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
    align-items: flex-start;
    line-height: 1.4;
}

.globe-tooltip-rich .tt-key {
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.62rem;
    min-width: 4.5rem;
    padding-top: 0.1rem;
}

.globe-tooltip-rich .tt-val {
    color: rgba(255, 255, 255, 0.92);
    word-break: break-word;
    flex: 1;
}

.globe-error {
    color: #f87171;
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
}
