/* Once A Century — an almanac: night skies, cream pages, an eyepiece and a constellation */
@font-face { font-family: "IM Fell English SC"; src: url(../assets/fonts/IMFellSC.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url(../assets/fonts/IMFell.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url(../assets/fonts/IMFell-Italic.woff2) format("woff2"); font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url(../assets/fonts/AlegreyaSans-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url(../assets/fonts/AlegreyaSans-Italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url(../assets/fonts/AlegreyaSans-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url(../assets/fonts/AlegreyaSans-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Xanh Mono"; src: url(../assets/fonts/XanhMono.woff2) format("woff2"); font-display: swap; }

:root {
  --night: #0B1026; --paper: #F3EAD3; --paper2: #E6D8B6; --gold: #F5C46B; --rust: #B5432B; --ink: #1E1A14; --mist: #A9B1D3;
  --sc: "IM Fell English SC", Georgia, serif; --fell: "IM Fell English", Georgia, serif; --body: "Alegreya Sans", system-ui, sans-serif; --mono: "Xanh Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 19px/1.55 var(--body); color: var(--ink); background: var(--night); overflow-x: hidden; }
a { color: inherit; }
button, input { font: inherit; }
h1, h2, h3 { font-family: var(--sc); font-weight: 400; margin: 0; line-height: 1; }
.btn { display: inline-block; padding: 12px 24px 10px; border: 2px solid var(--gold); border-radius: 999px; background: var(--gold); color: var(--night); font: 400 21px/1 var(--sc); letter-spacing: .03em; text-decoration: none; cursor: pointer; }
.btn:hover { background: #FFD88E; }
.btn.ghost { background: transparent; color: var(--gold); }
.btn:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }

/* ================================================================ the eclipse */
.hero { position: relative; min-height: clamp(620px, 100vh, 900px); color: var(--paper); overflow: hidden;
  background: radial-gradient(120% 90% at 72% 46%, #1A2350, var(--night) 60%, #05071A); }
#corona { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-in { position: relative; max-width: 1280px; margin: 0 auto; padding: 80px 40px 70px; min-height: inherit; display: flex; flex-direction: column; justify-content: center; }
.hero-in > * { max-width: 640px; }
.almanac { margin: 0 0 18px; font: italic 400 20px var(--fell); color: var(--mist); }
.hero h1 { font-size: 120px; line-height: .92; color: var(--paper); text-shadow: 0 4px 30px rgba(0,0,0,.6); }
.hero h1 span { display: block; } .hero h1 .a { display: inline; font-family: var(--fell); font-style: italic; font-size: .5em; color: var(--gold); }
.hero h1 span:first-child { display: inline; }
.lede { font-size: 21px; color: #DCD4BE; margin: 24px 0 26px; }
.lede b { color: var(--gold); font-weight: 700; }
.count { border-top: 1px solid rgba(243,234,211,.3); border-bottom: 1px solid rgba(243,234,211,.3); padding: 14px 0 12px; }
.count-h { margin: 0 0 8px; font: italic 400 17px var(--fell); color: var(--mist); }
.dials { display: flex; gap: 26px; }
.dials div { display: flex; flex-direction: column; }
.dials b { font: 400 54px/1 var(--mono); color: var(--paper); font-variant-numeric: tabular-nums; }
.dials span { font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--mist); margin-top: 4px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 0; }

/* ================================================================ the way around: phases of the moon */
.phases { display: flex; justify-content: center; gap: 0; background: #070A1C; border-top: 1px solid rgba(243,234,211,.15); border-bottom: 1px solid rgba(243,234,211,.15); }
.phases a { flex: 1; max-width: 250px; display: flex; align-items: center; gap: 14px; padding: 16px 20px; text-decoration: none; color: var(--paper); }
.phases a:hover, .phases a:focus-visible { background: #10163A; outline: none; }
.phases a:focus-visible span { text-decoration: underline; }
.phases span { display: flex; flex-direction: column; font: 400 20px/1.1 var(--sc); }
.phases em { font: italic 400 14px var(--fell); color: var(--gold); }
.moon { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--paper); box-shadow: 0 0 14px rgba(243,234,211,.25); }
.moon.p0 { background: #070A1C; box-shadow: inset 0 0 0 2px rgba(243,234,211,.55); }
.moon.p1 { box-shadow: inset 24px 0 0 0 #070A1C, 0 0 10px rgba(243,234,211,.2); }
.moon.p2 { background: linear-gradient(90deg, #070A1C 50%, var(--paper) 50%); }
.moon.p3 { box-shadow: inset 8px 0 0 0 #070A1C, 0 0 14px rgba(243,234,211,.25); }
.moon.p4 { box-shadow: 0 0 22px rgba(245,196,107,.6); }

/* ================================================================ pages */
main > section { scroll-margin-top: 10px; }
.witness, .century { background: var(--paper); background-image: radial-gradient(rgba(30,26,20,.05) 1px, transparent 1px); background-size: 6px 6px; }
.witness { padding: 70px 40px 80px; }
.w-head { max-width: 1280px; margin: 0 auto 26px; display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: end; }
.w-head h2 { font-size: 64px; color: var(--night); }
.w-head p { margin: 0; max-width: 640px; font-size: 19px; }
.w-grid { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: 1fr 320px; gap: 28px; }
.w-stage { min-width: 0; }
.skybox { position: relative; height: 560px; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 10px var(--ink), 0 0 0 12px var(--paper2), 0 24px 40px rgba(0,0,0,.35); }
#sky { position: absolute; inset: 0; display: block; touch-action: manipulation; cursor: pointer; }
.wmsg { position: absolute; left: 50%; top: 22px; z-index: 2; margin: 0; width: min(560px, 88%); padding: 14px 22px 12px; text-align: center; pointer-events: none;
  background: rgba(243,234,211,.86); color: var(--ink); border-radius: 4px; box-shadow: 0 10px 24px rgba(0,0,0,.4); opacity: 0; transform: translate(-50%, -8px); transition: opacity .2s, transform .2s; }
.wmsg.on { opacity: 1; transform: translate(-50%, 0); }
.wmsg b { display: block; font: 400 32px/1.05 var(--sc); }
.wmsg.win b { color: #7A5A12; } .wmsg.lose b { color: var(--rust); }
.wmsg span { display: block; margin-top: 4px; font-size: 17px; }
.wflash { position: absolute; left: 50%; bottom: 26%; z-index: 2; margin: 0; padding: 6px 14px; transform: translateX(-50%); border-radius: 3px; background: rgba(120,128,150,.95); color: #fff; font-weight: 700; font-size: 16px; opacity: 0; transition: opacity .15s; pointer-events: none; white-space: nowrap; }
.wflash.on { opacity: 1; }
.yearbar { display: flex; align-items: center; gap: 12px; margin-top: 26px; font: 400 17px var(--mono); }
.track { flex: 1; height: 8px; border-radius: 4px; background: var(--paper2); overflow: hidden; }
.bar { display: block; height: 100%; width: 0; background: var(--night); }
.w-pad { display: none; }
.w-side { display: flex; flex-direction: column; gap: 18px; }
.w-stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.w-stats div { border: 1px solid rgba(30,26,20,.3); padding: 8px 12px; background: rgba(255,255,255,.35); }
.w-stats .yr { grid-column: 1 / -1; }
.w-stats dt { font: italic 400 15px var(--fell); color: #6B604C; }
.w-stats dd { margin: 0; font: 400 34px/1.05 var(--mono); color: var(--night); }
.w-stats .yr dd { font-size: 56px; }
.nights { display: flex; gap: 8px; padding-top: 8px; }
.nights i { width: 22px; height: 22px; border-radius: 50%; background: var(--night); box-shadow: inset -6px -2px 0 0 var(--gold); }
.nights[data-n="2"] i:nth-child(3), .nights[data-n="1"] i:nth-child(n+2), .nights[data-n="0"] i { background: #9AA0AE; box-shadow: none; opacity: .5; }
.w-real { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.w-real li { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid rgba(30,26,20,.25); font-size: 17px; }
.w-real time { font: 400 16px var(--mono); color: var(--rust); }
.w-real small { font: 400 14px var(--mono); color: #6B604C; }
.w-real li.got { color: #2F5D2F; } .w-real li.got::after { content: "✓"; grid-column: 3; grid-row: 1; justify-self: end; font-weight: 700; }
.w-real li.got small { display: none; }
.w-real li.lost { text-decoration: line-through; color: #8B8070; }
.w-btns { display: flex; gap: 10px; margin: 0; }
.w-btns .btn { flex: 1; text-align: center; padding: 12px 10px 10px; }
.w-btns .btn.ghost { color: var(--night); border-color: var(--night); font-size: 17px; }
.w-btns .btn.ghost[aria-pressed="false"] { opacity: .6; text-decoration: line-through; }
.w-how { margin: 0; font-size: 15px; color: #4E4636; }
kbd { display: inline-block; min-width: 22px; padding: 0 5px; border: 1px solid var(--ink); border-radius: 3px; font: 400 13px/1.5 var(--mono); text-align: center; background: #fff; }
.k-touch { display: none; }
@media (hover: none) { .k-key { display: none; } .k-touch { display: inline; } }

/* ================================================================ the century */
.century { padding: 70px 40px 80px; border-top: 1px solid var(--paper2); }
.c-head { max-width: 1100px; margin: 0 auto 30px; display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; }
.c-head h2 { font-size: 56px; color: var(--night); }
.born { font: italic 400 20px var(--fell); }
.born input { width: 100px; padding: 6px 10px; border: 0; border-bottom: 2px solid var(--ink); background: transparent; font: 400 24px var(--mono); color: var(--rust); }
.born input:focus { outline: none; border-bottom-color: var(--rust); }
.born-note { color: #6B604C; }
.timeline { list-style: none; max-width: 1100px; margin: 0 auto; padding: 0 0 0 40px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 12px; top: 8px; bottom: 8px; width: 2px; background: var(--ink); }
.timeline li { position: relative; display: grid; grid-template-columns: 190px 1fr 220px; gap: 22px; align-items: baseline; padding: 18px 0; border-bottom: 1px solid rgba(30,26,20,.2); }
.timeline li::before { content: ""; position: absolute; left: -36px; top: 26px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }
.timeline li:first-child::before { background: var(--gold); border-color: var(--rust); box-shadow: 0 0 0 4px rgba(245,196,107,.35); }
.timeline time { font: 400 22px var(--mono); color: var(--rust); }
.timeline h3 { font-size: 30px; color: var(--night); grid-column: 2; }
.timeline li > p { margin: 6px 0 0; grid-column: 2; font-size: 18px; }
.timeline .age { grid-column: 3; grid-row: 1 / span 2; margin: 0; font: italic 400 19px var(--fell); color: #4E4636; text-align: right; }
.timeline li.far .age { color: var(--rust); }
.odds { max-width: 1100px; margin: 40px auto 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.odds p { margin: 0; padding: 18px 20px; border: 2px solid var(--ink); background: rgba(255,255,255,.4); font-size: 17px; }
.odds b { display: block; font: 400 64px/1 var(--mono); color: var(--night); margin-bottom: 6px; }

/* ================================================================ ephemeris (the token) */
.ephemeris { padding: 80px 40px 90px; color: var(--paper); background: radial-gradient(80% 60% at 20% 30%, #18214A, var(--night) 70%); }
.ephemeris h2 { max-width: 1280px; margin: 0 auto 30px; font-size: 64px; display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; }
.ephemeris h2 > span { font: 400 26px var(--mono); color: var(--gold); }
.e-grid { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: 1.45fr 1fr; gap: 34px; align-items: start; }
.eyepiece { padding: 18px; border-radius: 22px; background: linear-gradient(145deg, #8A6A35, #3B2A12 55%, #6E5225); box-shadow: inset 0 2px 0 rgba(255,230,170,.4), 0 24px 40px rgba(0,0,0,.45); }
.e-cap { display: flex; justify-content: space-between; margin: 0 4px 10px; font: italic 400 16px var(--fell); color: #F1DDB0; }
.e-cap a { color: var(--paper); font-family: var(--body); font-style: normal; }
.lens { position: relative; height: 470px; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: inset 0 0 0 4px #1A1206; }
.lens iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lens-wait { position: absolute; inset: 0; display: grid; place-items: center; color: #6B604C; font: italic 400 20px var(--fell); }
.lens-wait.off { display: none; }
.reticle { position: absolute; inset: 0; pointer-events: none; border-radius: 12px;
  background: linear-gradient(var(--rust), var(--rust)) top center / 2px 22px no-repeat, linear-gradient(var(--rust), var(--rust)) bottom center / 2px 22px no-repeat, linear-gradient(var(--rust), var(--rust)) left center / 22px 2px no-repeat, linear-gradient(var(--rust), var(--rust)) right center / 22px 2px no-repeat; opacity: .7; }
.e-side { display: flex; flex-direction: column; gap: 20px; }
.eph { width: 100%; border-collapse: collapse; background: var(--paper); color: var(--ink); box-shadow: 0 16px 30px rgba(0,0,0,.35); }
.eph th { text-align: left; padding: 10px 14px 8px; font: italic 400 15px var(--fell); color: #6B604C; border-bottom: 2px solid var(--ink); }
.eph td { padding: 9px 14px; border-bottom: 1px solid rgba(30,26,20,.18); font-size: 17px; }
.eph td:nth-child(2) { font: italic 400 19px var(--fell); color: var(--rust); width: 40px; }
.eph td:last-child { font: 400 19px var(--mono); text-align: right; }
.eph td.up { color: #2F6B2F; } .eph td.down { color: var(--rust); }
.e-note { margin: -10px 0 0; font-size: 14px; color: var(--mist); min-height: 1.4em; }
.catalogue { padding: 18px 20px; border: 1px solid rgba(243,234,211,.35); border-radius: 4px; background: rgba(243,234,211,.05); }
.cat-h { margin: 0 0 8px; font: italic 400 17px var(--fell); color: var(--mist); }
.cat-ca { margin: 0 0 14px; font: 400 18px/1.45 var(--mono); word-break: break-all; color: var(--paper); }
.cat-act { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0; }
#logged { font: italic 400 17px var(--fell); color: var(--gold); }
.catalogue.logged { border-color: var(--gold); }
.obs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.obs [hidden] { display: none; }
.obs a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid rgba(243,234,211,.3); border-radius: 4px; text-decoration: none; font: 400 19px var(--sc); }
.obs a:hover { border-color: var(--gold); color: var(--gold); }
.obs img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #fff; flex: none; }

/* ================================================================ the logbook */
.logbook { padding: 80px 40px; background: #2A2016; }
.page { max-width: 900px; margin: 0 auto; padding: 40px 48px 34px 86px; color: var(--ink); border-radius: 3px; box-shadow: 0 30px 50px rgba(0,0,0,.5);
  background: linear-gradient(90deg, transparent 60px, rgba(181,67,43,.5) 60px 62px, transparent 62px), repeating-linear-gradient(180deg, transparent 0 31px, rgba(20,28,64,.14) 31px 32px), #F8F1DE; }
.page h2 { font-size: 48px; color: var(--night); margin-bottom: 20px; }
.page h3 { font-size: 26px; margin: 26px 0 8px; }
.lg-grid { display: grid; grid-template-columns: 220px 1fr; gap: 30px; }
.lg-stats { margin: 0; display: grid; gap: 12px; align-content: start; }
.lg-stats dt { font: italic 400 16px var(--fell); color: #6B604C; }
.lg-stats dd { margin: 0; font: 400 46px/1 var(--mono); color: var(--night); }
.lg-seen { list-style: none; margin: 0; padding: 0; }
.lg-seen li { display: grid; grid-template-columns: 60px 1fr auto; gap: 10px; padding: 6px 0; border-bottom: 1px dashed rgba(30,26,20,.3); }
.lg-seen time { font: 400 17px var(--mono); color: var(--rust); }
.lg-seen b { font: italic 400 17px var(--fell); color: #8B8070; font-weight: 400; }
.lg-seen li.got b { color: #2F5D2F; }
.lg-runs { margin: 0; padding-left: 22px; font: italic 400 18px/1.75 var(--fell); }
.lg-runs .none { list-style: none; margin-left: -22px; color: #8B8070; }
.lg-foot { margin: 22px 0 0; font-size: 15px; color: #6B604C; }
#lReset { background: none; border: 0; padding: 0; color: var(--rust); text-decoration: underline; cursor: pointer; font-size: 15px; }

/* ================================================================ the constellation */
.stars { padding: 40px 24px 30px; background: #04060F; background-image: radial-gradient(rgba(243,234,211,.5) 1px, transparent 1.5px), radial-gradient(rgba(243,234,211,.25) 1px, transparent 1.5px), radial-gradient(rgba(243,234,211,.7) 1.4px, transparent 2px); background-size: 131px 89px, 73px 113px, 197px 157px; background-position: 13px 7px, 41px 53px, 90px 20px; }
.cons { display: block; width: 100%; max-width: 1200px; margin: 0 auto; height: auto; overflow: visible; }
.cons-tall, .neb-tall { display: none; }
.cons .line { fill: none; stroke: rgba(245,196,107,.55); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; }
.cons .st circle { fill: #FFF6DC; filter: drop-shadow(0 0 8px rgba(255,236,190,.9)); transition: r .2s; }
.cons .st text { font: 400 26px var(--sc); fill: var(--paper); text-anchor: middle; }
.cons a.st:hover circle, .cons a.st:focus-visible circle { fill: var(--gold); }
.cons a.st:hover text, .cons a.st:focus-visible text { fill: var(--gold); text-decoration: underline; }
.cons a.st:focus-visible { outline: none; }
.cons .epoch text { font: italic 400 22px var(--fell); fill: var(--mist); }
.cons .neb { font: italic 400 20px var(--fell); fill: rgba(169,177,211,.7); text-anchor: middle; }
.neb-tall { margin: 10px 0 0; text-align: center; font: italic 400 16px var(--fell); color: rgba(169,177,211,.8); }

/* ================================================================ smaller screens */
@media (max-width: 1050px) {
  .w-grid, .e-grid { grid-template-columns: 1fr; }
  .w-side { display: grid; grid-template-columns: 1fr 1fr; }
  .timeline li { grid-template-columns: 150px 1fr; }
  .timeline .age { grid-column: 2; grid-row: auto; text-align: left; }
}
@media (max-width: 700px) {
  body { font-size: 17px; }
  .hero { min-height: auto; }
  .hero-in { padding: 82vw 18px 44px; }
  .hero h1 { font-size: 64px; }
  .lede { font-size: 18px; }
  .dials { gap: 14px; } .dials b { font-size: 34px; } .dials span { font-size: 11px; }
  .phases a { flex-direction: column; gap: 6px; padding: 12px 2px; text-align: center; }
  .phases span { font-size: 13px; } .phases em { font-size: 12px; }
  .moon { width: 26px; height: 26px; } .moon.p1 { box-shadow: inset 18px 0 0 0 #070A1C; } .moon.p3 { box-shadow: inset 6px 0 0 0 #070A1C; }
  .witness, .century { padding: 46px 12px 54px; }
  .w-head { grid-template-columns: 1fr; gap: 10px; } .w-head h2 { font-size: 42px; } .w-head p { font-size: 17px; }
  .skybox { height: 430px; box-shadow: 0 0 0 6px var(--ink), 0 0 0 8px var(--paper2), 0 16px 30px rgba(0,0,0,.35); }
  .wmsg b { font-size: 24px; } .wmsg span { font-size: 15px; }
  .w-pad { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
  .w-pad button { padding: 14px 0; border: 0; border-radius: 8px; background: var(--night); color: var(--gold); font-size: 30px; line-height: 1; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
  .w-side { grid-template-columns: 1fr; }
  .w-stats .yr dd { font-size: 40px; } .w-stats dd { font-size: 28px; }
  .c-head h2 { font-size: 38px; }
  .timeline { padding-left: 30px; } .timeline::before { left: 6px; } .timeline li::before { left: -31px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; } .timeline h3, .timeline li > p, .timeline .age { grid-column: 1; }
  .timeline h3 { font-size: 25px; } .timeline time { font-size: 18px; }
  .odds { grid-template-columns: 1fr; gap: 12px; } .odds b { font-size: 46px; }
  .ephemeris { padding: 50px 12px 60px; } .ephemeris h2 { font-size: 44px; }
  .eyepiece { padding: 10px; border-radius: 14px; } .lens { height: 380px; }
  .eph td { padding: 8px 8px; font-size: 15px; } .eph td:last-child { font-size: 16px; }
  .cat-ca { font-size: 15px; }
  .obs { grid-template-columns: 1fr; }
  .logbook { padding: 46px 12px; }
  .page { padding: 26px 16px 24px 44px; background: linear-gradient(90deg, transparent 30px, rgba(181,67,43,.5) 30px 32px, transparent 32px), repeating-linear-gradient(180deg, transparent 0 31px, rgba(20,28,64,.14) 31px 32px), #F8F1DE; }
  .page h2 { font-size: 34px; }
  .lg-grid { grid-template-columns: 1fr; gap: 16px; } .lg-stats { grid-template-columns: 1fr 1fr; } .lg-stats dd { font-size: 34px; }
  .lg-seen li { grid-template-columns: 48px 1fr; } .lg-seen b { grid-column: 2; }
  .lg-runs { font-size: 16px; }
  .cons-wide { display: none; } .cons-tall { display: block; max-width: 360px; } .neb-tall { display: block; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
