/* Event Horizon: page-scoped rules. Kit classes carry everything else (site/kit/README.md). */

/* the page's one accent is the study's core hue, used for marks only: the plate rim and the one lit path */
:root { --th-lit: var(--th-core); }

/* hero: still first; the film (hold loop) plays on top of it only in full motion */
.eh-hero .th-visual { --ar: 16 / 9; background: var(--th-void); }
.eh-hero img, .eh-hero video { object-position: 50% 50%; }
@media (max-width: 719px) {
  .eh-hero .th-visual { --ar: 4 / 5; }
  .eh-hero img, .eh-hero video { object-position: 50% 46%; }
}
.eh-cap { margin-top: 12px; color: var(--th-ink-2); font: 400 13px/1.5 var(--th-font-ui); max-width: 62ch; }

/* section 1: how one pixel is traced */
.eh-trace { margin-top: 48px; }
.eh-trace .th-plate { padding: 0; }

/* section 2: slice and render. Resolved layout first (side by side, nothing hidden before JS and in reduced-motion mode);
   in full motion with JS the two stack, and the slice fades into the render once, when the stage is in view. */
.eh-stage { display: grid; gap: 16px; }
.eh-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.eh-pair .th-plate { margin: 0; }
.eh-slice .th-visual { --ar: 1 / 1; }
.eh-slice img { object-fit: cover; }
@media (min-width: 720px) {
  .eh-pair { grid-template-columns: minmax(0, 9fr) minmax(0, 16fr); align-items: stretch; }   /* 9 : 16 gives a square and a 16:9 frame the same height */
}
.eh-seg { display: none; }
.eh-stage-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.eh-stage-row .th-small { color: var(--th-ink-2); }
html.th-ready[data-motion="full"] .eh-seg { display: inline-flex; }
html.th-ready[data-motion="full"] .eh-pair { grid-template-columns: minmax(0, 1fr); }
html.th-ready[data-motion="full"] .eh-pair > * { grid-area: 1 / 1; }
html.th-ready[data-motion="full"] .eh-slice { z-index: 1; transition: opacity 1.4s var(--th-ease-decay) .35s; }
html.th-ready[data-motion="full"] .eh-slice .th-visual { --ar: 16 / 9; }
html.th-ready[data-motion="full"] .eh-slice img { object-fit: contain; padding: 3%; }
html.th-ready[data-motion="full"] .eh-stage[data-show="render"] .eh-slice { opacity: 0; pointer-events: none; }
html.th-ready[data-motion="full"] .eh-stage[data-manual] .eh-slice { transition-duration: .7s; transition-delay: 0s; }

/* section 4: ungraded and graded, side by side */
.eh-colour { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 720px) { .eh-colour { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.eh-swatches { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 24px; list-style: none; padding: 0; }
.eh-swatches li { display: inline-flex; align-items: center; gap: 10px; font: 400 14px/1 var(--th-font-ui); color: var(--th-ink-2); }
.eh-swatches i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(244, 243, 247, .24); }
.eh-swatches code { font: 400 12px/1 var(--th-font-data); color: var(--th-ink); }

/* the pictures below the fold load lazily: until a frame has decoded it shows the plate's own surface (the frame already holds the picture's aspect
   ratio, so nothing jumps), and the picture then fades in on opacity alone (page.js adds is-loaded; without scripts they are simply visible).
   Once loaded, the picture's own box is black, so the slice keeps its black field behind the contained image. */
.th-visual img[loading="lazy"] { transition: opacity .48s var(--th-ease-decay); }
html.th-ready .th-visual img[loading="lazy"]:not(.is-loaded) { opacity: 0; }
.th-visual img.is-loaded { background: #000; }

/* section 5: the live view is not public */
.eh-live { max-width: 66ch; }
.eh-live .th-gated { justify-items: start; }
.eh-live .th-empty { border-style: solid; }   /* a solid hairline, never a dashed outline */
.eh-subhead { margin: 40px 0 16px; }

/* the diagram's labels must stay at 12 px or more: tighter plate padding on phones keeps the 300-wide drawing at 1:1 or larger */
@media (max-width: 719px) { .eh-trace .th-specimen-body { padding: 12px; } }

/* on phones the notes under each formula line drop to their own line instead of running off the block */
@media (max-width: 719px) { .th-formula .c { display: block; margin-bottom: 6px; } }

.eh-seg button { height: var(--th-control-h, 44px); }
