/* Hero options. A: the relay (live). B: the orrery dot print. C: al-Sufi's stars. */
:root { --warm: #B5562E; --dot: #1B1A17; --plate-mode: light; --dim: brightness(.62) saturate(.25) contrast(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --warm: #E3936B; --dot: #ECEAE3; --plate-mode: dark; --dim: brightness(.3) saturate(.2); } }
:root[data-theme="dark"] { --warm: #E3936B; --dot: #ECEAE3; --plate-mode: dark; --dim: brightness(.3) saturate(.2); }

.hero h1 { font-size: clamp(40px, 5.6vw, 72px); max-width: 15ch; }
.open-now { margin: 14px 0 0; font-size: 15.5px; color: var(--muted); }
.open-now a { font-weight: 700; text-decoration: none; color: var(--c); }
.open-now a:hover { text-decoration: underline; }

/* ---------- A: the relay ---------- */
.hero-relay { padding-top: clamp(28px, 5vw, 72px); padding-bottom: 8px; }
.hero-relay .hero-text { display: grid; gap: 4px 56px; align-items: end; }
@media (min-width: 900px) { .hero-relay .hero-text { grid-template-columns: 1fr 1fr; } }
.hero-relay .lede { margin-top: 18px; }
.wall { position: relative; max-width: 1400px; margin: 22px auto 0; padding: 0 16px; }
@media (min-width: 760px) { .wall { padding: 0 44px; } }
.relay { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px 16px; grid-template-columns: 1fr 1fr; align-items: end; }
@media (min-width: 900px) {
  /* columns sized by each picture's shape so they share a height; the orrery hangs larger, the end of the line */
  .relay { grid-template-columns: 1.748fr .967fr .654fr 1.83fr; grid-template-rows: auto auto; gap: 0 26px; }
  .relay .work, .relay figure { display: grid; grid-row: span 2; grid-template-rows: subgrid; align-items: end; }
  .relay figcaption { align-self: start; }
}
.work figure { margin: 0; }
.frame { position: relative; aspect-ratio: 4 / 3; border-radius: 3px; overflow: visible; }
@media (min-width: 900px) { .frame { aspect-ratio: var(--ar); } }
.frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--fx) var(--fy); border-radius: 3px;
  filter: var(--dim); transition: filter 1.2s ease; box-shadow: 0 1px 2px rgb(0 0 0 / .25), 0 18px 40px -18px rgb(0 0 0 / .55); }
