/* The home page: the astrolabe (d), the living sky (e), both (f). */
body.home { overflow-x: clip; }
body.home-d { --bg: #F6EDD6; --card: #FFFBF0; --ink: #2A2113; --ink2: #2A2113; --muted: #4F432C; --line: #D5C296; --line2: #D5C296; --gold: #8A5F00; --gold-text: #6B4A06; --gold-soft: #F6E3AE;
  background: radial-gradient(900px 700px at 68% 340px, #FFF9E8 0%, #EFE3C4 75%) no-repeat, #EFE3C4; }
body.sky { --bg: #FBF8F0; --card: #FFFFFF; --ink: #1F1D18; --ink2: #1F1D18; --muted: #55503F; --line: #DDD4BD; --line2: #DDD4BD; --gold: #8A5F00; --gold-text: #6B4A06; --gold-soft: #FBEBBB; position: relative; }
:root[data-theme="dark"] body.home { --card: #151C36; --ink: #F3F1EA; --ink2: #F3F1EA; --muted: #C3CBE4; --line: #2E3A66; --line2: #2E3A66; --gold: #F2C14E; --gold-text: #F6D37E; --gold-soft: #3A2E10; }
:root[data-theme="dark"] body.home-d { --card: #141B36; --gold-soft: #33290F; background: radial-gradient(900px 700px at 68% 340px, #1B2550 0%, #0A0F22 70%) no-repeat, #0A0F22; }
:root[data-theme="dark"] body.sky { --bg: #0A0F20; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.home { --card: #151C36; --ink: #F3F1EA; --ink2: #F3F1EA; --muted: #C3CBE4; --line: #2E3A66; --line2: #2E3A66; --gold: #F2C14E; --gold-text: #F6D37E; --gold-soft: #3A2E10; }
  :root:not([data-theme="light"]) body.home-d { --card: #141B36; --gold-soft: #33290F; background: radial-gradient(900px 700px at 68% 340px, #1B2550 0%, #0A0F22 70%) no-repeat, #0A0F22; }
  :root:not([data-theme="light"]) body.sky { --bg: #0A0F20; }
}

/* the header lies over the sky */
body.sky .headwrap { position: absolute; z-index: 3; top: 52px; left: 0; right: 0; }
body.sky .brand, body.sky .brand .m { color: #fff; } body.sky .brand .s { color: #FFD064; }
body.sky .placebtn, body.sky .roundbtn { background: rgba(6,10,28,.62); color: #fff; border-color: rgba(255,255,255,.28); }

.hm { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.when { margin: 0; font: 500 14px/1.5 var(--sans); color: var(--muted); letter-spacing: 0; }
.when span { display: block; }
.countdown p { margin: 0; font-size: 17px; color: var(--gold-text); }
.countdown .big { font: 600 clamp(52px, 8vw, 88px)/1.05 var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.htimes { list-style: none; margin: 0; padding: 0; }
.htimes li { border: 1px solid var(--line); background: var(--card); }
.htimes li[aria-current] { background: var(--gold-soft); border-color: var(--gold); }
.htimes .t { font-variant-numeric: tabular-nums; }
.method { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--muted); font: 14px var(--sans); text-align: left; cursor: pointer; }
.method:hover { color: var(--ink); }
body.sky .method { align-self: center; }

/* d: times beside the astrolabe */
.astro { display: grid; grid-template-columns: minmax(300px, 370px) minmax(0, 1fr); gap: 14px; align-items: center; }
.astro-text { display: flex; flex-direction: column; gap: 10px; animation: rise .7s cubic-bezier(.2,.8,.2,1) both; }
.astro-stage canvas { display: block; width: min(100%, 760px, max(520px, (100vh - 150px) * 1.288)); height: auto; margin: 0 auto; aspect-ratio: 760 / 590; }
.astro .htimes { display: flex; flex-direction: column; gap: 3px; }
.astro .htimes li { display: flex; justify-content: space-between; align-items: center; min-height: 46px; padding: 0 16px; border-radius: 14px; font-weight: 500; }
.astro .htimes .t { font-size: 21px; }

/* e and f: the sky across the whole window */
.skyhero { position: relative; width: 100vw; margin-left: calc(50% - 50vw); height: 640px; color: #fff; background: #0A102C; }
.skyhero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.skyhero .when { position: absolute; left: max(20px, calc((100vw - var(--max)) / 2 + 20px)); top: 86px; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.75); }
.skyhero .over { position: absolute; left: 0; right: 0; top: 248px; text-align: center; pointer-events: none; }
body.home-f .skyhero { height: 720px; }
body.home-f .skyhero .over { top: 80px; }
.skyhero .countdown p, .skyhero .countdown .big { color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,.7); }
.skyhero .countdown .big { font-size: clamp(56px, 9vw, 104px); }
body.sky .htimes { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: -46px; }
body.sky .htimes li { display: flex; flex-direction: column; align-items: center; padding: 12px 0; border-radius: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.14); animation: rise .7s cubic-bezier(.2,.8,.2,1) both; }
body.sky .htimes li:nth-child(2) { animation-delay: .07s; } body.sky .htimes li:nth-child(3) { animation-delay: .14s; } body.sky .htimes li:nth-child(4) { animation-delay: .21s; }
body.sky .htimes li:nth-child(5) { animation-delay: .28s; } body.sky .htimes li:nth-child(6) { animation-delay: .35s; }
body.sky .htimes .n { font-size: 13px; color: var(--muted); }
body.sky .htimes .t { font-size: 28px; }

.playbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 18px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); }
.playbar label { font-size: 13px; color: var(--muted); }
.playbar input { flex: 1 1 220px; min-width: 0; height: 44px; accent-color: var(--gold); cursor: pointer; }
.playbar output { min-width: 80px; font-weight: 700; font-variant-numeric: tabular-nums; }
.playbar .btn.gold { min-width: 130px; justify-content: center; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; gap: 12px; align-items: center; min-height: 66px; padding: 10px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; transition: transform .25s ease, box-shadow .25s ease; }
.tile:hover, .tile:focus-visible { color: var(--ink); transform: perspective(600px) rotateX(10deg) translateY(-5px); box-shadow: 0 16px 28px rgba(0,0,0,.22); }
.tile .ic { display: flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-text); }
.tile .ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile span:last-child { min-width: 0; line-height: 1.35; }
.tile b { display: block; font-size: 14px; }
.tile small { font-size: 12px; color: var(--muted); }
@keyframes rise { from { transform: translateY(18px); } to { transform: none; } }

@media (max-width: 860px) {
  .astro { grid-template-columns: minmax(0, 1fr); }
  .astro-stage { order: -1; }
  .astro-stage canvas { width: 100%; }
  .astro-text { text-align: center; }
  .astro-text .htimes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .astro .htimes li { flex-direction: column; justify-content: center; padding: 8px 0; }
  .astro .method { align-self: center; }
  .countdown .big { font-size: 54px; }
  .skyhero { height: 430px; }
  .skyhero .when { left: 0; right: 0; top: 70px; text-align: center; font-size: 12px; }
  .skyhero .when span { display: inline; }
  .skyhero .over { top: 190px; }
  body.home-f .skyhero { height: 550px; }
  body.home-f .skyhero .over { top: 112px; }
  .skyhero .countdown p { font-size: 15px; }
  .skyhero .countdown .big { font-size: 56px; }
  body.sky .htimes { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: -30px; }
  body.sky .htimes li { padding: 8px 0; }
  body.sky .htimes .t { font-size: 21px; }
  .playbar { padding: 10px 12px; justify-content: space-between; }
  .playbar label { position: absolute; left: -9999px; }
  .playbar input { order: 1; flex-basis: 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .astro-text, body.sky .htimes li { animation: none; } .tile { transition: none; } .tile:hover, .tile:focus-visible { transform: none; } }
