/*
 * press.css — the structural layer.
 * Direct-perception structure: open forms, hairline rules, a single readable
 * measure, mono for labels and numerics. References ONLY the token interface
 * (var(--…)); carries no brand values. Swap tokens.css to re-skin.
 */

html {
  font-size: 18px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/*
 * (c) Donut scope — every rule below applies inside .gazette-paper but STOPS at
 * any .gazette-mount--standalone boundary (a `standalone` figure, e.g. an
 * embedded SPA). Content mounted there is excluded from gazette's reset,
 * bare-element styles and inherited typography, so it renders as it would outside
 * gazette and can bring its own CSS without the paper's cascade bleeding in. The
 * boundary reset (.gazette-mount--standalone { all: revert }) near the end of the
 * file stops properties inherited from body/:scope crossing in.
 */
@scope (.gazette-paper) to (.gazette-mount--standalone) {

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

:scope {
  box-sizing: border-box;
  max-width: var(--max-paper-width);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;

  /*
   * Inherited base typography is declared here on the in-document wrapper, not
   * only on body, so every descendant of the paper inherits gazette's values
   * directly from .gazette-paper rather than relying on the surrounding page's
   * body. The values mirror the body rule above; non-inherited page-box props
   * (margin, background) stay on body.
   */
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Front matter ---------- */
.gazette-frontmatter {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.gazette-title {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 1.25rem;
  letter-spacing: 0.0em;
}

.gazette-authors {
  font-size: 1.05rem;
  line-height: 1.5;
}

.gazette-author:not(:last-child)::after {
  content: ",";
  margin-right: 0.4em;
}

.gazette-author sup {
  font-family: var(--serif);
  font-size: 0.62em;
  color: var(--ink-muted);
  padding-left: 0.1em;
}

.gazette-affiliations {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.gazette-affiliation {
  margin: 0.1rem 0;
}

.gazette-affiliation sup {
  font-family: var(--serif);
  padding-right: 0.15em;
}

/* "Download PDF" link under the affiliations (frontmatter `pdf-download: true`). */
.gazette-pdf-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: 1rem;
  font-family: var(--serif);
  font-size: 0.82rem;
  color: var(--ink-muted);
  text-decoration: none;
}

.gazette-pdf-download:hover {
  color: var(--ink);
}

.gazette-pdf-icon {
  flex: none;
}

/* Date sits above the title, right-aligned against the measure. */
.gazette-date {
  text-align: right;
  margin-bottom: 0.25rem;
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-family: var(--serif);
}

/* ---------- Headings ---------- */
h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 2.5rem 0 0.75rem;
}

h2 {
  font-size: 1.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}

h3 {
  font-size: 1.2rem;
}

h4 {
  font-size: 1.02rem;
  color: var(--ink-fill);
}

/* ---------- Prose ---------- */
p {
  margin: 1rem 0;
}

a {
  color: var(--ink-link);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  text-decoration-thickness: 2px;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--ink-link);
}

strong,
b {
  font-weight: 600;
}

/* Inline `:trigger` controls: borderless prose buttons that drive a figure's
   update(). They sit in the run of text, so they inherit the prose font/size and
   read as a tinted chip rather than a UA button. */
.gazette-trigger {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: var(--trigger-bg);
  color: inherit;
  font: inherit;
  margin: 0.05em 0.35em;
  border-radius: 0.25em;
  cursor: pointer;
}

.gazette-trigger:hover {
  filter: brightness(0.96);
}

em,
i {
  font-style: italic;
}

ul,
ol {
  margin: 1rem 0;
  padding-left: 1.6rem;
}

li {
  margin: 0.3rem 0;
}

blockquote {
  margin: 1.25rem 0;
  padding: 0 0 0 1.2rem;
  border-left: 2px solid var(--line);
  color: var(--ink-muted);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

/* GitHub-style alert/callout: `> [!NOTE]` → <div class="gazette-note
   gazette-note--note">. Monochrome by default (chrome is paper and ink); use the
   per-type modifier classes (--note, --tip, --important, --warning, --caution)
   to tint individual kinds. */
.gazette-note {
  margin: 1.25rem 0;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--line);
  border: 3px solid var(--line-note);
  border-radius: 3px;
  font-weight: 500;
}

.gazette-note > :first-child {
  margin-top: 0;
}

.gazette-note > :last-child {
  margin-bottom: 0;
}

/* ---------- Code ---------- */
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--wash);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  font-family: var(--mono);
  font-size: 0.9rem;
  background: var(--wash);
  line-height: 1.8;
  overflow-x: auto;
  padding: 1rem 1rem;
}

