@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --maroon: #5A0112;
  --maroon-deep: #3A000B;
  --gold: #D9A441;
  --gold-text: #8A5E0B;
  --ivory: #FFF8EF;
  --ink: #2A0B12;
  --muted: #6B4850;
  --hairline: #E8D6CB;
  --field: #FFFFFF;
  --error: #A3162B;
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--maroon-deep); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% 0%, var(--maroon) 0%, var(--maroon-deep) 70%) no-repeat;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ---------- Brand band ---------- */

.band {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(1.75rem + env(safe-area-inset-top, 0)) 1rem 3.5rem;
}

.lotus { width: 96px; height: auto; }

.brand {
  margin: .5rem 0 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: .01em;
  color: #F6E2B0;
}

/* ---------- Ivory sheet ---------- */

.sheet {
  max-width: 34rem;
  margin: -2rem auto 0;
  padding: 2rem 1.25rem 2.5rem;
  background: var(--ivory);
  border-radius: 28px 28px 0 0;
  min-height: 60vh;
}

@media (min-width: 38rem) {
  .sheet { border-radius: 28px; margin-bottom: 3rem; padding: 2.5rem 2.25rem; min-height: 0; }
}

h1 {
  margin: 0 0 .5rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 2.35rem;
  line-height: 1.05;
  color: var(--maroon);
}

.lede { margin: 0 0 1.75rem; color: var(--muted); max-width: 60ch; }

/* ---------- Form ---------- */

.field { margin-bottom: 1.25rem; position: relative; }

label { display: block; font-weight: 600; margin-bottom: .35rem; }

input {
  width: 100%;
  font: inherit;
  color: inherit;
  padding: .8rem .9rem;
  min-height: 48px;
  border: 1.5px solid var(--hairline);
  border-radius: 12px;
  background: var(--field);
}

input:focus-visible, button:focus-visible, [role="option"]:focus-visible, a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-color: var(--maroon);
}

.hint { margin: .35rem 0 0; font-size: .875rem; color: var(--muted); }

#place-list {
  position: absolute;
  z-index: 5;
  left: 0; right: 0;
  margin: .25rem 0 0;
  padding: .35rem;
  list-style: none;
  background: var(--field);
  border: 1.5px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(58, 0, 11, .16);
  max-height: 18rem;
  overflow-y: auto;
}

#place-list li {
  padding: .65rem .7rem;
  border-radius: 8px;
  cursor: pointer;
}

#place-list li[aria-selected="true"], #place-list li:hover { background: #F7EBDD; }

#place-list .none { color: var(--muted); cursor: default; }
#place-list .none:hover { background: none; }

.error { color: var(--error); font-weight: 600; margin: 0 0 1rem; }

button[type="submit"] {
  width: 100%;
  min-height: 52px;
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  color: #FFF4DE;
  background: var(--maroon);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

button[type="submit"]:hover { background: #6E0A1E; }
button[type="submit"][aria-busy="true"] { opacity: .7; cursor: progress; }

/* ---------- Result ---------- */

.result {
  margin-top: 2.25rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--hairline);
  text-align: center;
}

.horizon { margin: 0 auto 1rem; max-width: 20rem; }
.horizon svg { width: 100%; height: auto; display: block; overflow: visible; }

.result-intro { margin: 0; color: var(--muted); }

#star-name {
  margin: .1rem 0 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 2.75rem;
  line-height: 1.05;
  color: var(--maroon);
}

.tamil { margin: .15rem 0 1.25rem; font-size: 1.05rem; color: var(--gold-text); font-weight: 600; }

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
  margin: 0 0 1.5rem;
}

.facts div { background: #F7EBDD; border-radius: 14px; padding: .7rem .4rem; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: .1rem 0 0; font-weight: 700; }

.moon { text-align: left; margin: 0 0 1.5rem; }
.moon h3 {
  margin: 0 0 .6rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--maroon);
}
.moon-facts { margin: 0; display: grid; gap: .5rem; }
.moon-facts div { background: #F7EBDD; border-radius: 14px; padding: .75rem .9rem; }
.moon-facts dt { font-size: .8rem; color: var(--muted); }
.moon-facts dd { margin: .15rem 0 0; font-weight: 700; }
.moon-facts .sub { display: block; font-weight: 400; font-size: .9rem; color: var(--muted); }
.moon-note { margin: .6rem 0 0; font-size: .9rem; color: var(--ink); background: #FFF1D6; border: 1px solid #EFD49C; border-radius: 12px; padding: .65rem .8rem; }

.borderline {
  text-align: left;
  background: #FFF1D6;
  border: 1px solid #EFD49C;
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin: 0 0 1.5rem;
}

.borderline h3 { margin: 0 0 .35rem; font-size: 1rem; }
.borderline p { margin: 0 0 .75rem; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.timeline li {
  display: flex; justify-content: space-between; gap: .75rem;
  padding: .55rem .75rem; border-radius: 10px; background: rgba(255, 255, 255, .7);
}
.timeline li.yours { background: var(--maroon); color: #FFF4DE; font-weight: 600; }
.timeline .when { white-space: nowrap; }
.timeline li span:last-child { text-align: right; }

.in-app { margin: 0 0 .75rem; }
.in-app strong { color: var(--maroon); }

.used { margin: 0; font-size: .875rem; color: var(--muted); }

footer { margin-top: 2.5rem; font-size: .8125rem; color: var(--muted); }
footer p { margin: .25rem 0; }
footer a { color: var(--maroon); }

/* ---------- The rising wheel ---------- */

.seg { fill: #F1E3D3; stroke: var(--ivory); stroke-width: 1.2; }
.seg.below { fill: #F6EDE2; }
.seg.rising { fill: url(#risegold); }
.horizon-line { stroke: var(--maroon); stroke-width: 1.4; }
.ground { fill: var(--ivory); opacity: .78; }
.east { font: 600 9px var(--sans); fill: var(--maroon); }
.marker { fill: var(--maroon); }

.ring { transform-origin: 0 0; transition: transform 1.4s cubic-bezier(.2, .7, .1, 1); }

@media (prefers-reduced-motion: reduce) {
  .ring { transition: none; }
}
