/* The cityscape gallery and the pricing analytics dashboard. Values come from tokens.css. */

/* Gallery hero */
.gallery-page {
    padding-bottom: 5rem;
}

.gallery-hero {
    background-color: var(--color-bg);
    background-image: var(--hero-light-gradient);
    padding: var(--space-8) 0;
    border-bottom: 1px solid var(--color-border);
}

.gallery-hero::before {
    display: none;
}

.gallery-badges {
    justify-content: center;
    margin-bottom: var(--space-4);
}

.gallery-badge-amber {
    background: var(--amber-50);
    color: var(--amber-600);
    border-color: var(--amber-100);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.gallery-badge-glass {
    background: var(--slate-100);
    color: var(--slate-600);
    border-color: var(--slate-300);
    font-weight: 500;
}

.gallery-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-navy);
}

.gallery-hero .lede {
    max-width: 820px;
    margin-bottom: var(--space-6);
    color: var(--color-text-2);
}

.gallery-stats {
    display: inline-flex;
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-xl);
    padding: var(--space-3) var(--space-6);
    gap: var(--space-5);
    flex-wrap: wrap;
    justify-content: center;
}

.gallery-stats > div {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-stats .value {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.2;
}

.gallery-stats .label {
    font-size: var(--text-xs);
    color: var(--color-text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.gallery-stats .divider {
    width: 1px;
    height: 32px;
    background-color: var(--color-border);
}

/* Toolbar */
.gallery-main {
    padding-top: 2rem;
}

.gallery-toolbar {
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-xl);
}

.gallery-controls {
    gap: 12px;
}

.gallery-search {
    position: relative;
    flex: 1 1 280px;
    min-width: min(100%, 240px);
    display: flex;
    align-items: center;
    color: var(--slate-600);
}

.gallery-search .icon {
    position: absolute;
    left: 12px;
    pointer-events: none;
}

.gallery-search input {
    padding: 10px 38px;
    border-radius: 10px;
    background-color: var(--slate-50);
    font-size: 0.92rem;
}

.gallery-search button {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--slate-600);
    padding: 4px;
    display: flex;
}

.gallery-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.85rem;
    color: var(--slate-600);
}

.gallery-control select {
    width: auto;
    padding: 9px 36px 9px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    background-position: right 12px center;
}

.gallery-views {
    gap: 6px;
    margin-left: auto;
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 500;
    border: 1px solid var(--slate-300);
    background: #fff;
    color: var(--slate-600);
    transition: all 0.15s ease;
}

.view-btn.is-active {
    background: var(--color-navy);
    color: #fff;
    border-color: var(--color-navy);
    font-weight: 600;
}

.gallery-status {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--slate-100);
}

.gallery-filtered {
    color: var(--slate-600);
    font-style: italic;
}

.link-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.84rem;
    text-decoration: underline;
    padding: 0;
}

.gallery-empty {
    padding: 4rem 2rem;
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
}

.gallery-empty-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--slate-800);
    margin-bottom: 0.5rem;
}

.gallery-empty .muted {
    margin-bottom: 1.5rem;
}

/* One grid, three layouts */
.gallery-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}

.gallery-table-head {
    display: none;
}

.cityscape {
    background-color: #fff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cityscape:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.18), 0 4px 10px -2px rgba(15, 23, 42, 0.08);
    border-color: var(--slate-400);
}

.cityscape-photo {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background-color: var(--slate-900);
    cursor: pointer;
    border: none;
    padding: 0;
    display: block;
    width: 100%;
    text-align: left;
}

.cityscape-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
    display: block;
}

.cityscape:hover .cityscape-photo img {
    transform: scale(1.04);
}

.cityscape-expand {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    color: #fff;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cityscape-state {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(74, 107, 94, 0.88);
    backdrop-filter: blur(6px);
    color: #fff;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.cityscape-overlay {
    display: none;
}

.cityscape-body {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
    gap: 12px;
}

.cityscape-head h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--slate-800);
    line-height: 1.25;
}

.cityscape-meta .badge {
    background: var(--slate-100);
    border: none;
    color: var(--color-navy);
    font-size: 0.8rem;
    padding: 4px 10px;
}

.cityscape-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.cityscape-actions .btn-ghost {
    flex: 1;
}

/* Compact thumbnail wall */
.gallery-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
    gap: 14px;
}