.work.lit .frame img { filter: none; }
/* the pool of light from above, once lit */
.work.lit .frame img { box-shadow: 0 1px 2px rgb(0 0 0 / .25), 0 18px 40px -18px rgb(0 0 0 / .55), 0 0 70px -20px color-mix(in srgb, var(--warm) 55%, transparent); }
.glint { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 2px solid #FFF3EA; opacity: 0;
  transform: scale(.4); transition: opacity .6s ease .3s, transform .8s cubic-bezier(.2, .9, .3, 1.4) .3s;
  box-shadow: 0 0 0 2px #E3936B, 0 0 0 4px rgb(20 12 6 / .55), 0 0 26px 8px color-mix(in srgb, #E3936B 70%, transparent), inset 0 0 8px 2px color-mix(in srgb, #E3936B 60%, transparent); }
.work.lit .glint { opacity: 1; transform: scale(1); }
.work figcaption { margin-top: 10px; font-size: 13.5px; font-weight: 700; color: var(--ink); opacity: .35; transition: opacity 1s ease .2s; }
.work.lit figcaption { opacity: 1; }
.thread { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.thread path { fill: none; stroke: #E3936B; stroke-width: 1.6; stroke-linecap: round; }
.thread path.case { stroke: rgb(20 12 6 / .45); stroke-width: 4.5; }
.thread .spark { fill: var(--warm); opacity: 0; filter: drop-shadow(0 0 6px var(--warm)); }
.credit { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: right; }
@media (max-width: 899px) { .thread { display: none; } }
@media (prefers-reduced-motion: reduce) { .frame img, .glint, .work figcaption { transition: none; } }

/* ---------- B: the orrery, reprinted ---------- */
.hero-orrery { display: grid; gap: 28px 48px; align-items: end; padding-top: clamp(28px, 5vw, 72px); }
@media (min-width: 980px) { .hero-orrery { grid-template-columns: 5fr 7fr; } }
.ho-fig { margin: 0; }
.ho-plate { position: relative; aspect-ratio: 340 / 252; }
.ho-plate canvas, .ho-plate img { position: absolute; inset: 0; width: 100%; height: 100%; }
.ho-plate canvas { image-rendering: pixelated; }
.ho-plate img { object-fit: cover; filter: grayscale(1) contrast(1.2); mask-image: radial-gradient(closest-side, #000 70%, transparent); }
.ho-fig.live img { display: none; }
.ho-fig figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); opacity: 0; transition: opacity 1s ease; }
.ho-fig.done figcaption, .ho-fig:not(.live) figcaption { opacity: 1; }

/* ---------- C: checked against the sky ---------- */
.hero-sufi { display: grid; gap: 28px 48px; align-items: center; padding-top: clamp(28px, 5vw, 72px); }
@media (min-width: 980px) { .hero-sufi { grid-template-columns: 5fr 6fr; } }
.hs-fig { margin: 0; }
.hs-plate { position: relative; }
.hs-plate img { display: block; width: 100%; height: auto; opacity: 0; transition: opacity 1.6s ease 2.2s; }
.hs-plate .for-dark { position: absolute; inset: 0; display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hs-plate .for-dark { display: block; } :root:not([data-theme="light"]) .hs-plate .for-light { visibility: hidden; } }
:root[data-theme="dark"] .hs-plate .for-dark { display: block; } :root[data-theme="dark"] .hs-plate .for-light { visibility: hidden; }
.hs-fig.stars-on .hs-plate img { opacity: 1; }
.star { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--warm); opacity: 0; transform: scale(.2);
  box-shadow: 0 0 10px 3px color-mix(in srgb, var(--warm) 55%, transparent); transition: opacity .5s ease, transform .6s cubic-bezier(.2, .9, .3, 1.4);
  transition-delay: calc(var(--i) * 55ms + 300ms); }
.hs-fig.stars-on .star { opacity: 1; transform: scale(1); }
.hs-fig figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .hs-plate img, .star { transition: none; } }

/* the story behind each picture: on hover, or tap / keyboard focus */
.work, .ho-fig, .hs-fig { outline-offset: 6px; cursor: default; }
.ho-plate, .hs-plate { position: relative; }
.gyaan { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 14px 12px; font-size: 14px; line-height: 1.45; color: #F4EFE8; text-wrap: pretty;
  background: linear-gradient(transparent, rgb(12 10 8 / .78) 38%); border-radius: 0 0 3px 3px; opacity: 0; transform: translateY(6px);
  transition: opacity .25s ease, transform .3s cubic-bezier(.2, .8, .2, 1); pointer-events: none; z-index: 2; }
.work:hover .gyaan, .work:focus-within .gyaan, .ho-fig:hover .gyaan, .ho-fig:focus-within .gyaan, .hs-fig:hover .gyaan, .hs-fig:focus-within .gyaan { opacity: 1; transform: none; }
@media (min-width: 900px) and (max-width: 1240px) { .work .gyaan { font-size: 12.5px; padding: 32px 10px 10px; } }
@media (prefers-reduced-motion: reduce) { .gyaan { transition: none; transform: none; } }

.relay-intro { margin-top: clamp(32px, 4.5vw, 56px); font-size: 16px; color: var(--muted); max-width: 1320px; }
.relay-intro .hint { white-space: nowrap; color: var(--ink); opacity: .7; }
.work:last-child.lit .frame img { filter: brightness(1.35) contrast(1.05); }
/* phones and touch screens have no hover: show each story as its caption */
.work .story { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (hover: none), (max-width: 899px) {
  .relay-intro .hint { display: none; }
  .work .gyaan { display: none; }
  .work figcaption { opacity: 1; }
  .work .story { position: static; width: auto; height: auto; clip-path: none; overflow: visible; margin-top: 4px; font-weight: 400; font-size: 13.5px; line-height: 1.45; color: var(--muted); text-wrap: pretty; }
}
.hs-fig figcaption a.src { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.hs-fig figcaption a.src:hover { color: var(--ink); text-decoration-color: currentColor; }
.hs-fig figcaption a.src { color: inherit; }
/* D: Dürer's sky. Rings round each astronomer's globe; al-Sufi's lights last and strongest */
.star.ring { width: 38px; height: 38px; margin: -19px 0 0 -19px; background: transparent; border: 2px solid var(--warm);
  box-shadow: 0 0 16px 4px color-mix(in srgb, var(--warm) 45%, transparent), inset 0 0 12px 2px color-mix(in srgb, var(--warm) 40%, transparent);
  transition-delay: calc(var(--i) * 450ms + 500ms); }
.star.ring.key { width: 52px; height: 52px; margin: -26px 0 0 -26px; border-width: 2.5px;
  box-shadow: 0 0 30px 10px color-mix(in srgb, var(--warm) 60%, transparent), inset 0 0 16px 3px color-mix(in srgb, var(--warm) 50%, transparent); }
.hs-durer .hs-plate img { transition-delay: .2s; }
/* E: Galileo's moon. The peaks glow one by one along the shadow line */
.hs-galileo .hs-plate img { transition-delay: .2s; }
.hs-galileo .star { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; background: #FFE2C9;
  box-shadow: 0 0 0 2px var(--warm), 0 0 18px 6px color-mix(in srgb, #E3936B 75%, transparent); transition-delay: calc(var(--i) * 350ms + 1400ms); }
@media (min-width: 980px) { .hs-galileo { grid-template-columns: 6fr 5fr; } }
/* F: al-Sufi's Bull. A tall page, so it is held to a column width */
.hs-bull .hs-plate { max-width: 500px; margin-inline: auto; }
.hs-bull .hs-plate img { transition-delay: .2s; }
.hs-bull .star { transition-delay: calc(var(--i) * 70ms + 900ms); }
