/* Slides are laid out on a 1920x1080 (16:9) canvas; scale text to match (theme default is 42px for 960 wide) */
:root {
  --r-main-font-size: 80px;
  --r-heading-text-transform: none; /* theme default is uppercase: keep titles as written */
}

.reveal .caption {
  text-transform: none;
  background: rgba(0, 0, 0, 0.55);
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 6px;
}

/* Credits slides (generated from media/manifest.json) */
.reveal .credit-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 28px 20px; font-size: 0.3em;
  width: 1840px; margin: 0 auto; /* 6 columns x 2 rows: 12 items per screen */
}
.reveal .credit-card { margin: 0; text-align: left; }
.reveal .credit-card img,
.reveal .credit-card video {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; margin: 0; display: block;
}
.reveal .credit-card figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; line-height: 1.25; }
.reveal #credits h3 { font-size: 0.9em; margin: 0 0 28px; }
.reveal .credit-owner { opacity: 0.85; }
.reveal .credit-source { opacity: 0.55; word-break: break-all; }

/* Slide 3: celestial bodies overlaying the Babylon images, with labels.
   Layout (1920x960 area): Sun + Moon stacked on the left, the five planets in a labelled group box on the right. */
.reveal .body-grid { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 60px; }
.reveal .body-col { display: flex; flex-direction: column; gap: 30px; }
.reveal .body-row { display: flex; align-items: center; justify-content: center; gap: 30px; }
.reveal .body-group {
  position: relative; display: flex; flex-direction: column; gap: 30px;
  border: 3px solid rgba(255, 255, 255, 0.6); border-radius: 28px; padding: 76px 36px 36px;
}
.reveal .body-group-label { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); font-size: 0.5em; }
.reveal .body-fig { position: relative; margin: 0; }
.reveal .body-fig img { width: auto; max-width: none; max-height: none; margin: 0; display: block; }
.reveal .body-col .body-fig img { height: 380px; }
.reveal .body-group .body-fig img { height: 330px; }
/* a body's label sits on top of the lower part of the body */
.reveal .body-fig .caption { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); white-space: nowrap; font-size: 0.5em; }