.gallery-grid.compact .cityscape {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.gallery-grid.compact .cityscape-body,
.gallery-grid.compact .cityscape-expand,
.gallery-grid.compact .cityscape-state {
    display: none;
}

.gallery-grid.compact .cityscape-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(15, 23, 42, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 8px 10px;
    color: #fff;
}

.gallery-grid.compact .cityscape-overlay strong {
    font-size: 0.95rem;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.gallery-grid.compact .cityscape-overlay small {
    font-size: 0.72rem;
    color: var(--slate-300);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    margin-top: 2px;
}

.gallery-grid.compact .cityscape:hover .cityscape-photo img {
    transform: scale(1.08);
    opacity: 0.88;
}

/* Table rows */
.gallery-grid.table {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.gallery-grid.table .gallery-table-head,
.gallery-grid.table .cityscape {
    display: grid;
    grid-template-columns: 100px 1.4fr 1fr 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
}

.gallery-grid.table .gallery-table-head {
    background-color: var(--slate-50);
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--slate-500);
    order: -1;
}

.gallery-grid.table .gallery-table-head .right {
    text-align: right;
}

.gallery-grid.table .cityscape {
    border: none;
    border-bottom: 1px solid var(--slate-100);
    border-radius: 0;
    box-shadow: none;
}

.gallery-grid.table .cityscape:hover {
    transform: none;
    background-color: var(--slate-100);
    box-shadow: none;
}

.gallery-grid.table .cityscape-photo {
    width: 80px;
    height: 50px;
    aspect-ratio: auto;
    border-radius: 6px;
}

.gallery-grid.table .cityscape-expand,
.gallery-grid.table .cityscape-state {
    display: none;
}

.gallery-grid.table .cityscape-body {
    display: contents;
}

.gallery-grid.table .cityscape-head {
    display: contents;
}

.gallery-grid.table .cityscape-head h3 {
    font-size: 0.95rem;
}

.gallery-grid.table .cityscape-statename {
    background: var(--slate-100);
    color: var(--slate-600);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    justify-self: start;
}

.gallery-grid.table .cityscape-actions {
    justify-content: flex-end;
    margin: 0;
}

.gallery-grid.table .cityscape-actions .btn-ghost {
    flex: 0 0 auto;
}

@media (max-width: 768px) {
    .gallery-grid.table .gallery-table-head {
        display: none;
    }

    .gallery-grid.table .cityscape {
        grid-template-columns: 80px 1fr;
    }

    .gallery-grid.table .cityscape-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .gallery-views {
        margin-left: 0;
    }
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.lightbox-dialog {
    background-color: #fff;
    border-radius: 18px;
    max-width: 1080px;
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
}

.lightbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--slate-50);
    gap: 1rem;
}

.lightbox-head h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--slate-900);
}

.lightbox-close {
    background: none;
    border: none;
    color: var(--slate-700);
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lightbox-stage {
    position: relative;
    background-color: #090d16;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    max-height: 62vh;
    overflow: hidden;
}

.lightbox-stage img {
    max-width: 100%;
    max-height: 62vh;
    object-fit: contain;
    display: block;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lightbox-nav.prev {
    left: 16px;
}

.lightbox-nav.next {
    right: 16px;
}

.lightbox-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
    gap: 12px;
}

.lightbox-foot code {
    background-color: var(--slate-100);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--slate-700);
    font-family: var(--font-mono);
}

/* Dashboard */
.dash {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem 1.5rem 5rem;
    color: var(--slate-800);
}

.dash-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.dash-head-left {
    flex: 1 1 600px;
}

.dash-badges {
    margin-bottom: 0.75rem;
    gap: 8px;
}

.dash-head h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--slate-900);
    margin-bottom: 0.5rem;
}

.dash-head p {
    max-width: 800px;
}

.small-dot {
    width: 6px;
    height: 6px;
    box-shadow: none;
    background-color: #16a34a;
}

.dash-kpis {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    margin-bottom: 2rem;
}

.dash-kpis .value {
    font-size: 2.1rem;
    color: var(--slate-900);
}

.dash-controls {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
}

.dash-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 240px;
    margin: 0;
    font-size: 0.9rem;
}

.dash-control > span {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--slate-700);
}

.dash-control select {
    font-size: 0.9rem;
    padding: 9px 36px 9px 12px;
}

.dash-control .btn {
    align-self: flex-start;
}

.dash-control input[type="search"] {
    font-size: 0.9rem;
    padding: 9px 12px;
}

.tier-pills,
.map-mode {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.map-mode {
    margin-bottom: 0.75rem;
}

.tier-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background-color: #fff;
    color: var(--slate-700);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tier-pill:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.tier-pill.is-active {
    background-color: var(--color-navy);
    border-color: var(--color-navy);
    color: #fff;
}

.dash-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--color-border);
}

.dash-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--slate-500);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: -2px;
    white-space: nowrap;
}

.dash-tab.is-active {
    border-bottom-color: var(--color-navy);
    color: var(--color-navy);
    font-weight: 700;
}

.dash-panel {
    border-radius: var(--radius-xl);
}

.dash-panel-head {
    margin-bottom: 1.25rem;
    align-items: flex-start;
}

