/* Shared styles for the content pages and the site header/footer.
   index.html links this before its own <style> block, so the calculator's
   inline rules win wherever the two overlap. Tokens match index.html. */

:root {
  --bg: #0f172a;
  --card-bg: #0b1120;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-strong: #0ea5e9;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --border-subtle: rgba(148, 163, 184, 0.35);
  --danger: #f97373;
  --radius-lg: 16px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.7);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1e293b 0, #020617 55%);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.main-wrapper {
  margin-left: auto;
  margin-right: auto;
  max-width: 900px;
}

.card {
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.09), transparent 50%),
              var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(15, 23, 42, 0.9);
  margin-bottom: 20px;
}

/* Content pages: let the wrapper fill the body (a flex row) and shrink
   below its content's width on phones instead of overflowing. */
.content-page .main-wrapper { width: 100%; min-width: 0; }

/* ---- Header and footer (every page, calculator included) ---- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 18px;
}

.site-brand {
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-main);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.site-nav a {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-main);
  font-size: 0.88rem;
  text-decoration: none;
}

.site-nav a:hover { border-color: var(--accent-strong); color: var(--accent); }

.site-nav a[aria-current] {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
  color: var(--accent);
}

.site-footer {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
}

.site-footer a { color: var(--text-main); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer p { margin: 8px 0 0 0; }

/* ---- Prose (content pages) ---- */

.prose { line-height: 1.65; font-size: 0.97rem; padding: 24px 26px; }
.prose > :first-child { margin-top: 0; }
.prose h1 { margin: 0 0 18px 0; font-size: 1.9rem; letter-spacing: 0.02em; }
.prose h2 {
  margin: 30px 0 10px 0;
  padding-bottom: 6px;
  font-size: 1.22rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}
.prose h3 { margin: 22px 0 6px 0; font-size: 1.02rem; color: var(--accent); }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose a { color: var(--accent); text-underline-offset: 2px; }
.prose a:hover { color: var(--accent-strong); }
.prose strong { color: #f1f5f9; }
.prose code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(148, 163, 184, 0.14);
  font-size: 0.86em;
}

.table-scroll { overflow-x: auto; margin: 16px 0; }
.prose table { border-collapse: collapse; min-width: 50%; font-size: 0.92rem; }
.prose th, .prose td {
  padding: 7px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}
.prose thead th { color: var(--text-muted); font-weight: 600; }
.prose .month-table td { font-variant-numeric: tabular-nums; }

/* ---- Zone pages ---- */

.size-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.size-picker span { color: var(--text-muted); margin-right: 4px; }
.prose .size-picker a {
  min-width: 34px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  text-align: center;
  text-decoration: none;
  color: var(--text-main);
}
.prose .size-picker a[aria-current] {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
  color: var(--accent);
}

.zone-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px 22px;
  margin-top: 14px;
}
.zone-month h3 { margin: 0 0 6px 0; text-align: center; }

.hm-weekdays, .hm-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.hm-weekdays {
  margin-bottom: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}
.zone-month .hm-day {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}
.zone-month .hm-day-odds { font-size: 0.56rem; opacity: 0.85; white-space: nowrap; }

.hm-green { background: #6ee7a8; color: #14532d; }
.hm-orange { background: #fdba74; color: #7c2d12; }
.hm-red { background: #fb9ba4; color: #7f1d1d; }
.hm-nodata { background: rgba(148, 163, 184, 0.18); color: var(--text-muted); }
.hm-out { background: transparent; color: rgba(148, 163, 184, 0.4); }

.hm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.hm-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.hm-chip { width: 12px; height: 12px; border-radius: 4px; }

.cta { margin: 26px 0 8px 0; }
.prose .cta-button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #02121f;
  font-weight: 700;
  text-decoration: none;
}
.prose .cta-button:hover { background: var(--accent); color: #02121f; }

@media (max-width: 720px) {
  body { padding: 20px 12px; }
  .prose { padding: 18px 16px; }
  .prose h1 { font-size: 1.6rem; }
}
