:root {
  --ink: #122028;
  --paper: #f3eee4;
  --foam: #e7f0ee;
  --water: #16343f;
  --deep: #0b1c24;
  --kelp: #3d5c48;
  --sail: #c45c26;
  --cedar: #6a4a32;
  --line: rgba(18, 32, 40, 0.12);
  --shadow: 0 18px 40px rgba(11, 28, 36, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d7e4df 0%, transparent 55%),
    var(--paper);
  font-family: "Source Sans 3", system-ui, sans-serif;
  line-height: 1.5;
}

h1, h2, h3, .brand {
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  letter-spacing: -0.02em;
}

a { color: var(--kelp); }
img { max-width: 100%; display: block; }

.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(243, 238, 228, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 16px;
}
.brand { font-size: 1.15rem; text-decoration: none; color: var(--deep); }
.brand span { color: var(--sail); }
nav { display: flex; gap: 18px; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--ink); font-size: 0.95rem; }
nav a:hover { color: var(--sail); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button {
  appearance: none; border: 0; background: transparent;
  font: inherit; padding: 6px 10px; border-radius: 999px; cursor: pointer;
  color: var(--ink);
}
.tabs button.on { background: var(--deep); color: #f6f1e8; }
.panel { display: none; }
.panel.on { display: block; }
body.tab-home .panel[data-panel~="home"] { display: block; }
body.tab-course .panel[data-panel~="course"] { display: block; }
body.tab-session .panel[data-panel~="session"] { display: block; }
body.tab-away .panel[data-panel~="session"] { display: none; }
body.tab-lab .panel[data-panel~="lab"] { display: block; }
body:not(.tab-home) .home-only { display: none; }
body:not(.tab-awards) .awards-only { display: none; }
body.tab-awards #map-sec { display: none; }
body:not(.tab-book) .book-only { display: none; }
body.tab-book #map-sec { display: none; }
body.tab-book .book { grid-template-columns: min(36rem, 100%); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip {
  font-size: 0.72rem;
  background: #efe3c8;
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--cedar);
}
.mode-bar {
  margin: 0 0 10px;
  padding: 8px 12px;
  background: #efe3c8;
  border-radius: 10px;
  font-size: 0.9rem;
}
.checks { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 0; font-size: 0.9rem; }
.lab-out {
  white-space: pre-wrap;
  font-size: 0.75rem;
  max-height: 240px;
  overflow: auto;
  margin: 8px 0 0;
}

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 36px;
  padding: 10px 0 28px;
  align-items: center;
}
.split .hero-photo img { height: 420px; }
#why-here p { max-width: 72ch; font-size: 1.08rem; }
.gallery.one {
  grid-template-columns: 1fr;
  grid-template-rows: 280px;
}
.gallery.one figure:first-child { grid-row: auto; }
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 36px;
  padding: 42px 0 28px;
  align-items: center;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--cedar);
  margin: 0 0 8px;
}
.hero h1 { font-size: clamp(2.1rem, 4vw, 3.4rem); line-height: 1.05; margin: 0 0 14px; }
.hero p { margin: 0 0 18px; font-size: 1.08rem; max-width: none; }
.hero-photo {
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 280px;
}
.hero-photo img { width: 100%; height: 520px; object-fit: cover; object-position: 55% 72%; }

