/* css/public-dashboard.css — public Oklahoma Child Wellbeing dashboard */
.pd-page { background: #f4f2ee; color: #1a1f2e; }
.dash {
  --pd-ink: #1a1f2e;
  --pd-ink-2: #475569;
  --pd-muted: #64748b;
  --pd-line: #e2ddd4;
  --pd-surface: #ffffff;
  --pd-teal: #0f766e;
  --pd-navy: #071d35;
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 20px 40px;
  font-family: var(--sans);
}
.pd-skip { position: absolute; left: -9999px; top: 0; z-index: 300; background: #fff; color: var(--navy); padding: 8px 12px; }
.pd-skip:focus { left: 12px; top: 64px; }
.pd-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dash :focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

/* Header + filters */
.pd-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 28px; margin-bottom: 14px; }
.pd-header-text { flex: 1 1 420px; min-width: 0; }
.pd-header h1 { font-family: var(--serif); font-size: clamp(26px, 3.2vw, 36px); line-height: 1.15; margin: 0 0 6px; color: var(--pd-navy); font-weight: 700; }
.pd-header p { margin: 0; color: var(--pd-ink-2); font-size: 15.5px; line-height: 1.5; max-width: 720px; }
.pd-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; flex: 0 1 auto; }
.pd-control { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--pd-ink-2); text-transform: uppercase; letter-spacing: .04em; }
.pd-control select {
  font: 500 14.5px/1.3 var(--sans); color: var(--pd-ink); text-transform: none; letter-spacing: 0;
  min-width: 210px; max-width: 320px; padding: 9px 34px 9px 11px; border: 1px solid #cbd2dc; border-radius: 8px; background: #fff;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #475569 50%), linear-gradient(135deg, #475569 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.pd-reset { font: 600 14px var(--sans); padding: 9px 14px; border-radius: 8px; border: 1px solid #cbd2dc; background: #fff; color: var(--pd-ink-2); cursor: pointer; }
.pd-reset:hover { border-color: var(--pd-teal); color: var(--pd-teal); }
.pd-status { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: #fff7e6; border: 1px solid #f1d9a6; color: #6b4a07; font-size: 14px; }
.pd-status[hidden] { display: none; }

.pd-section-label { font: 700 12px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--pd-muted); margin: 6px 0 8px; }
.pd-section-label span { color: var(--pd-ink); }

/* Panels & tiles */
.pd-panel { background: var(--pd-surface); border: 1px solid var(--pd-line); border-radius: 12px; box-shadow: 0 1px 3px rgba(16,24,39,.04); }
.pd-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.pd-tile { position: relative; background: #fff; border: 1px solid var(--pd-line); border-radius: 12px; padding: 12px 14px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pd-tile.is-active { border-color: var(--pd-teal); box-shadow: inset 0 3px 0 var(--pd-teal); }
.pd-tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pd-tile-name { font: 600 13.5px/1.3 var(--sans); color: var(--pd-ink-2); margin: 0; }
.pd-tile-icons { display: inline-flex; gap: 4px; flex: none; }
.pd-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid #d4d9e1; background: #fff; color: #334155; font: 600 14px/1 var(--sans); text-decoration: none; cursor: pointer; padding: 0;
}
.pd-info { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-weight: 700; font-size: 15px; }
.pd-icon:hover { border-color: var(--pd-teal); color: var(--pd-teal); background: #f0faf8; }
.pd-tile-value { font: 700 28px/1.1 var(--sans); color: var(--pd-ink); margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.pd-tile-value small { font-size: 13px; font-weight: 500; color: var(--pd-muted); }
.pd-tile-value.is-text, .pd-tiles .pd-tile-value.is-text { font-size: 19px; }
.pd-tile-value.is-missing { font-size: 17px; font-weight: 600; color: var(--pd-muted); }
.pd-tile-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; font-size: 12.5px; color: var(--pd-muted); line-height: 1.35; }
.pd-geo-tag { color: var(--pd-ink-2); }
.pd-geo-tag.is-statewide { background: #eef2f7; color: #334155; border-radius: 4px; padding: 0 6px; }
.pd-tile-compare { margin: 0; font-size: 12.5px; color: var(--pd-ink-2); }
.pd-tile-map { align-self: flex-start; margin-top: auto; padding: 4px 0 0; border: 0; background: none; color: var(--pd-teal); font: 600 12.5px var(--sans); cursor: pointer; }
.pd-tile-map[aria-pressed="true"] { color: var(--pd-muted); cursor: default; }
.pd-tile-map:hover { text-decoration: underline; }

/* Map + side panel */
.pd-map-layout { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(300px, 1fr); gap: 14px; margin-bottom: 18px; align-items: start; }
.pd-map-card { padding: 16px 18px 14px; min-width: 0; }
.pd-panel-title { font: 700 17px/1.3 var(--sans); margin: 0 0 2px; color: var(--pd-ink); }
.pd-map-hint { margin: 0 0 6px; color: var(--pd-muted); font-size: 13px; }
.pd-map { width: 100%; }
.pd-map-svg { display: block; width: 100%; height: auto; touch-action: manipulation; }
.pd-county { stroke: #ffffff; stroke-width: .8; cursor: pointer; transition: opacity .12s; }
.pd-county:hover { opacity: .82; stroke: #1a1f2e; stroke-width: 1.2; }
.pd-county-outline { fill: none; stroke: #071d35; stroke-width: 2.6; pointer-events: none; }
.pd-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 12.5px; color: var(--pd-ink-2); margin-top: 6px; }
.pd-legend-item, .pd-legend-ramp { display: inline-flex; align-items: center; gap: 6px; }
.pd-legend-ramp { gap: 2px; }
.pd-legend-ramp span { margin: 0 4px; }
.pd-swatch { display: inline-block; width: 16px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.08); }
.pd-swatch.is-hatch { background: repeating-linear-gradient(45deg, #f7f5f1 0 3px, #b9b3a8 3px 4.4px); }
.pd-legend-note { flex-basis: 100%; color: var(--pd-muted); font-size: 12px; }
.pd-table-details { margin-top: 10px; border-top: 1px solid var(--pd-line); padding-top: 8px; }
.pd-table-details summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--pd-teal); }
.pd-table-actions { margin: 8px 0; }
.pd-linkbtn { border: 0; background: none; padding: 0; color: var(--pd-teal); font: 600 13.5px var(--sans); cursor: pointer; text-decoration: underline; }
.pd-table-wrap { max-height: 360px; overflow: auto; border: 1px solid var(--pd-line); border-radius: 8px; }
.pd-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pd-table caption { text-align: left; padding: 8px 10px; font-weight: 600; color: var(--pd-ink-2); }
.pd-table th, .pd-table td { padding: 6px 10px; border-bottom: 1px solid #efebe4; text-align: right; }
.pd-table th[scope="row"], .pd-table thead th:first-child { text-align: left; font-weight: 500; }
.pd-table thead th { position: sticky; top: 0; background: #f8f7f4; font-weight: 600; }
.pd-table tr.is-state th, .pd-table tr.is-state td { font-weight: 700; background: #f5f9f8; }
.pd-table tr.is-selected th, .pd-table tr.is-selected td { background: #e6f5f3; }

.pd-side { display: block; padding: 16px 18px; min-width: 0; position: sticky; top: 76px; }
.pd-detail-geo { margin: 0; font: 700 12px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--pd-teal); }
.pd-detail-name { font: 700 17px/1.3 var(--sans); margin: 2px 0 0; color: var(--pd-ink); }
.pd-detail-value { font: 700 40px/1.05 var(--sans); margin: 8px 0 2px; color: var(--pd-ink); font-variant-numeric: tabular-nums; }
.pd-detail-value small { font-size: 15px; font-weight: 500; color: var(--pd-muted); }
.pd-detail-value.is-missing { font-size: 22px; color: var(--pd-muted); }
.pd-detail-compare { margin: 6px 0 0; font-size: 14px; color: var(--pd-ink-2); }
.pd-detail-hint { margin: 6px 0 0; font-size: 13px; color: var(--pd-muted); }
.pd-mini-title { font: 700 12px var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--pd-muted); margin: 16px 0 4px; padding-top: 12px; border-top: 1px solid var(--pd-line); }
.pd-mini-title[hidden] { display: none; }
.pd-strip, .pd-trend, .pd-chart-body { width: 100%; min-width: 0; }
.pd-strip-svg, .pd-chart { display: block; max-width: 100%; overflow: visible; }
.pd-axis { stroke: #cbd2dc; stroke-width: 1; }
.pd-ref { stroke: #334155; stroke-width: 1.5; stroke-dasharray: 3 3; }
.pd-ref-label { font: 600 11px var(--sans); fill: #334155; }
.pd-dot { fill: #94a3b8; fill-opacity: .55; stroke: #fff; stroke-width: 1; cursor: pointer; }
.pd-dot:hover { fill: #0f766e; fill-opacity: 1; }
.pd-dot.is-selected { fill: #0f766e; fill-opacity: 1; stroke: #071d35; stroke-width: 2; }
.pd-tick { font: 11px var(--sans); fill: #64748b; }
.pd-bar-label { font: 500 12px var(--sans); fill: #334155; }
.pd-grid { stroke: #eceae5; stroke-width: 1; }
.pd-cross { stroke: #94a3b8; stroke-width: 1; }
.pd-chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--pd-ink-2); margin-bottom: 4px; }
.pd-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pd-line-key { display: inline-block; width: 18px; border-top: 3px solid; }
.pd-line-key.is-dashed { border-top-style: dashed; }

/* Category tabs */
.pd-categories { margin-bottom: 18px; }
.pd-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.pd-tabs [role="tab"] {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--pd-line); border-bottom: 0; text-align: left;
  border-radius: 10px 10px 0 0; background: #ebe8e2; color: var(--pd-ink-2); font: 600 13.5px/1.25 var(--sans); cursor: pointer; min-width: 0;
}
.pd-tabs [role="tab"][aria-selected="true"] { background: #fff; color: var(--pd-navy); box-shadow: inset 0 3px 0 var(--pd-teal); }
.pd-tab-num { flex: none; display: inline-flex; width: 20px; height: 20px; border-radius: 50%; align-items: center; justify-content: center; background: #fff; border: 1px solid #cbd2dc; font-size: 11px; }
.pd-tabs [aria-selected="true"] .pd-tab-num { background: var(--pd-teal); border-color: var(--pd-teal); color: #fff; }
.pd-category-panel { border-top-left-radius: 0; padding: 16px 18px 18px; }
.pd-category-note { margin: 0 0 10px; color: var(--pd-muted); font-size: 13.5px; }
.pd-category-note:empty { display: none; }
.pd-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pd-tiles .pd-tile-value { font-size: 26px; }
.pd-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-top: 16px; }
.pd-chart-card { margin: 0; padding: 12px 14px; border: 1px solid var(--pd-line); border-radius: 10px; background: #fcfcfb; min-width: 0; }
.pd-chart-card figcaption { font: 700 14px/1.3 var(--sans); color: var(--pd-ink); margin-bottom: 6px; }

/* About */
.pd-about { padding: 14px 18px; border-left: 4px solid var(--pd-teal); background: #fff; border-radius: 0 10px 10px 0; }
.pd-about h2 { font: 700 16px var(--sans); margin: 0 0 6px; }
.pd-about ul { margin: 0 0 8px; padding-left: 18px; font-size: 14px; color: var(--pd-ink-2); line-height: 1.55; }
.pd-about-links { margin: 0; font-size: 14px; }
.pd-about a, .pd-dialog a { color: var(--pd-teal); font-weight: 600; }

/* Tooltip */
.pd-tooltip { position: fixed; z-index: 400; pointer-events: none; background: #0b1b2e; color: #fff; padding: 7px 10px; border-radius: 7px; font: 13px/1.4 var(--sans); max-width: 260px; box-shadow: 0 6px 20px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.pd-tooltip[hidden] { display: none; }
.pd-tooltip span { color: #dbe4ee; }

/* Info dialog */
.pd-dialog { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: min(86vh, 760px); box-shadow: 0 24px 60px rgba(0,0,0,.3); color: #1a1f2e; font-family: var(--sans); }
.pd-dialog::backdrop { background: rgba(7,29,53,.55); }
.pd-dialog-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px 10px; background: #fff; border-bottom: 1px solid #eceae5; }
.pd-dialog-head h2 { font: 700 18px/1.3 var(--sans); margin: 0; }
.pd-dialog-close { border: 0; background: #f1f5f9; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; cursor: pointer; flex: none; }
.pd-dialog-body { padding: 10px 20px 20px; }
.pd-info-cat { margin: 0 0 6px; font: 700 11.5px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--pd-teal, #0f766e); }
.pd-info-row h3 { font: 700 13px var(--sans); margin: 12px 0 2px; color: #334155; }
.pd-info-row p { margin: 0; font-size: 14.5px; line-height: 1.55; }
.pd-info-sources { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }
.pd-info-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid #eceae5; font-size: 14px; }
.pd-dialog .pd-linkbtn { color: #0f766e; }

.pd-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 14px 20px; background: var(--navy); color: #cbd5e1; font-size: 13px; }
.pd-footer a { color: #e2e8f0; }

@media (max-width: 1180px) {
  .pd-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pd-map-layout { grid-template-columns: 1fr; }
  .pd-side { position: static; }
  .pd-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pd-tabs [role="tab"] { border-radius: 10px; border-bottom: 1px solid var(--pd-line); }
  .pd-tabs [role="tab"][aria-selected="true"] { border-color: var(--pd-teal); }
  .pd-category-panel { border-top-left-radius: 12px; margin-top: 8px; }
}
@media (max-width: 640px) {
  .dash { padding: 14px 12px 28px; }
  .pd-controls { width: 100%; }
  .pd-control { flex: 1 1 100%; }
  .pd-control select { min-width: 0; max-width: none; width: 100%; }
  .pd-reset { width: 100%; }
  .pd-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pd-tile { padding: 10px 11px; }
  .pd-tile-value { font-size: 22px; }
  .pd-tile-name { font-size: 12.5px; }
  .pd-map-card, .pd-side, .pd-category-panel { padding: 12px; }
  .pd-detail-value { font-size: 32px; }
  .pd-charts { grid-template-columns: 1fr; }
  .pd-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pd-tabs [role="tab"] { padding: 8px 9px; font-size: 12.5px; }
}
@media (forced-colors: active) {
  .pd-county { stroke: CanvasText; }
  .pd-county-outline { stroke: Highlight; }
}
