/* TremOR Operation Research Group — handout and slide deck stylesheet.
   Shared by brief.html (1-page US Letter portrait) and deck.html (6-slide US Letter landscape). */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink-primary);
  background: var(--bg-canvas);
  font: 1rem/1.48 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent-primary);
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

a:hover {
  color: var(--accent-primary-hover);
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

button {
  font: inherit;
  color: var(--accent-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  padding: 0.45em 0.85em;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

button:hover:enabled {
  background: var(--accent-primary-tint);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---------- Toolbar & Page Shells ---------- */

.tools,
.controls {
  display: flex;
  align-items: center;
  gap: 1.2em;
  margin: 0 auto;
  padding: 1em 0;
  font-size: var(--text-sm);
}

.tools button {
  margin-left: auto;
}

.tools,
.stage,
.controls {
  width: min(94%, var(--max-width));
  margin-inline: auto;
}

.brief .tools,
.paper {
  width: min(94%, 850px);
}

.paper,
.slide {
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-top: 1px solid var(--accent-primary);
}

.paper {
  padding: 2.5em 2.8em;
  margin-bottom: 2rem;
  font-size: 0.94rem;
}

/* ---------- Typography ---------- */

h1,
h2,
.metric {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.12;
  margin: 0;
  color: var(--ink-primary);
}

h1 {
  font-size: 2.15em;
  letter-spacing: -0.02em;
}

h2 {
  border-top: 1px solid var(--border-strong);
  padding-top: 0.5em;
  margin: 1.05em 0 0.45em;
  font-size: 1.32em;
}

h3,
p {
  margin: 0.42em 0;
}

h3 {
  font-size: 0.98em;
  font-weight: 600;
  color: var(--accent-primary);
}

.org,
.kicker,
.folio,
.ref,
.band-label {
  font: 500 0.82em/1.4 var(--font-sans);
  color: var(--ink-muted);
  margin: 0;
}

.org {
  color: var(--accent-primary);
  margin-bottom: 0.35em;
}

.kicker {
  color: var(--accent-primary);
  margin-bottom: 0.22em;
}

.band-label {
  display: block;
  color: var(--accent-primary);
  margin-bottom: 0.2em;
}

.mission,
.lead {
  color: var(--ink-secondary);
}

.mission {
  font-size: 1.02em;
  margin-top: 0.55em;
}

.lead {
  font-size: 1.02em;
  max-width: 56ch;
}

.scope,
.note {
  background: var(--bg-subtle);
  padding: 0.52em 0.8em;
  color: var(--ink-secondary);
}

.scope {
  border-block: 1px solid var(--border-hairline);
  font-size: 0.88em;
  margin-top: 0.7em;
}

.note {
  border-top: 1px solid var(--border-strong);
  margin-top: 0.95em;
  font-size: 0.91em;
}

.status {
  display: inline-block;
  font: 500 0.72em/1.35 var(--font-sans);
  padding: 0.1em 0.5em;
  border-radius: var(--radius-sm);
  vertical-align: 0.12em;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.prereg {
  color: var(--status-prereg);
  background: var(--status-prereg-tint);
  border: 1px solid rgba(109, 83, 24, 0.28);
}

h2 .status {
  margin-left: 0.4em;
}

.note .status {
  margin-right: 0.35em;
  vertical-align: baseline;
}

/* ---------- Tables & Lists ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92em;
}

th,
td {
  padding: 0.38em 0.6em 0.38em 0;
  vertical-align: top;
  border-bottom: 1px solid var(--border-hairline);
}

thead th {
  color: var(--ink-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom-color: var(--border-strong);
}

.paper td:nth-child(2) {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.88em;
  font-variant-numeric: tabular-nums;
}

.paper th:first-child {
  width: 24%;
}

.results,
.pair,
.bands {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4em 1.6em;
}

.tiers {
  margin: 0;
}

.tiers div {
  display: grid;
  grid-template-columns: 30% 1fr;
  gap: 0.8em;
  border-bottom: 1px solid var(--border-hairline);
  padding: 0.44em 0;
}

.tiers div:last-child {
  border-bottom-color: var(--border-strong);
}

dt {
  font-weight: 600;
  color: var(--accent-primary);
}

dd {
  margin: 0;
  color: var(--ink-secondary);
}

.inquiry {
  margin-top: 0.55em;
  font-size: 0.91em;
  color: var(--ink-secondary);
}

footer {
  font-size: 0.83em;
  color: var(--ink-muted);
  margin-top: 0.95em;
  padding-top: 0.6em;
  border-top: 1px solid var(--border-hairline);
}

/* ---------- Slide Deck Layout ---------- */

.stage {
  container-type: inline-size;
}

.slide {
  aspect-ratio: 16 / 9;
  padding: 2.6% 4.8%;
  font-size: min(1.66cqw, 19px);
  display: flex;
  flex-direction: column;
}

.folio {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border-hairline);
  padding-bottom: 0.55em;
  margin-bottom: 1.15em;
  font-variant-numeric: tabular-nums;
}

.slide h1 {
  max-width: 28em;
  font-size: 2.05em;
  margin: 0.1em 0 0.42em;
}

.slide:first-child h1 {
  font-size: 2.35em;
  max-width: 20em;
}

.bands {
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1em;
  margin: 1.15em 0;
}

.bands > div,
.pair > * {
  border-top: 1px solid var(--border-strong);
  padding-top: 0.55em;
}

.band-range {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.94em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-primary);
  margin: 0.15em 0;
}

.band-note {
  display: block;
  font-size: 0.86em;
  color: var(--ink-muted);
}

.pair b {
  display: block;
  color: var(--ink-primary);
  margin-bottom: 0.15em;
}

.metric {
  font-size: 1.65em;
  color: var(--accent-primary);
  font-variant-numeric: lining-nums tabular-nums;
  margin: 0.15em 0 0.35em;
}

.metric i {
  font-size: 0.56em;
  color: var(--ink-muted);
}

.ref {
  margin-top: auto;
  padding-top: 0.8em;
}

.slide footer {
  margin-top: auto;
}

.bom th {
  font-weight: 400;
}

.bom td {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
}

.bom tr:last-child > * {
  font-weight: 600;
  color: var(--ink-primary);
}

.controls {
  justify-content: center;
}

[hidden] {
  display: none !important;
}

/* ---------- Slide Charts (Desktop & Print SVG) ---------- */

.chart-wide {
  margin: 0.35em 0 0.7em;
}

.slide svg {
  display: block;
  width: 100%;
  height: auto;
}

.gridline {
  fill: none;
  stroke: var(--border-hairline);
  stroke-width: 1;
}

.axis-line {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1;
}

.ceiling {
  fill: none;
  stroke: var(--accent-secondary);
  stroke-dasharray: 5 4;
  stroke-width: 1.75;
}

.chart-text {
  font: 14.5px var(--font-sans);
  fill: var(--ink-secondary);
}

.chart-muted {
  font: 13.5px var(--font-sans);
  fill: var(--ink-muted);
}

.chart-mono {
  font: 13.5px var(--font-mono);
  fill: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.chart-nyquist {
  font: 600 13.5px var(--font-sans);
  fill: var(--accent-secondary);
}

.bar-label {
  font: 500 14px var(--font-mono);
  fill: #ffffff;
  font-variant-numeric: tabular-nums;
}

.bar-label--sans {
  font: 500 14px var(--font-sans);
  fill: #ffffff;
  font-variant-numeric: tabular-nums;
}

.leader-line {
  fill: none;
  stroke: var(--status-prereg);
  stroke-width: 1.25;
}

/* ---------- Compact Responsive Charts (Mobile <= 720px) ---------- */

.chart-narrow {
  display: none;
  margin: 0.75em 0 1em;
}

.m-spec {
  position: relative;
  padding: 0.25rem 0 0.5rem;
}

.m-spec__nyquist {
  position: absolute;
  top: 0;
  bottom: 1.8rem;
  left: 56.5%;
  border-left: 1.5px dashed var(--accent-secondary);
  pointer-events: none;
}

.m-spec__nyquist-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-secondary);
  margin: 0 0 0.55rem;
  text-align: right;
}

.m-spec__row {
  margin-bottom: 0.7rem;
}

.m-spec__head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.84rem;
  margin-bottom: 0.22rem;
}

.m-spec__head strong {
  color: var(--ink-primary);
  font-weight: 600;
}

.m-spec__head span {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.m-spec__track {
  position: relative;
  height: 14px;
  background: var(--bg-subtle);
  border-inline: 1px solid var(--border-hairline);
}

.m-spec__bar {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--accent-primary);
}

.m-spec__bar--high {
  background: linear-gradient(90deg, var(--accent-secondary) 0%, var(--accent-secondary) 86%, rgba(154, 67, 38, 0.18) 100%);
}

.m-spec__bar--high::after {
  content: "\2192";
  position: absolute;
  right: -0.15rem;
  top: 50%;
  transform: translateY(-54%);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-secondary);
}

