/* ============================================================
   LIGHT LAYER — loaded THIRD, after ../../css/custom.css (the v1
   dark base, shared with the v1 deck and never edited) and
   css/v2.css. Removing this one <link> restores the dark deck
   byte-for-byte; nothing below is required by the markup.

   Two jobs:

     1. Redefine the palette tokens the base sheets declare on
        :root. That carries most rules across for free, because
        the semantics are attached to the token name, not to the
        lightness: amber is Ricci / matter / focusing / FK, cyan
        is Weyl / tides / shearing / FF, green is agreement with
        truth, violet is sft-wick, red is "this does not
        converge". Only the lightness moves.

     2. Override, one by one, every rule in custom.css and v2.css
        that bypasses a token and paints a literal tuned for a
        slate ground. Those are grouped below by source file and
        line so the two dark sheets can be diffed against this
        one when either changes.

   The palette matches scripts/_talkstyle.py's light sheet, so a
   figure's axis text and the slide's body text are the same ink.
   ============================================================ */

/* ============================================================
   0 · TOKENS
   ============================================================ */

:root {
  /* --- custom.css tokens --- */
  --bg0:       #ffffff;   /* slide ground                            */
  --bg1:       #f2f5f9;   /* card / panel fill                       */
  --ink:       #12161f;   /* primary text, axis labels               */
  --ink-dim:   #4a5567;   /* secondary text, captions   7.5:1 on bg  */
  --ink-faint: #636f7a;   /* footnotes, provenance      5.1:1 on bg  */
  --ricci:     #9f6209;   /* Ricci / matter / focusing / FK          */
  --ricci-soft:#8a5407;
  --weyl:      #0f6f96;   /* Weyl / tides / shearing / FF            */
  --weyl-soft: #0c5d80;
  --good:      #1c7a45;   /* agreement with truth / validation       */
  --rule:      #d6dce6;   /* hairlines, grid                         */

  /* --- v2.css tokens --- */
  --tool:      #6b34c4;   /* sft-wick, the machinery itself          */
  --tool-soft: #5a2aa8;
  --tool-ink:  #ffffff;   /* text on a solid --tool chip             */
  --code-bg:   #f2f5f9;
  --code-rule: #d6dce6;
  /* #b8341f sat 2.9 dE from --ricci under deuteranopia, i.e. the same colour
     to roughly one man in sixteen, and the two meet on slide 21 (the "floor"
     caveat beside the amber FK curves).  Under both common dichromacies amber,
     green and red all collapse onto the yellow axis and the blue side is
     already held by --weyl and --tool, so the only axis left is lightness:
     this is the same hue, much darker.  Measured worst-case separation across
     the accent set goes 2.9 -> 24.8 dE, contrast 11.1:1 on white.
     Keep in step with _lightstyle.py:53. */
  --warn:      #7a0c0a;   /* non-convergence, caveats                */

  /* --- new here --- */
  --spine:     #8693a5;   /* axis frame; mirrors the figure palette  */
  --chip-ink:  #ffffff;   /* text on any solid accent chip           */
  --shadow-1:  0 6px 18px rgba(18, 22, 31, 0.10);
  --shadow-2:  0 10px 28px rgba(18, 22, 31, 0.12);
}

/* On a light deck the "soft" variants can no longer be lighter than
   the base — they would fall off the page. They are re-cast as the
   slightly deeper, more saturated step, which is what their call
   sites (title h1 gradient, .venue, .byline .ph) actually need. */

/* ============================================================
   1 · custom.css OVERRIDES
   ============================================================ */

/* custom.css:30 — the viewport ground was two slate radial pools.
   Same geometry, near-white, so the canvas is not a flat sheet. */
