/* ============================================================
   CometCat — night-sky theme.
   System font stacks only; every visual is CSS or inline SVG.
   ============================================================ */

:root {
  --bg: #05070d;
  --bg-soft: #0a101d;
  --card: rgba(148, 180, 255, 0.05);
  --line: rgba(148, 180, 255, 0.14);
  --text: #c9d4e8;
  --muted: #8fa0bd;
  --faint: #6d7c99;
  --bright: #eef4ff;
  --accent: #8fd0ff;
  --warm: #ffd9a0;
  --radius: 16px;
  --serif: Georgia, Cambria, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Static CSS stars: fallback that shows through under the canvas
   and remains if the canvas is unsupported or JS is off. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    radial-gradient(1px 1px at 22px 34px, rgba(255, 255, 255, .55), transparent 100%),
    radial-gradient(1px 1px at 118px 92px, rgba(255, 255, 255, .35), transparent 100%),
    radial-gradient(1.5px 1.5px at 187px 148px, rgba(200, 220, 255, .45), transparent 100%),
    radial-gradient(1px 1px at 253px 62px, rgba(255, 255, 255, .3), transparent 100%),
    radial-gradient(1px 1px at 64px 190px, rgba(255, 224, 180, .4), transparent 100%),
    radial-gradient(1.5px 1.5px at 300px 210px, rgba(255, 255, 255, .4), transparent 100%);
  background-size: 340px 260px;
}

#sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  display: block;
}

a { color: var(--accent); }
::selection { background: rgba(143, 208, 255, .25); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------------- Header / hero ---------------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px clamp(16px, 5vw, 44px);
  flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: .06em; color: var(--bright); text-decoration: none; }
.topnav { display: flex; gap: clamp(10px, 3vw, 22px); flex-wrap: wrap; }
.topnav a { color: var(--muted); text-decoration: none; font-size: .92rem; transition: color .2s; }
.topnav a:hover, .topnav a:focus-visible { color: var(--accent); }

.hero { display: flex; flex-direction: column; min-height: 88vh; }
.hero-inner { margin: auto; text-align: center; padding: 28px 20px 72px; max-width: 720px; }
.logo {
  width: clamp(112px, 16vw, 150px);
  height: auto;
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 4px 18px rgba(20, 40, 80, .6));
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.7rem, 8vw, 4.3rem);
  color: var(--bright);
  margin: .5rem 0 0;
  letter-spacing: .015em;
}
.tagline {
  font-size: clamp(1.05rem, 2.5vw, 1.28rem);
  color: #aebbd6;
  margin: .7rem auto 1.1rem;
  max-width: 32em;
}
.about { color: var(--muted); font-size: .97rem; max-width: 44em; margin: 0 auto; }

/* ---------------- Sections ---------------- */

section { padding: 58px 0; scroll-margin-top: 12px; }
section + section { border-top: 1px solid rgba(148, 180, 255, .07); }
.wrap { width: min(1060px, 92%); margin: 0 auto; }

.kicker {
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: .72rem;
  color: var(--accent);
  margin: 0 0 .4rem;
}
h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  color: var(--bright);
  margin: 0 0 .35rem;
}
.sub { color: var(--muted); margin: 0 0 1.6rem; max-width: 52em; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
}

/* ---------------- Comet of the month ---------------- */