pre code {
  background: none;
  padding: 0;
}

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}

th {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--ink-muted);
  text-align: left;
}

th,
td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--line);
}

/* ---------- Figures ---------- */
.gazette-figure {
  margin: 2.5rem 0;
}

.gazette-mount {
  display: block;
  width: 100%;
  min-height: 3rem;
}

/* Breakout figures (`:::figure{… max-width=90vw}`): grow wider than the text
   column, centered, without shifting surrounding content. Width is
   max(column, <n>vw) — never narrower than the column, up to <n>% of the
   viewport, and never wider than it. --gazette-fig-vw carries the <n> set
   per-figure by the figure directive. */
.gazette-figure--wide {
  width: max(100%, calc(var(--gazette-fig-vw, 100) * 1vw));
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

/* Figure plot text uses the theme font. Observable Plot defaults to system-ui
   via zero-specificity :where() rules, so this ordinary rule overrides it. */
.gazette-mount svg {
  font-family: var(--serif);
}

/* Scale an image down to fit its figure, but never up past its intrinsic pixel
   size: `width: auto` keeps the natural width, `max-width: 100%` caps it to the
   figure box, and a smaller image stays centered rather than stretched. */
.gazette-figure-img,
.gazette-static-fallback {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

figcaption {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

/* Match the bold caption lead-in: same serif, weight, and ink. */
.gazette-figure-label {
  font-weight: 600;
  color: var(--ink-fill);
}

figcaption strong {
  color: var(--ink-fill);
}

/* Inline citation / footnote marker: a bracketless superscript number linking
   into the combined list below. `line-height: 0` keeps the superscript from
   padding out the line it sits on. */
.gazette-ref-mark {
  line-height: 0;
}

.gazette-ref-mark a {
  font-weight: 500;
}

/* ---------- References ---------- */
.gazette-references {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.gazette-references h2 {
  border: none;
  font-size: 1.25rem;
}

.gazette-reference-list {
  padding-left: 1.8rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

.gazette-reference {
  margin: 0.5rem 0;
}

.gazette-reference::marker {
  font-family: var(--mono);
  color: var(--ink-muted);
}

/* ---------- Acknowledgments ---------- */
.gazette-acknowledgments {
  font-size: 0.85rem;
}

.gazette-acknowledgments h2 {
  font-size: 1.1rem;
}

/* ---------- Math ---------- */
.katex {
  font-size: 1.05em;
}

.math-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
}

} /* end (c) donut @scope */

/* Donut boundary: a `standalone` figure's mount. `all: revert` drops gazette's
   inherited typography (font/color/line-height set on body/:scope) at this
   element, so the embedded app starts from the user-agent baseline and brings
   its own styles. Content inside the mount is already excluded from gazette's
   scoped rules above. */
.gazette-mount--standalone {
  all: revert;
}

/* ---------- Print ---------- */
@page {
  size: letter;
  margin: 1in;
}

@media print {
  html {
    font-size: 10.5pt;
  }
  body {
    background: var(--paper);
  }
  .gazette-paper {
    max-width: none;
    padding: 0;
  }
  a {
    text-decoration: none;
    color: var(--ink);
  }
  /* Print the baked static figure (exported screenshot or author image); the
     live interactive mount can't lay out for the print page. */
  .gazette-mount {
    display: none !important;
  }
  .gazette-static-fallback {
    display: block !important;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
  }
  .gazette-figure {
    break-inside: avoid;
  }
  /* No viewport breakout in print: figures lie within the page text block. */
  .gazette-figure--wide {
    width: 100%;
    left: auto;
    transform: none;
  }
  .gazette-figure img {
    max-width: 100%;
    height: auto;
  }
  h1,
  h2,
  h3,
  h4 {
    break-after: avoid;
  }
}
