/* ============================================================
   State Dashboards - site-specific overlays
   Loaded after css/styles.css; small footprint, only the bits
   that the parent (Hawaii) stylesheet doesn't already cover.
   ============================================================ */

/* Inline state selector: the state name in the H1 is the dropdown trigger.
   No chip chrome — reads as part of the title with a small caret. */
.state-selector-wrap {
    position: relative;
    display: inline-block;
}
.header-state-trigger {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: var(--hawaii-blue, #0D7C8F);
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 0.25em;
    line-height: inherit;
}
.header-state-trigger:hover,
.header-state-trigger:focus-visible {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    outline: none;
}
.header-state-trigger .state-selector-label {
    color: inherit;
}
.header-state-trigger .state-selector-caret {
    width: 0.6em;
    height: 0.6em;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.header-state-trigger[aria-expanded="true"] .state-selector-caret {
    transform: rotate(180deg);
}
.state-selector-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border, #d4d4d4);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    min-width: 18rem;
    max-height: 70vh;
    overflow-y: auto;
    font-size: 0.95rem;
    font-weight: 400;
}
.state-selector-item {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.95rem;
    cursor: pointer;
}
.state-selector-item:hover {
    background: #f3f6f7;
}
.state-selector-item.active {
    color: var(--hawaii-blue, #0D7C8F);
    font-weight: 600;
}
.state-selector-code {
    color: var(--text-muted, #777);
    font-size: 0.8rem;
    font-weight: 500;
    min-width: 1.6rem;
    font-variant-numeric: tabular-nums;
}
.state-selector-item.active .state-selector-code {
    color: var(--hawaii-blue, #0D7C8F);
}
.state-selector-name {
    flex: 1;
}

@media (max-width: 700px) {
    .state-selector-dropdown {
        min-width: min(20rem, calc(100vw - 2rem));
    }
}

/* Per-metric landing pages (/{state}/c/{metric}/). Lightweight, no-JS
   crawler-friendly layout. Inherits typography from styles.css. */
.cp-body { background: var(--bg, #f5f7f8); }
.cp-main {
    max-width: 48rem;
    margin: 1.25rem auto 4rem;
    padding: 0 1.5rem;
    color: var(--text, #252f37);
    line-height: 1.55;
}
.cp-eyebrow {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--hawaii-blue, #0D7C8F);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 0.5rem;
}
.cp-h1 {
    font-size: 2.1rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text, #252f37);
    line-height: 1.2;
}
.cp-officialName {
    font-size: 1rem;
    color: var(--text-muted, #6e7a84);
    margin: 0 0 1.5rem;
}
.cp-hero {
    margin: 1.5rem 0 0.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}
.cp-hero-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text, #252f37);
}
.cp-hero-year {
    font-size: 1.1rem;
    color: var(--text-muted, #6e7a84);
}
.cp-rank {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    display: inline-block;
}
.cp-rank.rank-good { background: rgba(5, 150, 105, 0.12);  color: #046b4a; }
.cp-rank.rank-mid  { background: rgba(110, 122, 132, 0.10);  color: #555; }  /* middle tier = informational metadata */
.cp-rank.rank-bad  { background: rgba(192, 57, 43, 0.12); color: #a82d1f; }
.cp-vs-median { margin: 0.25rem 0 1.5rem; color: var(--text, #252f37); }
.cp-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 1.5rem 0 2rem;
}
.cp-cta-link {
    color: var(--hawaii-blue, #0D7C8F);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid var(--hawaii-blue, #0D7C8F);
    padding-bottom: 2px;
}
.cp-cta-link.cp-cta-secondary {
    color: var(--text-muted, #6e7a84);
    border-bottom-color: var(--text-muted, #6e7a84);
    font-weight: 500;
}
.cp-cta-link:hover { opacity: 0.85; }
.cp-h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
}
.cp-h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.5rem 0;
    color: var(--text-muted, #6e7a84);
}
.cp-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 1rem;
    font-size: 0.95rem;
}
.cp-table th, .cp-table td {
    text-align: left;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid #e8ecee;
}
.cp-table th { color: var(--text-muted, #6e7a84); font-weight: 600; font-size: 0.85rem; }
.cp-peer-me { background: rgba(13, 124, 143, 0.08); font-weight: 600; }
.cp-peers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.cp-related { list-style: none; padding: 0; margin: 0.5rem 0 2rem; }
.cp-related li { padding: 0.4rem 0; border-bottom: 1px solid #e8ecee; }
.cp-related a {
    color: var(--hawaii-blue, #0D7C8F);
    text-decoration: none;
    font-weight: 500;
}
.cp-related a:hover { text-decoration: underline; }
.cp-back { margin-top: 2.5rem; }
.cp-back a {
    color: var(--text-muted, #6e7a84);
    text-decoration: none;
    font-size: 0.95rem;
}

.cp-spark {
    width: 100%;
    height: 120px;
    margin: 1.5rem 0 0.25rem;
    display: block;
}
.cp-spark-caption {
    font-size: 0.85rem;
    color: var(--text-muted, #6e7a84);
    margin: 0 0 1rem;
}
.cp-spark-caption a {
    color: var(--hawaii-blue, #0D7C8F);
    text-decoration: none;
}
.cp-spark-caption a:hover { text-decoration: underline; }

.cp-table td.rank-good { color: #046b4a; font-weight: 600; }
.cp-table td.rank-mid  { color: #555; font-weight: 500; }
.cp-table td.rank-bad  { color: #a82d1f; font-weight: 600; }

@media (max-width: 600px) {
    .cp-peers { grid-template-columns: 1fr; }
    .cp-hero-value { font-size: 2.4rem; }
    .cp-h1 { font-size: 1.65rem; }
}
