/* ===== Tokens ===== */
:root {
  --night: #131B33;
  --night-2: #0E1526;
  --teal: #0F3D3E;
  --gold: #C9A227;
  --gold-soft: #E4C863;
  --ivory: #F2ECDD;
  --copper: #B65C38;
  --sage: #7C9885;

  --font-display: 'Amiri', serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 4px;
  --wrap: 960px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--night);
  color: var(--ivory);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

a { color: var(--gold-soft); }

/* Subtle geometric star-field texture behind everything */
.star-field {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(242,236,221,0.25) 0, transparent 100%),
    radial-gradient(1px 1px at 140px 80px, rgba(242,236,221,0.18) 0, transparent 100%),
    radial-gradient(1.5px 1.5px at 300px 20px, rgba(201,162,39,0.3) 0, transparent 100%),
    radial-gradient(1px 1px at 400px 150px, rgba(242,236,221,0.2) 0, transparent 100%),
    radial-gradient(1.5px 1.5px at 500px 60px, rgba(242,236,221,0.15) 0, transparent 100%),
    radial-gradient(1px 1px at 620px 200px, rgba(201,162,39,0.25) 0, transparent 100%);
  background-repeat: repeat;
  background-size: 700px 400px;
}

/* ===== Header ===== */
.site-header {
  padding: 20px 0;
  border-bottom: 1px solid rgba(201,162,39,0.2);
}
.header-row { display: flex; align-items: center; justify-content: space-between; }
.brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 10px;
  color: var(--ivory);
  text-decoration: none;
}
.brand:hover { color: var(--gold-soft); }
.brand-mark { color: var(--gold); font-size: 1.3rem; }
.site-nav { display: flex; gap: 28px; }
.site-nav a {
  text-decoration: none;
  color: var(--ivory);
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.site-nav a:hover { opacity: 1; color: var(--gold-soft); }

/* ===== Hero ===== */
.hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  gap: 56px;
  padding: 72px 24px 56px;
}
.hero-moon svg { width: 100%; height: auto; }
.moon-base { fill: var(--gold-soft); }
.moon-shadow { fill: var(--night); }
.moon-ring { fill: none; stroke: rgba(201,162,39,0.35); stroke-width: 1; }

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--sage);
  margin: 0 0 10px;
}
#hijri-date-big {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  margin: 0 0 12px;
  color: var(--ivory);
  line-height: 1.1;
}
.hero-sub {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--gold-soft);
  margin: 0 0 18px;
}
.hero-note {
  font-size: 0.82rem;
  color: rgba(242,236,221,0.55);
  max-width: 48ch;
  margin: 0;
}

/* Geometric divider — 8-point star motif repeated as a structural rule */
.divider {
  height: 22px;
  margin: 8px auto 8px;
  max-width: var(--wrap);
  background-image: repeating-linear-gradient(
    135deg,
    rgba(201,162,39,0.35) 0px, rgba(201,162,39,0.35) 1px,
    transparent 1px, transparent 11px
  ),
  repeating-linear-gradient(
    45deg,
    rgba(201,162,39,0.35) 0px, rgba(201,162,39,0.35) 1px,
    transparent 1px, transparent 11px
  );
  opacity: 0.5;
  mask-image: linear-gradient(90deg, transparent, black 15%, black 85%, transparent);
}

/* ===== Sections ===== */
.section { padding: 56px 24px; }
.section-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 0 0 6px;
  color: var(--ivory);
}
.section-sub {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--sage);
  margin: 0 0 28px;
}

/* ===== Prayer times ===== */
.prayer-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.prayer-card {
  background: var(--teal);
  border: 1px solid rgba(201,162,39,0.25);
  border-radius: var(--radius);
  padding: 18px 10px;
  text-align: center;
  display: flex; flex-direction: column; gap: 8px;
}
.prayer-card.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold) inset;
}
.prayer-name {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sage);
}
.prayer-time {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--gold-soft);
}
.next-prayer {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--ivory);
}
.btn-locate {
  margin-top: 14px;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}
.btn-locate:hover { background: rgba(201,162,39,0.12); }

