:root {
    --blue: #005596;
    --blue-dark: #003f73;
    --ink: #17233a;
    --muted: #667792;
    --line: #d8e3ed;
    --soft: #f3f7fb;
    --orange: #ff6b16;
    color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: #eef3f8;
    color: var(--ink);
    font-family: "Plus Jakarta Sans", Arial, sans-serif;
}

button, select { font: inherit; }

.site-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--soft);
}

.site-nav-links { display: flex; gap: 7px; }
.site-nav-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #52647e;
    font-family: Montserrat, Arial, sans-serif;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
}
.site-nav-links a:hover { border-color: var(--line); background: #fff; color: var(--blue); }
.site-nav-links a.active { border-color: var(--blue); background: var(--blue); color: #fff; }
.partner-mark img { display: block; width: auto; height: 30px; max-width: 190px; }

.preview-shell {
    width: min(1380px, calc(100% - 36px));
    margin: 28px auto;
    padding: clamp(20px, 3vw, 38px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(28, 61, 91, 0.09);
}

.preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--blue);
    font-family: Montserrat, Arial, sans-serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    color: var(--blue-dark);
    font-family: Montserrat, Arial, sans-serif;
    font-size: clamp(28px, 4vw, 46px);
    letter-spacing: -.035em;
    line-height: 1.08;
}

.intro {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.preview-badge {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid #b9d8eb;
    border-radius: 999px;
    background: #eef8fd;
    color: var(--blue);
    font-family: Montserrat, Arial, sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.controls {
    display: grid;
    grid-template-columns: 1.15fr 1.1fr .8fr;
    gap: 12px;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--soft);
}

legend {
    padding: 0 6px;
    color: var(--muted);
    font-family: Montserrat, Arial, sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.segmented {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 5px;
}

.segmented button, .map-toolbar button {
    min-height: 40px;
    padding: 7px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #52647f;
    cursor: pointer;
    font-weight: 700;
}

.segmented button[aria-pressed="true"] {
    background: #fff;
    color: var(--blue);
    box-shadow: 0 2px 9px rgba(31, 74, 110, .12);
}

button:focus-visible, select:focus-visible {
    outline: 3px solid rgba(22, 139, 196, .38);
    outline-offset: 2px;
}

.period-label {
    margin: 16px 0 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.leasing-warning {
    margin: 0 0 14px;
    padding: 11px 13px;
    border-left: 4px solid #e29b36;
    border-radius: 8px;
    background: #fff8ed;
    color: #6a563d;
    font-size: 12px;
    line-height: 1.55;
}

.visual-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(260px, .72fr);
    gap: 16px;
}

.map-panel {
    position: relative;
    min-width: 0;
    min-height: 560px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: radial-gradient(circle at 48% 44%, #fff 0%, #eaf2f8 76%);
}

.map-panel svg {
    display: block;
    width: 100%;
    height: 560px;
}

.map-toolbar {
    position: absolute;
    z-index: 4;
    top: 12px;
    right: 12px;
}

.map-toolbar button {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .94);
    color: var(--blue);
    font-size: 12px;
    box-shadow: 0 4px 14px rgba(31, 74, 110, .1);
}

.county {
    cursor: pointer;
    outline: none;
    stroke: #fff;
    stroke-width: 1.4;
    vector-effect: non-scaling-stroke;
    transition: fill 140ms ease, stroke 140ms ease;
}

.county-outline {
    fill: none;
    stroke: var(--orange);
    stroke-width: 3;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.tooltip {
    position: absolute;
    z-index: 6;
    max-width: 220px;
    padding: 9px 11px;
    border-radius: 9px;
    background: rgba(19, 34, 54, .96);
    color: #fff;
    pointer-events: none;
    font-size: 12px;
    line-height: 1.45;
    opacity: 0;
    transform: translate(-50%, calc(-100% - 12px));
}

.tooltip[data-show="true"] { opacity: 1; }

.legend {
    position: absolute;
    z-index: 3;
    left: 14px;
    bottom: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 10px;
    border: 1px solid rgba(216, 227, 237, .94);
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    backdrop-filter: blur(6px);
}

.legend-swatch { width: 20px; height: 9px; border-radius: 2px; }

.map-panel.is-expanded {
    position: fixed;
    z-index: 100;
    inset: 12px;
    min-height: 0;
    border-radius: 18px;
    box-shadow: 0 20px 80px rgba(0, 20, 40, .28);
}

.map-panel.is-expanded svg { height: calc(100vh - 24px); }

.detail-panel {
    display: flex;
    flex-direction: column;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #fbfdff;
}

.detail-panel label {
    color: var(--muted);
    font-family: Montserrat, Arial, sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.detail-panel select {
    width: 100%;
    margin: 8px 0 22px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--blue-dark);
    font-weight: 800;
}

.primary-value {
    color: var(--blue-dark);
    font-family: Montserrat, Arial, sans-serif;
    font-size: clamp(42px, 5vw, 64px);
    font-weight: 900;
    letter-spacing: -.055em;
    line-height: 1;
}

.primary-unit {
    min-height: 44px;
    margin: 7px 0 20px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.detail-panel dl { margin: 0; border-top: 1px solid var(--line); }
.detail-panel dl div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.detail-panel dt { color: var(--muted); }
.detail-panel dd { margin: 0; color: var(--ink); font-weight: 800; }

.context-note {
    margin: auto 0 0;
    padding-top: 18px;
    color: #725d46;
    font-size: 12px;
    line-height: 1.55;
}

.data-notice {
    margin: 14px 0 0;
    padding: 11px 13px;
    border-left: 4px solid #e29b36;
    border-radius: 8px;
    background: #fff8ed;
    color: #6a563d;
    font-size: 12px;
}

footer {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

footer p { margin: 5px 0; }
footer a { color: var(--blue); font-weight: 700; }

.error-message {
    width: min(720px, calc(100% - 32px));
    margin: 60px auto;
    padding: 18px;
    border-radius: 12px;
    background: #fff1f1;
    color: #9f2525;
    text-align: center;
    font-weight: 700;
}

@media (max-width: 900px) {
    .controls { grid-template-columns: 1fr; }
    .visual-layout { grid-template-columns: 1fr; }
    .detail-panel { min-height: 380px; }
}

@media (max-width: 560px) {
    .preview-shell { width: 100%; margin: 0; padding: 16px; border: 0; border-radius: 0; }
    .site-navigation { align-items: stretch; flex-direction: column; margin-bottom: 18px; padding: 8px; }
    .site-nav-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .site-nav-links a { min-height: 44px; padding: 7px 4px; font-size: 10px; text-align: center; }
    .partner-mark { display: none; }
    .preview-header { display: block; }
    .preview-badge { display: inline-block; margin-top: 14px; }
    .intro { font-size: 13px; }
    .segmented button { min-height: 48px; padding: 6px 5px; font-size: 11px; line-height: 1.25; }
    .map-panel, .map-panel svg { min-height: 430px; height: 430px; }
    .map-panel.is-expanded { inset: 0; border-radius: 0; }
    .map-panel.is-expanded svg { height: 100vh; }
    .legend { right: 10px; left: 10px; flex-wrap: wrap; justify-content: center; }
    .detail-panel { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .county { transition: none; }
}