.dash-panel-head h2 {
    font-size: 1.3rem;
    color: var(--slate-900);
    margin-bottom: 0.25rem;
}

.dash-map {
    position: relative;
    background: #fff;
    border: 1px solid var(--color-border);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.dash-map provider-map {
    border-radius: 0;
}

.map-legend {
    position: absolute;
    bottom: 24px;
    left: 24px;
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--slate-300);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    font-size: 0.82rem;
    color: var(--slate-800);
}

.map-legend strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--slate-900);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.legend-foot {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--color-border);
    font-size: 0.75rem;
    color: var(--slate-500);
    font-weight: 600;
}

/* Price tiers: fills for dots and bars, text colours for figures */
.tier-under1k { background-color: #10b981; }
.tier-1k-1-4k { background-color: #3b82f6; }
.tier-1-4k-1-8k { background-color: #f59e0b; }
.tier-1-8k-2-5k { background-color: #f97316; }
.tier-2-5k-plus { background-color: #ef4444; }
.tier-under1k-text,
.stat .value.tier-under1k-text { color: #047857; }
.tier-1-4k-text,
.stat .value.tier-1-4k-text { color: #b45309; }
.tier-2-5k-text,
.stat .value.tier-2-5k-text { color: #b91c1c; }

/* Rankings grid-table */
.rank-table {
    overflow-x: auto;
    font-size: 0.9rem;
}

.rank-head,
.rank-row {
    display: grid;
    grid-template-columns: 60px 1.6fr 0.8fr 1fr 1fr 1fr 1fr 1fr 1fr;
    align-items: center;
    gap: 8px;
    min-width: 900px;
    padding: 12px 14px;
}

.rank-head {
    background-color: var(--slate-50);
    border-bottom: 2px solid var(--color-border);
    color: var(--slate-600);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rank-head button {
    background: none;
    border: none;
    text-align: left;
    font: inherit;
    color: inherit;
    padding: 0;
    text-transform: inherit;
    letter-spacing: inherit;
}

.rank-row {
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-700);
}

.rank-row.is-active {
    background-color: var(--green-50);
}

.rank-num {
    font-weight: 700;
    color: var(--slate-500);
}

.rank-state a {
    color: var(--slate-900);
}

/* Histogram */
.histogram {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 320px;
    padding-bottom: 2.5rem;
    border-bottom: 2px solid var(--color-border);
    overflow-x: auto;
    margin-top: 1rem;
}

.bar-col {
    flex: 1 1 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    min-width: 60px;
}

.bar-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--slate-900);
}

.bar-track {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: flex-end;
}

.bar-fill {
    width: 100%;
    border-radius: 6px 6px 0 0;
}

.bar-label {
    margin-top: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--slate-600);
    text-align: center;
    white-space: nowrap;
}

.histogram-analysis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 1.25rem;
    margin-top: 2rem;
    background-color: var(--slate-50);
    padding: 1.25rem;
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--slate-700);
    line-height: 1.5;
}

/* Metros */
.metro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.metro-card {
    background-color: var(--slate-50);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metro-card h3 {
    font-size: 1.15rem;
    color: var(--slate-900);
}

.metro-range {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.metro-range > div {
    display: flex;
    flex-direction: column;
}

.metro-range .label {
    font-size: 0.72rem;
    color: var(--slate-500);
    text-transform: uppercase;
}

.metro-range .tier-under1k-text,
.metro-range .tier-2-5k-text {
    font-size: 1.15rem;
    font-weight: 800;
}

/* Coverage & Freshness Diagnostics tab */
.coverage-kpis {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    margin-bottom: 1.5rem;
}

.coverage-link {
    color: var(--color-primary);
    font-weight: 700;
    text-decoration: underline;
}

.coverage-table {
    overflow-x: auto;
    font-size: 0.88rem;
}

.coverage-head,
.coverage-row {
    display: grid;
    grid-template-columns: 1.4fr 0.6fr 1.1fr 1.1fr 0.9fr 0.65fr 1.8fr;
    align-items: center;
    gap: 10px;
    min-width: 920px;
    padding: 11px 14px;
}

.coverage-head {
    background-color: var(--slate-50);
    border-bottom: 2px solid var(--color-border);
    color: var(--slate-600);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.coverage-row {
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-700);
}

.coverage-meter {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.coverage-bar {
    height: 7px;
    border-radius: var(--radius-pill);
    background: var(--slate-100);
    overflow: hidden;
}

.coverage-bar-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
}

.coverage-bar-fill.is-gpl {
    background: var(--sky-600);
}

.coverage-queues {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.coverage-queues a.badge {
    text-decoration: none;
}

.coverage-queues a.badge:hover {
    filter: brightness(0.95);
}

@media print {
    .dash-tabs,
    .dash-controls,
    .map-legend {
        display: none;
    }
}