/* ===== Calendar ===== */
.cal-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.cal-nav { display: flex; align-items: center; gap: 16px; font-family: var(--font-mono); }
.cal-nav button {
  background: none; border: 1px solid rgba(201,162,39,0.35); color: var(--gold-soft);
  width: 32px; height: 32px; border-radius: var(--radius); cursor: pointer; font-size: 1rem;
}
.cal-nav button:hover { background: rgba(201,162,39,0.12); }
.cal-month-label { min-width: 180px; text-align: center; color: var(--ivory); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.cal-weekday {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--sage);
  padding-bottom: 6px;
}
.cal-day {
  aspect-ratio: 1;
  background: var(--teal);
  border: 1px solid rgba(201,162,39,0.15);
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
}
.cal-day.empty { background: transparent; border: none; }
.cal-day.today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.cal-day-num { font-family: var(--font-display); font-size: 1.1rem; color: var(--ivory); }
.cal-day-greg { font-family: var(--font-mono); font-size: 0.62rem; color: var(--sage); }

/* ===== Events ===== */
.events-list { display: flex; flex-direction: column; gap: 2px; }
.event-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(201,162,39,0.15);
}
.event-days {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--copper);
  background: rgba(182,92,56,0.15);
  padding: 4px 8px;
  border-radius: var(--radius);
  text-align: center;
}
.event-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ivory);
}
.event-hijri {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--sage);
  margin-top: 2px;
}
.event-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--gold-soft);
  text-align: right;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid rgba(201,162,39,0.2);
  padding: 28px 24px;
  margin-top: 40px;
}
.footer-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; font-size: 0.85rem; color: rgba(242,236,221,0.6); }
.footer-family { color: var(--gold-soft); }
.site-footer a { color: var(--gold-soft); text-decoration: none; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { opacity: 0.85; }
.footer-links a:hover { opacity: 1; }

/* ===== Legal / content pages ===== */
.legal-content {
  max-width: 680px;
  padding: 64px 24px 80px;
}
.legal-title {
  font-family: var(--font-display);
  font-size: 2.1rem;
  margin: 0 0 8px;
  color: var(--ivory);
}
.legal-updated {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--sage);
  margin: 0 0 32px;
}
.legal-content h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--gold-soft);
  margin: 32px 0 10px;
}
.legal-content p {
  color: rgba(242,236,221,0.85);
  font-size: 0.98rem;
}
.legal-content a { color: var(--gold-soft); }

.contact-card {
  margin-top: 24px;
  background: var(--teal);
  border: 1px solid rgba(201,162,39,0.25);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 340px;
}
.contact-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sage);
}
.contact-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--gold-soft);
}

/* ===== Info / educational sections ===== */
.info-text {
  max-width: 68ch;
  color: rgba(242,236,221,0.85);
  font-size: 0.98rem;
  margin-bottom: 20px;
}
.month-table-wrap { overflow-x: auto; }
.month-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.month-table th, .month-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(201,162,39,0.15);
}
.month-table th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sage);
}
.month-table td:first-child { font-family: var(--font-mono); color: var(--gold-soft); width: 40px; }
.month-table td.month-name { font-family: var(--font-display); font-size: 1.02rem; color: var(--ivory); }

/* ===== FAQ ===== */
.faq-list { display: flex; flex-direction: column; gap: 2px; }
.faq-item { border-bottom: 1px solid rgba(201,162,39,0.15); }
.faq-item summary {
  cursor: pointer;
  padding: 16px 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ivory);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--gold);
  font-size: 1.2rem;
}
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p {
  padding-bottom: 16px;
  margin: 0;
  color: rgba(242,236,221,0.8);
  font-size: 0.92rem;
  max-width: 65ch;
}

/* ===== Disclaimer banner (homepage) ===== */
.disclaimer-banner {
  border: 1px solid rgba(182,92,56,0.35);
  background: rgba(182,92,56,0.08);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.82rem;
  color: rgba(242,236,221,0.75);
  margin: 8px 0 0;
}
.disclaimer-banner a { color: var(--copper); }

/* ===== Footer additions ===== */
.footer-copyright {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(242,236,221,0.4);
  margin-top: 10px;
}

/* ===== Back to top ===== */
#back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--teal);
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}
#back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
#back-to-top:hover { background: rgba(201,162,39,0.18); }
@media (prefers-reduced-motion: reduce) {
  #back-to-top { transition: opacity 0.01s; }
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; text-align: center; gap: 28px; padding-top: 48px; }
  .hero-moon { width: 140px; margin: 0 auto; }
  .prayer-grid { grid-template-columns: repeat(3, 1fr); }
  .site-nav { gap: 16px; }
  .event-row { grid-template-columns: 70px 1fr; }
  .event-date { grid-column: 1 / -1; text-align: left; padding-left: 90px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Keyboard focus visibility */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
