/* ---- Fonts (self-hosted; book/fonts/SOURCES.md): Source Serif 4 for the text and the
   headings, Inter for the interface. Variable woff2, subset; no CDN, no Google Fonts. ---- */
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 300 700; font-display: swap;
             src: url("fonts/SourceSerif4-VF-Roman.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400 700; font-display: swap;
             src: url("fonts/SourceSerif4-VF-Italic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
             src: url("fonts/Inter-VF.woff2") format("woff2"); }
:root { --font-serif: "Source Serif 4", Charter, Georgia, "Times New Roman", serif;
        --font-ui: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
        --body-size: 18px; }

/* Concept chips: a rounded background in the chip color, a 2 px bottom border in the plot color.
   The symbol itself stays in ink (STYLE.md section 2). */
/* No side padding: book/macros.html puts it in the math as \kern, which MathJax measures. */
.chip { border-radius: 4px; padding: 0; border-bottom: 2px solid; }
.chip-goal    { background: var(--chip-goal);    border-bottom-color: var(--plot-goal); }
.chip-spring  { background: var(--chip-spring);  border-bottom-color: var(--plot-spring); }
.chip-forcing { background: var(--chip-forcing); border-bottom-color: var(--plot-forcing); }
.chip-phase   { background: var(--chip-phase);   border-bottom-color: var(--plot-phase); }
.chip-basis   { background: var(--chip-basis);   border-bottom-color: var(--plot-basis); }
.chip-demo    { background: var(--chip-demo);    border-bottom-color: var(--plot-demo); }
.chip-repro   { background: var(--chip-repro);   border-bottom-color: var(--plot-repro); }

/* The four callouts: told apart by icon, title and border style, on neutral tints. The
   borders are drawn in the accent (STYLE.md section 3); the PDF keeps them in ink. The
   title is Inter: the kind as a small uppercase label, the rest in semibold, normal case
   (so a notebook name or cell title is never uppercased). Body text is the serif. */
.dmp-callout { margin: 1.6rem 0; padding: 1.1rem 1.4rem; border-radius: 10px; color: var(--ink); }
.dmp-callout > .dmp-callout-title { font-family: var(--font-ui); font-size: 15px; line-height: 1.45;
                                    font-weight: 600; margin-bottom: 0.55rem; }
.dmp-callout > .dmp-callout-title p { margin: 0; }
.dmp-callout > .dmp-callout-title strong { font-weight: 600; }
.dmp-callout .dmp-kind { font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase;
                         color: var(--accent); }
.dmp-callout .dmp-icon { color: var(--accent); }
.dmp-callout > .dmp-callout-body { font-size: 17px; line-height: 1.65; }
.dmp-callout > .dmp-callout-body > :last-child { margin-bottom: 0; }
.dmp-intuition { background: var(--box-intuition); border-left: 4px solid var(--accent); }
.dmp-math      { background: var(--box-math);      border: 1px solid var(--accent); }
.dmp-tryit     { background: var(--box-tryit);     border-left: 2px dashed var(--accent);
                 border-top: 1px solid var(--muted); border-right: 1px solid var(--muted);
                 border-bottom: 1px solid var(--muted); }
.dmp-gotcha    { background: var(--box-gotcha);    border-left: 4px double var(--accent); }
/* Display equations never scroll up and down. MathJax sizes each glyph to its ink, but the
   glyph's font box reaches up to about 0.72em below the baseline: the bottom padding holds
   it (no scrollbar, nothing clipped) and the negative margin gives the space back, so the
   gap to the next line stays the same. */
.dmp-math mjx-container[display="true"] { margin: 0.6rem 0 -0.5em; padding-bottom: 0.8em;
                                          overflow-x: auto; overflow-y: hidden;
                                          display: block; max-width: 100%; min-width: 0 !important; }
/* A wide equation scrolls inside its box on a phone; the page itself never scrolls sideways. */
.dmp-callout, .dmp-callout > .dmp-callout-body { min-width: 0; max-width: 100%; }
/* Without MathJax (JavaScript off, or the CDN unreachable) the TeX source shows: it wraps
   instead of widening the page. */
#quarto-document-content span.math.display { overflow-wrap: anywhere; }

/* Landing page: tiles and note (STYLE.md "Website brand (NYUAD)") */
.dmp-actions ul { list-style: none; padding: 0; margin: 1.2rem 0; display: grid;
                  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.8rem; }
/* Two tiles per row from 611 px (2 + 2, never 3 + 1); one per row below. */
@media (min-width: 768px) { .dmp-actions ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dmp-actions li { font-family: var(--font-ui); padding: 0.9rem 1rem; border: 1px solid var(--card-border); border-radius: 12px;
                  background: var(--page); transition: background-color 0.15s; }
.dmp-actions li:hover { background: var(--hover); }
.dmp-actions li a { font-size: 1.1em; font-weight: 700; color: var(--accent); }
.dmp-note { color: var(--ink); background: var(--box-intuition); border-left: 4px solid var(--accent);
            border-radius: 6px; padding: 0.7rem 1rem; margin: 1rem 0; }

/* ---- NYUAD brand frame (HTML only; STYLE.md "Website brand (NYUAD)") ----
   Violet marks the frame and links only, never a concept. */
body { background: var(--site-bg); }

/* Navbar: REACH logo + title on the left, NYU Abu Dhabi logo on the right. */
.navbar { background: var(--navbar-bg); }
/* Logos keep their own aspect ratio: only the height is set, they never shrink in the
   flex row, and object-fit guards against any squeeze. */
.navbar .navbar-brand-container { margin-left: 0 !important; margin-right: 0 !important; }
.navbar .navbar-brand-logo { margin-right: 0.5rem; flex-shrink: 0; }
.navbar .navbar-logo { height: 40px; max-height: none; width: auto; max-width: none;
                       flex-shrink: 0; object-fit: contain; }
.navbar .navbar-title { color: #FFFFFF; font-weight: 700; }
.navbar .nav-link img.dmp-nyuad-logo { height: 32px; width: auto; max-width: none;
                                       flex-shrink: 0; object-fit: contain; }
.navbar .navbar-nav .nav-item:has(img.dmp-nyuad-logo) { flex-shrink: 0; }
.navbar .nav-link:has(img.dmp-nyuad-logo) { padding-top: 0; padding-bottom: 0; }

/* Content area: a card on the site background, the same on every page. One column holds the
   text, the figures, the callouts, the opener and the end mark (STYLE.md "Type and layout"). */
#quarto-document-content { margin-top: 1rem; margin-bottom: 1rem; padding: 1.5rem 2rem;
                           background: var(--page); border: 1px solid var(--card-border); border-radius: 12px;
                           font-family: var(--font-serif); font-size: var(--body-size); line-height: 1.7; }
/* Sources: from 768 px a DOI never breaks. */
@media (min-width: 768px) {
  #quarto-document-content td:has(> a[href^="https://doi.org/"]) { white-space: nowrap; }
}
#quarto-document-content strong, #quarto-document-content b { font-weight: 600; }

/* Headings: serif, light display h1 (2.45x body), regular h2 (1.6x body) with its violet bar. */
#quarto-document-content h1 { font-family: var(--font-serif); font-weight: 300;
                                    font-size: calc(var(--body-size) * 2.45); line-height: 1.15;
                                    letter-spacing: -0.012em; }
body.quarto-dark #quarto-document-content h1 { font-weight: 350; }
#quarto-document-content h2 { font-family: var(--font-serif); font-weight: 400;
                              font-size: calc(var(--body-size) * 1.6); line-height: 1.25;
                              letter-spacing: -0.006em; margin-top: 1.9rem; }

