/* ============================================================
   Weather Witch — shared site stylesheet
   Link this file from every page: <link rel="stylesheet" href="styles.css">
   ============================================================ */

:root {
  --ink-900: #1b1526;
  --ink-800: #241c33;
  --plum-700: #362a47;
  --plum-600: #443456;
  --brass-500: #c79a3b;
  --brass-300: #e0c273;
  --teal-500: #5b8a8d;
  --parchment-100: #f4ecda;
  --parchment-200: #ebe0c6;
  --text-100: #f1e9d8;
  --text-400: #b6a9c9;
  --text-ink: #2b2438;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: linear-gradient(180deg, var(--ink-900) 0%, var(--ink-800) 55%, #2c2340 100%);
  color: var(--text-100);
  font-family: 'Work Sans', sans-serif;
  line-height: 1.6;
}

a { color: inherit; }

/* ---------- Star field (apply to any full-bleed section) ---------- */
.stars {
  position: relative;
  overflow: hidden;
}
.stars::before,
.stars::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(241,233,216,0.8), transparent),
    radial-gradient(1.5px 1.5px at 65% 15%, rgba(241,233,216,0.6), transparent),
    radial-gradient(1px 1px at 80% 55%, rgba(241,233,216,0.7), transparent),
    radial-gradient(1.5px 1.5px at 35% 70%, rgba(241,233,216,0.5), transparent),
    radial-gradient(1px 1px at 50% 40%, rgba(241,233,216,0.9), transparent),
    radial-gradient(1.5px 1.5px at 90% 80%, rgba(241,233,216,0.6), transparent),
    radial-gradient(1px 1px at 10% 85%, rgba(241,233,216,0.5), transparent);
  background-size: 100% 100%;
  animation: twinkle 5s ease-in-out infinite alternate;
  pointer-events: none;
}
.stars::after {
  background-position: 40px 30px;
  animation-duration: 7s;
  animation-delay: 1.2s;
}
@keyframes twinkle {
  from { opacity: 0.4; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .stars::before, .stars::after { animation: none; opacity: 0.7; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   Site header / navigation
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(27, 21, 38, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(199, 154, 59, 0.25);
}
.header-inner {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
}
.brand {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text-100);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.brand .moon-mini { color: var(--brass-300); }

/* Mobile hamburger toggle (checkbox hack, no JS required to function) */
.nav-toggle { display: none; }
.nav-toggle-label {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 0.4rem;
}
.nav-toggle-label span {
  width: 22px;
  height: 2px;
  background: var(--brass-300);
  display: block;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.site-nav > a {
  color: var(--text-100);
  text-decoration: none;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}
.site-nav > a:hover,
.site-nav > a.active { color: var(--brass-300); }

/* Dropdown groups */
.nav-group { position: relative; }
.nav-group summary {
  list-style: none;
  cursor: pointer;
  color: var(--text-100);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after {
  content: "▾";
  font-size: 0.7em;
  color: var(--brass-500);
}
.nav-group[open] summary::after { content: "▴"; }
.nav-group summary:hover { color: var(--brass-300); }

.nav-group ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--plum-700);
  border: 1px solid rgba(199, 154, 59, 0.3);
  border-radius: 8px;
  min-width: 220px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}
.nav-group ul li a {
  display: block;
  padding: 0.55rem 0.7rem;
  color: var(--text-100);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 5px;
  white-space: nowrap;
}
.nav-group ul li a:hover { background: rgba(199, 154, 59, 0.15); color: var(--brass-300); }

/* Mobile nav layout */
@media (max-width: 780px) {
  .nav-toggle-label { display: flex; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ink-800);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    border-bottom: 1px solid rgba(199, 154, 59, 0.25);
  }
  .nav-toggle:checked ~ .site-nav { max-height: 600px; }

  .site-nav > a,
  .nav-group {
    padding: 0.9rem 1.5rem;
    border-top: 1px solid rgba(199, 154, 59, 0.12);
  }
  .nav-group ul {
    position: static;
    transform: none;
    background: transparent;
    border: none;
    box-shadow: none;
    padding-left: 1rem;
    margin-top: 0.5rem;
    min-width: 0;
  }
  .nav-group summary { justify-content: space-between; }
}

/* ---------- Hero (homepage) ---------- */
.hero { text-align: center; padding: 6rem 1.5rem 5rem; }
.hero .moon { font-size: 2.25rem; display: inline-block; margin-bottom: 1rem; color: var(--brass-300); }
.hero h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  margin: 0 0 0.75rem;
  letter-spacing: 0.01em;
  color: var(--text-100);
}
.hero p.tagline {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--brass-300);
  max-width: 32ch;
  margin: 0 auto;
}

