/* style.css — Soltime. Dark, cosmic, hermetic. No external resources. */

:root {
  --bg: #070912;
  --bg-2: #0d1120;
  --panel: #121729;
  --panel-2: #171d33;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e7ecf5;
  --muted: #8b93ab;
  --gold: #f4b740;
  --gold-soft: rgba(244, 183, 64, 0.14);
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #16203f 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  font-size: 2.4rem;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(244, 183, 64, 0.55);
}
.brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: 0.02em; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }

.location { text-align: right; }
.loc-label { display: block; color: var(--text); font-size: 0.9rem; margin-bottom: 6px; }
.loc-actions { display: flex; gap: 8px; justify-content: flex-end; }

.btn {
  background: var(--gold);
  color: #1a1200;
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ---- Manual location form ---- */
.loc-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.loc-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}
.loc-form input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  width: 130px;
}
.loc-form input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.loc-error { color: #ff9b9b; font-size: 0.8rem; align-self: center; }

/* ---- Living sky ---- */
.sky-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
#sky { display: block; width: 100%; height: 320px; }
.sky-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px;
  pointer-events: none;
}
.label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.7);
}
.solar-time {
  font-family: var(--mono);
  font-size: clamp(2.2rem, 8vw, 3.6rem);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}
.tst-note { display: block; font-size: 0.78rem; color: rgba(255, 255, 255, 0.75); margin-top: 4px; }
.clock-clock { text-align: right; }
.clock-time {
  font-family: var(--mono);
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  color: rgba(255, 255, 255, 0.85);
}

/* ---- Grid of cards ---- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.card {
  background: linear-gradient(160deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card-title {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 14px;
}

/* Ruler card */
.ruler { display: flex; align-items: center; gap: 16px; }
.ruler-glyph {
  font-size: 3.4rem;
  line-height: 1;
  text-shadow: 0 0 30px currentColor;
}
.ruler-text { display: flex; flex-direction: column; gap: 3px; }
.ruler-name { font-size: 1.4rem; font-weight: 700; }
.ruler-meta { font-size: 0.82rem; color: var(--muted); }
.hour-number { font-size: 0.82rem; color: var(--gold); }
.countdown {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.countdown-time { font-family: var(--mono); font-size: 1.5rem; font-weight: 600; }

/* Wheel */
.wheel-card { display: flex; flex-direction: column; }
.wheel {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 240px;
  margin: 0 auto;
}
.wheel::before {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.12);
}
.wheel::after {
  content: "☉";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  color: rgba(255, 255, 255, 0.16);
}
.planet-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  opacity: 0.5;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.planet-glyph {
  font-size: 1.5rem;
  color: var(--planet-color);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-2);
}
.planet-name { font-size: 0.62rem; color: var(--muted); }
.planet-node.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.18);
}
.planet-node.active .planet-glyph {
  border-color: var(--planet-color);
  box-shadow: 0 0 22px -2px var(--planet-color);
  background: color-mix(in srgb, var(--planet-color) 18%, var(--bg-2));
}
.planet-node.active .planet-name { color: var(--text); }

/* Facts */
.facts { list-style: none; margin: 0; padding: 0; }
.facts li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.facts li:last-child { border-bottom: none; }
.facts span { color: var(--muted); }
.facts b { font-family: var(--mono); font-weight: 600; }
.moon-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.moon-line canvas { flex: 0 0 auto; filter: drop-shadow(0 0 10px rgba(220, 228, 245, 0.25)); }
.moon-text { display: flex; flex-direction: column; gap: 2px; }
.moon-text b { font-size: 0.95rem; }
.moon-text span { font-size: 0.78rem; color: var(--muted); }
.moon-pos { font-family: var(--mono); }
.moon-facts { margin-top: 10px; }
.moon-facts li { padding: 6px 0; }

/* Hours table */
.table-card { margin-bottom: 16px; }
.hours-table {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.hour-row {
  display: grid;
  grid-template-columns: 1.4rem 1.4rem 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 0.82rem;
}
.hour-row.night { opacity: 0.72; }
.hour-row .hr-num { color: var(--muted); font-family: var(--mono); font-size: 0.72rem; }
.hour-row .hr-glyph { color: var(--planet-color); font-size: 1.05rem; }
.hour-row .hr-time { font-family: var(--mono); color: var(--muted); font-size: 0.76rem; }
.hour-row.active {
  border-color: var(--planet-color);
  background: color-mix(in srgb, var(--planet-color) 14%, var(--bg-2));
  box-shadow: 0 0 18px -6px var(--planet-color);
  opacity: 1;
}
.hour-row.active .hr-name { font-weight: 700; }

/* Footer */
.foot { color: var(--muted); font-size: 0.78rem; line-height: 1.6; margin-top: 10px; }
.foot p { margin: 0; max-width: 70ch; }

/* ---- Responsive ---- */
@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .hours-table { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .app { padding: 16px 14px 36px; }
  #sky { height: 260px; }
  .sky-overlay { padding: 14px 16px; }
  .hours-table { grid-template-columns: 1fr; }
  .location, .loc-actions { text-align: left; justify-content: flex-start; }
}
