/* =========================================================================
   Living The Dream Surf School — "First wave"
   Palette & rules from research/design-language.md. Static site.
   ========================================================================= */

/* ---- Tokens (light = default) ---------------------------------------- */
:root {
  --ground: #F3F9F9;
  --surface: #FFFFFF;
  --ink: #0E2A33;
  --muted: #46606A;
  --brand: #0B7A8A;
  --brand-text: #0B7A8A;   /* small accent text / ticks / links on normal surfaces */
  --accent-dark: #BDEFF5;  /* accent text on always-dark bands — fixed */
  --coral: #FF9B7A;        /* highlight fill — dark text on it, never white */
  --ink-fixed: #0E2A33;    /* dark text on coral — fixed */
  --on-brand: #FFFFFF;     /* text on brand fills — fixed */
  --cream: #E9F5F5;        /* text on always-dark bands — fixed */
  --band: #0E2A33;         /* always-dark header/hero/footer/CTA/planner panel */

  --border: rgba(14, 42, 51, 0.14);
  --shadow: 0 6px 20px rgba(14, 42, 51, 0.08);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1080px;

  --note-bg: rgba(11, 122, 138, 0.10);
  --note-text: #0B5560;    /* ≥4.5:1 on the tint in light mode */

  --font-head: "Outfit", system-ui, sans-serif;
  --font-body: "Nunito Sans", system-ui, sans-serif;
}

[data-theme="dark"] {
  --ground: #0A1A1F;
  --surface: #122A31;
  --ink: #E9F5F5;
  --muted: #B8D0D4;
  --brand: #0B7A8A;
  --brand-text: #6FD3E0;
  /* --accent-dark, --coral, --ink-fixed, --on-brand, --cream stay fixed */
  --band: #050E11;

  --border: rgba(233, 245, 245, 0.16);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);

  --note-bg: rgba(111, 211, 224, 0.14);
  --note-text: #BDEFF5;
}

/* ---- Reset / base ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1rem; }
a { color: var(--brand-text); }

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

:focus-visible {
  outline: 3px solid var(--brand-text);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}

.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

.eyebrow {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--brand-text);
  margin: 0 0 0.6rem;
}

.lead { font-size: 1.1rem; color: var(--muted); }
.muted { color: var(--muted); }

/* ---- Note chips (≥4.5:1 in light) ------------------------------------ */
.note {
  display: inline-block;
  background: var(--note-bg);
  color: var(--note-text);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3em 0.7em;
  border-radius: 999px;
  border: 1px solid transparent;
}

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  padding: 0.75em 1.3em;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--brand);
  color: var(--on-brand);
  border-color: var(--brand);
}
.btn--primary:hover { background: #096573; border-color: #096573; color: var(--on-brand); }

.btn--coral {
  background: var(--coral);
  color: var(--ink-fixed);
  border-color: var(--coral);
}
.btn--coral:hover { background: #ff875f; border-color: #ff875f; color: var(--ink-fixed); }

.btn--ghost {
  background: transparent;
  color: var(--brand-text);
  border-color: var(--brand-text);
}
.btn--ghost:hover { background: var(--brand-text); color: var(--ground); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---- Header ----------------------------------------------------------- */
.site-header {
  background: var(--band);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(189, 239, 245, 0.14);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 0.9rem;
}

.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  margin-right: auto;
  line-height: 1.1;
}
.brand__name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--cream);
  overflow-wrap: anywhere;
}
.brand__sub {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-dark); /* header sub-label uses --accent-dark */
}

/* any .muted inside header uses --accent-dark */
.site-header .muted { color: var(--accent-dark); }

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--cream);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.3em 0.1em;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent-dark); border-bottom-color: var(--accent-dark); }
.site-nav a[aria-current="page"] { color: var(--accent-dark); border-bottom-color: var(--accent-dark); }

.header-actions { display: flex; align-items: center; gap: 0.6rem; }

/* header CTA — hidden ≤480px */
.header-cta { }

