/* The home hero "the open ledger" (7 Nov 2026, Canvas; the immersive preview's hero.css and base.css, approved by Sergiu
   the same evening, brought onto the live site). Loaded only on a page that carries the ledger (layout.php). Every rule is
   scoped to .lg-hero or its (i) sheet .lg-sheet and every class starts with lg-, so nothing here reaches another part of the
   site. Colours are the site's own tokens (app.css); the two new ones are the stage's backdrop and the sheet's scrim, each
   with its Lamplight twin in both copies (system dark without script, and the theme switch). Type: the site's Bricolage
   Grotesque only. No inline styles anywhere (CSP): what script sets is CSSOM. The poster files carry ?v= like asset(). */

.lg-hero,
.lg-sheet {
  --lg-stage-bg: transparent;
  --lg-backdrop: rgba(31, 28, 24, .46);
  --lg-gut: 16px;
  --lg-ease: cubic-bezier(.2, .7, .2, 1);
  --lg-fast: 160ms;
  --lg-t: 380ms;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lg-hero,
  :root:not([data-theme="light"]) .lg-sheet {
    --lg-stage-bg: transparent;
    --lg-backdrop: rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] .lg-hero,
:root[data-theme="dark"] .lg-sheet {
  --lg-stage-bg: transparent;
  --lg-backdrop: rgba(0, 0, 0, .6);
}
@media (min-width: 561px) {
  .lg-hero,
  .lg-sheet {
    --lg-gut: 20px;
  }
}

/* The hero. The section is a .home-hero too (app.css): the old hero's top room (clear of a season's garland), its glow and the
   season's hero layer (sky, frost, its own snow, the crystals) stay exactly as they are, under the content like the old .wrap. */
.lg-hero {
  font-family: var(--font-head);
  font-optical-sizing: auto;
  color: var(--ink);
  overflow-wrap: break-word;
}
.lg-pin {
  position: relative;
  display: flex;
  flex-direction: column;
}
/* The old hero's head, centred like every mascot (Sergiu, 31 Oct): the mascot, "0% platform fee", the headline, the line under it. */
.lg-hero .lg-head {
  padding: 0 var(--lg-gut);
}
.lg-hero .lg-head .mascot img {
  width: 64px;
  height: 64px;
}
.lg-hero .lg-h1 {
  max-width: 13em;
  margin: 4px auto 12px;
  font-family: var(--font-head);
  font-size: clamp(27px, 7.6vw, 40px);
  font-weight: 740;
  line-height: 1.02;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.lg-h1 span {
  display: inline;
}
.lg-hero .lg-lead {
  margin: 0 auto;
  max-width: 46ch;
}

/* (i): a small round button at the end of the live numbers; without script it is not drawn (it would do nothing). */
.lg-ibtn {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--lg-fast) var(--lg-ease);
}
.lg-ibtn svg {
  width: 20px;
  height: 20px;
}
.lg-ibtn:hover {
  background: var(--surface-2);
}
.lg-ibtn[hidden],
html:not(.lg-js) .lg-ibtn {
  display: none;
}

/* The stage: a fixed 3:2 frame, the poster under the canvas, the page scroll never trapped. */
.lg-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--lg-stage-bg);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
@supports not (aspect-ratio: 1) {
  .lg-stage {
    height: 0;
    padding-bottom: 66.667%;
  }
}
.lg-stage:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}
@media (pointer: fine) {
  .lg-stage {
    cursor: grab;
  }
  .lg-stage:active {
    cursor: grabbing;
  }
}
.lg-poster,
.lg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.lg-poster {
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-image: url(../img/ledger-poster-day-840.webp?v=15e8394f69);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lg-poster {
    background-image: url(../img/ledger-poster-night-840.webp?v=5c4754e2fa);
  }
}
:root[data-theme="dark"] .lg-poster {
  background-image: url(../img/ledger-poster-night-840.webp?v=5c4754e2fa);
}
@media (min-width: 900px) and (min-resolution: 1.5dppx) {
  .lg-poster {
    background-image: url(../img/ledger-poster-day-1680.webp?v=2582ca3273);
  }
}
@media (min-width: 900px) and (min-resolution: 1.5dppx) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lg-poster {
    background-image: url(../img/ledger-poster-night-1680.webp?v=35fd788759);
  }
}
@media (min-width: 900px) and (min-resolution: 1.5dppx) {
  :root[data-theme="dark"] .lg-poster {
    background-image: url(../img/ledger-poster-night-1680.webp?v=35fd788759);
  }
}
.lg-canvas {
  display: block;
  max-width: none;
  opacity: 0;
  transition: opacity var(--lg-t) var(--lg-ease);
}
.lg-hero[data-mode="live"] .lg-canvas {
  opacity: 1;
}

