/* Utah Dark Sky Tours — §4.8 "Statewide Atlas Page"
   Spectral 600/700 headings | IBM Plex Sans body | IBM Plex Mono data
   bg #12161f | surface #1c2232 | accent #4da6ff | CTA #f5c842
   ------------------------------------------------------------------ */

/* ========================= TOKENS ========================= */

:root {
  --bg:          #12161f;
  --surface:     #1c2232;
  --text:        #dce3ee;
  --muted:       #8090aa;
  --blue:        #4da6ff;
  --amber:       #f5c842;
  --amber-dark:  #12161f;   /* text on amber buttons */
  --amber-hover: #e3b32e;
  --red-bortle:  #e05252;   /* Bortle 5+ */
  --border:      rgba(77,166,255,0.15);
  --border-mid:  rgba(77,166,255,0.28);

  --f-display: "Spectral", Georgia, "Times New Roman", serif;
  --f-body:    "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-mono:    "IBM Plex Mono", "Courier New", monospace;

  --max-layout: 80rem;
  --measure:    65ch;
  --col:        min(var(--measure), 100% - 3rem);

  /* 4px base spacing scale */
  --s1: 0.25rem;   /*  4px */
  --s2: 0.5rem;    /*  8px */
  --s3: 0.75rem;   /* 12px */
  --s4: 1rem;      /* 16px */
  --s5: 1.25rem;   /* 20px */
  --s6: 1.5rem;    /* 24px */
  --s8: 2rem;      /* 32px */
  --s10: 2.5rem;   /* 40px */
  --s12: 3rem;     /* 48px */
  --s16: 4rem;     /* 64px */
  --s24: 6rem;     /* 96px */
}

/* ========================= RESET ========================== */

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: clamp(1rem, 1vw + 0.875rem, 1.125rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--text);
}

/* ========================= LAYOUT ========================= */

.wrap {
  width: min(var(--max-layout), 100% - 2.5rem);
  margin-inline: auto;
}

/* Body text is 65ch column, left-aligned */
.prose {
  max-width: var(--measure);
}

.prose p + p         { margin-top: var(--s5); }
.prose p + h2,
.prose ul + h2,
.prose ol + h2       { margin-top: var(--s16); }
.prose h2            { margin-top: var(--s12); }
.prose h3            { margin-top: var(--s8); }
.prose p:first-child { margin-top: 0; }
.prose ul, .prose ol { margin: var(--s5) 0 var(--s5) var(--s6); }
.prose li + li       { margin-top: var(--s2); }

main { display: block; }

section {
  padding: var(--s24) 0;
}

section.section-sm {
  padding: var(--s16) 0;
}

.section-alt {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

/* Alternating section gap rhythm — explicit, not cascading */

/* ========================= TYPOGRAPHY ===================== */

h1, h2, h3, h4, h5 {
  font-family: var(--f-display);
  font-weight: 700;
  line-height: 1.15;
  color: #f0f3f8;
  text-wrap: balance;
  overflow-wrap: break-word;
}

h1 { font-size: clamp(2.5rem, 6vw + 0.5rem, 4.5rem); }
h2 { font-size: clamp(1.5rem, 3vw + 0.5rem, 2.25rem); margin-bottom: var(--s5); }
h3 { font-size: clamp(1.1rem, 1.5vw + 0.75rem, 1.35rem); margin-bottom: var(--s3); }
h4 { font-size: 1rem; font-weight: 600; margin-bottom: var(--s2); }

/* mono captions / data */
.mono {
  font-family: var(--f-mono);
  font-size: 0.85em;
  letter-spacing: 0.01em;
  color: var(--muted);
}

/* ========================= HEADER / NAV =================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(18, 22, 31, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s6);
  padding: var(--s4) 0;
}

.brand {
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.brand span { color: var(--amber); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s5);
  font-size: 0.875rem;
  font-weight: 500;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: var(--s1) 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.site-nav a:hover { color: var(--text); }

.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--blue);
}

/* ========================= BUTTONS ======================== */

.btn {
  display: inline-block;
  padding: var(--s4) var(--s8);
  border-radius: 3px;
  font-family: var(--f-body);
  font-weight: 700;
  font-size: 0.9375rem;
  text-decoration: none;
  border: 1px solid transparent;
  min-height: 44px;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, filter 0.15s;
}

.btn-primary {
  background: var(--amber);
  color: var(--amber-dark);
  border-color: transparent;
}

.btn-primary:hover {
  background: var(--amber-hover);
  color: var(--amber-dark);
  filter: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--blue);
}

.btn-ghost:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ========================= HERO =========================== */

