:root {
  color-scheme: light;
  --page-width: 100vw;
  --page-gutter: clamp(1rem, 2.5vw, 2rem);
  --color-white: #FFFFFF;
  --color-cream: #FFFAFA;
  --color-purple: #9A3270;
  --color-orange: #F7B552;
  --color-infrastructure: #2F7F78;
  --color-dark: #142445;
  --color-yellow: #fdda14;
  --muted: rgb(20 36 69 / 68%);
  --line: rgb(20 36 69 / 16%);
  --shadow: 0 16px 45px rgb(20 36 69 / 12%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--color-dark);
  background: var(--color-cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3rem;
  align-items: end;
  padding: clamp(2.5rem, 6vw, 5.5rem) max(var(--page-gutter), calc((100vw - var(--page-width)) / 2));
  color: var(--color-white);
  background: var(--color-purple);
}

.hero__content { max-width: 760px; }

.eyebrow {
  margin: 0 0 .6rem;
  color: inherit;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; line-height: 1.08; }
h1 { max-width: 700px; font-size: clamp(2.5rem, 6vw, 5rem); letter-spacing: -.045em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); letter-spacing: -.025em; }

.hero__summary {
  max-width: 650px;
  margin: 1.25rem 0 1.75rem;
  color: var(--color-cream);
  font-size: 1.1rem;
  line-height: 1.65;
}

.hero__aside {
  display: grid;
  gap: .75rem;
  width: 220px;
}

.hero__metric {
  padding: 1.4rem 1.6rem;
  border: 1px solid rgb(255 255 255 / 32%);
  border-radius: 18px;
  background: rgb(255 255 255 / 10%);
  backdrop-filter: blur(8px);
}

.hero__metric span { display: block; font-size: 3rem; font-weight: 800; }
.hero__metric small { color: var(--color-cream); }

.layout-width-control {
  position: absolute;
  top: 1rem;
  right: var(--page-gutter);
  display: grid;
  gap: .45rem;
  width: 220px;
  padding: .8rem .9rem;
  border: 1px solid rgb(255 255 255 / 32%);
  border-radius: 12px;
  background: rgb(255 255 255 / 10%);
  font-size: .72rem;
  font-weight: 750;
  cursor: pointer;
}

.layout-width-control__heading {
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
}

.layout-width-control output {
  color: var(--color-yellow);
  font-variant-numeric: tabular-nums;
}

.layout-width-control input {
  width: 100%;
  accent-color: var(--color-yellow);
  cursor: ew-resize;
}

.button {
  display: inline-flex;
  padding: .78rem 1.05rem;
  border-radius: 9px;
  font-weight: 750;
  text-decoration: none;
}

.button--light { color: var(--color-dark); background: var(--color-yellow); height: 48px;}
.button--outline {
  border: 1px solid var(--line);
  color: var(--color-dark);
  background: var(--color-white);
  height: 48px;
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  width: min(var(--page-width), calc(100% - var(--page-gutter) - var(--page-gutter)));
  margin: 2rem auto;
}

.panel {
  min-width: 0;
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--color-white);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  gap: 2rem;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.panel .eyebrow { color: var(--color-purple); }

.definition-panel__heading .eyebrow { display: block; }

.definition-panel__toggle {
  margin-top: 1.25rem;
  padding: .65rem 1rem;
  border: 1px solid var(--color-purple);
  border-radius: 8px;
  color: var(--color-purple);
  background: var(--color-white);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.definition-panel__toggle:hover { background: rgb(154 50 112 / 8%); }
.definition-panel [hidden] { display: none; }

.definition-panel__title {
  margin: 0;
  display: block;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.08;
}

.definition-panel__content {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.4fr);
  gap: clamp(2rem, 4vw, 4rem);
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.definition-panel__content p { margin: 0; }
.definition-panel__content p + p { margin-top: 1rem; }

.definition-panel__preview p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  max-height: 5.1em;
  overflow: hidden;
}

.definition-panel__content h3 {
  margin: 0 0 1rem;
  color: var(--color-dark);
  font-size: 1.25rem;
  line-height: 1.25;
}