/* The open page's details. */
.lg-detail {
  padding: 0 var(--lg-gut);
}
.lg-causes {
  margin: 0;
  padding: 0;
  list-style: none;
}
.lg-cause {
  position: relative;
  margin: 0;
}
.lg-cause[hidden],
html.lg-js .lg-hero:not(.is-live) .lg-cause.is-later {
  display: none;
}
.lg-thumb {
  display: none;
}
/* A page the owner marked urgent carries the site's own red "Urgent" tag at the start of its title link (the word says it, never
   colour alone), small enough to sit in the title's first line. */
.lg-hero .lg-title .lg-urgent {
  gap: 4px;
  margin: 0 4px 0 0;
  padding: 3px 8px;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.1;
  letter-spacing: .01em;
  vertical-align: 3px;
}
.lg-hero .lg-title .lg-urgent svg {
  width: 12px;
  height: 12px;
}
.lg-hero .lg-title {
  margin: 2px 0 8px;
  font-family: var(--font-head);
  font-size: 21px;
  font-weight: 660;
  line-height: 1.14;
  letter-spacing: -.012em;
  color: var(--ink);
}
/* The title link's tap area is 44 px tall; padding and the same negative margin keep the layout box the text. */
.lg-hero .lg-title a {
  display: block;
  padding: 10px 0;
  margin: -10px 0;
  color: var(--ink);
  text-decoration: none;
}
.lg-hero .lg-title a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
.lg-hero .lg-amount {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  margin: 0;
  font-size: 15px;
  color: var(--ink-2);
}
.lg-amount strong {
  font-size: 20px;
  font-weight: 720;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lg-goal {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lg-bar {
  display: block;
  width: 100%;
  height: 6px;
  margin: 8px 0 0;
}
.lg-bar-track {
  fill: var(--surface-3);
}
.lg-bar-fill {
  fill: var(--gold);
}
.lg-hero .lg-proof {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 560;
  color: var(--green);
}
.lg-proof svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.lg-hero .lg-give {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  margin: 12px 0 0;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--on-gold);
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: normal;
  transition: background var(--lg-fast) var(--lg-ease);
}
.lg-give svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.lg-hero .lg-give:hover {
  background: var(--gold-deep);
}
.lg-hero a:focus-visible,
.lg-hero button:focus-visible,
.lg-sheet a:focus-visible,
.lg-sheet button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Pager: two round buttons and the position between them. Without script every cause is listed instead. */
.lg-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 4px;
}
html:not(.lg-js) .lg-pager {
  display: none;
}
.lg-hero .lg-count {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  overflow-wrap: normal;
  white-space: nowrap;
}
.lg-round {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--lg-fast) var(--lg-ease);
}
.lg-round svg {
  width: 18px;
  height: 18px;
}
.lg-round:hover:not(:disabled) {
  background: var(--surface-2);
}
.lg-round:disabled {
  opacity: .38;
  cursor: default;
}