/* ---------- Page header (subpages) ---------- */
.page-header { text-align: center; padding: 3.5rem 1.5rem 3rem; }
.page-header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: clamp(2.1rem, 4.5vw, 3rem);
  margin: 0 0 0.5rem;
  color: var(--text-100);
}
.page-header p.tagline {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  color: var(--brass-300);
  max-width: 40ch;
  margin: 0 auto;
}

/* ---------- Moon phase divider ---------- */
.moon-divider {
  text-align: center;
  letter-spacing: 0.6em;
  color: var(--brass-500);
  font-size: 1.1rem;
  padding: 0 0 0.25em 0.6em;
  opacity: 0.8;
  user-select: none;
}

/* ---------- Sections ---------- */
main { max-width: 880px; margin: 0 auto; padding: 0 1.5rem 5rem; }
section { margin-top: 4.5rem; }
section > h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--brass-300);
  text-align: center;
  margin-bottom: 0.4rem;
}
section > p.section-sub {
  text-align: center;
  color: var(--text-400);
  font-size: 0.95rem;
  margin-top: 0;
  margin-bottom: 2rem;
}

/* ---------- Content card (general prose) ---------- */
.intro-card,
.content-card {
  background: var(--plum-700);
  border: 1px solid rgba(199, 154, 59, 0.25);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  font-size: 1.05rem;
  color: var(--text-100);
}
.intro-card strong,
.content-card strong { color: var(--brass-300); font-weight: 600; }
.content-card h3 {
  font-family: 'Cormorant Garamond', serif;
  color: var(--brass-300);
  font-size: 1.3rem;
  margin-top: 1.75rem;
}
.content-card h3:first-child { margin-top: 0; }
.content-card ul { padding-left: 1.2rem; }
.content-card li { margin-bottom: 0.5rem; }

/* ---------- Link list (for "links" pages) ---------- */
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.link-list li {
  background: var(--plum-700);
  border: 1px solid rgba(199, 154, 59, 0.2);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.link-list a {
  font-weight: 600;
  color: var(--brass-300);
  text-decoration: none;
}
.link-list a:hover { text-decoration: underline; }
.link-list p {
  margin: 0.35rem 0 0;
  color: var(--text-400);
  font-size: 0.92rem;
}
.link-list .cover-link { display: block; text-align: center; }
.link-list .cover-link img { display: inline-block; }

/* ---------- Photo feature (centered image + caption) ---------- */
.photo-feature {
  max-width: 640px;
  margin: 0 auto 3.5rem;
  text-align: center;
}
.photo-feature img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid rgba(199, 154, 59, 0.25);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.photo-feature figcaption {
  margin-top: 1rem;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-100);
}
.photo-feature:last-child { margin-bottom: 0; }

/* ---------- Weather / instrument panel ---------- */
.instrument-panel {
  background: var(--ink-800);
  border: 1px solid var(--brass-500);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 0 0 1px rgba(199, 154, 59, 0.15) inset, 0 12px 32px rgba(0, 0, 0, 0.35);
}
.instrument-panel iframe { width: 100%; height: 400px; border: none; border-radius: 6px; display: block; }
.instrument-credit {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-400);
  margin-top: 0.75rem;
}
.instrument-credit a { color: var(--brass-300); text-decoration: none; border-bottom: 1px solid rgba(224, 194, 115, 0.4); }
.instrument-credit a:hover { color: var(--brass-500); }

/* ---------- Converters ---------- */
.converter-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
@media (max-width: 640px) { .converter-grid { grid-template-columns: 1fr; } }

.converter-card {
  background: var(--parchment-100);
  color: var(--text-ink);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem 1.6rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.converter-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 1rem;
  color: var(--text-ink);
  border-bottom: 1px solid rgba(43, 36, 56, 0.15);
  padding-bottom: 0.5rem;
}
.converter-row { display: flex; align-items: end; gap: 0.75rem; margin-bottom: 0.75rem; }
.converter-row:last-child { margin-bottom: 0; }
.field { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: #5c5270; }
.field input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(43, 36, 56, 0.25);
  border-radius: 6px;
  background: #fff;
  color: var(--text-ink);
  width: 100%;
}
.field input:focus { outline: 2px solid var(--teal-500); outline-offset: 1px; }
.convert-btn {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.55rem 0.7rem;
  border: none;
  border-radius: 6px;
  background: var(--teal-500);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}
.convert-btn:hover { background: #4a7376; }
.convert-btn:focus-visible { outline: 2px solid var(--brass-500); outline-offset: 2px; }

/* ---------- Footer ---------- */
footer { text-align: center; padding: 3rem 1.5rem 4rem; color: var(--text-400); font-size: 0.85rem; }
footer p.contact { margin-top: 0.75rem; }
footer a { color: var(--brass-300); text-decoration: none; border-bottom: 1px solid rgba(224, 194, 115, 0.4); }
footer a:hover { color: var(--brass-500); }
