@font-face {
  font-family: "Albert Sans";
  src: url("/brand/fonts/AlbertSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Albert Sans";
  src: url("/brand/fonts/AlbertSans-SemiBold.ttf") format("truetype");
  font-weight: 600 800;
  font-display: swap;
}

@font-face {
  font-family: Piazzolla;
  src: url("/brand/fonts/Piazzolla-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #f2f0e4;
  --surface: #fbf9ef;
  --ink: #0c251f;
  --muted: #3e5248;
  --line: #c9cbb9;
  --accent: #e2ee92;
  --accent-hover: #d5e777;
  --light-ink: #f6f5e7;
  --light-muted: #becabb;
  --font-body: "Albert Sans", "Avenir Next", sans-serif;
  --font-display: Piazzolla, Baskerville, "Times New Roman", serif;
  --page-gutter: clamp(1.25rem, 4vw, 3.5rem);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper) url("/brand/paper-grain.svg") repeat;
  font: 1.0625rem/1.55 var(--font-body);
}

a { color: inherit; text-underline-offset: .19em; }
button, input, select, textarea { font: inherit; }
button, a, input, summary { touch-action: manipulation; }
button, select, summary { cursor: pointer; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

.site-width {
  width: min(100%, 86rem);
  padding-inline: var(--page-gutter);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  z-index: 10;
  top: .65rem;
  left: .65rem;
  transform: translateY(-160%);
  padding: .5rem .9rem;
  background: var(--accent);
}

.skip-link:focus { transform: none; }

.folio-header { border-bottom: 1px solid var(--line); }

.folio-navwrap {
  display: flex;
  min-height: 4.375rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-group, .folio-navwrap nav { display: flex; align-items: center; }
.brand-group { gap: .9rem; }
.brand-group img { display: block; width: 6.3rem; height: auto; }
.folio-brand { border-left: 1px solid var(--line); padding-left: .9rem; font-weight: 700; }
.folio-navwrap nav { gap: clamp(.75rem, 2vw, 1.65rem); }
.folio-navwrap a { text-decoration: none; }
.folio-navwrap a:hover, .folio-navwrap nav a[aria-current] { text-decoration: underline; }
.folio-navwrap nav a { font-size: .9rem; font-weight: 700; white-space: nowrap; }
.source-link { padding: .42rem .65rem; border: 1px solid var(--line); }
.source-link:hover { background: var(--surface); }

.study-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(0, .94fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding-block: clamp(3rem, 5.5vw, 5rem);
  border-bottom: 1px solid var(--line);
}

.project-context { margin: 0 0 .8rem; color: var(--muted); font-size: .9rem; font-weight: 700; }
.project-context span { margin-inline: .26rem; }

.hero-copy h1, .section-heading h2, .session-section h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -.04em;
}

.hero-copy h1 { margin: 0; font-size: clamp(3.4rem, 7.1vw, 6.65rem); line-height: .99; text-wrap: balance; }
.hero-copy h1 em { font-weight: 400; }
.hero-description { margin: .95rem 0 1.45rem; max-width: 34rem; color: var(--muted); font-size: clamp(1.05rem, 1.6vw, 1.26rem); line-height: 1.48; }
.project-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.3rem; }
.primary-link, .text-link { font-size: .91rem; font-weight: 700; }
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 2.85rem;
  padding: .5rem .95rem;
  background: var(--accent);
  border: 1px solid #9da962;
  text-decoration: none;
}
.primary-link:hover { background: var(--accent-hover); }
.text-link:hover { color: #4d5e1d; }

.report-preview {
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.4rem);
  background: var(--ink);
  color: var(--light-ink);
  border: 1px solid #345148;
}

