/* Custom Font Hierarchy for Address Map */

/* Font Face Definitions */
@font-face {
    font-family: 'GT Standard Condensed Light';
    src: url('../fonts/GT-Standard-L-Condensed-Light-Trial.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'GT Standard';
    src: url('../fonts/GT-Standard-L-Standard-Regular-Trial.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Tiempos Text';
    src: url('../fonts/TiemposTextWeb-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Departure Mono';
    src: url('../fonts/DepartureMono-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Font Hierarchy Application */

/* H1 - GT Standard Condensed Light */
h1, .h1,
.title-main,
.app-header .header-title .title-main,
.title-subtitle,
.landing-title,
.main-score-value,
.subscore-value {
    font-family: 'GT Standard Condensed Light', sans-serif !important;
    font-weight: 300;
}

/* H2 and H3 - GT Standard */
h2, .h2,
h3, .h3,
.panel-header h2,
.tract-header h3,
.index-section h4,
.demographic-section h4,
.places-section h4,
.ranking-section h4,
.subscore-label {
    font-family: 'GT Standard', sans-serif !important;
    font-weight: 400;
}

/* P and body text - Tiempos Text */
p, body,
.body-text,
.panel-content,
.demographic-item,
.percentile-explanation,
.tract-location,
.ranking-info,
.landing-intro {
    font-family: 'Tiempos Text', serif !important;
}

/* Misc tags - Departure Mono */
code, pre, kbd, samp,
.code, .mono,
#tract-id,
.tract-id,
.geoid,
button,
input,
select,
.control-btn,
.layer-option label,
.analysis-btn {
    font-family: 'Departure Mono', monospace !important;
}

/* Override Google Fonts if loaded */
* {
    font-family: inherit;
}

/* Ensure proper fallbacks */
body {
    font-family: 'Tiempos Text', serif, Georgia, 'Times New Roman', Times, serif;
}

/* Index Section - Percentile Score */
.index-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.index-section h4 {
    font-family: 'GT Standard Condensed Light', sans-serif !important;
    font-weight: 300;
    font-size: 1.5rem !important;
}

.main-score-value {
    font-size: 4rem !important;
    font-family: 'Departure Mono', monospace !important;
    font-weight: 400;
}

.percentile-explanation {
    font-family: 'GT Standard', sans-serif !important;
    font-weight: 400;
}

/* Subscores Section */
.subscores-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.subscore-label {
    font-family: 'GT Standard', sans-serif !important;
    font-weight: 400;
}

.subscore-value {
    font-size: 2rem !important;
    font-family: 'Departure Mono', monospace !important;
    font-weight: 400;
}

/* Demographic Section - Accordion Style */
.demographic-section {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.demographic-section h4.accordion-header {
    font-family: 'GT Standard Condensed Light', sans-serif !important;
    font-weight: 300 !important;
    font-size: 1.5rem !important;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e0e5ec;
    transition: color 0.2s ease;
}

.accordion-header:hover {
    color: #4361ee;
}

.accordion-icon {
    transition: transform 0.3s ease;
    font-size: 1rem;
    color: #666;
}

.accordion-icon-open {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-content.accordion-open {
    max-height: 500px;
}

.demographic-label,
.demo-label {
    font-family: 'GT Standard', sans-serif !important;
    font-weight: 400;
}

.demographic-value,
.demo-value {
    font-family: 'Departure Mono', monospace !important;
    font-weight: 400;
}

/* Panel Header Layout */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

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

.panel-header-content h2 {
    margin: 0;
}

/* Tract Number - Departure Mono */
.tract-number,
.tract-number span {
    font-family: 'Departure Mono', monospace !important;
    font-weight: 400 !important;
}

/* Density Category Badges */
.density-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'GT Standard', sans-serif !important;
    white-space: nowrap;
}

.density-badge.density-urban {
    background-color: #0066cc;
    color: white;
}

.density-badge.density-small-town {
    background-color: #2e7d32;
    color: white;
}

.density-badge.density-rural {
    background-color: #f57c00;
    color: white;
}

/* Address search specific */
.mapboxgl-ctrl-geocoder input {
    font-family: 'Departure Mono', monospace !important;
}

.address-search-container {
    font-family: 'Departure Mono', monospace !important;
}

/* Landing Screen Styles */
.landing-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow: visible;
}

/* Hide header and loading overlay on initial load */
.app-header.hidden-initially {
    display: none;
}

#loading-overlay {
    z-index: 999;
}

.landing-content {
    max-width: 600px;
    width: 90%;
    text-align: center;
    padding: 2rem;
    overflow: visible;
}

.landing-title {
    font-size: 3.5rem;
    margin: 0 0 1.5rem 0;
    color: #2c3e50;
    line-height: 1.2;
}

.landing-intro {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #34495e;
    margin: 0 0 2.5rem 0;
}

.landing-geocoder {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: visible;
    position: relative;
}

.landing-geocoder .mapboxgl-ctrl-geocoder {
    width: 100%;
    max-width: none;
    box-shadow: none;
    border: none;
    position: relative;
}

.landing-geocoder .mapboxgl-ctrl-geocoder input {
    font-size: 1.125rem;
    padding: 1.25rem 3.5rem 1.25rem 3.5rem;
    height: auto;
    border-radius: 12px;
}

.landing-geocoder .mapboxgl-ctrl-geocoder--icon-search {
    width: 24px;
    height: 24px;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Ensure suggestions dropdown is visible */
.landing-geocoder .suggestions {
    position: absolute;
    background: white;
    width: 100%;
    z-index: 1001;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: -12px;
}

.mapboxgl-ctrl-geocoder .suggestions {
    position: absolute !important;
    z-index: 1001 !important;
    background: white !important;
}

/* Desert Badge Section */
.desert-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    text-align: center;
    display: none; /* Hidden by default */
}

.desert-section.show-desert {
    display: block; /* Show when desert is tagged */
}

.desert-badge-display {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background-color: #ef4444;
    color: white;
    border-radius: 50px;
    font-family: 'GT Standard', sans-serif !important;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Children Quartile Section */
.children-quartile-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.children-quartile-section h4 {
    font-family: 'GT Standard Condensed Light', sans-serif !important;
    font-weight: 300;
    font-size: 1.5rem !important;
    margin-bottom: 1rem;
}

.quartile-container {
    position: relative;
    padding-top: 3.5rem;
}

.quartile-percentage {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Departure Mono', monospace !important;
    font-size: 1.2rem;
    font-weight: 400;
    color: #333;
    transition: left 0.3s ease;
}

.quartile-arrow {
    position: absolute;
    top: 1.8rem;
    font-size: 1.8rem;
    color: #333;
    transition: left 0.3s ease;
    transform: translateX(-50%);
    z-index: 10;
}

.quartile-boxes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
}

.quartile-box {
    height: 30px;
    transition: opacity 0.3s ease;
}

.quartile-box-1 {
    background-color: #b8d4c8;
}

.quartile-box-2 {
    background-color: #8bc4a8;
}

.quartile-box-3 {
    background-color: #5eb388;
}

.quartile-box-4 {
    background-color: #2e7d5a;
}

.quartile-labels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.quartile-label-item {
    text-align: center;
    font-family: 'GT Standard', sans-serif !important;
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
}

/* Places Chart Styling - Simple List Format */
.places-section {
    margin-bottom: 1.5rem !important;
    padding-bottom: 0 !important;
}

.places-section h4 {
    font-family: 'GT Standard Condensed Light', sans-serif !important;
    font-weight: 300;
    font-size: 1.5rem !important;
}

.places-chart {
    height: auto !important;
}

.places-breakdown {
    margin-top: 1rem;
}

/* Total section - at the top */
.place-total-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.place-total-label {
    font-weight: 400;
    color: #333;
    font-family: 'GT Standard', sans-serif !important;
}

.place-total-value {
    font-size: 1.2rem;
    font-weight: 400;
    color: #333;
    font-family: 'Departure Mono', monospace !important;
}

/* Category sections */
.place-category-section {
    margin-bottom: 1.5rem;
}

/* Main category items - same format as total */
.place-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.place-score-label {
    font-weight: 400;
    color: #333;
    font-family: 'GT Standard', sans-serif !important;
}

.place-score-value {
    font-size: 1.1rem;
    font-weight: 400;
    color: #333;
    font-family: 'Departure Mono', monospace !important;
}

/* Subcategory items - indented, smaller */
.place-subscore-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    margin-left: 1.5rem;
}

.place-subscore-label {
    font-size: 0.875rem;
    color: #666;
    font-weight: 400;
    font-family: 'GT Standard', sans-serif !important;
}

.place-subscore-value {
    font-size: 0.9rem;
    font-weight: 400;
    color: #555;
    font-family: 'Departure Mono', monospace !important;
}

/* Airport note */
.place-airport-note {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.place-airport-actual {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.25rem;
    font-family: 'Tiempos Text', serif !important;
}

.place-airport-explanation {
    font-size: 0.75rem;
    color: #999;
    font-style: italic;
    font-family: 'Tiempos Text', serif !important;
}

/* Explore Link */
.explore-link-container {
    margin-top: 1.5rem;
}

/* Analysis Panel Styling */
.analysis-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.analysis-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #4361ee;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Departure Mono', monospace;
    font-size: 0.875rem;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analysis-btn:hover {
    background: #3451d1;
}

.analysis-btn.secondary {
    background: #6c757d;
}

.analysis-btn.secondary:hover {
    background: #5a6268;
}

.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-family: 'GT Standard', sans-serif;
    font-size: 0.875rem;
    color: #333;
    font-weight: 500;
}

.filter-group select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Departure Mono', monospace;
    font-size: 0.875rem;
    background: white;
}

.range-slider-dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.range-slider-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.range-label {
    font-size: 0.75rem;
    color: #666;
    font-family: 'GT Standard', sans-serif;
}

.range-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4361ee;
    cursor: pointer;
}

.range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4361ee;
    cursor: pointer;
    border: none;
}