/* Figures: every figure, plot or concept drawing (and a live figure), fills the text column;
   its {width=..%} is for the PDF, HTML ignores it. The caption is in Inter. */
#quarto-document-content figure img { width: 100%; max-width: 100%; height: auto; }
#quarto-document-content figure > figcaption { font-family: var(--font-ui); font-size: 14.5px;
                                               line-height: 1.5; color: var(--muted); text-align: left;
                                               margin-top: 0.7rem; margin-bottom: 0.4rem; }
.fig-label { color: var(--ink); font-weight: 600; }

/* Footnotes ("reference-location: section", HTML only): the notes of a section close it, in
   Inter under a hairline. The note number in the text keeps Quarto's pop-up. */
#quarto-document-content aside.footnotes { font-family: var(--font-ui); font-size: 14.5px; line-height: 1.5;
                                             color: var(--muted); margin-top: 1.4rem; }
#quarto-document-content aside.footnotes hr { margin: 0 0 0.8rem; width: 64px; border-top: 1px solid var(--card-border); opacity: 1; }
#quarto-document-content aside.footnotes ol { padding-left: 1.4rem; margin-bottom: 0; }
#quarto-document-content aside.footnotes li p { margin-bottom: 0.4rem; }

/* Accent: links, active chapter, h2 bar. */
#quarto-document-content h2 { border-left: 6px solid var(--accent); padding-left: 0.6rem; }
.sidebar-navigation .sidebar-link.active, .sidebar-navigation .sidebar-link.active .menu-text,
.sidebar-navigation .sidebar-link.active .chapter-title { color: var(--accent); font-weight: 600; }
.sidebar-navigation .sidebar-item-container:hover { background: var(--hover); border-radius: 6px; }
/* The chapter's sections under its entry (js/sections.js): indented, the one in view in the accent. */
.sidebar-navigation .dmp-sections { margin: 0.15rem 0 0.4rem 0.9rem; padding-left: 0.6rem;
                                    border-left: 1px solid var(--card-border); }