.comet-card { display: grid; grid-template-columns: 1.6fr 1fr; gap: clamp(20px, 4vw, 36px); align-items: start; }
.comet-card h3 { font-family: var(--serif); color: var(--bright); font-size: 1.45rem; margin: 0 0 .6rem; font-weight: 600; }
.comet-card p { margin: 0 0 .9rem; }
.comet-card p:last-child { margin-bottom: 0; }
.comet-side { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.comet-art { width: 100%; max-width: 190px; height: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0; }
.chips li {
  font-family: var(--mono);
  font-size: .78rem;
  color: #cfe3ff;
  background: rgba(143, 208, 255, .08);
  border: 1px solid rgba(143, 208, 255, .22);
  border-radius: 999px;
  padding: .32rem .72rem;
  white-space: nowrap;
}

/* ---------------- Moon ---------------- */

.moon-card { display: grid; grid-template-columns: 240px 1fr; gap: clamp(20px, 4vw, 40px); align-items: center; }
.moon-visual { margin: 0; }
.moon-visual svg { display: block; width: 100%; max-width: 240px; height: auto; margin: 0 auto; }
.moon-fallback { color: var(--muted); font-size: .88rem; text-align: center; }
.moon-data h3 { margin: 0 0 .2rem; font-family: var(--serif); font-size: 1.5rem; color: var(--bright); font-weight: 600; }
.moon-illum { margin: .4rem 0 .1rem; }
.moon-illum #moonIllum { font-family: var(--serif); font-size: 2.5rem; color: var(--accent); line-height: 1; }
.moon-illum .unit { color: var(--muted); font-size: .95rem; margin-left: .35rem; }
.moon-age { margin: .15rem 0 .8rem; color: var(--faint); font-family: var(--mono); font-size: .82rem; }
.moon-blurb { margin: 0; color: var(--text); max-width: 40em; }

.phase-strip { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.phase-strip .ph { display: block; border-radius: 50%; }
.phase-strip svg { display: block; width: 36px; height: 36px; }
.phase-strip .ph.now { box-shadow: 0 0 0 2px rgba(143, 208, 255, .65), 0 0 14px rgba(143, 208, 255, .35); }

/* ---------------- Gallery ---------------- */

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.shot { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .25s, transform .25s; }
.shot:hover { border-color: rgba(143, 208, 255, .35); transform: translateY(-2px); }
.shot svg { display: block; width: 100%; height: auto; }
.shot figcaption { padding: 12px 16px 14px; font-size: .92rem; color: #b9c6de; }
.shot-meta { display: block; margin-top: 3px; color: var(--faint); font-size: .76rem; font-family: var(--mono); }

/* ---------------- Star map ---------------- */

.map-grid { display: grid; grid-template-columns: 1.9fr 1fr; gap: 20px; align-items: stretch; }
.map-card { padding: 14px; }
#constellations { display: block; width: 100%; height: auto; }
#constellations .fstar { fill: #cfe0ff; }
#constellations .mw-band { fill: none; stroke: #9fb8e8; stroke-linecap: round; }
#constellations text {
  font-family: system-ui, sans-serif;
  font-size: 2.4px;
  letter-spacing: .04em;
  fill: rgba(220, 232, 255, .42);
  pointer-events: none;
}
.const { cursor: pointer; outline: none; }
.const .cl {
  fill: none;
  stroke: rgba(143, 208, 255, .30);
  stroke-width: .28;
  stroke-linecap: round;
  transition: stroke .2s, stroke-width .2s;
}
.const .cs { fill: #dfe9ff; transition: fill .2s; }
.const:hover .cl, .const.active .cl, .const:focus-visible .cl { stroke: var(--accent); stroke-width: .42; }
.const:hover .cs, .const.active .cs, .const:focus-visible .cs { fill: #ffffff; }
.const:hover text, .const.active text, .const:focus-visible text { fill: #cfe6ff; }

.map-info { display: flex; flex-direction: column; gap: 6px; }
.map-info h3 { margin: 0; font-family: var(--serif); color: var(--bright); font-size: 1.3rem; font-weight: 600; }
.map-season { margin: 0; color: var(--accent); font-size: .8rem; font-family: var(--mono); }
#mapFact { margin: 2px 0 0; font-size: .95rem; }

/* ---------------- Buttons ---------------- */

.btn {
  font: inherit;
  font-size: .88rem;
  color: var(--accent);
  background: rgba(143, 208, 255, .08);
  border: 1px solid rgba(143, 208, 255, .3);
  border-radius: 999px;
  padding: .42rem 1rem;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.btn:hover, .btn:focus-visible { background: rgba(143, 208, 255, .16); color: var(--bright); }
.btn-primary { background: rgba(143, 208, 255, .16); }
.btn-small { font-size: .8rem; padding: .3rem .8rem; }
.btn-wide { width: 100%; padding: .6rem 1rem; }
.login-btn { font-size: .85rem; }

/* ---------------- Photo wall (real photos) ---------------- */

.shot img { display: block; width: 100%; height: clamp(190px, 24vw, 300px); object-fit: cover; }
.shot.portrait img { object-position: 50% 22%; }
.credits { margin-top: 16px; color: var(--faint); font-size: .72rem; font-family: var(--mono); }

/* ---------------- Forum ---------------- */

.forum-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.forum-stats { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.forum-stats li {
  font-family: var(--mono);
  font-size: .74rem;
  color: #cfe3ff;
  background: rgba(143, 208, 255, .08);
  border: 1px solid rgba(143, 208, 255, .22);
  border-radius: 999px;
  padding: .3rem .7rem;
}
.forum-card { padding: 6px 0; }
.thread-list { list-style: none; margin: 0; padding: 0; }
.thread-list li + li { border-top: 1px solid rgba(148, 180, 255, .09); }
.thread {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  padding: 14px 20px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.thread:hover, .thread:focus-visible { background: rgba(143, 208, 255, .05); border-left-color: var(--accent); outline: none; }
.t-title { display: block; color: var(--bright); font-weight: 600; }
.pin {
  font-family: var(--mono);
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--warm);
  border: 1px solid rgba(255, 217, 160, .35);
  border-radius: 999px;
  padding: .1rem .5rem;
  margin-right: .55rem;
  vertical-align: 1px;
}
.t-preview { display: block; color: var(--muted); font-size: .88rem; margin-top: 3px; }
.t-meta { display: block; color: var(--faint); font-size: .74rem; font-family: var(--mono); margin-top: 5px; }
.forum-note {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 6px 20px 14px;
  padding: 12px 16px;
  border: 1px solid rgba(143, 208, 255, .3);
  border-radius: 12px;
  background: rgba(143, 208, 255, .07);
  color: #cfe3ff;
  font-size: .9rem;
}

/* ---------------- Login modal ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 5, 10, .72);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  position: relative;
  width: min(400px, 100%);
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .5);
}
.modal h3 { margin: 0 0 .3rem; font-family: var(--serif); color: var(--bright); font-size: 1.35rem; font-weight: 600; }
.modal-sub { margin: 0 0 1.1rem; color: var(--muted); font-size: .9rem; }
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--faint);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { color: var(--bright); }
.field { display: block; margin-bottom: .9rem; font-size: .85rem; color: var(--muted); }
.field input {
  display: block;
  width: 100%;
  margin-top: .3rem;
  font: inherit;
  color: var(--bright);
  background: #070b14;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .7rem;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(143, 208, 255, .18); }
.login-error { margin: .2rem 0 .8rem; color: #ff9d8f; font-size: .86rem; }
.modal-foot { margin: .9rem 0 0; font-size: .84rem; color: var(--muted); }
.modal-foot a { color: var(--accent); }

/* ---------------- Footer ---------------- */

footer {
  border-top: 1px solid rgba(148, 180, 255, .08);
  padding: 38px 20px 48px;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}
footer p { margin: 0 0 .4rem; }
.foot-small { font-size: .78rem; color: var(--faint); }

/* ---------------- Responsive ---------------- */

@media (max-width: 820px) {
  .map-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .comet-card { grid-template-columns: 1fr; }
  .comet-side { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  section { padding: 44px 0; }
  .hero { min-height: 82vh; }
}
@media (max-width: 640px) {
  .moon-card { grid-template-columns: 1fr; }
  .moon-visual svg { max-width: 200px; }
}

/* ---------------- Reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