.hero {
  position: relative;
  min-height: 75vh;
  display: flex;
  align-items: flex-end;
  background:
    linear-gradient(
      to bottom,
      rgba(18,22,31,0.20) 0%,
      rgba(18,22,31,0.30) 40%,
      rgba(18,22,31,0.70) 80%,
      rgba(18,22,31,0.88) 100%
    ),
    url("/images/brand/natural-bridges-hero.jpg") center / cover no-repeat;
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  padding: var(--s24) 0 var(--s16);
  max-width: 52rem;
}

.hero-inner h1 {
  font-size: clamp(2.5rem, 6vw + 0.5rem, 4.5rem);
  line-height: 1.1;
  color: #f5f7fb;
}

.hero-inner .lede {
  font-family: var(--f-body);
  font-size: clamp(1rem, 1.5vw + 0.75rem, 1.2rem);
  color: rgba(220,227,238,0.9);
  margin-top: var(--s5);
  max-width: var(--measure);
  line-height: 1.65;
}

.hero-coord {
  font-family: var(--f-mono);
  font-size: 0.85rem;
  color: var(--blue);
  letter-spacing: 0.06em;
  margin-top: var(--s4);
  opacity: 0.85;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  margin-top: var(--s8);
}

/* ========================= PARK COMPARISON GRID =========== */

.parks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s5);
  margin-top: var(--s10);
}

.park-card {
  background: #232b3e;
  border: 1px solid rgba(77,166,255,0.28);
  border-radius: 3px;
  padding: var(--s6) var(--s6) var(--s5);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  transition: border-color 0.15s;
}

.park-card:hover {
  border-color: var(--border-mid);
}

/* Bryce promoted card */
.park-card.featured {
  border: 2px solid var(--amber);
  padding: calc(var(--s6) - 1px) calc(var(--s6) - 1px) calc(var(--s5) - 1px);
  grid-column: 1 / -1;     /* spans full row */
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto;
  gap: var(--s3) var(--s8);
}

.park-card.featured .park-card-body {
  display: contents;
}

.park-star {
  position: absolute;
  top: -0.6rem;
  left: var(--s6);
  font-size: 0.8125rem;
  font-family: var(--f-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--amber-dark);
  background: var(--amber);
  padding: 0.15rem var(--s3);
  border-radius: 0;
}

.park-name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 2vw + 0.5rem, 1.4rem);
  color: #f0f3f8;
  line-height: 1.2;
}

.park-coords {
  font-family: var(--f-mono);
  font-size: 0.875rem;
  color: var(--blue);
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.bortle-display {
  font-family: var(--f-mono);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 500;
  line-height: 1;
  /* color set by class below */
}

.bortle-1-2  { color: var(--amber); }
.bortle-3-4  { color: var(--muted); }
.bortle-5up  { color: var(--red-bortle); }

.bortle-label {
  font-family: var(--f-body);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-top: var(--s1);
}

.park-note {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.6;
  margin-top: var(--s1);
}

.park-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: var(--s2);
  font-family: var(--f-body);
}

.park-meta strong { color: var(--text); font-weight: 600; }

/* Bortle column in featured card */
.park-bortle-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: var(--s4) var(--s5);
  background: rgba(18,22,31,0.6);
  border: 1px solid var(--border);
  border-radius: 3px;
  min-width: 6rem;
  text-align: center;
}

/* ========================= ATLAS BOOKING CTA CARD ========= */

.atlas-cta {
  grid-column: 1 / -1;
  background: #232b3e;
  border: 1px solid rgba(77,166,255,0.28);
  border-radius: 3px;
  border-left: 3px solid var(--amber);
  padding: var(--s8) var(--s8) var(--s6);
  display: flex;
  gap: var(--s8);
  align-items: center;
  flex-wrap: wrap;
  margin-top: var(--s5);
}

.atlas-cta-text {
  flex: 1 1 280px;
}

.atlas-cta-text h3 {
  font-family: var(--f-display);
  font-size: clamp(1.15rem, 2vw + 0.5rem, 1.5rem);
  color: #f0f3f8;
  margin-bottom: var(--s3);
}

.atlas-cta-text p {
  font-size: 0.9375rem;
  color: var(--muted);
  max-width: 48ch;
}

/* ========================= COMPARISON TABLE =============== */

.table-scroll {
  overflow-x: auto;
  margin-top: var(--s6);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 34rem;
}

thead tr {
  border-bottom: 2px solid var(--blue);
}

th {
  font-family: var(--f-body);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blue);
  padding: var(--s3) var(--s4);
  text-align: left;
  white-space: nowrap;
}

th.right, td.right {
  text-align: right;
  font-family: var(--f-mono);
}

td {
  padding: var(--s4) var(--s4);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  vertical-align: top;
}

td:first-child {
  color: var(--text);
  font-weight: 600;
  font-family: var(--f-body);
}

