/* Rate My Berth. Palette borrowed from paper charts: navy ink, shallow-water blue,
   and the magenta used for lights and marks. Port red / starboard green carry the scores. */
@font-face { font-family: Barlow; font-weight: 400; font-display: swap; src: url(/vendor/barlow/barlow-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Barlow; font-weight: 500; font-display: swap; src: url(/vendor/barlow/barlow-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Barlow; font-weight: 600; font-display: swap; src: url(/vendor/barlow/barlow-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 500; font-display: swap; src: url(/vendor/barlow-sc/barlow-semi-condensed-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 600; font-display: swap; src: url(/vendor/barlow-sc/barlow-semi-condensed-latin-600-normal.woff2) format('woff2'); }

:root {
  --ink: #0E2A47; --muted: #55677B; --line: #D2E0EC; --water: #E6F1F9; --sea: #1D6FA5; --paper: #fff;
  --magenta: #B5197A; --magenta-dark: #931363; --link: #931363; --danger: #B3261E; --ok: #1B7F5C;
  --surface: #fff; --field-line: #9FB0C2; --track: #DCE9F3; --chip: #F4F9FC; --chip-line: #B9D3E6;
  --b-wait-bg: #FCEFD5; --b-wait: #7A4B05; --b-ok-bg: #DDF1E9; --b-ok: #125C42; --b-no-bg: #F9E1DF; --b-no: #8E1C16;
  --good: #1B7F5C; --mid: #A9690C; --low: #B3261E; --none: #7B8A9A;
  --display: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif;
  --text: Barlow, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --topbar: 60px;
  /* Wave edges, drawn once and tiled. White wave hanging below the top bar, and white swell rising into a blue band. */
  --wave-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='9'%3E%3Cpath d='M0 0H80V4Q60 10 40 4T0 4Z' fill='%23fff'/%3E%3Cpath d='M0 4Q20 -2 40 4T80 4' fill='none' stroke='%231D6FA5' stroke-width='1.3' opacity='.6'/%3E%3C/svg%3E");
  --wave-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='10'%3E%3Cpath d='M0 10H80V5Q60 -1 40 5T0 5Z' fill='%23fff'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 400 16px/1.5 var(--text); color: var(--ink); background: var(--paper); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
h1, h2 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -.005em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
p { margin: 0; }
a { color: var(--link); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 2px; border-radius: 2px; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-weight: 500; }

/* top bar */
.topbar { height: var(--topbar); display: flex; align-items: center; gap: 20px; padding: 0 20px; background: var(--paper); position: relative; z-index: 1100; }
.topbar::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 9px; background: var(--wave-down) repeat-x; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 600 1.35rem/1 var(--display); white-space: nowrap; }
#search { flex: 1; max-width: 440px; display: flex; }
#search input { flex: 1; min-width: 0; border-radius: 4px 0 0 4px; border-right: 0; }
#search button { border: 1px solid var(--sea); background: var(--sea); color: #fff; font: 500 .95rem var(--text); padding: 0 16px; border-radius: 0 4px 4px 0; cursor: pointer; }
#nav { margin-left: auto; display: flex; align-items: center; gap: 20px; font-weight: 500; white-space: nowrap; }
#nav a { color: var(--ink); text-decoration: none; }
#nav a:hover { text-decoration: underline; }

/* layout */
#shell { display: grid; grid-template-columns: 1fr 440px; height: calc(100% - var(--topbar)); }
#map { background: var(--water); min-height: 0; }
#panel { position: relative; overflow-y: auto; border-left: 1px solid var(--line); padding: 24px; display: flex; flex-direction: column; gap: 18px; }
#page { height: calc(100% - var(--topbar)); overflow-y: auto; background: var(--wave-up) repeat-x 0 120px local, linear-gradient(var(--water) 129px, var(--paper) 129px) local; }
.page-inner > h1 { margin-bottom: 56px; }
.page-inner { max-width: 760px; margin: 0 auto; padding: 48px 24px 80px; display: flex; flex-direction: column; gap: 18px; }
.lede { font-size: 1.15rem; max-width: 60ch; }
.prose { margin: 0; padding-left: 1.2em; max-width: 68ch; display: grid; gap: 6px; }
.section { margin-top: 14px; padding-top: 18px; border-top: 1px solid var(--line); }

/* controls */
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--field-line); border-radius: 4px; padding: 9px 11px; background: var(--surface); width: 100%; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--magenta); }
.btn { display: inline-flex; justify-content: center; align-items: center; font: 600 1rem var(--text); border: 1px solid var(--ink); background: var(--surface); color: var(--ink); padding: 10px 18px; border-radius: 4px; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.btn.primary:hover { background: var(--magenta-dark); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.ghost { border-color: transparent; }
.btn.small { padding: 6px 12px; font-size: .92rem; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.link { font: inherit; font-weight: 500; background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link.danger { color: var(--danger); }
.link.on { color: var(--ok); text-decoration: none; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; }
.row.end { justify-content: flex-end; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label, legend { font-weight: 600; padding: 0; }
.hint, legend small { color: var(--muted); font-size: .88rem; font-weight: 400; }
.joined { display: flex; }
.joined select { width: 84px; flex: none; border-radius: 4px 0 0 4px; border-right: 0; }
.joined input { border-radius: 0; min-width: 0; }
.joined select:last-child { width: 122px; border-radius: 0 4px 4px 0; border-right: 1px solid var(--field-line); border-left: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.note { background: var(--water); border-left: 3px solid var(--sea); padding: 10px 12px; font-size: .95rem; }

/* score tags: the berth-number plaque */
.tag, .pin { font: 600 1rem/1 var(--display); color: #fff; background: var(--none); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 28px; padding: 0 6px; flex: none; font-variant-numeric: tabular-nums; }
.tag-big { font-size: 1.7rem; min-width: 64px; height: 52px; }
.tag-good, .pin-good, .fill-good { background: var(--good); }
.tag-mid, .pin-mid, .fill-mid { background: var(--mid); }
.tag-low, .pin-low, .fill-low { background: var(--low); }
.pin { position: relative; width: 40px; box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(14, 42, 71, .45); cursor: pointer; }
.pin::after { content: ''; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: #fff; }
.pin-new { background: var(--magenta); font-size: .85rem; }
/* Small badges for toilets, bins, parking and pontoon labels */
.feat { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font: 600 .72rem/1 var(--text); color: #fff; background: #1D6FA5; padding: 3px 5px; border-radius: 3px; box-shadow: 0 0 0 1.5px #fff; cursor: pointer; }
.feat-pontoon { font: 600 .95rem/1 var(--display); background: #0E2A47; padding: 3px 7px; border-radius: 10px; }
.feat-other { background: #55677B; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.pop .btn { width: 100%; }
.map-switch { display: flex; border-radius: 4px; overflow: hidden; box-shadow: 0 1px 5px rgba(14, 42, 71, .4); }
.map-switch button { font: 600 .88rem var(--text); padding: 7px 12px; border: 0; background: var(--surface); color: var(--ink); cursor: pointer; }
.map-switch button[aria-pressed=true] { background: var(--sea); color: #fff; }
.leaflet-container { font-family: var(--text); }
.leaflet-tooltip { font: 500 .9rem var(--text); color: var(--ink); }
.pop { display: grid; gap: 6px; font-size: .95rem; min-width: 190px; }
.pop p { margin: 0 !important; color: var(--muted); }

/* list */
.panel-head { display: grid; gap: 8px; margin: -24px -24px 0; padding: 30px 24px 34px; background: var(--wave-up) repeat-x bottom, var(--water); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.place-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.place-list a { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.place-list a:hover { background: var(--water); }
.place-main { display: grid; flex: 1; min-width: 0; font-size: .92rem; }
.place-main strong { font-size: 1rem; }
.place-cost { font: 600 1.05rem var(--display); white-space: nowrap; }
.place-cost small { font: 400 .8rem var(--text); color: var(--muted); }
.empty { background: var(--water); padding: 24px; display: grid; gap: 10px; justify-items: start; }
.empty-line { color: var(--muted); }

/* place */
.back { font-weight: 500; text-decoration: none; }
.back::before { content: '‹ '; }
.place-head { display: flex; gap: 14px; align-items: center; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.facts dt { font-size: .85rem; color: var(--muted); }
.facts dd { margin: 0; font: 600 1.15rem var(--display); }
.bars { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 11em 1fr 2em; align-items: center; gap: 10px; font-size: .93rem; }
.bar { height: 8px; background: var(--track); border-radius: 2px; overflow: hidden; }
.bar-fill { display: block; height: 100%; }
.bar-num { font: 600 .95rem var(--display); text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--chip-line); background: var(--chip); border-radius: 3px; padding: 2px 9px; font-size: .88rem; }

/* review */
.review { display: grid; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.review header { display: flex; gap: 12px; align-items: center; }
.review header div { display: grid; font-size: .9rem; }
.review header strong { font-size: 1.02rem; }
.review .body { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 68ch; }
.meta { font-size: .9rem; color: var(--muted); }
.review footer { display: flex; gap: 18px; font-size: .92rem; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos button { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 3px; overflow: hidden; line-height: 0; }
.photos img { width: 92px; height: 70px; object-fit: cover; }
.photos .remove { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--paper); line-height: 20px; font-size: 14px; }
details summary { cursor: pointer; font-size: .92rem; font-weight: 500; color: var(--link); }
.scores { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 20px; font-size: .9rem; }
.scores li { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--line); }

/* review form */
.rating { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rating legend { float: left; display: grid; }
.rating-row { display: flex; gap: 4px; }
/* Keep the visually hidden radio inside its label, so focusing it never scrolls the page. */
.rating-row label { position: relative; }
.rating-row input { top: 0; left: 0; }
.rating-row span { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--field-line); border-radius: 3px; font: 600 1rem var(--display); cursor: pointer; }
.rating-row input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.rating-row .na { display: flex; align-items: center; gap: 5px; margin-left: 8px; font-size: .88rem; font-weight: 500; color: var(--muted); cursor: pointer; }
.rating-row .na input { position: static; width: auto; }
.rating.is-na .rating-row label:not(.na) span { opacity: .35; cursor: default; }
.rating.is-na legend { color: var(--muted); }
.rating-row input:focus-visible + span { outline: 3px solid var(--magenta); outline-offset: 2px; }
.edit-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.edit-scores legend { margin-bottom: 6px; }
.edit-scores label { display: grid; grid-template-columns: 1fr 62px; align-items: center; gap: 6px; font-size: .88rem; }
.edit-scores select { padding: 5px 6px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.checks legend { margin-bottom: 6px; }
.checks label { display: flex; gap: 8px; align-items: center; }
.checks.inline { display: flex; gap: 20px; }
.checks.inline legend { float: left; margin: 0 8px 0 0; }

/* cards, admin */
.card { border: 1px solid var(--line); border-radius: 4px; padding: 18px 20px 4px; display: grid; gap: 8px; }
.card .review { border-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge { font-size: .82rem; font-weight: 600; padding: 2px 9px; border-radius: 3px; white-space: nowrap; }
.badge-pending { background: var(--b-wait-bg); color: var(--b-wait); }
.badge-approved { background: var(--b-ok-bg); color: var(--b-ok); }
.badge-rejected { background: var(--b-no-bg); color: var(--b-no); }
.moderate { flex-wrap: wrap; align-items: center; gap: 10px !important; padding-bottom: 14px; }
.moderate input { flex: 1 1 100%; }
.table { border-top: 1px solid var(--line); }
.table-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.table-row > input { flex: 2 1 200px; width: auto; }
.table-row > select { flex: 1 1 150px; width: auto; }
.table-row > span:first-child { flex: 1 1 240px; }

/* dialog, toast */
dialog { max-height: calc(100vh - 32px); overflow-y: auto; background: var(--paper); border: 0; border-radius: 6px; padding: 28px; width: min(440px, calc(100vw - 32px)); color: var(--ink); box-shadow: 0 20px 60px rgba(14, 42, 71, .35); }
dialog::backdrop { background: rgba(14, 42, 71, .55); }
dialog .close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
dialog h2 { margin-bottom: 4px; padding-right: 20px; }
dialog:has(.lightbox) { width: auto; max-width: calc(100vw - 32px); padding: 8px; }
.lightbox { display: block; max-width: 100%; max-height: 84vh; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 4px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 3000; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* Dark mode. theme.js sets data-theme on <html> from the visitor's choice, or their device setting. */
:root[data-theme=dark] {
  color-scheme: dark;
  --ink: #E4EDF6; --muted: #9BB0C4; --line: #213A53; --water: #10283F; --sea: #2A7FB8; --paper: #0A1929;
  --link: #F29BD0; --danger: #FF8E85; --ok: #5FD0A6;
  --surface: #0F2337; --field-line: #3A5673; --track: #1C3550; --chip: #10283F; --chip-line: #2C4E6E;
  --b-wait-bg: #40300C; --b-wait: #F5CE83; --b-ok-bg: #0F3B2C; --b-ok: #8FE0BF; --b-no-bg: #47201D; --b-no: #FFB3AC;
  --wave-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='9'%3E%3Cpath d='M0 0H80V4Q60 10 40 4T0 4Z' fill='%230A1929'/%3E%3Cpath d='M0 4Q20 -2 40 4T80 4' fill='none' stroke='%234A9AD0' stroke-width='1.3' opacity='.7'/%3E%3C/svg%3E");
  --wave-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='10'%3E%3Cpath d='M0 10H80V5Q60 -1 40 5T0 5Z' fill='%230A1929'/%3E%3C/svg%3E");
}
/* Map tiles are light images, so flip them rather than fetch a second tile set. */
[data-theme=dark] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.7); }
[data-theme=dark] #map { background: #0C2032; }
[data-theme=dark] .leaflet-popup-content-wrapper, [data-theme=dark] .leaflet-popup-tip, [data-theme=dark] .leaflet-tooltip,
[data-theme=dark] .leaflet-bar a, [data-theme=dark] .leaflet-control-attribution { background: var(--surface); color: var(--ink); }
[data-theme=dark] .leaflet-bar a { border-bottom-color: var(--line); }
[data-theme=dark] .leaflet-tooltip-top::before { border-top-color: var(--surface); }
[data-theme=dark] .leaflet-control-attribution a { color: var(--link); }
[data-theme=dark] dialog { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0, 0, 0, .6); }
[data-theme=dark] dialog::backdrop { background: rgba(0, 0, 0, .65); }
.theme-toggle { font: inherit; font-size: 1.15rem; line-height: 1; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); cursor: pointer; }

/* On desktop only the side panel scrolls; the window itself never does. */
@media (min-width: 861px) { html, body { overflow: hidden; } }

@media (max-width: 860px) {
  :root { --topbar: 104px; }
  .topbar { flex-wrap: wrap; gap: 8px 14px; padding: 10px 14px; align-content: center; }
  #search { order: 3; flex: 1 1 100%; max-width: none; }
  #nav { gap: 14px; font-size: .92rem; }
  #shell { display: block; height: auto; }
  #map { height: 48vh; }
  #panel { border-left: 0; border-top: 1px solid var(--line); padding: 20px 16px 48px; overflow: visible; }
  .panel-head { margin: -20px -16px 0; padding: 24px 16px 30px; }
  .page-inner > h1 { margin-bottom: 44px; }
  .bar-row { grid-template-columns: 9em 1fr 2em; }
  .rating { grid-template-columns: 1fr; gap: 6px; }
}