/* Live numbers, one row with (i) at its end: three columns, a caption may take two lines between words (never inside one). */
.lg-numbers {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px var(--lg-gut) 0;
  padding: 12px 0 18px;
  border-top: 1px solid var(--line);
}
.lg-hero .lg-live {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: start;
  gap: 4px 22px;
  margin: 0;
  padding: 0;
}
.lg-live div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
}
.lg-hero .lg-live dt {
  font-size: 13px;
  font-weight: 480;
  line-height: 1.25;
  color: var(--ink-3);
}
.lg-hero .lg-live dd {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lg-ok {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.lg-ok svg {
  width: 16px;
  height: 16px;
  color: var(--green);
}

/* Without script the first four causes are listed (the book holds every cause since 8 Nov 2026; a list of all of them
   would push the page far down, and /explore lists them all); without the 3D ledger each cause shows its photo as a small
   print, cut 3:2 from the middle like the cause cards. */
html:not(.lg-js) .lg-cause + .lg-cause {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
html:not(.lg-js) .lg-cause:nth-child(n + 5) {
  display: none;
}
html:not(.lg-js) .lg-thumb,
.lg-hero[data-mode="poster"] .lg-thumb {
  display: block;
  float: right;
  width: 96px;
  height: 64px;
  margin: 4px 0 6px 12px;
  object-fit: cover;
  border: 3px solid #FBF9F4;
  box-shadow: 0 1px 3px rgba(31, 28, 24, .25);
  transform: rotate(1.5deg);
  filter: var(--photo-filter);
}

/* Scroll mode (data-turn="scroll"): one stop per page, the hero pinned while the pages turn (clip, not hidden, so the pin holds). */
.lg-scroll {
  height: calc(100svh + (var(--pages, 4) - 1) * 60svh);
}
.lg-hero.lg-scroll {
  overflow: clip;
}
.lg-scroll .lg-pin {
  position: sticky;
  top: var(--head-h);
  min-height: calc(100svh - var(--head-h));
}

/* Phones: the book and the open page's Donate on the first screen at 360 x 780 with the longest real titles, in every language,
   with a season's garland: the mascot small above the headline, then the book and its page, the live numbers, and the old hero's
   label and line as the hero's last words (their place in the page's text stays under the headline). A long title keeps to two
   lines (the whole title stays in the link, read in full by screen readers and on the cause page). Every tap stays 44 px. */
@media (max-width: 599px) {
  .lg-hero .lg-head {
    display: contents;
  }
  .lg-hero .lg-head .mascot {
    order: 1;
    padding: 0 var(--lg-gut);
  }
  .lg-hero .lg-h1 {
    order: 2;
    margin-bottom: 10px;
    padding: 0 var(--lg-gut);
  }
  .lg-stage {
    order: 3;
  }
  .lg-detail {
    order: 4;
  }
  .lg-numbers {
    order: 5;
  }
  .lg-hero .lg-eyebrow {
    order: 6;
    margin: 6px auto 10px;
  }
  .lg-hero .lg-lead {
    order: 7;
    margin: 0 auto 8px;
    padding: 0 var(--lg-gut);
    font-size: 1.06rem;
  }
  .lg-tt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
  }
  .lg-hero .lg-give {
    min-height: 48px;
    margin-top: 10px;
  }
  .lg-pager {
    padding: 4px 0 2px;
  }
  .lg-hero .lg-title {
    margin: 0 0 6px;
  }
  .lg-bar,
  .lg-hero .lg-proof {
    margin-top: 6px;
  }
  .lg-numbers {
    margin-top: 10px;
    padding: 8px 0 12px;
  }
  .lg-hero .lg-live {
    column-gap: 14px;
  }
  .lg-hero .lg-live dt {
    font-size: 12px;
  }
}

/* Tablets: one column, the stage capped; the head as in the old hero, the mascot at its size. */
@media (min-width: 600px) {
  .lg-pin {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 var(--lg-gut);
  }
  .lg-stage {
    border-radius: 4px;
  }
  .lg-hero .lg-head,
  .lg-detail {
    padding: 0;
  }
  .lg-hero .lg-head {
    margin-bottom: 26px;
  }
  .lg-hero .lg-head .mascot img {
    width: 112px;
    height: 112px;
  }
  .lg-hero .lg-h1 {
    margin: 0 auto 14px;
    font-size: 40px;
  }
  /* One line per sentence, each as wide as its words, so the swoosh stays under its own words (like the old hero's 12em title). */
  .lg-h1 span {
    display: block;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
  }
  .lg-numbers {
    margin-left: 0;
    margin-right: 0;
  }
  .lg-hero .lg-give {
    align-self: flex-start;
    display: inline-flex;
  }
}

/* Computers: the old hero's head centred across the top, then the ledger on the left and the open page on the right, inside the
   site's own width (the header's edges). */
@media (min-width: 900px) {
  .lg-pin {
    display: grid;
    grid-template-columns: minmax(0, 1.42fr) minmax(300px, 1fr);
    grid-template-rows: auto auto auto 1fr auto;
    grid-template-areas:
      "head head"
      "stage detail"
      "stage ."
      "stage ."
      "stage live";
    column-gap: 48px;
    width: min(var(--wrap), 100% - 40px);
    max-width: none;
    margin: 0 auto;
    padding: 0 0 8px;
  }
  /* The head a little more compact than the old hero's (its top room is still clear of the garland), so the book and the open
     page's Donate rise into the first screen. */
  .lg-hero.home-hero {
    padding-top: 48px;
  }
  .lg-hero .lg-head {
    grid-area: head;
    margin-bottom: 24px;
  }
  .lg-hero .lg-head .mascot img {
    width: 96px;
    height: 96px;
  }
  .lg-hero .lg-lead {
    max-width: 62ch;
  }
  .lg-hero .lg-eyebrow {
    margin-bottom: 14px;
  }
  .lg-hero .lg-h1 {
    max-width: none;
    margin-bottom: 12px;
    font-size: clamp(40px, 3.9vw, 60px);
  }
  .lg-stage {
    grid-area: stage;
    align-self: start;
  }
  .lg-detail {
    grid-area: detail;
  }
  .lg-hero .lg-title {
    font-size: 27px;
  }
  .lg-amount strong {
    font-size: 23px;
  }
  .lg-hero .lg-give {
    display: inline-flex;
    min-width: 220px;
  }
  .lg-numbers {
    grid-area: live;
    margin: 18px 0 0;
    padding-bottom: 6px;
  }
  .lg-scroll .lg-pin {
    align-content: center;
  }
}

/* The (i) sheet: a modal dialog, a bottom sheet on phones and a panel from 600 px. */
.lg-sheet {
  width: 100%;
  max-width: 100%;
  max-height: 86svh;
  margin: auto 0 0;
  padding: 18px 20px calc(22px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-head);
  font-optical-sizing: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.lg-sheet::backdrop {
  background: var(--lg-backdrop);
}
.lg-sheet[open] {
  animation: lg-up var(--lg-t) var(--lg-ease);
}
@keyframes lg-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}
.lg-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.lg-sheet h2 {
  margin: 8px 0;
  font-family: var(--font-head);
  font-size: 23px;
  font-weight: 720;
  line-height: 1.1;
  letter-spacing: -.015em;
  color: var(--ink);
}
.lg-sheet h3 {
  margin: 20px 0 6px;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--ink);
}
.lg-sheet p,
.lg-sheet li {
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 62ch;
}
.lg-sheet p {
  margin: 0 0 8px;
}
.lg-sheet ul {
  margin: 0 0 12px;
  padding-left: 20px;
}
.lg-sheet li + li {
  margin-top: 4px;
}
.lg-sheet .lg-small {
  font-size: 13.5px;
  color: var(--ink-3);
}
.lg-close {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}
.lg-close svg {
  width: 18px;
  height: 18px;
}
.lg-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 16px 0 0;
}
.lg-sheet .lg-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  font-weight: 580;
  color: var(--ink);
  text-underline-offset: 4px;
  overflow-wrap: normal;
}
@media (min-width: 600px) {
  .lg-sheet {
    max-width: 540px;
    margin: auto;
    border-radius: 16px;
    padding-bottom: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lg-canvas,
  .lg-ibtn,
  .lg-give,
  .lg-round {
    transition: none;
  }
  .lg-sheet[open] {
    animation: none;
  }
}
