/* =========================================================================
   Pulborough Tides — design system
   River Arun palette: deep tidal teal, estuary sand, flood/ebb accents.
   Mobile-first, fluid type, fast (no web fonts, GPU-friendly motion).
   ========================================================================= */

:root {
  /* Brand / water */
  --deep:      #0a2a3a;   /* deep river at dusk */
  --tide:      #0e4d64;   /* mid water */
  --tide-2:    #11697f;
  --shallow:   #2f9bb3;   /* shallows */
  --foam:      #e8f5f7;

  /* Land / paper */
  --sand:      #f6f1e7;   /* page background */
  --paper:     #fffdf9;   /* cards */
  --ink:       #142026;   /* text */
  --ink-soft:  #4a5b63;
  --line:      #e3dccb;   /* hairlines on sand */

  /* State accents */
  --flood:     #1ea7a0;   /* rising / flooding (teal-green) */
  --ebb:       #c2772f;   /* falling / ebbing (warm ochre) */
  --high:      #0e7c86;
  --low:       #b06a2c;

  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(10,42,58,.06), 0 12px 30px -12px rgba(10,42,58,.25);
  --maxw:      min(1080px, 100% - 2.5rem);

  --ff-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ff-head: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--ff-body);
  color: var(--ink);
  background: var(--sand);
  line-height: 1.55;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
}

h1, h2, h3 { font-family: var(--ff-head); line-height: 1.12; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 1.3rem + 3.4vw, 3.4rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.5rem, 1.15rem + 1.7vw, 2.2rem); margin: 0 0 .6em; }
h3 { font-size: 1.2rem; margin: 0 0 .4em; }
p  { margin: 0 0 1em; }
a  { color: var(--tide-2); text-underline-offset: 2px; }
a:hover { color: var(--shallow); }

section { padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem); }
section > * { max-width: var(--maxw); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; max-width: var(--maxw); margin-inline: auto;
  padding-block: 1rem; position: relative; z-index: 5;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--deep); }