.dataset-controls {
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: .7rem .85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.dataset-controls legend {
  padding: 0 .3rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.dataset-controls label {
  display: flex;
  gap: .45rem;
  align-items: center;
  font-size: .9rem;
  font-weight: 650;
  cursor: pointer;
}

.swatch { width: 11px; height: 11px; border-radius: 3px; }
.swatch--tiered { background: var(--color-purple); }
.swatch--tier3 { background: var(--color-orange); }
.swatch--infrastructure { background: var(--color-infrastructure); }

.chart { display: grid; gap: .8rem; }
.chart-row { display: grid; grid-template-columns: minmax(180px, 31%) 1fr; gap: 1rem; align-items: center; }
.chart-label { font-size: .86rem; line-height: 1.3; }
.bars { display: grid; gap: 4px; }
.bar-line { display: grid; grid-template-columns: minmax(0, 1fr) 2.2rem; gap: .55rem; align-items: center; }
.bar-track { height: 17px; overflow: hidden; border-radius: 5px; background: rgb(20 36 69 / 8%); }
.bar { height: 100%; min-width: 2px; border-radius: 5px; transition: width 220ms ease; }
.bar--tiered { background: var(--color-purple); }
.bar--tier3 { background: var(--color-orange); }
.bar--infrastructure { background: var(--color-infrastructure); }
.bar-value { font-size: .8rem; font-weight: 750; font-variant-numeric: tabular-nums; }

.status { color: var(--muted); font-size: .9rem; }

.table-tools {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.table-download {
  align-self: end;
  white-space: nowrap;
}

.table-general-feedback {
  align-self: end;
  white-space: nowrap;
}

.table-dataset-choice,
.table-filter {
  display: flex;
  align-items: center;
  margin: 0;
  padding: .65rem .8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.table-dataset-choice {
  gap: .55rem 1rem;
  font-size: .8rem;
  font-weight: 700;
}

.table-dataset-choice legend,
.table-filter legend {
  padding: 0 .3rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.table-dataset-choice label {
  display: inline-flex;
  gap: .35rem;
  align-items: center;
  white-space: nowrap;
  cursor: pointer;
}

.table-filter input {
  width: min(310px, 70vw);
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--color-dark);
  background: var(--color-white);
  font: inherit;
}

.column-picker {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--color-cream);
}

.column-picker summary {
  padding: .75rem .9rem;
  font-size: .86rem;
  font-weight: 750;
  cursor: pointer;
}

.column-picker__actions {
  display: flex;
  gap: .5rem;
  padding: 0 .9rem .7rem;
}

.column-picker button {
  padding: .4rem .65rem;
  border: 1px solid rgb(20 36 69 / 30%);
  border-radius: 7px;
  color: var(--color-dark);
  background: var(--color-white);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
}

#column-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .55rem 1rem;
  margin: 0;
  padding: .8rem .9rem 1rem;
  border: 0;
  border-top: 1px solid var(--line);
}

#column-controls legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

#column-controls label {
  display: flex;
  gap: .45rem;
  align-items: start;
  font-size: .8rem;
  line-height: 1.3;
  cursor: pointer;
}

.table-wrap {
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  scrollbar-gutter: stable;
}
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .8rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }
thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--color-white);
  box-shadow: 0 2px 0 var(--line);
}
td { min-width: 9rem; }
td:nth-child(2) { min-width: 11rem; font-weight: 700; }
td a { color: var(--color-purple); font-weight: 700; overflow-wrap: anywhere; }

.review-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 10rem;
  background: var(--color-white);
  box-shadow: 2px 0 0 var(--line);
}
th.review-cell {
  z-index: 4;
  box-shadow: 2px 2px 0 var(--line);
}
td.review-cell { font-weight: 400; }
.review-action,
.review-status {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: .4rem .65rem;
  border-radius: 7px;
  font-size: .76rem;
  font-weight: 750;
  white-space: nowrap;
}
.review-action {
  border: 1px solid rgb(20 36 69 / 18%);
  color: var(--color-dark);
  background: var(--color-yellow);
  text-decoration: none;
}
.review-action:hover { filter: brightness(.96); }
.review-status {
  color: var(--color-purple);
  background: rgb(154 50 112 / 10%);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--color-yellow);
  outline-offset: 2px;
}

footer {
  width: min(var(--page-width), calc(100% - var(--page-gutter) - var(--page-gutter)));
  margin: 0 auto;
  padding: .5rem 0 2.5rem;
  color: var(--muted);
  font-size: .8rem;
}

@media (max-width: 720px) {
  .definition-panel__content { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero__aside { width: min(100%, 280px); }
  .layout-width-control { position: static; width: 100%; }
  .section-heading { align-items: stretch; flex-direction: column; gap: 1rem; }
  .dataset-controls { width: fit-content; flex-wrap: wrap; }
  .table-tools { align-items: stretch; flex-direction: column; }
  .table-dataset-choice { width: fit-content; flex-wrap: wrap; }
  .chart-row { grid-template-columns: 1fr; gap: .4rem; }
  .table-filter { width: 100%; }
  .table-filter input { width: 100%; }
}