tbody tr:nth-child(odd) td {
  background: rgba(28,34,50,0.5);
}

/* mono values right-aligned */
td.mono-val {
  font-family: var(--f-mono);
  text-align: right;
  white-space: nowrap;
  font-size: 0.875rem;
}

/* ========================= FIGURES / PHOTOS =============== */

figure {
  margin: var(--s10) 0;
}

figure img {
  border-radius: 0;
  border: 1px solid var(--border);
  width: 100%;
}

figcaption {
  margin-top: var(--s3);
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

figcaption .fig-coord {
  display: block;
  font-family: var(--f-mono);
  font-size: 0.875rem;
  color: var(--blue);
  margin-top: var(--s1);
  opacity: 0.8;
}

/* Full-bleed photo break — intentionally breaks column */
.photo-break {
  position: relative;
  height: 50vh;
  min-height: 280px;
  max-height: 520px;
  overflow: hidden;
  margin: var(--s24) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.photo-break img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.72);
  border: none;
}

.photo-break figcaption {
  position: absolute;
  bottom: var(--s4);
  left: var(--s5);
  right: var(--s5);
  color: rgba(220,227,238,0.75);
  font-size: 0.875rem;
}

.photo-break figcaption .fig-coord {
  color: rgba(77,166,255,0.75);
}

/* ========================= PULL QUOTE ==================== */

.pull-quote {
  border-left: 3px solid var(--blue);
  padding: var(--s5) var(--s6);
  margin: var(--s10) 0;
  background: var(--surface);
  border-radius: 0 3px 3px 0;
}

.pull-quote p {
  font-family: var(--f-display);
  font-size: clamp(1.1rem, 2vw + 0.5rem, 1.4rem);
  font-style: italic;
  color: var(--text);
  line-height: 1.5;
}

.pull-quote cite {
  display: block;
  margin-top: var(--s3);
  font-family: var(--f-mono);
  font-size: 0.875rem;
  color: var(--muted);
  font-style: normal;
  letter-spacing: 0.03em;
}

/* ========================= CALLOUT ======================== */

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  background: var(--surface);
  border-radius: 0 3px 3px 0;
  padding: var(--s5) var(--s6);
  margin: var(--s8) 0;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.65;
}

/* ========================= RANK CARDS ===================== */

.rank-list {
  margin-top: var(--s8);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.rank-card {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: var(--s5) var(--s6);
  background: #232b3e;
  border: 1px solid rgba(77,166,255,0.28);
  border-radius: 3px;
  padding: var(--s6);
}

.rank-card.featured {
  background: #232b3e;
  border: 2px solid var(--amber);
  padding: calc(var(--s6) - 1px);
}

.rank-num {
  font-family: var(--f-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--amber);
  line-height: 1;
  padding-top: 0.2rem;
}

.rank-card h3 {
  margin-bottom: var(--s2);
  font-size: 1.25rem;
}

.rank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  font-family: var(--f-mono);
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: var(--s4);
  letter-spacing: 0.02em;
}

.rank-meta b { color: var(--text); font-weight: 600; }

.rank-card p {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.65;
}

/* ========================= FAQ ============================ */

.faq-list {
  margin-top: var(--s8);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  overflow: hidden;
}

.faq-item summary,
.faq-item > h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s5) var(--s6);
  cursor: pointer;
  list-style: none;
  font-family: var(--f-display);
  font-size: clamp(0.95rem, 1.5vw + 0.5rem, 1.1rem);
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item[open] > summary {
  border-bottom-color: var(--border);
  color: #f0f3f8;
}

.faq-toggle {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--blue);
  transition: transform 0.2s ease-out;
  font-size: 1.1rem;
  font-style: normal;
  font-family: var(--f-mono);
  line-height: 1;
  text-align: center;
}

.faq-item[open] .faq-toggle {
  transform: rotate(45deg);
}

.faq-answer {
  padding: var(--s5) var(--s6) var(--s6);
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.faq-answer p + p { margin-top: var(--s4); }

/* ========================= MONTH CARDS ==================== */

.month-list {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  margin-top: var(--s8);
}

.month {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  padding: var(--s6);
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: var(--s4) var(--s6);
  align-items: start;
}

.month-name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: #f0f3f8;
  line-height: 1.2;
}

