:root {
  --ars-ink: #2b1d2a;
  --ars-ochre: #cb5b2e;
  --ars-gold: #d8a33c;
  --ars-green: #5b8e3e;
  --ars-blue: #2c89a0;
  --ars-sand: #f6f1e8;
  --ars-paper: #fffdfa;
  --ars-border: #e2d8ca;
  --ars-muted: #6d625b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ars-ink);
  background: linear-gradient(180deg, var(--ars-sand), #f8f7f3 42%, #f4f2ec);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: #126f82; text-underline-offset: 2px; }
a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--ars-blue); outline-offset: 3px; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem clamp(1rem, 3vw, 2.5rem);
  background: var(--ars-paper);
  border-bottom: 5px solid var(--ars-ochre);
  box-shadow: 0 1px 12px rgba(43, 29, 42, .07);
}

.brand-block { min-width: 0; }
.eyebrow, .section-label { margin: 0 0 .3rem; color: var(--ars-ochre); font-size: .77rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(1.45rem, 2.7vw, 2.35rem); line-height: 1.05; letter-spacing: -.03em; }
h2 { margin: 0; font-size: clamp(1.3rem, 2.2vw, 1.8rem); }
.subtitle { margin: .45rem 0 0; color: var(--ars-muted); }
.ars-logo { display: block; width: auto; max-width: min(340px, 38vw); max-height: 96px; object-fit: contain; }

.dashboard-shell { width: min(1180px, calc(100% - 2rem)); margin: 1.35rem auto 2.5rem; }
.dashboard-intro, .analysis-card, .method-card { margin-bottom: 1rem; padding: clamp(1rem, 2.4vw, 1.5rem); background: var(--ars-paper); border: 1px solid var(--ars-border); border-radius: 15px; box-shadow: 0 2px 12px rgba(43, 29, 42, .055); }
.dashboard-intro { border-top: 5px solid var(--ars-green); }
.dashboard-intro > p:not(.section-label), .method-card p { max-width: 76ch; line-height: 1.55; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin: 1.2rem 0 0; }
.summary-grid div { padding: .8rem; background: #f7f2e9; border-radius: 10px; }
.summary-grid dt { color: var(--ars-muted); font-size: .76rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.summary-grid dd { margin: .25rem 0 0; font-size: 1.3rem; font-weight: 850; }
.status { min-height: 1.4rem; color: var(--ars-muted); font-weight: 650; }
.status.error { padding: .8rem; color: #8b260c; background: #fff3e8; border-left: 4px solid var(--ars-ochre); }
.preview-notice { padding: .8rem 1rem; color: #714414; background: #fff4d9; border: 1px solid #e4c887; border-left: 4px solid var(--ars-gold); border-radius: 9px; font-weight: 750; }

.analysis-card { border-top: 5px solid var(--ars-blue); }
.card-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: end; }
.metric-field { min-width: min(280px, 100%); color: var(--ars-muted); font-size: .82rem; font-weight: 750; }
select { display: block; width: 100%; margin-top: .3rem; padding: .62rem .7rem; color: var(--ars-ink); background: #fff; border: 1px solid #cfc2b4; border-radius: 9px; font: inherit; }
.year-controls { display: grid; grid-template-columns: auto minmax(120px, 1fr) auto minmax(120px, 1fr); gap: .65rem; align-items: center; margin: 1.2rem 0 .5rem; }
.year-controls label { font-size: .82rem; font-weight: 750; }
.year-controls output { color: var(--ars-green); font-weight: 850; }
.year-controls input { width: 100%; accent-color: var(--ars-green); }

.timeline-chart { min-height: 360px; overflow-x: auto; }
.timeline-chart svg { display: block; width: 100%; min-width: 720px; height: auto; }
.chart-grid { stroke: #e5ddd2; stroke-width: 1; }
.chart-axis { fill: var(--ars-muted); font-size: 12px; }
.chart-bar { fill: var(--ars-green); }
.chart-bar:hover, .chart-bar:focus { fill: var(--ars-ochre); outline: none; }
.chart-note { color: var(--ars-muted); font-size: .88rem; line-height: 1.5; }
.data-table-panel { margin-top: .8rem; }
.data-table-panel summary { cursor: pointer; color: #126f82; font-weight: 750; }
table { width: 100%; margin-top: .7rem; border-collapse: collapse; }
th, td { padding: .55rem .65rem; text-align: right; border-top: 1px solid #eee2d4; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--ars-muted); background: #fffaf3; font-size: .78rem; text-transform: uppercase; }

.wordcloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: .35rem .8rem; min-height: 340px; padding: clamp(1rem, 4vw, 2.5rem); background: radial-gradient(circle at center, #fffdfa, #f4f0e8); border: 1px solid #ede2d3; border-radius: 12px; }
.wordcloud span { color: hsl(var(--term-hue), 48%, var(--term-light)); font-size: clamp(.84rem, calc(.72rem + var(--term-scale) * 2.2rem), 3rem); font-weight: calc(520 + var(--term-scale) * 330); line-height: 1; }
.wordcloud span:nth-child(3n) { font-family: Georgia, "Times New Roman", serif; }
.wordcloud span:nth-child(5n) { font-style: italic; }

.method-card { border-left: 5px solid var(--ars-gold); }
.site-footer { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem clamp(1rem, 4vw, 4rem); color: #fffaf3; background: var(--ars-ink); font-size: .86rem; }
.site-footer a { color: #fffaf3; }

@media (max-width: 760px) {
  .site-header { align-items: flex-start; padding: .85rem 1rem; }
  .ars-logo { max-width: 35vw; max-height: 72px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .card-heading { display: block; }
  .metric-field { display: block; margin-top: .8rem; }
  .year-controls { grid-template-columns: auto 1fr; }
}

@media (max-width: 520px) {
  .site-header { display: block; }
  .ars-logo { margin-top: .7rem; max-width: min(230px, 74vw); }
  .dashboard-shell { width: min(100% - 1rem, 1180px); }
  .summary-grid { grid-template-columns: 1fr; }
  .site-footer { display: block; }
  .site-footer a { display: inline-block; margin-top: .45rem; }
}