.stats-wrap { margin: 8px 0 36px; }
.period { display: flex; gap: 6px; margin: 0 0 10px; }
.period button {
  appearance: none; border: 1px solid var(--line); background: #fffdf8;
  font: inherit; padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.period button.on { background: var(--deep); color: #f6f1e8; border-color: var(--deep); }
.stats {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.stat {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  flex: 1 0 140px;
  min-width: 140px;
}
.stat b { display: block; font-family: Fraunces, serif; font-size: 1.45rem; }
.stat span { color: #5b6a70; font-size: 0.82rem; }

section { padding: 10px 0 46px; }
section h2 { font-size: 1.8rem; margin: 0 0 8px; }
.lede { color: #4a5a60; margin: 0 0 18px; max-width: 62ch; }

.map-shell {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr;
  gap: 16px;
  min-height: 520px;
}
#mark-list, #zone-list {
  max-height: 220px;
  overflow: auto;
}
#zone-list li.on { color: var(--sail); font-weight: 650; }
.zone-handle {
  background: #f6f1e8;
  border: 2px solid #c45c26;
  border-radius: 50%;
}
#map {
  height: 560px;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #c9d7d4;
}
.side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drop {
  border: 1.5px dashed #8aa09a;
  background: var(--foam);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}
.drop.drag { background: #d7ece6; border-color: var(--kelp); }
.drop input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 4px;
}
.btn {
  appearance: none;
  border: 0;
  background: var(--deep);
  color: #f6f1e8;
  border-radius: 999px;
  padding: 9px 16px;
  font: inherit;
  cursor: pointer;
}
.btn.ghost {
  background: transparent;
  color: var(--deep);
  border: 1px solid var(--line);
}
.hint { font-size: 0.86rem; color: #5b6a70; margin: 8px 0 0; }

.sails { overflow: auto; max-height: 330px; display: flex; flex-direction: column; gap: 8px; }
body.tab-home .sails { overflow: visible; max-height: none; }
body.tab-home .sail { padding: 8px 10px; }
body.tab-home .sail h3 { font-size: 0.95rem; }
body.tab-home .sail .chips { display: none; }
.cap-icon {
  font-size: 20px;
  line-height: 26px;
  text-align: center;
  transform: rotate(155deg);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.4));
}
.cap-icon.wet { filter: drop-shadow(0 1px 1px rgba(30,80,140,.55)); }
.cap-icon.dry { opacity: 0.9; }
.egg-icon {
  font-size: 18px;
  line-height: 22px;
  text-align: center;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.35));
}
.sail {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  align-items: start;
}
.sail:hover { border-color: #8aa09a; }
.sail.active {
  border-color: var(--sail);
  background: #f6e6d8;
  box-shadow: inset 3px 0 0 var(--sail);
}
.swatch { width: 10px; height: 100%; min-height: 36px; border-radius: 99px; }
.sail h3 { margin: 0; font-size: 0.98rem; font-family: "Source Sans 3", sans-serif; font-weight: 650; }
.meta { font-size: 0.8rem; color: #5b6a70; }
.sail .note { font-size: 0.84rem; margin-top: 4px; }

.notes, .challenges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 14px;
}
.card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.card ul { margin: 0; padding-left: 18px; }
.card li { margin: 0 0 6px; }

.challenge, .achieve {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.achieve:last-child { border-bottom: 0; }
.achieve-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.achieve h4 { margin: 0; font-size: 1rem; font-family: "Source Sans 3", sans-serif; }
.achieve p { margin: 4px 0 0; font-size: 0.9rem; color: #5b6a70; }
.achieve.done h4 { color: #3d5c48; }
.badge { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }
.badge.yes { color: #3d5c48; }
.badge.no { color: #8b3a2a; }
.when { font-size: 0.78rem; color: var(--cedar); margin-top: 4px; }
.tick { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 0.85rem; }
.achieve-cat { margin: 0 0 18px; }
.award-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; table-layout: fixed; }
.award-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: #5b6a70; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.award-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.award-table th:first-child,
.award-table td:first-child { width: auto; }
.award-table th:nth-child(2),
.award-table td:nth-child(2),
.award-table th:nth-child(3),
.award-table td:nth-child(3) { width: 3.6rem; white-space: nowrap; padding-left: 4px; padding-right: 4px; }
.award-table th:nth-child(4),
.award-table td:nth-child(4) { width: 2.2rem; }
.award-table .how { font-size: 0.82rem; color: #5b6a70; margin-top: 2px; }
.achieve-cat h3 { margin: 8px 0 0; font-size: 1.05rem; }
#challenge-list { padding: 16px 18px; }

.gallery {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  grid-template-rows: 220px 220px;
  gap: 10px;
}
.gallery figure { margin: 0; position: relative; overflow: hidden; border-radius: 14px; }
.gallery figure:first-child { grid-row: 1 / span 2; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(11,28,36,.72));
  color: #f6f1e8;
  font-size: 0.84rem;
}
.gallery .ph-frame {
  height: 100%;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(-45deg, #e4ddd0 0 10px, #efe8dc 10px 20px);
  color: #6a4a32;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.1rem;
}

footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 40px;
  color: #5b6a70;
  font-size: 0.88rem;
}

@media (max-width: 1100px) {
  .split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 36px;
  padding: 10px 0 28px;
  align-items: center;
}
.split .hero-photo img { height: 420px; }
#why-here p { max-width: 72ch; font-size: 1.08rem; }
.gallery.one {
  grid-template-columns: 1fr;
  grid-template-rows: 280px;
}
.gallery.one figure:first-child { grid-row: auto; }
.hero, .split { grid-template-columns: 1fr; }
  .hero-photo img { height: 360px; }
}
@media (max-width: 860px) {
  .hero, .map-shell, .notes, .challenges, .stats, .gallery {
    grid-template-columns: 1fr;
  }
  .gallery { grid-template-rows: auto; }
  .gallery figure:first-child { grid-row: auto; }
  .gallery figure { height: 220px; }
  #map { height: 380px; }
  nav.tabs { display: flex; }
}

.crab-icon, .race-icon, .pin-icon {
  font-size: 18px; line-height: 22px; text-align: center;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.35));
}

.bb-buoy {
  width: 12px; height: 16px;
  background: linear-gradient(#fff 0 35%, #e24a1b 35% 100%);
  border: 1.5px solid #5c2416;
  border-radius: 6px 6px 3px 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.bb-buoy.hit { box-shadow: 0 0 0 2px rgba(226,74,27,.35), 0 1px 2px rgba(0,0,0,.35); }
.bb-buoy.nav-red {
  width: 0; height: 0;
  background: none;
  border: none;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid #d92b2b;
  border-radius: 0;
  box-shadow: none;
}
.bb-buoy.nav-grn {
  width: 9px; height: 9px;
  background: #2f9e44;
  border: 1px solid #1b5e2a;
  border-radius: 1px;
}


body.pinning .leaflet-overlay-pane,
body.pinning .leaflet-marker-pane { pointer-events: none; }

.sail h3 { display: flex; align-items: flex-start; gap: 6px; }
.fav {
  flex: 0 0 auto;
  border: 0; background: none; cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: 0;
  color: #c4b8a4;
}
.fav.on { color: #d4a017; }

.log-filters { display: none; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
body.tab-log .log-filters { display: flex; }
.log-filters button {
  font: inherit; font-size: 0.78rem; padding: 4px 10px;
  border-radius: 999px; border: 1px solid var(--line);
  background: #fffdf8; cursor: pointer; color: var(--ink);
}
.log-filters button.on { background: var(--deep); color: #f6f1e8; border-color: var(--deep); }

.rm-red {
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 11px solid #e03131;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.35));
}
.rm-yellow {
  width: 10px; height: 10px;
  background: #f4d03f;
  border: 1px solid #b8860b;
  box-shadow: 0 1px 1px rgba(0,0,0,.35);
}

.bb-buoy.selected { outline: 2px solid #1f6f8b; outline-offset: 2px; }

.award-totals { display:flex; flex-wrap:wrap; gap:16px; margin-bottom:16px; font-size:1.05rem; }
.award-table { width:100%; border-collapse:collapse; }
.award-table th, .award-table td { text-align:left; padding:8px 6px; border-bottom:1px solid var(--line); vertical-align:top; }
.award-table th:nth-child(2), .award-table td:nth-child(2),
.award-table th:nth-child(3), .award-table td:nth-child(3) { width:22%; white-space:nowrap; }
.how { font-size:0.8rem; color:#5b6a70; font-weight:400; }

.trophy-shelf { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:10px; }
.trophy { border:1px solid var(--line); border-radius:12px; padding:10px; background:#fffdf8; opacity:.45; }
.trophy.on { opacity:1; background:#f6e6d8; border-color:#c45c26; }
.trophy .cup { font-size:1.4rem; }

.map-label {
  background: rgba(255,253,248,.92);
  color: #3a2418;
  border: 1px solid #c45c26;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  pointer-events: auto;
}
.map-label.selected { outline: 2px solid #1f6f8b; }

body.tab-log .sails { max-height: min(70vh, 640px); }
.sail-month {
  margin: 12px 0 4px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a4a32;
}
.sail-month:first-child { margin-top: 0; }

.book { display:grid; grid-template-columns: 1fr 1fr; gap:18px; align-items:start; }
.book-form label { display:block; margin:0 0 12px; font-size:0.88rem; color:#5b6a70; }
.book-form input, .book-form textarea {
  display:block; width:100%; margin-top:4px; font:inherit; padding:8px 10px;
  border:1px solid var(--line); border-radius:8px; background:#fffdf8;
}
.book-list .card p { margin:8px 0 0; }
@media (max-width: 860px) { .book { grid-template-columns: 1fr; } }

.sail-detail { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.score-break { width: 100%; font-size: 0.88rem; border-collapse: collapse; }
.score-break td { padding: 2px 0; }
.score-break td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.away-filters { display: none; }
body.tab-log .away-filters { display: none; }
body.tab-races .log-filters { display: none; }
body.tab-races .away-filters { display: flex; }

body:not(.dev) #tabs [data-tab="course"],
body:not(.dev) #tabs [data-tab="session"] { display: none; }

.notes { display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
.notes article:first-child { grid-column: 1 / -1; }
@media (max-width: 860px) {
  .notes { grid-template-columns: 1fr; }
}
.hero h1 { border-bottom: 3px solid var(--sail); display: inline-block; padding-bottom: 6px; }
