/* ============================================================
   Streetary stylesheet
   Externalizado en Sprint 8.1 (auditoría 2026-05-15 §UX-MEDIO).
   Servido con Cache-Control: public, immutable, max-age=1y.
   ============================================================ */

/* Variables — duplicadas en critical inline en base.html para FCP */
:root {
    --primary: #1a365d;
    --primary-light: #2b6cb0;
    --accent: #38a169;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --text: #2d3748;
    /* WCAG AA: --text-light passes 4.5:1 against white only. */
    --text-light: #4a5568;
    --text-muted: #4a5568;
    --on-primary-soft: #cbd5e0;
    --border: #cbd5e0;
    --score-high: #38a169;
    --score-medium: #d69e2e;
    --score-low: #e53e3e;
}

/* Resets / focus already in critical inline */

/* Layout / typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}
a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* Header / nav */
header {
    background: var(--primary);
    color: white;
    padding: 0.75rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
header .container { display: flex; align-items: center; justify-content: space-between; }
header a { color: white; }
.logo { font-size: 1.25rem; font-weight: 700; }
nav a { margin-left: 1.5rem; font-size: 0.9rem; }

/* Breadcrumb */
.breadcrumb {
    padding: 0.5rem 0;
    font-size: 0.85rem;
    color: #2d3748;
}
.breadcrumb a { color: #2b6cb0; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 0.3rem; color: #4a5568; }

/* Card */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card h2 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

/* Score badges */
.score-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}
.score-high { background: #c6f6d5; color: #22543d; }
.score-medium { background: #fefcbf; color: #744210; }
.score-low { background: #fed7d7; color: #742a2a; }

/* Grid */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

/* Stat */
.stat {
    text-align: center;
    padding: 1rem;
}
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Score bar */
.score-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}
.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

/* Tag */
.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: #edf2f7;
    border-radius: 4px;
    font-size: 0.8rem;
    margin: 0.15rem;
}

/* Footer */
footer {
    margin-top: 3rem;
    padding: 2rem 0;
    background: var(--primary);
    color: #cbd5e0;
    font-size: 0.85rem;
}
footer a { color: #90cdf4; }
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}
.footer-grid h4 { color: white; margin-bottom: 0.5rem; }

/* ── Search UI (shared across home + /search/) ─────────── */
.search-hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.search-hero h1 { font-size: 1.75rem; color: var(--primary); margin-bottom: 0.5rem; }
.search-hero p { color: var(--text-light); font-size: 1rem; margin-bottom: 1.5rem; }
.search-box {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
}
.search-box input {
    width: 100%;
    padding: 0.9rem 1.25rem;
    font-size: 1.1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    background: var(--card-bg);
    color: var(--text);
}
.search-box input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}
.search-box input::placeholder { color: var(--text-light); }
#search-status {
    text-align: center;
    padding: 0.5rem 0 0;
    color: var(--text-light);
    font-size: 0.9rem;
    min-height: 1.5rem;
}
.search-results-wrapper {
    max-width: 640px;
    margin: 0 auto;
    padding-bottom: 2rem;
}
.search-result-list { list-style: none; padding: 0; margin: 0; }
.search-result-item a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    transition: background 0.15s;
}
.search-result-item a:hover { background: #edf2f7; text-decoration: none; }
.search-result-name { font-weight: 500; font-size: 0.95rem; }
.search-result-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.search-result-meta .score-badge {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    min-width: 2rem;
    text-align: center;
}
.search-result-district a { background: #f7fafc; }
.search-section-title {
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1rem 0.25rem;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    header .container { flex-wrap: wrap; }
    nav { width: 100%; display: flex; justify-content: center; gap: 0; margin-top: 0.4rem; }
    nav a { margin-left: 0; padding: 0.25rem 0.6rem; font-size: 0.8rem; }
    .search-hero { padding: 1.5rem 0 1rem; }
    .search-hero h1 { font-size: 1.35rem; }
    .search-box input { font-size: 1rem; padding: 0.75rem 1rem; }
    .search-result-item a { padding: 0.6rem 0.75rem; }
}
