/* Shared styling for every report HTML at /flood_reports/*.html.
 *
 * Every report page references this file via a single <link> tag. The
 * companion /report-chrome.js wraps the raw body content in site chrome
 * (header + footer + styled article). Updating these two files updates
 * the appearance of every report in the archive — old and new alike.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,400;9..144,600&display=swap');

:root {
  --bg: #fafaf7;
  --bg-sunken: #f4f2ec;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-muted: #475569;
  --line: #e2e8f0;
  --accent: #0e7490;
  --accent-soft: #cffafe;
  --safe: #059669;
  --elevated: #c2410c;
  --warning: #b91c1c;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Hidden until JS wraps the content — prevents a flash of unstyled
 * markdown before chrome lands. report-chrome.js adds .chrome-ready
 * once the DOM has been rebuilt. */
body {
  visibility: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.chrome-ready { visibility: visible; }

h1, h2, h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ----- Site header (injected by JS) ----- */
header.site {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(1.2) blur(8px);
}
header.site .nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
header.site .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}
header.site .brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: block;
}
header.site nav.links {
  display: flex;
  gap: 28px;
  font-size: 0.925rem;
}
header.site nav.links a { color: var(--ink); }
header.site nav.links a:hover { color: var(--accent); text-decoration: none; }
header.site nav.links a[aria-current="page"] { color: var(--accent); }
header.site .nav-cta {
  background: var(--ink);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: inline-block;
  white-space: nowrap;
}
header.site .nav-cta:hover {
  background: #1e293b;
  text-decoration: none;
  color: #fff;
}
header.site .menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}
header.site .menu-toggle:hover { background: var(--bg-sunken); }
header.site .menu-toggle .bar {
  transition: transform 0.2s ease, opacity 0.15s ease;
  transform-origin: center;
}
header.site .menu-toggle[aria-expanded="true"] .bar.top {
  transform: translate(0, 5px) rotate(45deg);
}
header.site .menu-toggle[aria-expanded="true"] .bar.middle { opacity: 0; }
header.site .menu-toggle[aria-expanded="true"] .bar.bottom {
  transform: translate(0, -5px) rotate(-45deg);
}

/* ----- Report body (wraps whatever was in <body>) ----- */
main.report { padding: 40px 0 24px; }
main.report .back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: var(--ink-muted);
}
article.report-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 40px;
  max-width: 72ch;
}
article.report-body h1,
article.report-body h2,
article.report-body h3 {
  /* LLM output includes section headings like
     "PRECAUTIONARY/PREPAREDNESS ACTIONS..." — one long unbreakable
     compound that overflows on narrow iPhone viewports. Allow the
     browser to break mid-word when needed (it prefers the slash). */
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}
article.report-body h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  margin: 0 0 18px;
}
article.report-body h2 {
  font-size: clamp(1.125rem, 4vw, 1.375rem);
  margin: 28px 0 10px;
  color: var(--ink);
}
article.report-body h3 {
  font-size: 1.1rem;
  margin: 22px 0 8px;
}
article.report-body p {
  margin: 0 0 14px;
  color: var(--ink);
}
article.report-body strong { color: var(--ink); }
article.report-body ul,
article.report-body ol {
  padding-left: 1.25em;
  margin: 0 0 14px;
  color: var(--ink);
}
article.report-body li { margin: 4px 0; }
article.report-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.925rem;
}
article.report-body th,
article.report-body td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
}
article.report-body th {
  background: var(--bg-sunken);
  font-weight: 600;
}
article.report-body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-sunken);
  padding: 2px 6px;
  border-radius: 4px;
}
article.report-body blockquote {
  margin: 14px 0;
  padding: 12px 18px;
  background: var(--bg-sunken);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--ink-muted);
}

/* ----- Supplementary widgets (tide chart / weather / analog) ----- */
.report-widgets {
  max-width: 820px;
  margin: 24px auto 0;
  padding: 0 24px;
}
.report-widgets .widgets-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
  margin: 16px 0 14px;
}
.report-widgets h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.125rem;
  margin: 0 0 12px;
  color: var(--ink);
}

.tide-chart-widget {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 0 0 20px;
}
.tide-chart-widget figcaption {
  color: var(--ink-muted);
  font-size: 0.875rem;
  margin-bottom: 16px;
}
.tide-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.weather-widget {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 0 0 20px;
}
.weather-widget .weather-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 0.925rem;
}
.weather-widget .weather-table th,
.weather-widget .weather-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  color: var(--ink);
}
.weather-widget .weather-table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--line);
}
.weather-widget .weather-table tbody th {
  color: var(--ink-muted);
  font-weight: 500;
  width: 40%;
}
.weather-widget .weather-table td.range {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.weather-widget .hint {
  color: var(--ink-muted);
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.55;
}

.analog-widget {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 0 0 20px;
}
.analog-widget .analog-card {
  background: var(--bg-sunken);
  border-radius: 10px;
  padding: 18px 20px;
}
.analog-widget .analog-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.analog-widget .analog-date {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}
.analog-widget .analog-cat {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--elevated-soft, #ffedd5);
  color: var(--elevated);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.analog-widget .analog-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 0 0 14px;
}
.analog-widget .analog-stats > div { margin: 0; }
.analog-widget .analog-stats dt {
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
}
.analog-widget .analog-stats dd {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.125rem;
  color: var(--ink);
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.analog-widget .analog-similarity,
.analog-widget .analog-notes {
  color: var(--ink-muted);
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 0 0 6px;
}
.analog-widget .analog-notes {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

@media (max-width: 600px) {
  .report-widgets { padding: 0 16px; }
  .tide-chart-widget,
  .weather-widget,
  .analog-widget { padding: 20px 20px; }
  .analog-widget .analog-stats { grid-template-columns: 1fr 1fr; }
}

/* ----- Footer (injected by JS) ----- */
footer.site {
  padding: 40px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 0.85rem;
  margin-top: 48px;
}
footer.site .footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
footer.site .footer-links { display: flex; gap: 20px; }
footer.site a { color: var(--ink-muted); }

@media (max-width: 720px) {
  header.site .menu-toggle { display: inline-flex; }
  header.site .nav { position: relative; }
  header.site .brand { flex-grow: 1; }
  header.site nav.links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
    padding: 8px 24px 16px;
    font-size: 1rem;
  }
  header.site nav.links.open { display: flex; }
  header.site nav.links a {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  header.site nav.links a:last-child { border-bottom: 0; }
  header.site .nav-cta { padding: 8px 12px; font-size: 0.8rem; }
  article.report-body { padding: 24px 22px; }
}
