/* ════════════════════════════════════════════════════════════════════════
   Public homepage (/) and the About page (/about).
   Uses public_theme.css for the reading palette and base.css for shared tokens. The four
   cards draw real Plotly charts with the same tokens the viewer and the Water
   section use, so a curated card looks like the page it came from.
   ════════════════════════════════════════════════════════════════════════ */

.home-page [hidden] { display: none !important; }

/* base.css makes body a 100vh flex column for the viewer's app shell; this is
   an ordinary scrolling document. */
body.home-page {
  height: auto;
  min-height: 100vh;
  display: block;
  overflow: auto;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

/* ── Event banner ──────────────────────────────────────────────────────── */
.home-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 12px 20px;
  background: var(--accent-strong);
  color: #fff;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.home-banner:hover .home-banner-cta { text-decoration: underline; }
.home-banner-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  animation: none;
}
.home-banner.is-upcoming .home-banner-dot { animation: none; opacity: 0.7; }
.home-banner-cta { font-weight: 500; opacity: 0.92; }
.home-banner-cta { text-decoration: underline; text-underline-offset: 4px; }
@keyframes home-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
  60%      { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .home-banner-dot { animation: none; }
}

/* ── Header ────────────────────────────────────────────────────────────── */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px max(24px, calc((100vw - 1200px) / 2));
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.home-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink-strong);
  min-width: 0;
}
.home-logo { width: 34px; height: 34px; flex-shrink: 0; }
.home-brand-text {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.home-brand-text b { font-weight: 700; }
.home-signin {
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.home-signin:hover { background: var(--accent-ink, var(--accent-strong)); border-color: var(--accent-ink, var(--accent-strong)); }
.home-signin.is-open { background: var(--panel); color: var(--accent-strong); }
.home-signin.is-open:hover { background: var(--accent-fade); }

/* ── Page column ───────────────────────────────────────────────────────── */
.home-wrap {
  width: 100%;
  max-width: 1248px;
  margin: 0 auto;
  padding: 0 24px 56px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.home-hero { padding: 52px 0 20px; display: grid; grid-template-columns: 1.2fr 1fr; align-items: end; gap: 32px; }
.home-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 4.4vw, 3.75rem); max-width: 620px;
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.1;
  color: var(--ink-strong);
}
.home-hero p {
  margin-top: 8px;
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 420px;
  color: var(--mid);
}

.home-eyebrow {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--dim);
}

/* ── Loading / error ───────────────────────────────────────────────────── */
.home-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 26px 8px;
  color: var(--dim);
  font-size: 0.9rem;
}
.home-loading img { width: 30px; height: 30px; }
.home-error {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--bad);
  background: var(--bad-bg);
  color: var(--bad);
  border-radius: var(--r-lg);
  font-size: 0.9rem;
}
.home-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

/* ── Card grid ─────────────────────────────────────────────────────────── */
.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 900px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
}

.home-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.home-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.home-card-head h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
  margin-top: 3px;
  line-height: 1.2;
}
.home-card-meta {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--dim);
  text-align: right;
  white-space: nowrap;
  line-height: 1.5;
  flex-shrink: 0;
}
.home-card-meta span { display: block; }
/* Under 560px the title and the meta column fight for one line; stack them
   so "Chlorophyll-a, last 90 days" stays on one or two lines. */
@media (max-width: 559px) {
  .home-card-head { flex-direction: column; gap: 6px; }
  .home-card-meta { text-align: left; white-space: normal; }
  .home-card-meta span { display: inline; }
  .home-card-meta span + span::before { content: ' · '; }
}
.home-card-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.home-card-empty {
  padding: 22px 8px;
  color: var(--dim);
  font-size: 0.9rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  text-align: center;
}

.home-plot { width: 100%; height: 280px; min-width: 0; }
.home-plot-tall { height: 300px; }
.home-plot-note {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--dim);
}

/* mFL metrics strip — same three tiles the viewer's metrics row shows. */
.home-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.home-metric {
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--panel-sunken);
  min-width: 0;
}
.home-metric-label {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--dim);
}
.home-metric-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink-strong);
  margin-top: 4px;
}
.home-metric-value.is-empty { color: var(--faint); font-weight: 400; }
.home-metric-unit { font-size: 0.76rem; color: var(--faint); margin-top: 1px; }

/* mHR colour block — the measured chromaticity is the only colour not from a token. */
.home-colour {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px; min-height: 98px;
  border-radius: var(--r-lg);
  background: var(--panel-sunken);
}
.home-swatch {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line-strong);
  flex-shrink: 0;
}
.home-colour-text { min-width: 0; font-size: 0.86rem; color: var(--mid); line-height: 1.45; }
.home-colour-text b { color: var(--ink-strong); font-weight: 600; }
.home-colour-text .mono { font-family: var(--font-mono); font-size: 0.78rem; color: var(--dim); }

/* Chart key under the Water cards (mirrors water.css .wa-chart-key). */
.home-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 0.8rem;
  color: var(--mid);
}
.home-key > span { display: inline-flex; align-items: center; gap: 8px; }
.home-key i { display: inline-block; flex: none; width: 28px; color: var(--key-colour); }
.home-key .k-line  { border-top: 2px solid currentColor; }
.home-key .k-thick { border-top: 4px solid currentColor; }
.home-key .k-dash  { border-top: 2px dotted currentColor; }
.home-key .k-dot   { width: 9px; height: 9px; margin: 0 9px; border-radius: 50%; background: currentColor; }