.brand-mark {
  font-size: 1.6rem; line-height: 1; color: var(--shallow);
  transform: translateY(1px);
}
.brand-text { font-family: var(--ff-head); font-size: 1.3rem; letter-spacing: -.01em; }
.brand-text strong { color: var(--deep); }
.site-nav { display: flex; gap: 1.1rem; font-size: .95rem; }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover { color: var(--tide); }
@media (max-width: 460px) { .site-nav { display: none; } }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  color: var(--foam);
  background:
    radial-gradient(120% 90% at 80% -10%, rgba(47,155,179,.45), transparent 60%),
    linear-gradient(165deg, var(--tide) 0%, var(--deep) 100%);
  padding-block: clamp(2rem, 1rem + 5vw, 4.5rem) clamp(3rem, 2rem + 6vw, 6rem);
  border-radius: 0 0 var(--radius) var(--radius);
}
/* layered moving water at the foot of the hero */
.hero::after {
  content: ""; position: absolute; inset: auto 0 -1px 0; height: 120px;
  background:
    radial-gradient(60% 100% at 20% 100%, rgba(232,245,247,.12), transparent 70%),
    radial-gradient(50% 100% at 75% 100%, rgba(232,245,247,.10), transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 2; }
.hero h1 { color: #fff; }
.hero-sub { color: rgba(232,245,247,.86); max-width: 40ch; font-size: 1.05rem; }
.hero-sub strong { color: #fff; }

/* Answer card — the whole point of the page */
.answer-card {
  margin-top: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(232,245,247,.18);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
  max-width: 560px;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.5);
}
.answer-label {
  text-transform: uppercase; letter-spacing: .14em; font-size: .72rem;
  color: rgba(232,245,247,.7); margin: 0 0 .5rem;
}
.answer-headline { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin: 0; }
.tide-type {
  font-family: var(--ff-head); font-size: clamp(1.4rem, 1rem + 2vw, 2rem);
  padding: .1em .5em; border-radius: 999px; line-height: 1.1;
}
.tide-high { background: rgba(30,167,160,.22); color: #aef3ed; box-shadow: inset 0 0 0 1px rgba(30,167,160,.5); }
.tide-low  { background: rgba(194,119,47,.22);  color: #f7d3a8; box-shadow: inset 0 0 0 1px rgba(194,119,47,.5); }
.answer-time {
  font-family: var(--ff-head); font-weight: 600;
  font-size: clamp(2.8rem, 1.8rem + 5vw, 4.6rem);
  color: #fff; line-height: .95; font-variant-numeric: tabular-nums;
}
.answer-countdown { font-size: 1.1rem; color: rgba(232,245,247,.9); margin: .4rem 0 1.2rem; }
.answer-countdown [data-countdown] { font-weight: 600; color: #fff; }
.answer-height { color: rgba(232,245,247,.7); }

.flow-bar {
  height: 10px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.14); position: relative;
}
.flow-fill {
  height: 100%; width: var(--p, 0%);
  background: linear-gradient(90deg, var(--shallow), #7fe0d8);
  border-radius: 999px; transition: width .6s ease;
}
.is-falling .flow-fill { background: linear-gradient(90deg, #e8a85e, var(--ebb)); }
.flow-state { font-size: .95rem; margin: .7rem 0 0; color: rgba(232,245,247,.86); }
.flow-state strong { color: #fff; }

.answer-error { text-align: center; }

.staleness {
  max-width: var(--maxw); margin: 1.2rem auto -1rem; background: #fff6e5;
  border: 1px solid #f0d9a8; color: #8a5a12; padding: .7rem 1rem;
  border-radius: var(--radius-sm); font-size: .92rem;
}

/* ---------- Today ---------- */
.today-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tide-row {
  display: flex; align-items: baseline; gap: .6rem; background: var(--paper);
  border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-sm);
  padding: .8rem 1rem; box-shadow: var(--shadow);
}
.tide-row.tide-high { border-left-color: var(--high); }
.tide-row.tide-low  { border-left-color: var(--low); }
.tide-row.is-past { opacity: .62; }
.tide-row.is-past .tide-row-time { text-decoration: line-through; text-decoration-color: var(--line); }
.tide-row-type { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.tide-row-time { font-family: var(--ff-head); font-size: 1.6rem; font-variant-numeric: tabular-nums; margin-left: auto; }
.tide-row-height { color: var(--ink-soft); font-size: .9rem; }

/* ---------- Week table ---------- */
.week-table { width: 100%; border-collapse: collapse; background: var(--paper);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.week-table th, .week-table td { text-align: left; padding: .85rem 1rem; border-top: 1px solid var(--line); }
.week-table thead th { background: var(--deep); color: var(--foam); border: 0; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .08em; }
.week-table tbody th { font-family: var(--ff-head); font-weight: 600; width: 8.5rem; white-space: nowrap; }
.week-table tbody tr:first-child th { color: var(--tide); }
.chip { display: inline-flex; align-items: baseline; gap: .35rem; margin: .15rem .35rem .15rem 0;
  padding: .3rem .6rem; border-radius: 999px; font-variant-numeric: tabular-nums; font-size: .95rem; }
.chip-high { background: #e1f1f0; color: #0b5b54; }
.chip-low  { background: #f6e8d6; color: #8a5418; }
.chip-tag { font-weight: 700; font-size: .72rem; }
.chip small { opacity: .65; }
.chip-none { color: var(--ink-soft); }
.table-note { color: var(--ink-soft); font-size: .85rem; margin-top: .9rem; }

/* ---------- Why us ---------- */
.why { background: linear-gradient(180deg, var(--sand), #efe7d6); }
.why-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.why-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; box-shadow: var(--shadow); }
.why-card h3 { color: var(--tide); }
.why-card p { margin: 0; color: var(--ink-soft); }
.why-card strong { color: var(--ink); }

/* ---------- Hooks ---------- */
.hook { color: #fff; border-radius: var(--radius); }
.hook-inner { max-width: var(--maxw); margin-inline: auto; }
.hook-eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; opacity: .8; margin: 0 0 .4rem; }
.hook h2 { color: #fff; max-width: 18ch; }
.hook p { max-width: 52ch; opacity: .92; }
.hook-paddle { background:
  radial-gradient(120% 120% at 90% 0%, rgba(47,155,179,.5), transparent 55%),
  linear-gradient(135deg, var(--tide-2), var(--deep)); }
.hook-pub { background:
  radial-gradient(120% 120% at 10% 0%, rgba(194,119,47,.55), transparent 55%),
  linear-gradient(135deg, #7a4a1f, #3a2412); margin-top: 1px; }

.btn { display: inline-block; font-weight: 600; text-decoration: none; padding: .8rem 1.3rem;
  border-radius: 999px; transition: transform .15s ease, box-shadow .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: #fff; color: var(--deep); box-shadow: 0 10px 24px -10px rgba(0,0,0,.5); }
.btn-primary:hover { color: var(--tide); }
.btn-ghost { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }

/* ---------- FAQ ---------- */
.faq-item { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .2rem 1.1rem; margin-bottom: .7rem; box-shadow: var(--shadow); }
.faq-item summary { cursor: pointer; font-weight: 600; padding: .9rem 0; font-family: var(--ff-head);
  font-size: 1.08rem; color: var(--deep); list-style-position: inside; }
.faq-item summary::marker { color: var(--shallow); }
.faq-item p { color: var(--ink-soft); margin: 0 0 1rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--deep); color: rgba(232,245,247,.8); padding: 2.5rem 0; }
.site-footer > p { max-width: var(--maxw); margin: 0 auto .6rem; padding-inline: 0; }
.site-footer strong { color: #fff; }
.site-footer a { color: var(--shallow); }
.footer-meta { font-size: .85rem; opacity: .85; }
.sample-flag { color: #ffd27d; font-weight: 600; }

/* ---------- Cookie consent banner ---------- */
.cookie-banner {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%);
  z-index: 50; width: min(680px, calc(100% - 1.5rem));
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--deep); color: var(--foam);
  border: 1px solid rgba(232,245,247,.18); border-radius: var(--radius);
  padding: 1rem 1.2rem; box-shadow: 0 18px 50px -18px rgba(0,0,0,.6);
}
.cookie-banner[hidden] { display: none; }
.cookie-text { margin: 0; flex: 1 1 280px; font-size: .92rem; color: rgba(232,245,247,.9); }
.cookie-text a { color: var(--shallow); }
.cookie-actions { display: flex; gap: .6rem; margin-left: auto; }
.cookie-actions .btn { padding: .55rem 1.1rem; font-size: .92rem; }

/* ---------- Legal / privacy page ---------- */
.legal { max-width: 70ch; }
.legal h1 { margin-bottom: .2em; }
.legal-updated { color: var(--ink-soft); font-size: .9rem; margin-bottom: 2rem; }
.legal h2 { font-size: 1.3rem; margin-top: 1.8rem; color: var(--tide); }
.legal p { color: var(--ink); }

/* ---------- Motion / a11y ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
:focus-visible { outline: 3px solid var(--shallow); outline-offset: 2px; border-radius: 4px; }