/* theme toggle */
.theme-toggle {
  background: transparent;
  border: 2px solid rgba(189, 239, 245, 0.4);
  color: var(--cream);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover { border-color: var(--accent-dark); background: rgba(189, 239, 245, 0.12); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Header button-text exceptions (bug 6) so dark-band link rules don't win */
.site-header a.btn--primary { color: var(--on-brand); }
.site-header a.btn--primary:hover { color: var(--on-brand); }
.site-header a.btn--ghost { color: var(--accent-dark); border-color: var(--accent-dark); }
.site-header a.btn--ghost:hover { color: var(--band); background: var(--accent-dark); }

/* ---- Always-dark band base ------------------------------------------- */
.hero, .band, .site-footer {
  background: var(--band);
  color: var(--cream);
}

/* Bug 1: explicit light-on-dark for all text inside always-dark bands */
.hero, .hero h1, .hero h2, .hero h3, .hero h4, .hero p, .hero li,
.band, .band h1, .band h2, .band h3, .band h4, .band p, .band li,
.site-footer, .site-footer h1, .site-footer h2, .site-footer h3,
.site-footer h4, .site-footer p, .site-footer li {
  color: var(--cream);
}
.hero .muted, .band .muted, .site-footer .muted { color: var(--accent-dark); }
.hero .eyebrow, .band .eyebrow, .site-footer .eyebrow { color: var(--accent-dark); }
.hero a:not(.btn), .band a:not(.btn), .site-footer a:not(.btn) { color: var(--accent-dark); }
.hero a:not(.btn):hover, .band a:not(.btn):hover, .site-footer a:not(.btn):hover { color: var(--cream); }

.hero .note, .band .note, .site-footer .note {
  background: rgba(189, 239, 245, 0.16);
  color: var(--accent-dark);
  border-color: rgba(189, 239, 245, 0.3);
}

/* Bug 6: button-text exceptions inside dark bands incl. :hover */
.hero a.btn--primary, .band a.btn--primary, .site-footer a.btn--primary,
.hero a.btn--primary:hover, .band a.btn--primary:hover, .site-footer a.btn--primary:hover {
  color: var(--on-brand);
}
.hero a.btn--coral, .band a.btn--coral, .site-footer a.btn--coral,
.hero a.btn--coral:hover, .band a.btn--coral:hover, .site-footer a.btn--coral:hover {
  color: var(--ink-fixed);
}
/* ghost buttons on dark bands: both a. and button. incl :hover */
.hero a.btn--ghost, .hero button.btn--ghost,
.band a.btn--ghost, .band button.btn--ghost,
.site-footer a.btn--ghost, .site-footer button.btn--ghost {
  color: var(--accent-dark);
  border-color: var(--accent-dark);
}
.hero a.btn--ghost:hover, .hero button.btn--ghost:hover,
.band a.btn--ghost:hover, .band button.btn--ghost:hover,
.site-footer a.btn--ghost:hover, .site-footer button.btn--ghost:hover {
  color: var(--band);
  background: var(--accent-dark);
}

/* ---- Hero ------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; }
.hero__inner {
  position: relative;
  z-index: 2;
  padding-block: clamp(3rem, 8vw, 6rem);
  max-width: 640px;
}
.hero__media { position: absolute; inset: 0; z-index: 0; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; opacity: 0.32; }
.hero::after {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(120deg, rgba(14,42,51,0.92), rgba(14,42,51,0.55));
}
[data-theme="dark"] .hero::after {
  background: linear-gradient(120deg, rgba(5,14,17,0.92), rgba(5,14,17,0.6));
}
.hero .img-note {
  color: var(--accent-dark);
  font-size: 0.78rem;
  margin-top: 1.2rem;
  opacity: 0.85;
}

/* ---- Proof strip ------------------------------------------------------ */
.proof {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: center;
}
.proof__item { text-align: center; }
.proof__big {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--brand-text);
}
.proof__label { font-size: 0.9rem; color: var(--muted); }

/* ---- Wave divider ----------------------------------------------------- */
.wave-divider { display: block; width: 100%; height: 36px; color: var(--brand); opacity: 0.25; }

/* ---- Cards ------------------------------------------------------------ */
.grid {
  display: grid;
  gap: 1.3rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card {
  background: var(--surface);
  border: 1px solid var(--border); /* bug 16: visible border in light */
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.card--media { padding: 0; overflow: hidden; }
.card--media img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.card--media .card__body { padding: 1.3rem; }
.img-note { font-size: 0.78rem; color: var(--muted); margin: 0.6rem 0 0; }

/* ---- Find-us / NAP ---------------------------------------------------- */
dl.nap { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; }
dl.nap dt { font-weight: 700; font-family: var(--font-head); min-width: 0; }
dl.nap dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.findus { display: grid; gap: 1.5rem; grid-template-columns: 1fr 1fr; align-items: center; }
.findus > * { min-width: 0; }

/* ---- CTA band --------------------------------------------------------- */
.cta-band { text-align: center; }
.cta-band .btn-row { justify-content: center; }

/* ---- Lesson planner --------------------------------------------------- */
.planner {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: start;
}
.planner__form { display: grid; gap: 1.4rem; }
.planner fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin: 0;
  background: var(--surface);
}
.planner legend {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0 0.4em;
  color: var(--ink);
}
.planner legend .legend-note { display: block; font-family: var(--font-body); font-weight: 400; font-size: 0.85rem; color: var(--muted); }

/* stepper */
.stepper { display: flex; align-items: center; gap: 1rem; }
.stepper button {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--brand);
  background: transparent;
  color: var(--brand-text);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.stepper button:hover { background: var(--brand); color: var(--on-brand); }
.stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper__value {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.8rem;
  min-width: 2ch;
  text-align: center;
}
.stepper__caption { color: var(--muted); font-size: 0.95rem; }

/* option tiles (radio/checkbox) — selected visible without colour alone */
.options { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7em 0.9em;
  cursor: pointer;
  background: var(--surface);
  font-weight: 600;
}
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option__tick {
  width: 20px; height: 20px;
  border: 2px solid var(--muted);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: transparent;
  font-size: 0.85rem;
  font-weight: 900;
}
.option input:checked ~ .option__tick {
  border-color: var(--brand-text);
  color: var(--brand-text); /* selected-option ticks use --brand-text */
}
.option input:checked ~ .option__label { }
/* bug 13: selected visible via outline + tick, not colour alone */
.option:has(input:checked) {
  border-color: var(--brand-text);
  outline: 2px solid var(--brand-text);
  outline-offset: 1px;
}
.option input:focus-visible ~ .option__tick { outline: 3px solid var(--brand-text); outline-offset: 2px; }

.field-dependent { margin-top: 0.9rem; }
.field-dependent[hidden] { display: none; }
.field label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.field input[type="date"],
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.6em 0.75em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--ground);
  color: var(--ink);
}
.field textarea { resize: vertical; min-height: 4.5em; }
.char-count { font-size: 0.8rem; color: var(--muted); display: block; margin-top: 0.3rem; }

