/* Living footnotes — dariusz.tv
   Colours come from style.css, so they follow the site's own theme (including
   body.dark-theme, switched by the bulb). Set on body, not :root, because the dark
   theme redefines its colours on body. Link this file after style.css. */
body {
  --lf-coral: var(--label-color, #bf4e44);
  --lf-ink: var(--text-primary, #1f3442);
  --lf-paper: var(--bg-color, #fff);
  --lf-rule: var(--rule, rgba(31, 52, 66, 0.12));
  --lf-band: var(--band-bg, #f8f5f2);
  --lf-mono: monospace;
}

/* Superscript reference */
.lf-ref {
  all: unset;
  display: inline-block;
  vertical-align: super;
  font: 600 0.62em/1 var(--lf-mono);
  color: var(--lf-coral);
  padding: 0.15em 0.25em;
  margin-left: 0.05em;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: background-color .15s, color .15s;
}
/* bigger invisible tap target (~32px) without moving the text */
.lf-ref::after { content: ""; position: absolute; inset: -11px -10px; }
.lf-ref[hidden] { display: none; }
.lf-ref:hover { background: color-mix(in srgb, var(--lf-coral) 14%, transparent); }
.lf-ref:focus-visible { outline: 2px solid var(--lf-coral); outline-offset: 2px; }
.lf-ref[aria-expanded="true"] { background: var(--lf-coral); color: var(--lf-paper); }
.lf-term { text-decoration: underline dotted color-mix(in srgb, var(--lf-coral) 70%, transparent); text-underline-offset: 0.2em; }

/* Panel */
.lf-panel {
  margin: 0.25rem 0 1.75rem;
  padding: 0.9rem 0 0;
  border-top: 1px solid var(--lf-rule);   /* top line only: the next About block's own line closes it */
  opacity: 0; transform: translateY(-4px);
  transition: opacity .25s ease, transform .25s ease;
}
.lf-panel.is-open { opacity: 1; transform: none; }
/* Beat the site's .ed-column p (size 1.08rem, line height 1.8, 1.25rem gap) inside panels */
.lf-panel p { margin: 0; font-size: inherit; line-height: inherit; }
.lf-panel p.lf-cap {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  font: 500 11px/1.4 var(--lf-mono);
  letter-spacing: .08em; text-transform: uppercase;
  margin: 0 0 .7rem;
}
.lf-panel p.lf-cap b { color: var(--lf-coral); font-weight: 600; }
.lf-panel p.lf-cap span { opacity: .55; }
.lf-panel p.lf-note { font: 400 11px/1.5 var(--lf-mono); opacity: .6; margin: .6rem 0 0; }
.lf-stage { position: relative; }
.lf-panel p.lf-more { opacity: 1; margin-top: .9rem; }
.lf-panel p.lf-more a { color: var(--text-accent, #3b6f8f); text-decoration: none; letter-spacing: .04em; }
.lf-panel p.lf-more a:hover { color: var(--text-accent-hover, #bf4e44); text-decoration: underline; }
.lf-btn {
  all: unset; cursor: pointer;
  font: 500 11px/1 var(--lf-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--lf-coral); border: 1px solid currentColor; border-radius: 3px; padding: .45em .7em;
}
.lf-btn:focus-visible { outline: 2px solid var(--lf-coral); outline-offset: 2px; }
.lf-canvas { display: block; width: 100%; touch-action: pan-y; cursor: grab; border-radius: 2px; }
.lf-canvas:active { cursor: grabbing; }
.lf-canvas:focus-visible { outline: 2px solid var(--lf-coral); outline-offset: 2px; }
.lf-hl { background: color-mix(in srgb, var(--lf-coral) 16%, transparent); transition: background-color .2s; }

/* 1 · Trailer */
.lf-trailer {
  position: relative; aspect-ratio: 2.39 / 1; background: #0b0b0b; color: #fff;
  overflow: hidden; display: grid; place-items: center; border-radius: 2px;
}
.lf-trailer::before, .lf-trailer::after {
  content: ""; position: absolute; left: 0; right: 0; height: 12%; background: #000; z-index: 2;
}
.lf-trailer::before { top: 0; } .lf-trailer::after { bottom: 0; }
.lf-card { font: 600 clamp(13px, 3.4vw, 22px)/1.2 var(--lf-mono); letter-spacing: .28em; text-align: center; padding: 0 1rem; }
.lf-card.cut { animation: lf-cut .9s ease both; }
@keyframes lf-in { 0% { opacity: 0; letter-spacing: .5em; } 40%, 100% { opacity: 1; letter-spacing: .28em; } }
.lf-card.cut.hold { animation-name: lf-in; }
@keyframes lf-cut { 0% { opacity: 0; letter-spacing: .5em; } 25%, 80% { opacity: 1; letter-spacing: .28em; } 100% { opacity: 0; } }
.lf-tc { position: absolute; right: .6rem; bottom: 14%; font: 10px var(--lf-mono); color: var(--lf-coral); z-index: 3; }
/* 1 · Trailer with stills from the real video */
.lf-reel { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; border-radius: 2px; }
.lf-reel img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.04); transition: opacity .6s ease, transform 2.4s ease-out; user-select: none; }
.lf-reel img.on { opacity: 1; transform: scale(1); }
.lf-reel-title {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 0 1rem; text-align: center; color: #fff;
  font: 600 clamp(13px, 3.2vw, 20px)/1.3 var(--lf-mono); letter-spacing: .22em; text-transform: uppercase;
  opacity: 0; transition: opacity .5s ease;
}
.lf-reel-title.on { opacity: 1; }
.lf-reel .lf-tc { bottom: .6rem; }
.lf-dot { all: unset; width: 10px; height: 10px; border-radius: 50%; cursor: pointer; border: 1px solid var(--lf-coral); }
.lf-dot[aria-pressed="true"] { background: var(--lf-coral); }
.lf-dot:focus-visible { outline: 2px solid var(--lf-coral); outline-offset: 2px; }
.lf-dot { position: relative; } .lf-dot::after { content: ""; position: absolute; inset: -8px; }
.lf-row { display: flex; gap: .6rem; align-items: center; margin-top: .6rem; }

/* 2 · Explainer chart */
.lf-chart text { font: 11px var(--lf-mono); fill: currentColor; }
.lf-chart .bar { fill: var(--lf-coral); transform-box: fill-box; transform-origin: left; transform: scaleX(0); transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.lf-chart.go .bar { transform: scaleX(1); }
.lf-chart .bar.dim { fill: color-mix(in srgb, var(--lf-coral) 45%, transparent); }

/* 4 · DNA preview: the helix beside a legend and the selected pair */
.lf-dna { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.6rem; }
.lf-dna .lf-canvas { cursor: grab; touch-action: pan-y; }
.lf-dna-side { flex: 1 1 200px; min-width: 0; }
.lf-panel ul.lf-dna-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, max-content); gap: .35rem 1.2rem; font: 12px/1.4 var(--lf-mono); }
.lf-dna-legend li { display: flex; align-items: center; gap: .45rem; }
.lf-dna-sw { width: 14px; height: 6px; border-radius: 3px; flex: none; }
.lf-panel p.lf-dna-pair { min-height: 3em; margin: .9rem 0 0; font: 600 12px/1.5 var(--lf-mono); color: var(--lf-ink); }

/* 5 · Game: the Cityscape's own puzzle panel (.city-game, .city-block … are styled in style.css).
   Only undo the About column's paragraph style inside it, and add the win wave. */
.lf-panel .city-game p { margin: 0; line-height: 1.7; }
.lf-panel .city-game p.city-game-prompt { font-size: 1rem; }
.lf-panel .city-game p.city-game-help, .lf-panel .city-game p.city-game-fact { font-size: .85rem; }
.lf-panel .city-game.lf-wave .city-block { animation: lf-blockwave .6s ease-out var(--wave) both; }
@keyframes lf-blockwave { 45% { transform: translateY(-3px); box-shadow: 0 0 22px rgba(255, 201, 120, 1); filter: brightness(1.15); } }
.lf-panel p.lf-status { font: 12px/1.5 var(--lf-mono); margin-top: .7rem; }

/* 6 · AR preview: the Hiro marker on a table with the AR die (navy, white pips) */
.lf-arp {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 2px; cursor: pointer; touch-action: manipulation;
  background: linear-gradient(var(--lf-band), color-mix(in srgb, var(--lf-band) 80%, var(--lf-ink)));
  perspective: 900px; perspective-origin: 50% 20%;
}
.lf-arp:focus-visible { outline: 2px solid var(--lf-coral); outline-offset: 2px; }
.lf-arp-table {
  position: absolute; left: 50%; top: 58%; width: var(--m); height: var(--m);
  transform: translate(-50%, -50%) rotateX(62deg); transform-style: preserve-3d;
}
.lf-arp-marker { position: absolute; inset: 0; width: 100%; height: 100%; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); user-select: none; }
.lf-arp-shadow {
  position: absolute; left: 50%; top: 50%; width: calc(var(--d) * 1.15); height: calc(var(--d) * 1.15);
  transform: translate(-50%, -50%); border-radius: 22%; background: rgba(0, 0, 0, .35); filter: blur(6px);
}
.lf-arp-hop, .lf-arp-cube { position: absolute; left: 50%; top: 50%; width: var(--d); height: var(--d); margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2); transform-style: preserve-3d; }
.lf-arp-hop { transform: translateZ(calc(var(--d) / 2)); }
.lf-arp.rolling .lf-arp-hop { animation: lf-hop 1.1s cubic-bezier(.3, .6, .3, 1); }
@keyframes lf-hop { 0%, 100% { transform: translateZ(calc(var(--d) / 2)); } 35% { transform: translateZ(calc(var(--d) * 1.6)); } 70% { transform: translateZ(calc(var(--d) * .62)); } }
.lf-arp-cube { margin: 0; left: 0; top: 0; transition: transform 1.1s cubic-bezier(.2, .7, .25, 1); }
.lf-arp-face {
  position: absolute; inset: 0; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); place-items: center;
  padding: 12%; background: #2c5670; border-radius: 14%; backface-visibility: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), inset 0 -6px 12px rgba(0, 0, 0, .25);
}
.lf-arp-face i { width: 62%; height: 62%; border-radius: 50%; }
.lf-arp-face i.on { background: #fff; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3); }

.lf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .lf-panel, .lf-ref, .lf-hl { transition: none; }
  .lf-panel .city-game.lf-wave .city-block { animation: none; }
  .lf-panel { transform: none; }
  .lf-chart .bar { transition: none; }
  .lf-card.cut { animation: none; }
  .lf-arp-cube { transition: none; }
  .lf-arp.rolling .lf-arp-hop { animation: none; }
  .lf-reel img, .lf-reel-title { transition: none; transform: none; }
}
