/*
 * Forecast pages: independent scrollport.
 * Map app.css sets html/body { height:100%; overflow:hidden } for Leaflet.
 * We do NOT fight that for document scrolling — instead #beach-scroll is a
 * fixed full-viewport layer with its own overflow-y:auto (always works).
 */

html.beach-html {
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

html.beach-html body.beach-page,
body.beach-page {
  height: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  position: relative !important;
  background: var(--bg-deep, #021018);
}

/* Decorative ocean — behind content, never captures scroll */
body.beach-page > .ocean-bg,
body.beach-page .ocean-bg {
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

/*
 * THE scroll container — full viewport, vertical scroll only.
 * All forecast content lives inside this element.
 */
#beach-scroll,
.beach-scroll {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  z-index: 2 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  box-sizing: border-box;
}

.beach-shell {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 18px 120px;
  overflow: visible;
  min-height: min-content;
  box-sizing: border-box;
}

.beach-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

#back-to-map {
  font-weight: 700;
}

.back-link {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.back-link:hover {
  text-decoration: underline;
}

.footer-logo-link {
  display: inline-block;
  margin-bottom: 10px;
  line-height: 0;
}

.footer-logo {
  height: 88px;
  width: auto;
  max-width: min(220px, 70vw);
  object-fit: contain;
  opacity: 0.95;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.45));
}

.beach-footer a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
}

.beach-footer a:hover {
  text-decoration: underline;
}

.nav-brand {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.beach-hero {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: stretch;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  margin-bottom: 14px;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan-dim);
}

.beach-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.15;
  color: var(--text);
}

.hero-sub {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.coords {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hero-score {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.score-ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid var(--cyan);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(3, 40, 55, 0.65);
  box-shadow: 0 0 24px rgba(61, 224, 255, 0.2);
}

.score-ring #score-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}

.score-ring small {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 4px;
}

.now-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.now-metrics .metric {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.now-metrics .metric .k {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}

.now-metrics .metric .v {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.forecast-section {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.section-head {
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.moon-now {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.moon-emoji {
  font-size: 2.4rem;
  line-height: 1;
}

.moon-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.moon-tip {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 2px;
}

.moon-tip.prime {
  color: var(--good);
}

.moon-calendar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.moon-day {
  width: 48px;
  text-align: center;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 4px;
}

.moon-day.spring {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(240, 193, 75, 0.35);
}

.moon-day .me {
  display: block;
  font-size: 1.1rem;
}

.moon-day .md {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.day-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.day-card.excellent {
  border-color: rgba(26, 255, 192, 0.45);
}
.day-card.good {
  border-color: rgba(46, 229, 157, 0.4);
}
.day-card.fair {
  border-color: rgba(230, 200, 74, 0.35);
}
.day-card.poor {
  border-color: rgba(240, 138, 75, 0.35);
}
.day-card.bad {
  border-color: rgba(240, 82, 82, 0.35);
}

.day-card .date {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 6px;
}

.day-headline {
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 2.2em;
  margin-bottom: 8px;
  line-height: 1.35;
}

.day-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-size: 0.8rem;
}

.day-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-stats strong {
  font-variant-numeric: tabular-nums;
}

.hourly-wrap {
  overflow: auto;
  max-height: 420px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.hourly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.hourly-table th {
  position: sticky;
  top: 0;
  background: #0a2a3a;
  text-align: left;
  padding: 8px 10px;
  color: var(--cyan-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 1;
}

.hourly-table td {
  padding: 7px 10px;
  border-top: 1px solid rgba(61, 224, 255, 0.08);
}

.hourly-table tr.good-row {
  background: rgba(46, 229, 157, 0.08);
}

.tide-chart-wrap {
  margin-top: 4px;
}

.tide-chart {
  width: 100%;
  height: 140px;
  display: block;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.tide-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.tide-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
}

.tide-daily {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tide-day-chip {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.78rem;
  color: var(--text);
}

.tide-day-chip b {
  display: block;
  color: var(--cyan);
  font-size: 0.7rem;
  margin-bottom: 2px;
}

.forecast-section.tips ul {
  margin: 8px 0 0;
  padding-left: 1.2em;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.9rem;
}

.forecast-section.tips li {
  margin-bottom: 6px;
}

.beach-footer {
  text-align: center;
  padding: 12px 8px 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

.legal-block {
  border-color: rgba(240, 193, 75, 0.4);
  background: rgba(240, 193, 75, 0.07);
}

.legal-block h2 {
  color: var(--gold);
}

.legal-disclaimer {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.legal-disclaimer strong {
  color: var(--gold);
}

.legal-disclaimer-footer {
  margin: 0 auto 12px;
  max-width: 36rem;
  font-size: 0.8rem;
  color: var(--gold);
}

.site-home-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.site-home-link:hover {
  color: var(--cyan);
  text-decoration: underline;
}

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px;
  color: var(--muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(61, 224, 255, 0.2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .beach-hero {
    flex-direction: column;
  }

  .score-ring {
    width: 96px;
    height: 96px;
  }

  .beach-shell {
    padding: 12px 12px 100px;
  }

  #beach-scroll,
  .beach-scroll {
    /* iOS safe areas */
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}