/* Slide 5: lunar eclipse. A feathered round shadow sweeps over the moon once the slide is shown. */
.reveal .eclipse-panel {
  position: absolute; left: 780px; top: 160px; width: 1080px; height: 880px;
  background: #030409; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.reveal .eclipse-moon { position: relative; width: 560px; height: 560px; border-radius: 50%; overflow: hidden; }
.reveal .eclipse-moon img { width: 100%; height: 100%; margin: 0; max-width: none; max-height: none; display: block; }
.reveal .eclipse-shadow {
  position: absolute; left: 50%; top: 50%; width: 1500px; aspect-ratio: 1; translate: -50% -50%; /* centred on the moon; transform is left to the animation */
  border-radius: 50%; pointer-events: none;
  /* solid core with a soft, feathered rim */
  background: radial-gradient(circle closest-side, rgba(14, 6, 4, 0.96) 0%, rgba(14, 6, 4, 0.96) 58%, rgba(14, 6, 4, 0) 100%);
  transform: translateX(-1200px);
}
.reveal section.present .eclipse-shadow { animation: eclipse-pass 12s ease-in-out 1s infinite; }
@keyframes eclipse-pass {
  from { transform: translateX(-1200px); }
  to   { transform: translateX(1200px); }
}

/* Slide 6: Aristarchus' right triangle Earth - Moon - Sun (not to scale) */
.reveal .triangle-panel {
  position: absolute; left: 660px; top: 160px; width: 1200px; height: 880px;
  background: #030409; border-radius: 6px; overflow: hidden; /* keeps glows etc. inside the panel */
}
.reveal .triangle-panel svg { position: absolute; inset: 0; margin: 0; max-width: none; max-height: none; }
.reveal .triangle-panel img, .reveal .triangle-panel video { position: absolute; margin: 0; max-width: none; max-height: none; translate: -50% -50%; }
.reveal .triangle-panel video { width: 150px; height: 150px; object-fit: cover; border-radius: 50%; }

/* Slide 7: total solar eclipse. The orange corona only lights up once the Moon has settled over the Sun
   (the auto-animate transition takes 1.2s, hence the delay). */
.reveal .triangle-panel img.eclipse-sun { border-radius: 50%; }
.reveal section.present .triangle-panel img.eclipse-sun { animation: corona 2.5s ease-out 1s both; }
@keyframes corona {
  from { box-shadow: 0 0 0 0 rgba(255, 150, 40, 0), 0 0 0 0 rgba(255, 90, 0, 0); }
  to   { box-shadow: 0 0 25px 12px rgba(255, 160, 50, 0.95), 0 0 65px 38px rgba(255, 100, 10, 0.55), 0 0 130px 70px rgba(255, 70, 0, 0.25); }
}

/* Slide 7: the Moon starts exactly over the Sun (x=1450, y=241, 325px) and on click moves midway between the Earth
   (150,600) and the Sun (1450,240) -> (800,420), at half the size (162.5px), so it fits between the tangent lines. */
.reveal .triangle-panel img.moon-midway { left: 1450px; top: 241px; width: 325px; }
/* The move is only forced (!important) once the fragment is shown: reveal.js auto-animate leaves its own transition
   (transform only) on matched elements, and overriding it while the slide is being entered breaks the arrival animation. */
.reveal .triangle-panel img.moon-midway.visible {
  left: 800px; top: 420px; width: 162.5px;
  transition: left 1.2s ease-in-out, top 1.2s ease-in-out, width 1.2s ease-in-out !important;
}
/* the corona fades out as soon as the Moon moves away */
.reveal section.present .triangle-panel:has(.moon-midway.visible) img.eclipse-sun { animation: corona-off 0.8s ease-in both; }
@keyframes corona-off {
  from { box-shadow: 0 0 25px 12px rgba(255, 160, 50, 0.95), 0 0 65px 38px rgba(255, 100, 10, 0.55), 0 0 130px 70px rgba(255, 70, 0, 0.25); }
  to   { box-shadow: 0 0 0 0 rgba(255, 150, 40, 0), 0 0 0 0 rgba(255, 90, 0, 0), 0 0 0 0 rgba(255, 70, 0, 0); }
}

/* Slide 7, subslide: distance labels. Click 2 moves them to the centre of the Moon (800,420) and the Sun (1450,240)
   (dominant-baseline is 'hanging', so y is the top of the text: centre minus about half the font size). */
.reveal .triangle-panel text.lbl-1m, .reveal .triangle-panel text.lbl-19m {
  stroke: #000; stroke-width: 0; stroke-linejoin: round; paint-order: stroke;
  transition: transform 1.2s ease-in-out, stroke-width 1.2s ease-in-out;
}
.reveal .triangle-panel text.lbl-1m  { transform: translate(500.8px, 559.3px) rotate(-8.56deg); }
.reveal .triangle-panel text.lbl-19m { transform: translate(1085.8px, 471.3px) rotate(-8.56deg); }
.reveal .triangle-panel:has(.step2.visible) text.lbl-1m  { transform: translate(800px, 392px) rotate(0deg); stroke-width: 8px; }
.reveal .triangle-panel:has(.step2.visible) text.lbl-19m { transform: translate(1450px, 212px) rotate(0deg); stroke-width: 8px; }
/* Click 2: while the labels shift, the coin, its cone and its labels fade away */
.reveal .triangle-panel img.coin, .reveal .triangle-panel .coin-cone { transition: opacity 1.2s ease-in-out; }
.reveal .triangle-panel:has(.step2.visible) img.coin, .reveal .triangle-panel:has(.step2.visible) .coin-cone { opacity: 0; }
/* Click 3: 19M (on the Sun) is replaced by 400M, same place and outline; the old label fades instead of jumping */
.reveal .triangle-panel text.lbl-400m { transform: translate(1450px, 212px); stroke: #000; stroke-width: 8px; stroke-linejoin: round; paint-order: stroke; }
.reveal .triangle-panel text.lbl-19m { transition: transform 1.2s ease-in-out, stroke-width 1.2s ease-in-out, opacity 0.6s ease-in-out; }

/* formaat-maan slide: the Moon starts just under the bottom ray (ray y=642, Moon 110px: centre 697 = top edge touching the ray)
   and rises to just above it (centre 587 = bottom edge touching), then an equally sized hourglass fades in beside it. */
.reveal .triangle-panel img.moon-rise { left: 1550px; top: 697px; width: 110px; }
.reveal .triangle-panel img.moon-rise.visible { animation: moon-rise 4s ease-in-out both; }
@keyframes moon-rise { from { top: 697px; } to { top: 587px; } }
.reveal .triangle-panel svg.hourglass {
  inset: auto; left: 1676px; top: 587px; width: 110px; height: 110px; translate: -50% -50%; opacity: 0;
}
.reveal .triangle-panel:has(img.moon-rise.visible) svg.hg1 { animation: hourglass-in 0.8s ease-out 4s both; }
@keyframes hourglass-in { from { opacity: 0; } to { opacity: 1; } }

/* Click 2: the moon keeps rising in one smooth movement (587 -> 183 = completely above the top ray at y=238), 12s ease-in-out.
   Each hourglass fades in when the moon passes its level (477 / 367 / 257): after 4.3s, 6.3s and 8.4s of that easing curve. */
.reveal .triangle-panel:has(.hg2.visible) img.moon-rise { animation: moon-rise2 12s ease-in-out both; }
@keyframes moon-rise2 { from { top: 587px; } to { top: 183px; } }
.reveal .triangle-panel svg.hg2 { top: 477px; }
.reveal .triangle-panel svg.hg3 { top: 367px; }
.reveal .triangle-panel svg.hg4 { top: 257px; }
.reveal .triangle-panel svg.hg2.visible { animation: hourglass-in 0.8s ease-out 4.3s both; }
.reveal .triangle-panel svg.hg3.visible { animation: hourglass-in 0.8s ease-out 6.3s both; }
.reveal .triangle-panel svg.hg4.visible { animation: hourglass-in 0.8s ease-out 8.4s both; }
/* the ratio label fades in once the moon has finished its 12s movement */
.reveal .triangle-panel text.lbl-ratio { opacity: 0; }
.reveal .triangle-panel:has(.hg2.visible) text.lbl-ratio { animation: hourglass-in 0.8s ease-out 12s both; }

/* Earth's shadow on the Moon (formaat-maan slide): a dark copy of the Moon, clipped to the band between the rays (y 238..642) with
   soft edges, moving in step with the Moon (its top = Moon top - 238). */
.reveal .triangle-panel .shadow-clip {
  position: absolute; left: 0; top: 238px; width: 1800px; height: 404px; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 36px, #000 calc(100% - 36px), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 36px, #000 calc(100% - 36px), transparent 100%);
}
.reveal .triangle-panel .shadow-clip img.shadow-moon {
  left: 1550px; top: 459px; width: 110px;
  filter: brightness(0.4) sepia(1) saturate(4) hue-rotate(-22deg); opacity: 0.93;
}
.reveal .triangle-panel:has(.moon-rise.visible) img.shadow-moon { animation: shadow-rise 4s ease-in-out both; }
@keyframes shadow-rise { from { top: 459px; } to { top: 349px; } }
.reveal .triangle-panel:has(.hg2.visible) img.shadow-moon { animation: shadow-rise2 12s ease-in-out both; }
@keyframes shadow-rise2 { from { top: 349px; } to { top: -55px; } }

/* Rays that draw themselves from the Sun to the Earth when their fragment becomes visible (slide 9) */
.ray-draw line { stroke-dasharray: 1; stroke-dashoffset: 1; }
.ray-draw.visible line { stroke-dashoffset: 0; transition: stroke-dashoffset 2.5s ease-in-out; }
.ray-draw.visible line:nth-child(2) { transition-delay: 0.4s; }

/* Schaal slide: on click 1 the Sun and Earth shrink to the true scale of their distance (centre to centre = 1550px) */
.schaal-panel:has(.sch-dist.visible) .sch-sun   { left: 200px !important;  width: 14.4px !important;  transition: left 3s ease-in-out, width 3s ease-in-out !important; }
.schaal-panel:has(.sch-dist.visible) .sch-earth { left: 1750px !important; width: 0.13px !important;  transition: left 3s ease-in-out, width 3s ease-in-out !important; }
.schaal-panel:has(.sch-dist.visible) .sch-cap-sun   { left: 200px !important; transition: left 3s ease-in-out; }
.schaal-panel:has(.sch-dist.visible) .sch-cap-earth { left: 1750px !important; transition: left 3s ease-in-out; }
/* Click 2: the Sun and its caption leave to the left, the distance caption fades away, the Earth moves to the left and grows to 740px */
.schaal-panel:has(.sch-two.visible) .sch-sun       { left: -500px !important; }
.schaal-panel:has(.sch-two.visible) .sch-cap-sun   { left: -500px !important; }
.schaal-panel:has(.sch-two.visible) .sch-earth     { left: 500px !important; width: 740px !important; }
.schaal-panel:has(.sch-two.visible) .sch-cap-earth { left: 500px !important; }
.schaal-panel:has(.sch-two.visible) .sch-dist      { opacity: 0 !important; transition: opacity 1s; }
/* ... and at the same time the Moon (3.474 km = 0.2727 x the Earth = 202px) and its caption enter from the right */
.schaal-panel:has(.sch-two.visible) .sch-moon     { left: 1650px !important; transition: left 3s ease-in-out !important; }
.schaal-panel:has(.sch-two.visible) .sch-cap-moon { left: 1650px !important; transition: left 3s ease-in-out; }
/* Click 3: the Earth shifts left and both shrink to the true scale of their distance (384.400 km centre to centre = 1400px: Earth x=250, Moon x=1650
   -> Earth 46.4px, Moon 12.7px), a bit quicker than the earlier moves */
.schaal-panel:has(.sch-three.visible) .sch-earth     { left: 250px !important; width: 46.4px !important; transition: left 2.4s ease-in-out, width 2.4s ease-in-out !important; }
.schaal-panel:has(.sch-three.visible) .sch-moon      { width: 12.7px !important; transition: left 2.4s ease-in-out, width 2.4s ease-in-out !important; }
.schaal-panel:has(.sch-three.visible) .sch-cap-earth { left: 250px !important; transition: left 2.4s ease-in-out; }