.filter-group label span {
    font-family: 'Departure Mono', monospace;
    color: #4361ee;
    font-weight: 600;
}

.explore-link {
    color: #34495e;
    text-decoration: none;
    font-family: 'Tiempos Text', serif;
    font-size: 1rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    display: inline-block;
    border-bottom: 1px solid rgba(52, 73, 94, 0.3);
    padding-bottom: 2px;
}

.explore-link:hover {
    opacity: 1;
    border-bottom-color: rgba(52, 73, 94, 0.6);
}

@media (max-width: 768px) {
    .landing-title {
        font-size: 2.5rem;
    }

    .landing-intro {
        font-size: 1.125rem;
    }
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1;
    min-width: 200px;
}

.legend-title {
    font-family: 'GT Standard', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #2c3e50;
}

.legend-categories {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-category {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.category-name {
    font-family: 'GT Standard', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: #2c3e50;
}

.category-scale {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 16px;
}

.scale-gradient {
    height: 8px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.1);
    display: block;
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    font-family: 'Departure Mono', monospace;
    font-size: 0.65rem;
    color: #7f8c8d;
}

.legend-description {
    margin: 12px 0 0 0;
    font-family: 'GT Standard', sans-serif;
    font-size: 0.7rem;
    color: #7f8c8d;
    line-height: 1.3;
}

/* Info Button */
.info-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    color: #2c3e50;
    font-size: 20px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.info-button:hover {
    background: #f8f9fa;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .map-legend {
        bottom: 10px;
        right: 10px;
        padding: 12px;
        min-width: 170px;
    }

    .legend-title {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .category-name {
        font-size: 0.7rem;
    }

    .scale-labels {
        font-size: 0.6rem;
    }

    .legend-description {
        font-size: 0.65rem;
    }

    .info-button {
        bottom: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}