.sidebar-navigation .dmp-sections a { display: block; font-size: 0.85rem; line-height: 1.35; color: var(--muted);
                                      padding: 0.22rem 0.5rem; margin-left: -0.6rem; border-left: 2px solid transparent;
                                      border-radius: 0 6px 6px 0; text-decoration: none; }
.sidebar-navigation .dmp-sections a:hover { background: var(--hover); color: var(--ink); }
.sidebar-navigation .dmp-sections a.active { color: var(--accent); font-weight: 600; border-left-color: var(--accent); }
/* From 992 px the sidebar is as tall as its list and at most the screen less the navbar (68 px)
   and the footer (60 px): a longer list scrolls inside it, and the footer never pushes it up.
   !important: quarto-nav.js writes max-height inline. */
@media (min-width: 992px) { #quarto-sidebar { align-self: start; max-height: calc(100vh - 128px) !important; } }
/* The phone menu: long chapter titles wrap (Quarto sets nowrap), so the menu fits the screen. */
@media (max-width: 991.98px) {
  #quarto-sidebar .sidebar-menu-container { white-space: normal; }
  #quarto-sidebar .sidebar-item .sidebar-link { line-height: 1.3; padding-top: 0.2rem; padding-bottom: 0.2rem; }
}

/* Footer: one line where it fits. */
.nav-footer-center { flex: 1 1 auto; }

/* Code */
pre, div.sourceCode, code { background-color: var(--code-bg); }

/* Landing title block only: violet gradient, white title, affiliation in lavender. */
body.dmp-landing #title-block-header { background: linear-gradient(135deg, var(--title-from), var(--title-to));
  color: #FFFFFF; border-radius: 12px; padding: 1.6rem 1.8rem; margin-bottom: 1.6rem; }
body.dmp-landing #title-block-header .title,
body.dmp-landing #title-block-header .subtitle,
body.dmp-landing #title-block-header .author { color: #FFFFFF; }
body.dmp-landing #title-block-header.quarto-title-block.default .quarto-title-meta-author { display: block; margin-top: 1rem; }
body.dmp-landing #title-block-header .quarto-title-meta-heading { display: none; }
body.dmp-landing #title-block-header .author { font-family: var(--font-ui); font-size: 0.9em; font-weight: 700; margin: 0; }
body.dmp-landing #title-block-header .affiliation { font-family: var(--font-ui); font-size: 0.85em;
                                                    color: var(--title-affil); margin: 0; }
body.dmp-landing #title-block-header .quarto-title-meta { display: none; }

/* Chapter opener, chapters 1-9 (filters/dmp.lua, partials/title-block.html): a band in the
   landing gradient with the numeral, the kicker, the title without its "Chapter N · " prefix
   (still in the h1, visually hidden), the promise and a short rule. */