/* board-line preview */
.boardline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
}
.boardline__sand {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  min-height: 70px;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,155,122,0.12), rgba(243,230,200,0.5));
}
[data-theme="dark"] .boardline__sand {
  background: linear-gradient(180deg, rgba(255,155,122,0.14), rgba(18,42,49,0.7));
}
.board {
  width: 16px;
  height: 52px;
  border-radius: 50% 50% 45% 45% / 70% 70% 30% 30%;
  background: var(--brand);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25);
}
.board:nth-child(even) { background: var(--coral); }
.boardline__more {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--brand-text);
  align-self: center;
}
.boardline__caption { margin: 0.8rem 0 0; font-weight: 700; font-family: var(--font-head); }

/* message panel — always dark (planner panel is an always-dark band: bug 1) */
.msg-panel {
  background: var(--band);
  color: var(--cream);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.msg-panel h3, .msg-panel p, .msg-panel li, .msg-panel .muted { color: var(--cream); }
.msg-panel .eyebrow { color: var(--accent-dark); }
.msg-panel .msg-empty { color: var(--accent-dark); }
.msg-panel__text {
  background: rgba(189, 239, 245, 0.08);
  border: 1px solid rgba(189, 239, 245, 0.2);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 0 0 1.2rem;
  min-height: 3em;
  white-space: pre-wrap;
  color: var(--cream);
}
.msg-panel .btn-row { }
/* button exceptions inside msg-panel (bug 6) */
.msg-panel a.btn--primary, .msg-panel a.btn--primary:hover { color: var(--on-brand); }
.msg-panel a.btn--coral, .msg-panel a.btn--coral:hover { color: var(--ink-fixed); }
.msg-panel a.btn--ghost, .msg-panel button.btn--ghost {
  color: var(--accent-dark); border-color: var(--accent-dark);
}
.msg-panel a.btn--ghost:hover, .msg-panel button.btn--ghost:hover {
  color: var(--band); background: var(--accent-dark);
}
.copy-status { font-size: 0.85rem; color: var(--accent-dark); margin: 0.6rem 0 0; min-height: 1.2em; }

/* ---- Footer ----------------------------------------------------------- */
.site-footer { margin-top: auto; }
.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1.3fr 1fr 1fr;
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
}
.footer-grid > * { min-width: 0; }
.footer-grid h4 { color: var(--accent-dark); margin-top: 0; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.footer-grid a { color: var(--cream); text-decoration: none; }
.footer-grid a:hover { color: var(--accent-dark); text-decoration: underline; }
.footer-grid dl.nap dt, .footer-grid dl.nap dd { color: var(--cream); }

.footer-bottom {
  border-top: 1px solid rgba(189, 239, 245, 0.14);
  padding-block: 1.3rem;
  font-size: 0.85rem;
  color: var(--accent-dark);
}
.footer-bottom .container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  justify-content: space-between;
}
.demo-note {
  background: var(--band);
  color: var(--cream);
  border: 1px solid rgba(189, 239, 245, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
}
.demo-note strong { color: var(--accent-dark); }
.footer-bottom .demo-note strong { color: var(--accent-dark); }

/* ---- Layout helpers --------------------------------------------------- */
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
.stack > * + * { margin-top: 1rem; }
.center { text-align: center; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.narrow { max-width: 680px; }
.narrow.center { margin-inline: auto; }

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 860px) {
  .findus { grid-template-columns: 1fr; }
  .planner { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  /* nav on its own row ≤700px */
  .site-header .container { flex-wrap: wrap; }
  .site-nav { order: 3; flex-basis: 100%; }
  .site-nav ul { gap: 0.25rem 1rem; }
}

@media (max-width: 480px) {
  /* hide header CTA ≤480px */
  .header-cta { display: none; }
  h1 { font-size: 1.8rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .container { padding-inline: 16px; }
}

@media (max-width: 360px) {
  .brand__name { font-size: 1rem; }
  .options { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