.m-spec__ticks {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--border-strong);
  padding-top: 0.25rem;
  margin-top: 0.35rem;
}

.m-audit__total {
  font-size: 0.84rem;
  color: var(--ink-secondary);
  margin: 0 0 0.45rem;
}

.m-audit__bar {
  display: flex;
  width: 100%;
  height: 24px;
  overflow: hidden;
  border: 1px solid var(--border-hairline);
}

.m-audit__seg--unique {
  width: 66%;
  background: var(--accent-primary);
}

.m-audit__seg--cross {
  width: 33.4%;
  background: var(--accent-secondary);
}

.m-audit__seg--within {
  width: 0.6%;
  min-width: 3px;
  background: var(--status-prereg);
}

.m-audit__list {
  list-style: none;
  margin: 0.65rem 0 0.45rem;
  padding: 0;
  font-size: 0.86rem;
}

.m-audit__list li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.22rem 0;
  border-bottom: 1px solid var(--border-hairline);
}

.m-audit__list strong {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.m-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  display: inline-block;
  align-self: center;
}

.m-swatch--unique {
  background: var(--accent-primary);
}

.m-swatch--cross {
  background: var(--accent-secondary);
}

.m-swatch--within {
  background: var(--status-prereg);
}

.m-audit__eq {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin: 0.35rem 0 0;
}