#title-block-header.dmp-opener { background: linear-gradient(135deg, var(--title-from), var(--title-to));
  color: #FFFFFF; border-radius: 12px; padding: 2.6rem 2.6rem 2.3rem; margin-bottom: 2.2rem; }
#title-block-header.dmp-opener .dmp-opener-num { display: block; font-family: var(--font-serif);
  font-weight: 300; font-size: 94px; line-height: 0.82; letter-spacing: -0.03em; color: rgba(255, 255, 255, 0.26); }
#title-block-header.dmp-opener .dmp-opener-kicker { font-family: var(--font-ui); font-size: 11.5px; font-weight: 600;
  line-height: 1; letter-spacing: 0.17em; text-transform: uppercase; color: var(--title-affil); margin: 1.1rem 0 0; }
#title-block-header.dmp-opener h1.title { color: #FFFFFF; font-weight: 300; font-size: 44px; line-height: 1.12;
  letter-spacing: -0.018em; margin: 0.65rem 0 1.05rem; }
/* Quarto's ".default .quarto-title .title { margin-bottom: 0 }" is more specific than the rule above. */
#title-block-header.dmp-opener.quarto-title-block.default .quarto-title h1.title { margin-bottom: 1.05rem; }
#title-block-header.dmp-opener .dmp-promise { font-family: var(--font-serif); font-size: 18px; line-height: 1.5;
  color: #EADFF3; margin: 0; max-width: 46ch; }
#title-block-header.dmp-opener .dmp-opener-rule { width: 64px; height: 3px; border-radius: 2px;
  background: var(--title-affil); margin-top: 1.4rem; }
#title-block-header.dmp-opener .quarto-title-meta { display: none; }
/* Below 992 px Quarto's "body.nav-sidebar #title-block-header { margin-block-end: 0 }" would
   set the opener flush on the lead paragraph; this keeps the gap at every width. */
body.nav-sidebar #title-block-header.dmp-opener { margin-block-end: 2.2rem; }
/* The robot hook under the opener: a little larger, with a two-line initial letter. It is a
   section of its own (filters/dmp.lua) whose empty heading is never shown. */
#dmp-lead-section > h2 { display: none; }
.dmp-lead > p { font-size: calc(var(--body-size) * 1.14); line-height: 1.68; }
.dmp-lead > p::first-letter { color: var(--accent); font-weight: 600; }
@supports (initial-letter: 2) or (-webkit-initial-letter: 2) {
  .dmp-lead > p::first-letter { -webkit-initial-letter: 2; initial-letter: 2; margin-right: 0.1em; }
}
/* End mark: a diamond between two hairlines (a CSS shape: the web fonts carry no U+25C6). */
.dmp-endmark { display: flex; align-items: center; gap: 14px; margin: 3rem 0 0.5rem; }
.dmp-endmark::before, .dmp-endmark::after { content: ""; flex: 1; height: 1px; background: var(--card-border); }
.dmp-endmark-diamond { width: 8px; height: 8px; background: var(--accent); transform: rotate(45deg); }

/* Live figures (HTML only; book/js/live.js draws them, filters/dmp.lua places them). As wide as
   the text, like a plot, in a card with the controls on the soft fill below. Curves take the
   concept colors only through the theme's --plot-* variables, so the light/dark toggle switches
   them; all text is ink or muted (STYLE.md section 2). Controls and readout in Inter with
   tabular numbers. --dmp-live-ready is the marker live.js waits for: without these rules (a
   stale or missing dmp.css) every SVG shape fills black, so the figure stays hidden. */
figure.dmp-live { margin: 1.4rem 0 1.6rem; --dmp-live-ready: 1; }
.dmp-live-box { background: var(--page); border: 1px solid var(--card-border); border-radius: 12px;
                overflow: hidden; font-family: var(--font-ui); color: var(--ink); }
.dmp-live-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 16px 0; }
.dmp-live-badge { font-size: 10.5px; font-weight: 600; line-height: 1; letter-spacing: 0.09em;
                  text-transform: uppercase; color: var(--accent); background: var(--hover);
                  padding: 5px 9px; border-radius: 5px; }
