/* Notebook analytical workspace ------------------------------------------- */
/* Scoped to the public notebook. The working column is wider than the prose
   measure and is tied to the viewport height at the chart's own 880:340 aspect
   ratio: a wide monitor gains both chart width and chart height, while a laptop
   still fits the whole plot in the first view. Settings stay below the plot so
   opening them cannot move it. No sticky management bar. */
.wrap.notebook-main { max-width: none; }
.notebook-main { padding-inline: clamp(18px, 2.4vw, 48px); }
.notebook-main .crumbs { padding-top: 6px; }
.notebook-main .page-head { padding: 16px 0; max-width: none; }
.notebook-main .page-head h1 { font-family: var(--sans); font-size: clamp(1.35rem, 3.6vw, 1.65rem); line-height: 1.15; letter-spacing: -.02em; }
.notebook-main .page-head .meta { margin: 4px 0 0; }
.notebook-head-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px 16px; flex-wrap: wrap;
}
.notebook-main .notebook-head-row .meta { margin: 0; }
.notebook-main .notebook-search, .notebook-main .notebook-selection { margin: 22px 0; }
.notebook-workspace {
  width: min(100%, 2400px, max(calc((100vh - 19.4rem) * 2.588), 40rem));
  margin-inline: auto;
}
.notebook-chart-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px 20px; flex-wrap: wrap; margin: 0 0 8px;
}
.notebook-chart-head h2 { font-family: var(--sans); font-size: clamp(1rem, 1.9vw, 1.15rem); line-height: 1.2; }
.notebook-chart-links { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.notebook-chart-links .btn { min-height: 44px; padding: 7px 10px; font-size: .85rem; }
.notebook-chart-state {
  margin: 0 0 6px; color: var(--accent); font-weight: 600; font-size: .8rem;
}
.notebook-chart-form { margin: 0; }
.notebook-chart .chart-figure { margin: 0 0 8px; }
.notebook-chart .chart-figure figcaption {
  max-width: none; margin: 0 0 6px; color: var(--muted);
  font-size: .75rem; line-height: 1.3;
}
.notebook-chart-period { margin: 0 0 4px; color: var(--ink); font-size: .8rem; line-height: 1.3; }
.notebook-chart-period-label {
  display: block; color: var(--muted); font-weight: 600; letter-spacing: 0; margin: 0 0 2px;
}
.notebook-chart-period .note { font-size: .75rem; }
.notebook-chart-sources {
  list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: 2px 20px; margin: 0; padding: 0;
}
.notebook-chart-sources li { display: grid; gap: 0; min-width: 0; }
.notebook-chart-sources strong, .notebook-chart-sources span { line-height: 1.3; font-size: .78rem; }
.notebook-chart-sources strong { color: var(--ink); }
.notebook-chart-sources .legend-swatch { vertical-align: middle; margin-right: 8px; }
.notebook-chart-alignment { margin: 10px 0 0; max-width: 78ch; }
.notebook-analysis-note { margin: 10px 0 0; max-width: 78ch; color: var(--ink); }
.cell-period { display: block; color: var(--muted); font-size: .78em; font-weight: 400; }
.cell-missing { color: var(--muted); font-style: italic; }
.notebook-calculation-side { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); }
.notebook-calculation-side h4, .notebook-calculation-side h5 { margin: 8px 0 4px; }
.notebook-calculation-side .analysis-inputs { margin-top: 6px; }
.card-chart {
  margin: 8px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.35;
}
.notebook-help {
  margin: 28px 0 0; border-top: 1px solid var(--rule); padding-top: 10px;
}
.notebook-help > summary {
  cursor: pointer; color: var(--accent); font-size: .85rem; font-weight: 600;
  padding: 6px 0;
}
.notebook-help-body { max-width: 68ch; }
.notebook-help-body p { font-size: .85rem; }
.notebook-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin: 8px 0 0;
}
.notebook-toolbar .btn { min-height: 44px; padding: 8px 12px; font-size: .85rem; }
.notebook-caveat {
  margin: 12px 0 0; padding: 8px 12px; border-left: 4px solid #d9b45a;
  background: #fbf6e8; color: #5a4a00; max-width: 78ch; font-size: .85rem;
}
.notebook-chart { margin: 4px 0 16px; padding: 16px; background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 8px; }
.notebook-chart .figure-block { grid-template-columns: 1fr; gap: 16px; }
.notebook-chart .figure-meta {
  border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 14px;
}
.notebook-chart .chart-shell, .notebook-chart .chart-figure { width: 100%; }
.notebook-chart .legend {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: 8px 20px;
}
.notebook-chart .legend li {
  display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 4px 10px;
}
.notebook-chart .legend-value { grid-column: 2; }
.notebook-definitions, .notebook-chart .provenance-details { margin-top: 12px; }
.notebook-definitions > summary, .notebook-chart .provenance-details > summary {
  cursor: pointer; color: var(--accent); font-size: .85rem; padding: 6px 0;
}
.notebook-table-scroll { overflow-x: auto; max-width: 100%; }
.notebook-table-scroll .data-table {
  display: table; width: max-content; min-width: 100%; white-space: normal;
}
.notebook-table-scroll th { max-width: 18rem; }
.notebook-chart-settings {
  margin: 16px 0 0; background: var(--paper); border: 1px solid var(--rule-strong);
  border-radius: 8px;
}
/* Settings are grouped controls, separate from chart reading and source evidence. */
.notebook-chart-settings > summary {
  display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 10px 12px; cursor: pointer; font-weight: 600;
  list-style: none; font-size: 0.95rem;
}
.notebook-chart-settings > summary span { flex: 1; min-width: 0; }
.notebook-chart-settings > summary::-webkit-details-marker { display: none; }
.notebook-chart-settings > summary > .ui-icon:last-child { transition: transform var(--motion) ease; }
.notebook-chart-settings[open] > summary { border-bottom: 1px solid var(--rule-strong); }
.notebook-chart-settings[open] > summary > .ui-icon:last-child { transform: rotate(180deg); }
.notebook-chart-options { display: grid; gap: 16px; padding: 14px 12px; }
.notebook-chart-options .settings-group {
  border: 1px solid var(--rule); border-radius: 8px; margin: 0;
  padding: 10px 12px 12px; min-width: 0; background: var(--surface);
}
.notebook-chart-options legend { font-weight: 700; padding-inline: 6px; font-size: 0.9rem; }
.notebook-chart-options .note { margin: 8px 0 0; }
.settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.notebook-count { padding: 4px 10px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); }
.notebook-count strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.notebook-chart-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  gap: 12px;
}
.notebook-chart-pair label {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; font-weight: 600;
  font-size: .85rem;
}
.notebook-chart-options .settings-group > label {
  display: flex; flex-direction: column; gap: 4px; font-weight: 600;
  font-size: .85rem;
}
.notebook-chart-options .form-select, .notebook-chart-options .form-control {
  width: 100%; max-width: 100%; min-width: 0;
}
.notebook-chart-options .btn {
  justify-self: start; min-height: 44px; padding: 8px 14px;
}
.notebook-chart-choices { display: grid; gap: 8px; margin: 8px 0 0; padding: 0; }
.notebook-chart-choices label {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px; border: 1px solid var(--rule); border-radius: 7px; cursor: pointer; background: var(--surface);
  font-size: .9rem;
}
.notebook-chart-choices label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.notebook-chart-choices label > span { min-width: 0; overflow-wrap: anywhere; }
.notebook-chart-choices .form-check-input { margin: 3px 0 0; }
.notebook-chart .chart-series-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: 14px; margin-top: 14px;
}
.notebook-chart .chart-series-meta-side {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
  padding: 16px; min-width: 0;
}
.notebook-chart .chart-series-meta-side h3 { font-size: 0.95rem; margin-bottom: 8px; }
.notebook-chart .chart-series-meta-side dl {
  display: grid; grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
  gap: 4px 12px; margin: 0; font-size: 0.8rem;
}
.notebook-chart .chart-series-meta-side dt { color: var(--muted); font-weight: 600; }
.notebook-chart .chart-series-meta-side dd { margin: 0; overflow-wrap: anywhere; }
.notebook-results { width: 100%; overflow-x: auto; }
.notebook-results .data-table { min-width: 100%; }
.notebook-results th, .notebook-results td {
  padding: 8px 8px; border-bottom: 1px solid var(--rule);
  text-align: left; vertical-align: top;
}
.notebook-results th { font-size: .75rem; font-weight: 700; color: var(--muted); }