/* Forel-Ule scale strip, 21 cells. */
.home-fui { display: flex; flex-direction: column; gap: 4px; }
.home-fui-cells { display: flex; gap: 1px; }
.home-fui-cells span {
  flex: 1;
  height: 14px;
  border-radius: 2px;
}
.home-fui-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--dim);
}

/* ── Links ─────────────────────────────────────────────────────────────── */
.home-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 720px) {
  .home-links { grid-template-columns: 1fr 1fr; }
}
.home-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.home-link:hover { border-color: var(--accent); background: var(--accent-fade); }
.home-link.is-live .home-eyebrow { color: var(--good); }
.home-link-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-strong);
}
.home-link-title { text-decoration: underline; text-underline-offset: 4px; }
.home-link-sub { font-size: 0.84rem; color: var(--mid); line-height: 1.4; }

/* ── Footer ────────────────────────────────────────────────────────────── */
.home-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 1248px;
  margin: 0 auto;
  padding: 0 18px 28px;
  font-size: 0.78rem;
  color: var(--dim);
}
.home-footer a { color: var(--accent-strong); text-decoration: none; }
.home-footer a:hover { text-decoration: underline; }

/* ── About page ────────────────────────────────────────────────────────── */
.about-wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 30px 18px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.about-wrap h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.1;
  color: var(--ink-strong);
  margin-top: 6px;
}
.about-lead { font-size: 1.05rem; color: var(--mid); line-height: 1.5; margin-top: 8px; }
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 720px) {
  .about-grid { grid-template-columns: 1fr 1fr; }
}
.about-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.about-block h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-strong);
}
.about-block p { font-size: 0.9rem; line-height: 1.5; color: var(--mid); }
.about-block .mono { font-family: var(--font-mono); font-size: 0.8rem; color: var(--dim); }
.about-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--mid);
}
.about-flow span {
  padding: 6px 10px;
  border-radius: var(--r-lg);
  background: var(--panel-sunken);
  color: var(--ink);
  font-weight: 500;
}
.about-flow i { font-style: normal; color: var(--faint); }
.about-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.about-actions a {
  font-size: 0.86rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--accent-strong);
  color: var(--accent-strong);
  text-decoration: none;
  background: var(--panel);
}
.about-actions a.is-primary { background: var(--accent-strong); color: #fff; }
.about-actions a:hover { background: var(--accent-fade); }
.about-actions a.is-primary:hover { background: var(--accent-ink, var(--accent-strong)); }

.home-card-head { background: transparent; border: 0; padding: 0; flex-direction: column; gap: 10px; }
.home-card-meta { text-align: left; white-space: normal; }
.home-card-meta span { display: inline; }
.home-card-meta span + span::before { content: ' / '; color: var(--line-strong); }
.home-links { margin-top: 8px; }
.home-link { background: transparent; border: 0; border-top: 1px solid var(--line-strong); border-radius: 0; padding: 22px 0; }
.home-signin, .home-btn { min-height: 44px; display: inline-flex; align-items: center; }
@media (max-width: 700px) {
  .home-header { padding: 16px 20px; }
  .home-wrap { padding: 0 16px 32px; gap: 24px; }
  .home-hero { grid-template-columns: 1fr; padding: 32px 4px 8px; gap: 12px; }
  .home-hero p { margin: 0; font-size: 1rem; }
  .home-card { padding: 20px 16px; }
  .home-card-head h2 { font-size: 1.35rem; }
  .home-metric { padding: 10px 8px; }
  .home-metric-value { font-size: 1.15rem; }
  .public-nav { gap: 16px; }
  .home-logo { width: 28px; height: 28px; }
  .home-brand-text { font-size: 0.9rem; }
}
@media (max-width: 380px) {
  .home-header { padding: 16px; }
  .home-brand { gap: 6px; }
  .home-brand-text { font-size: 0.8rem; }
  .home-logo { width: 24px; height: 24px; }
  .public-nav { gap: 12px; }
  .home-signin { padding: 8px 10px; }
  .home-banner { text-align: center; }
  .home-banner-dot { display: none; }
  .home-metric-label { font-size: 0.7rem; min-height: 2.6em; }
}

/* Introductions span each plot pair and keep a readable line length. */
.home-section-intro { grid-column: 1 / -1; padding: 24px 0 0; }
.home-section-intro h2 { color: var(--text-strong, #15383e); font-size: 28px; font-weight: 500; margin: 0 0 12px; }
.home-section-intro p { max-width: 1000px; margin: 0; font-size: 18px; line-height: 1.65; color: #4d646a; }

/* Two distinct destinations, with a strong event invitation and a quiet explainer. */
.home-links { grid-template-columns: 1.3fr 1fr; gap: 20px; }
.home-link { position: relative; padding: 30px 60px 30px 30px; border: 1px solid #c4d9da; border-radius: 16px; background: #e4efef; }
.home-link::after { content: '↗'; position: absolute; top: 27px; right: 25px; font-size: 30px; }
.home-link:first-child { background: #055057; color: #fff; border-color: #055057; }
.home-link:first-child .home-eyebrow, .home-link:first-child .home-link-title, .home-link:first-child .home-link-sub { color: inherit; }
.home-link:first-child .home-link-sub { opacity: .8; }
.home-link:hover { border-color: #055057; box-shadow: 0 5px 16px #15383e12; }
@media(max-width: 640px) { .home-links { grid-template-columns: 1fr; } }