.dmp-live-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 0; padding: 0;
                   font-size: 13px; color: var(--muted); }
.dmp-live-legend li { display: flex; align-items: center; gap: 6px; }
.dmp-live-legend svg { overflow: visible; }
.dmp-live-plot { padding: 6px 8px 0; }
.dmp-live-plot svg { display: block; width: 100%; height: auto; font-family: var(--font-ui); }
.dmp-live-grid line { stroke: var(--muted); stroke-opacity: 0.25; stroke-width: 0.5; }
.dmp-live-frame { fill: none; stroke: var(--muted); stroke-opacity: 0.45; stroke-width: 0.8; }
.dmp-live-tick text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dmp-live-axis { fill: var(--ink); font-size: 12.5px; }
.dmp-live-sub { font-size: 9.5px; }
.dmp-live-demo { fill: none; stroke: var(--plot-demo); stroke-width: 2; stroke-dasharray: 7 5; }
.dmp-live-repro { fill: none; stroke: var(--plot-repro); stroke-width: 2.5; stroke-linejoin: round; }
.dmp-live-goal { stroke: var(--plot-goal); stroke-width: 2; stroke-dasharray: 0.1 5; stroke-linecap: round; }
.dmp-live-goal-star { fill: var(--plot-goal); stroke: var(--page); stroke-width: 1; }
.dmp-live-forcing { fill: none; stroke: var(--plot-forcing); stroke-width: 2; }
.dmp-live-forcing-area { fill: var(--plot-forcing); fill-opacity: 0.25; stroke: none; }
.dmp-live-controls { display: flex; flex-wrap: wrap; gap: 16px 28px; padding: 14px 18px 10px;
                     background: var(--box-intuition); border-top: 1px solid var(--card-border); }
.dmp-live-ctl { display: flex; flex-direction: column; gap: 6px; flex: 1 1 190px; min-width: 190px; }
.dmp-live-lab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
                font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.dmp-live-lab label { margin: 0; }
.dmp-live-val { color: var(--ink); font-size: 13px; font-weight: 600; letter-spacing: 0;
                font-variant-numeric: tabular-nums; white-space: nowrap; }
.dmp-live-ctl input[type="range"] { width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
.dmp-live-ticks { position: relative; height: 16px; font-size: 11px; color: var(--muted);
                  font-variant-numeric: tabular-nums; }
.dmp-live-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.dmp-live-ticks span::before { content: ""; position: absolute; left: 50%; top: -4px; width: 1px; height: 4px;
                               background: var(--muted); }
.dmp-live-ctl-check { justify-content: center; }
.dmp-live-ctl-check label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px;
                            color: var(--ink); cursor: pointer; }
.dmp-live-ctl-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.dmp-live-readout { margin: 0; padding: 2px 18px 14px; background: var(--box-intuition); font-size: 14px;
                    line-height: 1.5; color: var(--muted); font-variant-numeric: tabular-nums; white-space: pre-wrap; }
.dmp-live-readout b { color: var(--ink); font-weight: 600; }

/* Phones: no horizontal scroll; the logos shrink and the title may go. */
@media (max-width: 575.98px) {
  .navbar .navbar-logo { height: 26px; }
  .navbar .nav-link img.dmp-nyuad-logo { height: 22px; }
  .navbar .navbar-title { display: none; }
  .navbar .navbar-container { padding-left: 0.5rem; padding-right: 0.5rem; }
  /* the card reaches 0.5rem into Quarto's gutters; the text keeps its 1.5rem from the screen edge */
  #quarto-document-content { margin-left: -0.5rem; margin-right: -0.5rem; padding: 1rem calc(1.5rem - 1px);
                             border-radius: 10px; }
  #quarto-document-content h1 { font-size: calc(var(--body-size) * 1.9); }
  body.dmp-landing #title-block-header { padding: 1.1rem 1.1rem; }
  #title-block-header.dmp-opener { padding: 1.9rem 1.4rem 1.7rem; border-radius: 10px; }
  #title-block-header.dmp-opener .dmp-opener-num { font-size: 66px; }
  #title-block-header.dmp-opener h1.title { font-size: 33px; }
}