.reveal-viewport {
  background:
    radial-gradient(1200px 800px at 78% 8%, #f4f7fb 0%, rgba(244, 247, 251, 0) 60%),
    radial-gradient(1000px 700px at 12% 96%, #eef2f8 0%, rgba(238, 242, 248, 0) 55%),
    var(--bg0);
}

/* index.html carries per-section data-background-color="#05070b" /
   "#0b0f17", which reveal writes as an inline style on the generated
   .slide-background. Neutralise it so the viewport ground shows
   through. Targets background-color only: the title slide's image
   lives on the .slide-background-content child and is untouched. */
.reveal .backgrounds .slide-background {
  background-color: transparent !important;
}

/* custom.css:79,80 + 253, v2.css:31 — solid-fill chips carried dark
   text because the dark palette's accents were pale. Every accent is
   now dark enough that white is the legible fill (4.97:1 worst case,
   on --ricci). */
.chip.ricci,
.chip.weyl,
.chip.good,
.chip.tool,
.chip.warn { color: var(--chip-ink); }
.chip.kicker { color: var(--ink-dim); background: transparent; border: 1px solid var(--rule); }

/* custom.css:107 — .figcard existed to put a light plate under the v1
   deck's dark-ink figures. On a light slide it is a white box on
   white with a heavy shadow. Neutralised rather than deleted, so any
   slide still carrying the class simply loses the plate. */
.figcard {
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}
.figcard img,
.figcard svg { border-radius: 0; }

/* custom.css:120 — GIF/video frames. The regenerated animations have
   white grounds, so the hairline border is now what delimits the
   media from the slide; it must stay. Only the shadow is softened. */
.media {
  box-shadow: var(--shadow-1);
  border: 1px solid var(--rule);
}

/* custom.css:191 and v2.css:259 — drop-shadow on a TRANSPARENT figure
   shadows the ink itself, not a card edge. Against slate that read as
   a lift; against white it is a grey smear doubling every plot line.
   Off for both. */
.reveal img.fig,
.diagstrip .diag img { filter: none; }

/* custom.css:140 — the title h1 was a white-to-pale-accent gradient,
   i.e. invisible on white. Same sweep, dark end to accent end. */
.title-wrap h1 {
  background: linear-gradient(92deg, var(--ink) 26%, var(--weyl) 74%, var(--ricci));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* custom.css:221 — the title scrim was a dark-to-transparent wash over
   the κ-map. Flipped to white-to-transparent, left-heavy, so the text
   column sits on near-solid page and the map stays visible on the
   right. Paired with the opacity drop below. */
/* A solid card on the kappa-map read as a white slab dropped on the image.
   The scrim is now a full-slide-height wash that fades out to the right, so
   there is no edge anywhere: the text sits on near-solid page, the map comes
   through progressively, and the right of the slide is close to the bare
   image. It lives on the section rather than on .title-wrap so it spans the
   whole 720px height instead of only the text block. */
.title-wrap {
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  max-width: 34em;
  padding: 0;
}
.reveal section.title-slide { position: relative; }
.reveal section.title-slide::before {
  content: "";
  position: absolute;
  left: -12vw; right: -12vw; top: -30vh; bottom: -30vh;
  background: linear-gradient(100deg,
    rgba(255, 255, 255, 0.975) 0%,
    rgba(255, 255, 255, 0.955) 42%,
    rgba(255, 255, 255, 0.78)  63%,
    rgba(255, 255, 255, 0.32)  82%,
    rgba(255, 255, 255, 0.00)  100%);
  pointer-events: none;
  z-index: 0;
}
.reveal section.title-slide > * { position: relative; z-index: 1; }

/* The cover image (assets/figures/gevolution_kappa_cover.png) is a dark
   kappa-map. At 0.18 over white it was barely there; the slide read as
   an empty page. It now runs at 0.62 and the text is protected by a
   solid card rather than by washing the whole image out, so the map is
   legible as a map. Only the title slide carries a background image, so
   this is a no-op everywhere else. */
.reveal .backgrounds .slide-background .slide-background-content {
  opacity: 0.62 !important;
}

/* custom.css:179 — .srctag is the only small print that sits on the
   κ-map rather than on the page. The map's darkest pixel at 0.18 over
   white is #d3d3d3, where --ink-faint measures 3.37:1. One step down
   in ink puts the worst case at 4.94:1, and it costs nothing on the
   slides where the tag sits on plain white (7.5:1). */
/* The srctag sits on the kappa-map, so it needs a scrim. Putting the scrim on
   the div made a full-slide-width white band that washed out the last line of
   the paper list underneath it. The scrim goes on an inner span, which
   shrink-wraps to the text. */
.srctag { color: var(--ink); background: none; padding: 0; }
.srctag > span {
  background: rgba(255, 255, 255, 0.82);
  padding: 0.25em 0.6em;
  border-radius: 8px;
}

/* custom.css:255 — the flip card. Faces keep their red/green identity
   as tints instead of near-black grounds. */
.flip-face { box-shadow: var(--shadow-1); border: 1px solid var(--rule); background: var(--bg1); }
.flip-front { border-color: #e0b0a6; background: #fdf3f1; }
.flip-back  { border-color: #a6d2ba; background: #eff8f3; }

/* custom.css:292 — the funder logos sat on white plates that
   normalised a transparent-background logo and a white-background
   one against slate. On white the plates are invisible boxes with a
   shadow. Plates removed; both files read directly on the page (the
   ERC mark is dark blue/orange ink on transparency, the Manchester
   mark is a purple block with grey wordmark). */
.acklogos img {
  background: none;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

/* ============================================================
   2 · v2.css OVERRIDES
   ============================================================ */

/* v2.css:47 — the code card. Kept as a card, but a light one: a
   near-black slab is the one thing that would still read as the old
   deck. Every token below already routes through a palette token, so
   only the two literals (the head fill and the code ink) move. */
.codecard { box-shadow: var(--shadow-1); }
.codecard .codehead { background: #e6ecf4; color: var(--ink-dim); }
/* --ink-faint on the head fill measured 4.33:1; the label is 13.8px
   uppercase, so it takes the next step down in ink. */
.codecard code,
.reveal .codecard code { color: var(--ink); }
/* v2.css:98 — numbers used --ricci-soft, which was the PALER amber.
   On white the base amber is the legible one. */
.codecard .n { color: var(--ricci); }

/* v2.css:147 — the engine step in the machine flow. Violet tint
   instead of a violet-to-slate gradient. */
.flow > .step.engine {
  background: linear-gradient(180deg, #f3ecff 0%, var(--bg1) 100%);
  box-shadow: 0 0 0 1px rgba(107, 52, 196, 0.20), var(--shadow-1);
}

/* v2.css:195 — the floating caption over full-bleed media. The
   animations now have white grounds, so a translucent white scrim
   alone would vanish into them: the hairline border and the shadow
   are what separate the caption from the frame behind it. */
.bleedcap {
  background: rgba(242, 245, 249, 0.94);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-2);
}

/* v2.css:324 — print variant of the same. */
@media print {
  .bleedcap { backdrop-filter: none; background: #f2f5f9; }
}

/* ============================================================
   3 · index.html LITERALS THAT REACH THE PAGE THROUGH KaTeX
   index.html:117,142 colour terms inside display maths with
   \textcolor{#f5b942} / {#4cc9f0} / {#b98cf5} — the DARK palette,
   hard-coded into the LaTeX source. KaTeX emits them as an inline
   `color` style, so they are re-pointed at the tokens by matching
   the literal in the style attribute. The markup stays theme-neutral.

   NOTE: the browser does NOT keep the hex. KaTeX writes the value into
   the style attribute and the engine re-serialises it as rgb(), so the
   selectors below must match BOTH forms, with and without the space
   after each comma. Matching only the hex silently does nothing.

     #f5b942 -> rgb(245, 185, 66)   Ricci
     #4cc9f0 -> rgb(76, 201, 240)   Weyl
     #b98cf5 -> rgb(185, 140, 245)  tool
   ============================================================ */
.reveal .katex [style*="f5b942" i],
.reveal .katex [style*="245, 185, 66"],
.reveal .katex [style*="245,185,66"]   { color: var(--ricci) !important; }

.reveal .katex [style*="4cc9f0" i],
.reveal .katex [style*="76, 201, 240"],
.reveal .katex [style*="76,201,240"]   { color: var(--weyl)  !important; }

.reveal .katex [style*="b98cf5" i],
.reveal .katex [style*="185, 140, 245"],
.reveal .katex [style*="185,140,245"]  { color: var(--tool)  !important; }

/* ============================================================
   4 · CHROME
   ============================================================ */

/* reveal decides light-vs-dark chrome from the data-background-color
   ATTRIBUTE, which index.html still spells "#05070b". The painted
   ground is now white but reveal keeps stamping .has-dark-background
   on .reveal, so reveal.css's own
       .reveal.has-dark-background .controls { color: #fff }
   was painting WHITE nav arrows on a white page — invisible, and not
   visible in any grep of the deck's own sheets. Same for the
   jump-to-slide input and the overlay element tokens. Re-pointed at
   the same specificity, later in the cascade. */
.reveal .progress,
.reveal .controls,
.reveal.has-dark-background .controls,
.reveal.has-light-background .controls { color: var(--weyl); }

.reveal.has-dark-background .jump-to-slide-input,
.reveal.has-light-background .jump-to-slide-input { color: var(--ink); }

.reveal.has-dark-background,
.reveal-viewport.has-dark-background {
  --r-overlay-element-bg-color: 0, 0, 0;
  --r-overlay-element-fg-color: 240, 240, 240;
}

.reveal .slide-number { color: var(--ink-faint); }
.reveal pre { box-shadow: none; }
::selection { background: rgba(15, 111, 150, 0.18); }

/* ============================================================
   Review pass: measured text sizes and contrast on the light deck.
   Every text node was walked in canvas pixels and scored against its
   real backdrop; these are the ones that failed 13px or 4.5:1.
   ============================================================ */

/* .prov ran at 11.4px, the smallest real text in the deck and present on
   fourteen slides. Up to 13.2px, and off the faintest ink onto --ink-dim. */
.prov { font-size: 0.44em; color: var(--ink-dim); line-height: 1.4; }

/* the title slide's paper list was 13.8px */
.title-wrap .papers { font-size: 0.5em; }

/* code is monospace, which reads smaller than its point size suggests */
.codecard pre, .reveal .codecard pre { font-size: 0.5em; }
.codecard .codehead { font-size: 0.5em; }

/* figure captions carry real content in this deck, not just labels */
.figcap { font-size: 0.66em; color: var(--ink-dim); }

/* the alt-bg slides were set apart by a near-black backdrop in the dark deck.
   On light, a tint of the panel colour keeps the sectioning without a slab. */
.reveal .backgrounds .slide-background.alt-bg .slide-background-content,
.reveal section.alt-bg { background-color: transparent; }

/* The paper list is the only small text on the title slide that sits over the
   kappa-map rather than over plain page. --ink-faint clears 4.5:1 on white but
   is doing it over a busy image at 15px, which reads as washed out. One step
   darker each; costs nothing, since these two rules apply only here. */
.title-slide .papers .pt { color: var(--ink); }
.title-slide .papers .pa { color: var(--ink-dim); }


/* ============================================================
   COVER: the one dark slide.
   Diagnosis from the outside review, which is better than the three
   iterations that preceded it. v1 works because it has TWO value
   families and ONE ink: dark ground, dark text panel, light type. The
   panel's edge carries no contrast, so the eye reads a single object,
   image-with-title-inside-it. The light conversion made THREE families
   (white page, mid-tone map, dark ink) and put the map at exactly the
   lightness where it fights dark type, so no opacity value could fix it.
   Everything below is scoped to .title-slide; delete the block and the
   light cover returns.
   ============================================================ */
.reveal section.title-slide {
  --ink:        #eef1f6;
  --ink-dim:    #9aa6b8;
  /* 4.46:1 on the #0b0f17 scrim at #6f7d92, just under the bar for the
     17px credit line, and the kappa-map behind it is not uniform. */
  --ink-faint:  #8b98ab;
  --weyl:       #87ddf7;
  --weyl-soft:  #87ddf7;
  --ricci-soft: #f7cd77;
}
/* The scrim was sized in vh/vw against the viewport while its containing
   block is the content-hugging section, which left a hard full-width seam
   at ~92% height with the raw map showing below it. Removed, not tuned. */
.reveal section.title-slide::before { content: none; }
.reveal .backgrounds .slide-background.title-slide { background-color: #0b0f17; }
.reveal .backgrounds .slide-background.title-slide .slide-background-content {
  opacity: 0.9 !important;
}
.title-wrap {
  background: linear-gradient(90deg,
    rgba(11, 15, 23, 0.86) 0%,
    rgba(11, 15, 23, 0.62) 60%,
    rgba(11, 15, 23, 0.18) 100%);
  padding: 1.1em 1.3em;
  border-radius: 14px;
  max-width: 36em;
}
.title-wrap h1 {
  background: linear-gradient(92deg, #ffffff 30%, var(--weyl-soft) 78%, var(--ricci-soft));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title-slide .papers .pt { color: var(--ink-dim); }
.title-slide .papers .pa { color: var(--ink-faint); }
.title-slide .srctag { color: var(--ink-faint); }
.title-slide .srctag > span { background: none; padding: 0; }
.reveal.has-dark-background .controls { color: #ffffff; }

/* ============================================================
   MASTHEAD: pin the header height.
   reveal centres each section's content box, and those boxes vary by
   ~300px, so the kicker landed anywhere from 21px to 163px down and the
   header jumped up to 88px between consecutive slides. A floor on the
   section height centres every short slide to the same offset.

   reveal.css carries `.reveal.center .slides section { min-height: 0
   !important }`, so the rule needs both that specificity and its own
   !important. Sections are flex columns: the floor does not merely pad
   the box, it stretches the content, so too high a value pushes the
   tall slides off the canvas. Measured, header top across slides 2-28:

     none 180px spread | 590 -> 52 | 610 -> 42 | 630 -> 39, no overflow
     640 -> 39 but slide 9 overflows 1px | 682 -> 19 and 16 slides
     overflow by 28px

   630 is where the spread stops improving: slides 5, 9 and 12 are
   naturally 668-682 tall and cannot be pushed further down. The title
   and bleed slides are excluded; they are full-bleed by design.

   center:false was the other candidate. It leaves the short slides
   top-heavy with ~400px of dead space and breaks the vertical stacks.
   ============================================================ */
.reveal.center .slides > section:not(.title-slide):not(.bleed),
.reveal.center .slides > section > section:not(.bleed) {
  min-height: 630px !important;   /* beats reveal's own min-height:0 !important */
}

/* The accent rule under each headline is display:block with a fixed
   width and no auto margins, so it collapsed to the h2's left content
   edge while the headline itself is centred: a stray amber-to-cyan dash
   in the left margin on 28 slides. Overridden here rather than in
   ../css/custom.css, which the v1 deck still uses. */
.reveal h2.lead::after { margin-left: auto; margin-right: auto; }

/* custom.css:104 runs .bigq .accent as a ricci-to-weyl gradient.  In the dark
   palette both ends were bright and the middle stayed readable; the light
   palette's #9f6209 and #0f6f96 interpolate through a muddy olive-grey in
   sRGB, right where the middle of the phrase falls.  One colour instead. */
.reveal .bigq .accent {
  background: none; -webkit-text-fill-color: currentColor;
  color: var(--ricci);
}