/* ---------- Mobile Breakpoint ---------- */

@media screen and (max-width: 720px) {
  .tools {
    flex-wrap: wrap;
    gap: 0.65em;
  }

  .tools button {
    margin-left: 0;
  }

  .paper,
  .slide {
    padding: 1.25rem;
  }

  .slide {
    aspect-ratio: auto;
    font-size: 0.97rem;
  }

  .slide h1,
  .slide:first-child h1 {
    font-size: 1.65rem;
  }

  .pair,
  .results,
  .bands,
  .tiers div {
    grid-template-columns: 1fr;
  }

  .paper th:first-child {
    width: auto;
  }

  .chart-wide {
    display: none;
  }

  .chart-narrow {
    display: block;
  }
}

/* ---------- Print Layout ---------- */

@page briefpage {
  size: letter portrait;
  margin: 0.42in 0.48in;
}

@page deckpage {
  size: letter landscape;
  margin: 0.35in 0.42in;
}

@media print {
  body {
    background: #ffffff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .brief {
    page: briefpage;
  }

  .deck {
    page: deckpage;
  }

  .tools,
  .controls,
  .chart-narrow {
    display: none !important;
  }

  .chart-wide {
    display: block !important;
  }

  .paper,
  .slide {
    border: 0;
    border-top: 1pt solid var(--accent-primary);
    margin: 0;
    background: #ffffff;
  }

  .paper {
    width: 100%;
    padding: 0.12in 0 0;
    font-size: 9.2pt;
    line-height: 1.32;
  }

  .paper h1 {
    font-size: 20pt;
  }

  .paper h2 {
    font-size: 12pt;
    margin: 0.72em 0 0.32em;
    padding-top: 0.38em;
  }

  .paper .org {
    font-size: 8.5pt;
    margin-bottom: 0.2em;
  }

  .paper .mission {
    font-size: 9.4pt;
    margin-top: 0.35em;
  }

  .paper .scope {
    font-size: 8.5pt;
    padding: 0.38em 0.65em;
    margin-top: 0.45em;
  }

  .paper h3,
  .paper p {
    margin-block: 0.24em;
  }

  .paper th,
  .paper td {
    padding: 0.28em 0.45em 0.28em 0;
  }

  .paper .tiers div {
    padding-block: 0.28em;
  }

  .paper footer {
    margin-top: 0.65em;
    padding-top: 0.42em;
    font-size: 8.3pt;
  }

  .stage {
    width: 100%;
    container-type: normal;
  }

  .slide,
  .slide[hidden] {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    height: 7.75in;
    aspect-ratio: auto;
    padding: 0.22in 0.1in 0.12in;
    font-size: 13.4pt;
    line-height: 1.34;
    break-after: page;
    page-break-after: always;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .slide:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .slide .folio {
    margin-bottom: 0.9em;
  }

  .slide h1 {
    font-size: 24pt;
  }

  .slide:first-child h1 {
    font-size: 27pt;
  }

  a {
    color: var(--accent-primary);
  }
}
