/* ── Natural Disasters and Family Violence — Victorian LGA Evidence Base ── */
/* Styling guided by Australian Government digital style conventions       */

:root {
  --navy: #1B3A5C;
  --navy-dark: #122840;
  --teal: #00698F;
  --teal-light: #E8F4F8;
  --blue-link: #0D5F8A;
  --blue-visited: #4C2C92;
  --bg: #FFFFFF;
  --bg-alt: #F5F5F5;
  --bg-warm: #FAFAF8;
  --border: #D3D3D3;
  --border-light: #E8E8E8;
  --text: #313131;
  --text-secondary: #616161;
  --text-heading: #1B3A5C;
  --green: #0B6623;
  --green-bg: #E9F5EC;
  --red: #B81237;
  --red-bg: #FDF0F3;
  --amber: #9B6F00;
  --amber-bg: #FFF8E7;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-link); text-decoration: underline; }
a:visited { color: var(--blue-visited); }
a:hover { color: var(--navy); }

.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* ── Header band ── */
.header-band {
  background: var(--navy);
  color: #FFFFFF;
  border-bottom: 4px solid var(--teal);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 28px;
}

.header-brand {
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.75);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.header-inner h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  color: #FFFFFF;
  margin-bottom: 10px;
}

.header-subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.6;
  max-width: 720px;
}

/* ── Key figures bar ── */
.key-figures {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
}

.key-figures-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.key-figure {
  display: flex;
  flex-direction: column;
}

.key-figure-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.key-figure-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ── Navigation tabs ── */
.tabs {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #FFFFFF;
  border-bottom: 2px solid var(--border);
}

.tabs-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 0;
}

.tab {
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 14px 20px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.tab:hover {
  color: var(--navy);
}

.tab.active {
  color: var(--navy);
  border-bottom-color: var(--teal);
  font-weight: 600;
}

/* ── Panels ── */
.panel {
  display: none;
  padding: 40px 0 56px;
}

.panel.active { display: block; }

.panel h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 16px;
  line-height: 1.3;
}

.panel h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 28px 0 10px;
}

.panel h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 20px 0 8px;
}

.panel p {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.75;
}

.panel ul, .panel ol {
  margin: 0 0 14px 24px;
  font-size: 0.95rem;
  line-height: 1.75;
}

.panel li { margin-bottom: 4px; }

/* ── Charts ── */
.chart-box {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 20px;
  margin: 24px 0;
}

/* ── Findings cards ── */
.findings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}

.finding-card {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--teal);
  border-radius: 2px;
  padding: 20px 22px;
}

.finding-card h4 {
  font-size: 0.92rem;
  color: var(--navy);
  margin: 0 0 8px;
  font-weight: 600;
}

.finding-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.65;
}

/* ── Tables (ABS/AIHW style) ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 20px 0;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  background: var(--navy);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0.01em;
}

tbody tr:nth-child(even) {
  background: var(--bg-alt);
}

tbody tr:hover {
  background: var(--teal-light);
}

tr.major-row { font-weight: 500; }
tr.major-row td:first-child { font-weight: 600; }

tr.gap-row {
  background: var(--red-bg) !important;
}

tr.lga-separator {
  background: var(--navy) !important;
  color: #FFFFFF;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

tr.lga-separator td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--navy-dark);
}

td.change-neg {
  color: var(--green);
  font-weight: 500;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 2px;
  white-space: nowrap;
}

.tag.available { background: var(--green-bg); color: var(--green); }
.tag.unavailable { background: var(--red-bg); color: var(--red); }

/* ── Callout boxes ── */
.callout {
  border-radius: 2px;
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 0.9rem;
  line-height: 1.7;
  border-left: 4px solid;
}

.callout strong { display: block; margin-bottom: 4px; }

.callout-info {
  background: var(--teal-light);
  border-color: var(--teal);
}

.callout-warning {
  background: var(--amber-bg);
  border-color: var(--amber);
}

.callout-critical {
  background: var(--red-bg);
  border-color: var(--red);
}

/* ── Recommendation cards ── */
.rec-cards { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }

.rec-card {
  display: flex;
  gap: 18px;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  padding: 20px;
}

.rec-card.priority {
  border-left: 4px solid var(--red);
}

.rec-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  font-size: 1rem;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--navy);
}

.rec-card.priority .rec-num {
  background: var(--red);
}

.rec-card h4 {
  font-size: 0.95rem;
  margin: 0 0 6px;
  color: var(--navy);
}

.rec-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0 0 6px;
}

.rec-card p:last-child { margin-bottom: 0; }

.contact-link {
  font-size: 0.82rem;
  color: var(--blue-link);
}

/* ── Downloads section ── */
.download-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.download-list li {
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-alt);
}

.download-list li:hover {
  background: var(--teal-light);
}

.download-desc {
  font-size: 0.88rem;
  color: var(--text);
}

.download-link {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Footer ── */
.footer {
  padding: 40px 0 32px;
  border-top: 4px solid var(--navy);
  background: var(--bg-alt);
}

.footer h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 12px;
}

.refs {
  list-style: decimal;
  padding-left: 24px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.8;
  columns: 2;
  column-gap: 32px;
}

.refs li { break-inside: avoid; margin-bottom: 6px; }
.refs em { font-style: italic; }