@media (max-width: 1280px) {
  /* Large reading type needs labelled result records through tablet/laptop widths. */
  .notebook-results {
    display: block; width: 100%; overflow: visible; white-space: normal;
  }
  .notebook-results tbody, .notebook-results tr, .notebook-results td { display: block; width: 100%; }
  .notebook-results thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .notebook-results tr {
    background: var(--surface); border: 1px solid var(--rule); border-radius: 9px;
    padding: 8px 16px; margin: 0 0 12px;
  }
  .notebook-results td {
    border: 0; border-top: 1px solid var(--rule); padding: 10px 0;
    white-space: normal;
  }
  .notebook-results td:first-child { border-top: 0; }
  .notebook-results td::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    color: var(--muted); font-weight: 600;
  }
  .notebook-results td:not([data-label])::before { content: none; }
}

@media (max-width: 899px) {
  /* Below the desktop heading row: the plot stays first, settings follow it. */
  .notebook-chart-head { margin-bottom: 4px; }
}

@media (max-width: 760px) {
  .notebook-main { padding-inline: 18px; }
  .notebook-head-row { align-items: center; }
  .notebook-chart { padding: 12px; }
  .notebook-chart-head { gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
  .notebook-chart-links { gap: 8px; }
  .notebook-chart-options { padding: 16px 10px; }
  .notebook-chart-options .settings-group { padding-inline: 12px; }
  .settings-actions { align-items: stretch; flex-direction: column; }
  .settings-actions .btn { width: 100%; }
  .notebook-main .notebook-head-row .meta { margin-top: 4px; }
  .notebook-chart-caption { font-size: .8rem; }
  .notebook-chart-period { font-size: .85rem; }
  .notebook-chart-sources { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .site-footer, .search, .filters, .windows, .pager, .pagination, .app-pagination, .download { display: none; }
  .notebook-toolbar, .notebook-chart-settings, .notebook-chart-options,
  .notebook-search { display: none; }
  .notebook-workspace { width: 100%; }
  .notebook-chart-links, .notebook-help { display: none; }
  body { background: #fff; }
  .card, .figure-block, .provenance, .formula { border-color: #999; }
  .chart-scroll { overflow: visible; }
  .chart-wrap { min-width: 0; }
  /* The snapshot/causality caveat and the plot metadata must survive print. */
  .notebook-caveat { display: block; }
  /* Print selects the server SVG: the canvas and its controls never reach paper. */
  .chart-enhanced .chart { opacity: 1 !important; }
  .chart-canvas, .chart-controls, .chart-hint { display: none !important; }
  /* Evidence must reach paper even when its native disclosure is closed on screen. The
     ::details-content rule opens the browser's content wrapper; the child rule is the
     fallback for engines that still hide closed details with display:none. */
  .notebook-workspace details.notebook-definitions,
  .notebook-workspace details.provenance-details,
  .notebook-workspace details.table-details { display: block; }
  .notebook-workspace details.notebook-definitions > summary,
  .notebook-workspace details.provenance-details > summary,
  .notebook-workspace details.table-details > summary { display: none; }
  .notebook-workspace details.notebook-definitions::details-content,
  .notebook-workspace details.provenance-details::details-content,
  .notebook-workspace details.table-details::details-content {
    content-visibility: visible !important;
    display: block !important;
  }
  .notebook-workspace details.notebook-definitions > *:not(summary),
  .notebook-workspace details.provenance-details > *:not(summary),
  .notebook-workspace details.table-details > *:not(summary) {
    display: block !important;
  }
  .notebook-workspace details.notebook-definitions > table,
  .notebook-workspace details.provenance-details > table,
  .notebook-workspace details.table-details > table {
    display: table !important;
  }
  .notebook-table-scroll { overflow: visible; }
}


/* Shared tool panels keep the native forms and evidence independently usable. */
.notebook-workspace .notebook-search, .notebook-workspace .notebook-selection {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 20px;
}
.notebook-workspace .section-head h2 { font-family: var(--sans); font-size: 1.15rem; line-height: 1.2; }
.notebook-workspace .notebook-search .filters { border: 0; padding: 0; }
.notebook-workspace .notebook-help { background: var(--surface); padding: 12px 16px; border: 1px solid var(--rule); border-radius: 9px; }
.notebook-workspace .notebook-help > summary { color: var(--ink); }
.notebook-workspace details.table-details, .notebook-workspace details.notebook-definitions,
.notebook-workspace details.provenance-details, .notebook-workspace details.authored-reading,
.notebook-workspace details.analytical-options {
  margin-block: 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface);
}
.notebook-workspace details.table-details > summary,
.notebook-workspace details.notebook-definitions > summary,
.notebook-workspace details.provenance-details > summary,
.notebook-workspace details.authored-reading > summary,
.notebook-workspace details.analytical-options > summary {
  min-height: 44px; padding: 10px; color: var(--ink); font-weight: 600;
}
.notebook-workspace details[open].table-details > summary,
.notebook-workspace details[open].notebook-definitions > summary,
.notebook-workspace details[open].provenance-details > summary,
.notebook-workspace details[open].authored-reading > summary,
.notebook-workspace details[open].analytical-options > summary { border-bottom: 1px solid var(--rule); }
.notebook-workspace .analytical-options-body, .notebook-workspace .authored-note, .notebook-method-body { padding: 10px; }
.notebook-workspace .card { padding: 16px; border-radius: 8px; }
.notebook-workspace .notebook-selection .card-label { font-family: var(--sans); line-height: 1.35; }
.directory-main .page-head { padding: 20px 0 12px; }
.directory-main .page-head h1 { font-family: var(--sans); font-size: clamp(1.35rem, 3.6vw, 1.65rem); }
.directory-main .page-head .lede { font-size: 0.95rem; margin: 10px 0 0; }
.directory-main section { margin: 24px 0; }
.directory-main .section-head h2 { font-family: var(--sans); font-size: 1.1rem; }
.directory-main .compare-list { display: grid; gap: 10px; }
.directory-main .compare-item { padding: 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; }
.directory-main .compare-link { font-family: var(--sans); font-size: 1rem; line-height: 1.3; }
@media (max-width: 760px) {
  .notebook-workspace .notebook-search, .notebook-workspace .notebook-selection { padding: 16px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .notebook-chart-settings > summary > .ui-icon:last-child { transition: none; }
}
@media print {
  .notebook-chart { border: 0; padding: 0; }
  .settings-actions { display: none; }
}

/* The entry is still the operator's CMS page, rendered as a data application. */
.cms-home-main .hero { padding: 20px 0 16px; margin: 0; }
.cms-home-main .hero h1 { font-family: var(--sans); font-size: clamp(1.45rem, 4.2vw, 1.85rem); line-height: 1.15; max-width: 30ch; text-wrap: initial; }
.cms-home-main .hero .eyebrow { margin-bottom: 8px; }
.cms-home-main .hero-actions { margin: 16px 0 12px; }
.cms-home-main > .section-head { margin-block: 16px 12px; }
.cms-home-main .section-head h2 { font-family: var(--sans); }
.cms-home-main .card-label { font-family: var(--sans); }

/* Authored home search: one native GET form inside the CMS hero. Its presence hides the
   duplicate global search in the masthead without changing the rest of the shell. */
.cms-hero-search { margin: 14px 0 4px; max-width: 34rem; }
.cms-hero-search .form-control { min-height: 44px; padding: 8px 10px; font-size: 0.9rem; }
.cms-hero-search .btn { min-height: 44px; padding: 8px 14px; font-size: 0.85rem; }
.cms-hero-search .input-group { width: 100%; }

/* Compact is an authored page class, not a new global scale. It only tightens vertical
   rhythm around the existing hero, sections and card grid; type, metadata and sparklines
   keep their approved sizes. */
.cms-compact .hero { padding: 8px 0 6px; }
.cms-compact .hero h1 { font-size: clamp(1.35rem, 3.8vw, 1.65rem); }
.cms-compact .hero .lede { margin-top: 8px; margin-bottom: 8px; }
.cms-compact .hero-actions { margin: 6px 0 4px; gap: 6px; }
.cms-compact .hero-actions .btn { padding-inline: 12px; }
.cms-compact .hero .freshness { margin-top: 2px; }
.cms-compact .cms-hero-search { margin-top: 8px; }
.cms-compact > .section-head { margin-block: 8px 6px; padding-bottom: 6px; }
.cms-compact section { margin-block: 24px; }
.cms-compact .cards { gap: 14px; }
.cms-compact .card { padding: 16px; }
.cms-compact .cards-overflow { margin-top: 12px; }
@media (max-width: 600px) {
  .notebook-chart-options .settings-group { border-inline: 0; border-radius: 0; padding-inline: 0; }
}