.preview-header, .preview-detail div { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.preview-header { border-bottom: 1px solid #597168; padding-bottom: .8rem; }
.preview-header h2 { margin: 0; font: 700 .95rem var(--font-body); }
.preview-header span { color: var(--accent); font: .76rem ui-monospace, monospace; }
.report-preview > p { margin: .75rem 0 .6rem; color: var(--light-muted); font-size: .87rem; }
.preview-comparison { display: grid; grid-template-columns: 1fr 1fr; margin: 0; font-variant-numeric: tabular-nums; }
.preview-comparison > div + div { border-left: 1px solid #597168; padding-left: 1rem; }
.preview-comparison dt, .preview-detail dt { color: var(--light-muted); font-size: .85rem; }
.preview-comparison dd { margin: .15rem 0 0; font: 400 clamp(1.9rem, 3.5vw, 3.15rem)/1.1 var(--font-display); }
.preview-comparison dd > span:first-child { font-size: .71em; }
.share-track {
  display: block;
  width: calc(100% - .65rem);
  height: .3rem;
  margin-top: .55rem;
  background: #ffffff20;
}
.share-track::before { display: block; height: 100%; content: ""; }
.share-reported::before { width: 60%; background: var(--light-muted); }
.share-reconciled::before { width: 50%; background: var(--accent); }
.preview-detail { margin: .85rem 0 0; border-top: 1px solid #597168; }
.preview-detail div { padding: .4rem 0; border-bottom: 1px solid #597168; }
.preview-detail dd { margin: 0; font-size: .9rem; font-weight: 700; }

.evidence-section, .session-section {
  padding-block: clamp(2.75rem, 5.6vw, 5rem);
  scroll-margin-top: 1.25rem;
}

.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 2rem; margin-bottom: 1.55rem; }
.section-heading h2, .session-section h2 { font-size: clamp(2.2rem, 4.1vw, 3.5rem); line-height: 1.04; margin: 0; }
.section-heading p, .session-section p, .panel-heading p, .reading-panel p { color: var(--muted); margin: .45rem 0 0; }

.condition-picker {
  position: relative;
  display: grid;
  flex: 0 1 20rem;
  gap: .3rem;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
}

.condition-trigger, .condition-options li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  min-height: 3rem;
  padding: .5rem .85rem;
  color: var(--ink);
  text-align: left;
}

.condition-trigger {
  width: 100%;
  border: 1px solid #a1aa97;
  border-radius: 0;
  background: var(--surface);
}

.condition-trigger:hover, .condition-trigger[aria-expanded="true"] { background: #ecefdb; }
.condition-trigger::after {
  width: .48rem;
  height: .48rem;
  margin: 0 .16rem .23rem 0;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  content: "";
}

.condition-trigger[aria-expanded="true"]::after { transform: translateY(.25rem) rotate(225deg); }
.condition-trigger:focus-visible { outline: none; }
.condition-trigger:focus-visible .condition-value { text-decoration: underline; text-underline-offset: .25em; }
@media (forced-colors: active) {
  .condition-trigger:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
}

.condition-options {
  position: absolute;
  z-index: 2;
  inset: calc(100% + .3rem) 0 auto;
  margin: 0;
  padding: .25rem;
  border: 1px solid #a1aa97;
  background: var(--surface);
  box-shadow: 0 .6rem 1.4rem #0c251f1c;
  list-style: none;
}

.condition-options li { min-height: 2.75rem; padding-inline: .55rem; cursor: pointer; }
.condition-options li[aria-selected="true"] { background: #e9efb9; }
.condition-options li.is-active, .condition-options li:hover { background: #eef1dd; }
.condition-trigger:focus-visible + .condition-options li.is-active { box-shadow: inset 2px 0 var(--ink); }
.condition-options li[aria-selected="true"]::after {
  width: .5rem;
  height: .26rem;
  margin-right: .15rem;
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: rotate(-45deg);
  content: "";
}

.condition-glyph {
  width: 1.03rem;
  height: .88rem;
  border: 1px solid #61806b;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, #61806b 2px 3px, transparent 3px 4px);
  background-origin: content-box;
  background-clip: content-box;
  padding: 1px 2px;
}

[data-mode="author"] .condition-glyph { background: linear-gradient(transparent 2px, #61806b 2px 5px, transparent 5px); }
[data-mode="independent"] .condition-glyph { background: linear-gradient(to top, #61806b 0 5px, transparent 5px); }

.evidence-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .8fr); gap: 1.25rem; align-items: start; }
.source-panel, .reading-panel, .study-note { min-width: 0; background: var(--surface); border: 1px solid var(--line); }
.panel-heading, .condition-reading, .reading-panel details, .study-note { padding: clamp(1rem, 2vw, 1.45rem); }
.evidence-grid h3, .study-note h3 { margin: 0; font-weight: 700; font-size: 1.07rem; }
.evidence-grid p { font-size: .96rem; }
.source-panel table { width: 100%; border-collapse: collapse; font-size: .92rem; text-align: left; }
.source-panel td, .source-panel th { border-top: 1px solid var(--line); padding: .55rem clamp(.75rem, 2vw, 1.45rem); }
.source-panel thead { background: #eeeee0; }
.source-panel tbody th { font-weight: 600; }
.source-panel .cited { background: #e9efb9; }
.reading-panel details { border-top: 1px solid var(--line); }
.reading-panel summary { font-weight: 600; }
.reading-panel .evidence-value { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .25rem .75rem; justify-content: space-between; }
.reading-panel strong { color: var(--ink); }
.session-section { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .8fr); gap: 1.5rem 3rem; border-top: 1px solid var(--line); }
.session-section .project-actions { margin-top: 1.15rem; }

.folio-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 1.5rem; border-top: 1px solid var(--line); padding-block: 1.25rem 2rem; font-size: .875rem; color: var(--muted); }
.folio-footer > a { font-weight: 700; }
.folio-footer nav { display: flex; flex-wrap: wrap; gap: .45rem 1.3rem; }
.folio-footer a:hover { color: var(--ink); }

@media (max-width: 760px) {
  .study-hero, .evidence-grid, .session-section { grid-template-columns: minmax(0, 1fr); }
  .study-hero { gap: 1.85rem; }
  .hero-copy h1 { font-size: clamp(3.1rem, 10vw, 5rem); }
}

@media (max-width: 530px) {
  .folio-navwrap { flex-wrap: wrap; gap: .45rem; padding-block: .7rem; }
  .folio-navwrap nav { width: 100%; gap: .55rem 1rem; flex-wrap: wrap; }
  .folio-navwrap nav a { font-size: .84rem; }
  .source-link { padding: .24rem .4rem; }
  .section-heading { display: grid; gap: .9rem; }
  .condition-picker { width: 100%; }
}

[hidden] { display: none !important; }

.denominator-figure {
  margin: .85rem 0;
  padding: .75rem;
  background: #eff0e2;
  border: 1px solid var(--line);
  font-size: .82rem;
}

.denominator-figure figcaption { font-weight: 700; margin-bottom: .5rem; }
.count-row {
  display: grid;
  grid-template-columns: minmax(4.45rem, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: .6rem;
  padding-block: .36rem;
}

.count-row + .count-row { border-top: 1px solid var(--line); }
.count-row strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.booking-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .22rem; }
.booking-strip i { height: .65rem; border: 1px solid #8d9d87; background: #dae1d1; }
.booking-strip i:nth-child(-n+3) { border-color: #536b59; background: #536b59; }
.count-reported i:last-child { background: transparent; border-style: dashed; }

.study-diagram { margin: 0; text-align: center; }
.study-diagram figcaption { font-weight: 700; text-align: left; }
.diagram-node {
  width: fit-content;
  margin-inline: auto;
  padding: .35rem .75rem;
  border: 1px solid #879884;
  background: #edf0e0;
  font-size: .88rem;
  font-weight: 700;
}

.diagram-root { margin-top: .85rem; }
.diagram-branches {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(.25rem, 1.1vw, .7rem);
  margin: 0;
  padding: 1.25rem 0;
  list-style: none;
}

.diagram-branches::before, .diagram-branches::after {
  position: absolute;
  inset-inline: 17% 17%;
  height: .65rem;
  border: solid #879884;
  content: "";
}

.diagram-branches::before { top: .6rem; border-width: 1px 1px 0; }
.diagram-branches::after { bottom: .6rem; border-width: 0 1px 1px; }
.diagram-branches li {
  display: grid;
  align-items: center;
  min-width: 0;
  min-height: 3rem;
  padding: .3rem clamp(.18rem, .7vw, .45rem);
  border: 1px solid #879884;
  background: var(--surface);
  font-size: clamp(.72rem, 1.2vw, .9rem);
  line-height: 1.23;
}

.diagram-branches li:nth-child(2)::before, .diagram-branches li:nth-child(2)::after {
  position: absolute;
  left: 50%;
  height: 1.25rem;
  width: 1px;
  background: #879884;
  content: "";
}

.diagram-branches li:nth-child(2)::before { top: 0; }
.diagram-branches li:nth-child(2)::after { bottom: 0; }
.diagram-outcome { background: #e9efb9; }
.study-diagram > p { margin-top: .85rem; font-size: .86rem; }