.footer-meta {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Heatmap table ── */
.heatmap-wrap {
  margin: 28px 0;
  max-height: 75vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 16px 0 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.heatmap-legend-swatch {
  display: inline-block;
  width: 28px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.1);
  vertical-align: middle;
}

.heatmap-legend-label {
  margin-right: 10px;
  white-space: nowrap;
}

table.heatmap {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0;
  table-layout: fixed;
}

table.heatmap th {
  background: var(--navy);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: 0.01em;
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 2px solid var(--navy-dark);
}

/* Group header row */
table.heatmap .hm-group-row th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 7px 8px;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(255,255,255,0.25);
}

table.heatmap th.hm-group-pre {
  background: var(--navy);
  border-right: 3px solid var(--teal);
}

table.heatmap th.hm-group-post {
  background: var(--teal);
}

/* Column header row (row 2) */
table.heatmap thead tr:nth-child(2) th {
  position: sticky;
  top: 31px;
  z-index: 4;
}

table.heatmap th.hm-th-era {
  background: #1A5E7A;
}

/* Era divider — thick left border */
table.heatmap th.hm-era-divider,
table.heatmap td.hm-era-divider {
  border-left: 3px solid var(--teal) !important;
}

/* LGA name column — sticky horizontal + vertical corner cell */
table.heatmap th.hm-th-lga {
  text-align: left;
  min-width: 160px;
  width: 160px;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 6;
}

table.heatmap th.hm-th-meta {
  position: sticky;
  top: 0;
  z-index: 5;
}

table.heatmap td {
  padding: 5px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
}

table.heatmap td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text);
  background: #FFFFFF;
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid var(--border);
}

table.heatmap tbody tr:nth-child(even) td:first-child { background: var(--bg-alt); }
table.heatmap tbody tr:hover td:first-child { background: var(--teal-light); }
table.heatmap tbody tr:nth-child(even) td { background-color: inherit; }
table.heatmap tbody tr:hover td { opacity: 0.92; }

/* Heatmap cell colours */
.hm-up-high   { background: #C62828; color: #FFFFFF; font-weight: 600; }
.hm-up-med    { background: #EF6C00; color: #FFFFFF; font-weight: 500; }
.hm-up-low    { background: #FFF9C4; color: #313131; }
.hm-down-low  { background: #C8E6C9; color: #313131; }
.hm-down-high { background: #2E7D32; color: #FFFFFF; font-weight: 500; }

/* DRFA event badge inside heatmap cells */
.hm-drfa-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  border-radius: 7px;
  margin-left: 3px;
  vertical-align: middle;
  background: rgba(0,0,0,0.2);
  color: inherit;
}

.hm-up-low .hm-drfa-badge,
.hm-down-low .hm-drfa-badge {
  background: rgba(0,0,0,0.12);
  color: var(--text-secondary);
}

/* DRFA total column */
.hm-drfa-total {
  font-weight: 700;
  color: var(--navy);
}

/* Exposure tags */
.hm-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hm-tag-high     { background: #FFCDD2; color: #B71C1C; }
.hm-tag-medium   { background: #FFE0B2; color: #E65100; }
.hm-tag-low      { background: #E3F2FD; color: #1565C0; }
.hm-tag-baseline { background: var(--teal-light); color: var(--teal); }

/* Baseline row left border */
tr.hm-baseline td:first-child {
  border-left: 4px solid var(--teal);
}

/* Separator row between disaster-affected and baseline groups */
tr.hm-separator td {
  background: var(--navy) !important;
  color: #FFFFFF;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 7px 8px;
  text-align: left;
  letter-spacing: 0.01em;
  border-bottom: 2px solid var(--navy-dark);
}

/* ── Statistical analysis tables ── */
table.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 16px 0 24px;
}

table.stat-table th {
  background: var(--navy);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 9px 12px;
  text-align: left;
  border-bottom: 2px solid var(--navy-dark);
}

table.stat-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}

table.stat-table tbody tr:nth-child(even) { background: var(--bg-alt); }
table.stat-table tbody tr:hover { background: var(--teal-light); }

table.stat-table td.stat-num {
  text-align: right;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.82rem;
}

/* Traffic-light significance indicators */
.sig-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.sig-yes {
  background: var(--green-bg);
  color: var(--green);
}

.sig-maybe {
  background: var(--amber-bg);
  color: var(--amber);
}

.sig-no {
  background: #F5F5F5;
  color: #999;
}

/* Statistical narrative block */
.stat-narrative {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--teal);
  border-radius: 2px;
  padding: 20px 24px;
  margin: 24px 0;
}

.stat-narrative h4 {
  font-size: 0.95rem;
  color: var(--navy);
  margin: 0 0 10px;
}

.stat-narrative p {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.7;
}

.stat-narrative p:last-child { margin-bottom: 0; }

.stat-narrative .stat-key-finding {
  font-weight: 600;
  color: var(--navy);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .key-figures-inner { flex-direction: column; gap: 12px; }
  .findings-row { grid-template-columns: 1fr; }
  .tabs-inner { overflow-x: auto; }
  .tab { font-size: 0.8rem; padding: 12px 14px; }
  .rec-card { flex-direction: column; }
  .refs { columns: 1; }
  th, td { padding: 8px 10px; font-size: 0.82rem; }
  .download-list li { flex-direction: column; align-items: flex-start; gap: 6px; }
  .footer-meta { flex-direction: column; }
  .heatmap-wrap { margin: 20px -24px; border-radius: 0; border-left: 0; border-right: 0; }
  table.heatmap th.hm-th-lga, table.heatmap td:first-child { min-width: 110px; width: 110px; font-size: 0.72rem; }
  .heatmap-legend { gap: 4px; }
}