.month-tag {
  display: block;
  margin-top: var(--s2);
  font-family: var(--f-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  opacity: 0.8;
}

.month-body {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.65;
}

.month-body a { color: var(--blue); }

/* ========================= BREADCRUMBS ==================== */

.breadcrumbs {
  font-size: 0.8125rem;
  color: var(--muted);
  padding: var(--s5) 0 0;
  font-family: var(--f-body);
  font-weight: 500;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover { color: var(--text); }

.breadcrumbs span { margin: 0 var(--s2); }

/* ========================= PAGE HEADER (subpages) ========= */

.page-header {
  padding: var(--s16) 0 var(--s12);
}

.page-header-inner {
  max-width: 54rem;
}

.page-header-inner .lede {
  font-size: clamp(1rem, 1.5vw + 0.5rem, 1.2rem);
  color: rgba(220,227,238,0.82);
  margin-top: var(--s5);
  max-width: var(--measure);
  line-height: 1.65;
}

/* ========================= CTA BAND ======================= */

.cta-band {
  background: var(--surface);
  border-block: 1px solid var(--border);
  padding: var(--s16) 0;
  text-align: center;
}

.cta-band h2 { margin-bottom: var(--s4); }

.cta-band p {
  max-width: 44ch;
  margin: 0 auto var(--s8);
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Photo version */
.cta-band.cta-photo {
  background:
    linear-gradient(rgba(18,22,31,0.45), rgba(18,22,31,0.60)),
    url("/images/brand/east-canyon-milky-way.jpg") center / cover no-repeat;
}

.cta-band.cta-photo p { color: rgba(220,227,238,0.85); }

/* ========================= FOOTER ========================= */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: var(--s12) 0 var(--s8);
  margin-top: var(--s16);
  font-size: 0.875rem;
  color: var(--muted);
}

.footer-cols {
  display: grid;
  gap: var(--s8);
  margin-bottom: var(--s8);
}

@media (min-width: 46rem) {
  .footer-cols { grid-template-columns: 2fr 1fr 1fr; }
}

.site-footer h4 {
  font-family: var(--f-display);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--s4);
}

.site-footer ul { list-style: none; }
.site-footer li { margin-top: var(--s2); }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--blue); }

.footer-note {
  border-top: 1px solid var(--border);
  padding-top: var(--s5);
  font-size: 0.8125rem;
  line-height: 1.6;
}

/* ========================= MOBILE NAV TOGGLE ============== */

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  cursor: pointer;
  padding: var(--s2) var(--s3);
  font-size: 1.15rem;
  line-height: 1;
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
}

/* ========================= SCROLL REVEAL ================== */

/* Scroll-driven reveal — no opacity:0 at any state; subtle translate only */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: fade-up linear forwards;
      animation-timeline: view();
      animation-range: entry 5% entry 35%;
    }

    @keyframes fade-up {
      from { opacity: 0.85; translate: 0 0.6rem; }
      to   { opacity: 1; translate: 0 0; }
    }
  }
}

/* ========================= MOBILE ========================= */

@media (max-width: 768px) {

  section { padding: var(--s12) 0; }
  section + section { padding-top: var(--s10); }

  .hero { min-height: 65vh; }
  .hero-inner { padding: var(--s12) 0 var(--s10); }

  /* nav */
  .site-header .wrap {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
  }

  .nav-toggle { display: flex; }

  .site-nav {
    display: none;
    flex-direction: column;
    gap: var(--s1);
    width: 100%;
    order: 3;
    padding: var(--s3) 0 var(--s4);
    border-top: 1px solid var(--border);
    margin-top: var(--s3);
  }

  .site-nav.open { display: flex; }

  .site-nav a {
    display: block;
    padding: var(--s3) 0;
    min-height: 44px;
  }

  /* parks grid to single col */
  .parks-grid {
    grid-template-columns: 1fr;
  }

  .park-card.featured {
    grid-column: 1;
    grid-template-columns: 1fr;
  }

  .park-bortle-col {
    flex-direction: row;
    align-items: baseline;
    gap: var(--s4);
    min-width: unset;
    justify-content: flex-start;
    padding: var(--s3) var(--s4);
  }

  /* hero actions stack */
  .hero-actions { flex-direction: column; }

  .hero-actions .btn,
  .cta-band .btn {
    display: block;
    width: 100%;
    text-align: center;
  }

  /* month cards to single col */
  .month {
    grid-template-columns: 1fr !important;
    gap: var(--s3);
  }

  /* rank cards */
  .rank-card {
    grid-template-columns: 2.5rem 1fr;
    padding: var(--s5);
    gap: var(--s3) var(--s4);
  }

  /* table scroll — allow horizontal scroll, no bleed on mobile */
  .table-scroll {
    margin-inline: 0;
    padding-inline: 0;
  }

  th, td { padding: var(--s3) var(--s3); }

  .atlas-cta { flex-direction: column; gap: var(--s5); }

  .photo-break { height: 40vh; margin: var(--s16) 0; }

  img { max-width: 100%; }
}

/* ========================= PRINT ========================== */

@media print {
  .site-header, .cta-band, .site-footer, .nav-toggle { display: none; }
  body { background: white; color: black; }
}
