@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Condensed:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap");

:root {
  --navy: #0b2545;
  --navy-2: #1c3a63;
  --blue: #1f5bd6;
  --blue-dark: #1747a8;
  --ink: #0b2545;
  --muted: #3d4a60;
  --soft: #b9c8e3;
  --line: #d5dde8;
  --wash: #eaf0f8;
  --white: #fff;
  --edit: #39ff14;
  --bad: #d32f2f;
  --cond: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --r: 8px;
  --pad: clamp(16px, 5vw, 32px);
  --col: max(var(--pad), calc((100% - 1080px) / 2 + var(--pad)));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--white); color: var(--ink); font: 400 17px/1.55 var(--sans); }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--blue-dark); }
h1, h2, h3 { font-family: var(--cond); font-weight: 700; line-height: 1; margin: 0; }
p { margin: 0; text-wrap: pretty; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--pad); }
.tnum { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { font: 600 13px var(--cond); letter-spacing: .06em; text-transform: uppercase; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 10; background: var(--navy); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { font: 700 16px var(--cond); letter-spacing: .04em; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.nav { display: none; gap: 20px; }
.nav a { color: #fff; text-decoration: none; font: 500 15px var(--sans); }
.nav a:hover { color: var(--soft); }
.call { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 6px; background: #fff; color: var(--navy); font: 600 15px var(--sans); text-decoration: none; }
.call:hover { background: var(--wash); color: var(--navy); }

/* Hero: full-bleed, board docked */
.hero { position: relative; min-height: calc(100svh - 56px); display: flex; flex-direction: column; justify-content: space-between; background: var(--navy); overflow: hidden; }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 46% 50%; }
.plate { position: relative; align-self: flex-start; margin: 28px var(--pad) 24px 0; background: var(--navy); color: #fff; padding: 14px 18px 16px var(--col); border-radius: 0 6px 6px 0; display: grid; gap: 6px; }
.plate h1 { font-size: clamp(46px, 15vw, 84px); line-height: .95; }
.plate .route { font: 600 19px var(--cond); }
.plate .tag { font-size: 15px; color: #dbe4f3; }

.board { position: relative; background: var(--navy); color: #fff; }
.board-inner { padding: 0 var(--col); }
.board-head { display: flex; justify-content: space-between; gap: 12px; padding: 12px var(--col) 8px; color: var(--soft); }
.dep { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--navy-2); }
.dep:last-child { padding-bottom: 16px; }
.dep-from { display: grid; }
.dep-from b { font: 500 16px var(--sans); }
.dep-in { font-size: 14px; color: var(--soft); }
.dep-time { font: 700 clamp(36px, 12vw, 48px)/1 var(--cond); white-space: nowrap; }
.dep-time small { font-size: .45em; margin-left: 4px; }

/* Sections */
.board-msg { margin: 0; padding: 14px var(--col) 18px; border-top: 1px solid var(--navy-2); font: 600 clamp(22px, 7vw, 30px)/1.2 var(--cond); text-wrap: balance; }
.board-msg.notice { font: 500 16px/1.45 var(--sans); background: var(--blue); padding: 12px var(--col); }
.season { margin-top: 14px; font: 600 clamp(20px, 6vw, 24px)/1.2 var(--cond); color: var(--navy); }
.season-note { padding: 10px 14px; background: var(--wash); border-radius: 6px; font-weight: 500; }
section.block { padding: 44px 0; border-top: 1px solid var(--line); }
.head { margin-bottom: 20px; display: grid; gap: 6px; }
.head h2 { font-size: clamp(32px, 10vw, 48px); color: var(--navy); }
.lede { font-size: 18px; line-height: 1.6; max-width: 62ch; }

/* Live */
.live { border-top: 1px solid var(--line); padding: 24px 0 0; }
.live-box { max-width: 560px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.live-map { position: relative; }
.live-map svg { display: block; width: 100%; height: auto; }
.live-credit { position: absolute; right: 0; bottom: 0; padding: 1px 6px; background: rgba(255, 255, 255, .8); color: var(--muted); font-size: 11px; text-decoration: none; }
.live-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 12px 16px; font-size: 15px; }
.live-bar strong { font-weight: 600; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); margin-right: 8px; }
.dot.off { background: #9aa6ba; }

/* Timetable */
.tt { width: 100%; border-collapse: collapse; }
.tt th { text-align: left; padding: 0 12px 10px; color: var(--muted); border-bottom: 2px solid var(--navy); }
.tt td { padding: 0 12px; height: 52px; border-bottom: 1px solid var(--line); font: 600 24px var(--cond); }
.tt td:first-child { border-right: 1px solid var(--line); }
.tt td.past { color: #8b96aa; font-weight: 500; }
.tt td.is-next { background: var(--navy); color: #fff; }
/* The operator's own note under the times. Nothing shows to visitors while it is empty. */
.times-note { margin-top: 16px; padding: 14px 16px; background: var(--wash); border-radius: 6px; font: 600 18px/1.4 var(--sans); color: var(--navy); }
.times-note:empty { display: none; }

/* Prices */
.fares { list-style: none; margin: 28px 0 0; padding: 0; border-top: 2px solid var(--navy); }
.fare { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.fare-name { font: 500 18px var(--sans); }
.fare-detail { display: block; font-size: 15px; color: var(--muted); }
.fare-price { font: 700 clamp(34px, 11vw, 44px)/1 var(--cond); color: var(--blue); }
.notes { margin-top: 18px; display: grid; gap: 6px; font: 600 18px var(--sans); }
.notes span { display: block; }
.notes .fn { font-weight: 400; color: var(--muted); }

/* Wharves */
.wharves { display: grid; gap: 12px; }
.wharf { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); }
.wharf h3 { font-size: 26px; color: var(--navy); }
.btn { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 0 18px; border-radius: 6px; border: 2px solid var(--navy); color: var(--navy); background: #fff; font: 600 16px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--wash); color: var(--navy); }
.btn.solid { background: var(--navy); color: #fff; }
.btn.solid:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }

/* Russell */
.cards { display: grid; gap: 20px; margin-top: 28px; }
.card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--r); }
.card h3 { margin-top: 10px; font-size: 24px; color: var(--navy); }

/* Contact over sunset photo */
.sunset { position: relative; min-height: 560px; display: flex; align-items: flex-end; background: var(--navy); overflow: hidden; }
.sunset > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.sunset-inner { position: relative; width: 100%; padding-top: 32px; padding-bottom: 24px; display: grid; gap: 10px; }
.sunset-title { justify-self: start; background: var(--navy); color: #fff; font-size: clamp(30px, 9vw, 40px); padding: 10px 14px; border-radius: 6px; }
.contact { display: grid; gap: 10px; }
.contact a { display: grid; gap: 2px; padding: 14px 16px; background: var(--navy); border-radius: var(--r); text-decoration: none; }
.contact a:hover { background: var(--navy-2); }
.contact .k { font-size: 14px; color: var(--soft); }
.contact .v { font: 700 clamp(22px, 7vw, 28px)/1.15 var(--cond); color: #fff; overflow-wrap: anywhere; }

footer { background: var(--navy); color: var(--soft); padding: 28px 0 36px; font-size: 15px; }
footer .wrap { display: grid; gap: 4px; }
.op-login { justify-self: start; margin-top: 14px; padding: 10px 0; font-size: 14px; color: #8fa3c4 !important; text-decoration: none; }
.op-login:hover { color: #fff !important; text-decoration: underline; }
footer strong { font: 700 18px var(--cond); letter-spacing: .04em; color: #fff; }

@media (min-width: 720px) {
  .nav { display: flex; }
  .board-inner { display: grid; grid-template-columns: 1fr 1fr; }
  .board .dep:first-child { padding-right: var(--pad); }
  .board .dep:last-child { border-left: 1px solid var(--navy-2); padding-left: var(--pad); }
  .wharves, .contact { grid-template-columns: 1fr 1fr; }
  .sunset { min-height: 640px; }
  .sunset-inner { padding-bottom: 40px; }
}
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Logged-in view: a bright green bar says this is the admin's view; green boxes mark what can be changed */
.editing .editable { outline: 3px solid var(--edit); outline-offset: 2px; cursor: pointer; }
.editing img.editable { outline-offset: -3px; }
.editing .is-editing { outline: 4px solid var(--edit); outline-offset: 3px; box-shadow: 0 0 0 9px rgba(57, 255, 20, .25); cursor: text; }
.editing [contenteditable] { caret-color: currentColor; }
.editing [contenteditable]:focus { outline: none; }
.editing .is-editing [contenteditable], .editing [contenteditable].is-editing { min-width: 2ch; }
.editing #notice:empty::before { content: "Type the notice"; opacity: .85; font-style: italic; }
.editing #notice.editable { outline-offset: -3px; }
/* The notice switch on the board, for the admin only */
.ed-notice-row, .ed-live-row { display: none; }
.editing .ed-live-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 12px; padding: 8px 12px; border-radius: var(--r); outline: 3px solid var(--edit); font: 600 16px var(--sans); color: var(--navy); }
.editing .ed-live-row.ed-changed { outline-width: 5px; }
.ed-live-row small { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }
.ed-live-row .ed-switch i { border-color: var(--navy); }
.editing .ed-notice-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px var(--col); border-top: 1px solid var(--navy-2); outline: 3px solid var(--edit); outline-offset: -3px; font: 600 16px var(--sans); }
.editing .ed-notice-row.ed-changed { outline-width: 5px; outline-offset: -5px; }
.ed-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.ed-switch i { position: relative; width: 52px; height: 30px; border-radius: 999px; background: var(--muted); border: 2px solid var(--white); transition: background .15s; }
.ed-switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--white); transition: transform .15s; }
.ed-switch[aria-checked="true"] i { background: var(--edit); }
.ed-switch[aria-checked="true"] i::after { transform: translateX(22px); background: var(--navy); }
.ed-switch b { min-width: 2.2em; text-align: left; }
.ed-switch:focus-visible { outline: 3px solid var(--edit); outline-offset: 2px; }
.edit-bar .btn.preset { white-space: normal; text-align: left; justify-content: flex-start; padding-top: 6px; padding-bottom: 6px; }
.editing [data-ph]:empty::before { content: attr(data-ph); color: var(--muted); font-style: italic; }
.ed-fare .fare-name { display: grid; gap: 4px; }
.ed-fare [data-f] { display: block; padding: 2px 4px; border-bottom: 2px dashed var(--line); }
.ed-fare .fare-price { white-space: nowrap; }
.ed-fare .fare-price [data-f] { display: inline-block; min-width: 1.5ch; }
.ed-fare .btn.del { justify-self: start; min-height: 40px; padding: 0 12px; font-size: 14px; }
.admin-view { padding-bottom: 150px; }
.edit-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom)); background: var(--edit); color: var(--navy); border-top: 3px solid var(--navy); }
.edit-bar p { margin: 0; font-size: 15px; }
.edit-actions, .ed-row { display: flex; flex-wrap: wrap; gap: 8px; }
.edit-bar .btn { min-height: 44px; }
.edit-bar .btn.del { border-color: var(--navy); color: #8a2a2a; }
.ed-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; }
.ed-check input { width: 24px; height: 24px; accent-color: var(--navy); }
.ed-f { display: grid; gap: 4px; font-weight: 600; font-size: 15px; }
.ed-f span { font-weight: 400; font-size: 14px; }
.ed-in { width: 100%; padding: 10px 12px; border: 2px solid var(--navy); border-radius: 8px; font: 400 16px var(--sans); color: var(--ink); background: var(--white); }
.ed-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.edit-bar label.btn { position: relative; }

/* Problems: red on the field with the reason beside it, red on its box */
.ed-err { display: block; width: fit-content; max-width: 100%; margin: 6px 0 0; padding: 4px 8px; border-radius: 4px; background: var(--bad); color: var(--white); font: 600 14px/1.3 var(--sans); letter-spacing: 0; text-transform: none; white-space: normal; text-align: left; }
.ed-msg .ed-err { display: inline-block; margin: 0; }
.editing .editable.ed-bad-box { outline-color: var(--bad); }
.editing .is-editing.ed-bad-box { box-shadow: 0 0 0 9px rgba(211, 47, 47, .25); }
.editing [contenteditable].ed-bad, .editing [contenteditable].ed-bad:focus { outline: 3px solid var(--bad); outline-offset: 2px; }
.ed-fare [data-f].ed-bad { border-bottom-color: var(--bad); }
.ed-in.ed-bad, .ed-in.ed-bad:focus { border-color: var(--bad); outline: 3px solid var(--bad); outline-offset: 1px; }
.editing [data-copy]:empty::before { content: "Empty"; font-style: italic; opacity: .7; }
.editing .times-note:empty { display: block; }
.editing .times-note:empty::before { content: "Add a note under the times"; }
.ed-count { font-weight: 600; margin-left: .5em; }

/* The timetable is edited on its own page: a dashed box and a tag say so */
.editing [data-edit].editable { outline-style: dashed; }
.editing #times .head[data-edit]::after { content: "Opens timetable editor \2197"; justify-self: start; width: fit-content; margin-top: 6px; padding: 4px 10px; border-radius: 999px; background: var(--navy); color: var(--white); font: 600 13px/1.4 var(--sans); }

/* Every editable box has a pencil badge on its corner; unsaved boxes get a heavier outline and "Changed" beside the pencil */
.editing .editable.ed-changed { outline-width: 5px; }
#ed-tags { position: absolute; top: 0; left: 0; z-index: 5; }
body:not(.editing) #ed-tags { display: none; }
.ed-tag { position: absolute; transform: translate(-100%, -80%); display: flex; align-items: center; gap: 4px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 999px; background: var(--edit); color: var(--navy); border: 2px solid var(--navy); font: 700 12px/1 var(--sans); white-space: nowrap; pointer-events: none; }
.ed-tag svg { width: 12px; height: 12px; fill: currentColor; flex: none; }
.ed-toast { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.ed-toast .btn { min-height: 40px; }
.ed-ok { font-weight: 600; }
.edit-bar .btn:disabled { opacity: .55; cursor: default; }

/* While a box is open the rest of the page dims; the open box stays clear */
#ed-dim i { position: fixed; z-index: 6; background: rgba(11, 37, 69, .45); pointer-events: none; }
/* Little screen left (the phone keyboard is up): the bar is one line, just what is needed to type and finish */
.ed-compact .edit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-top: 6px; padding-bottom: 6px; }
.ed-compact .edit-bar .ed-msg { flex: 1 1 auto; }
.ed-compact .edit-bar .ed-row, .ed-compact .edit-bar .ed-f > span, .ed-compact .edit-bar [data-ed="undo-this"] { display: none; }
.ed-compact .edit-bar .ed-f { flex: 1 1 100%; order: 3; }
.ed-compact .edit-bar .btn { min-height: 40px; }

/* Neon green alone is hard to see on white: a navy line sits inside the outline. Keyboard focus is a thick navy ring. */
.editing .editable:not(img) { box-shadow: 0 0 0 2px var(--navy); }
.editing .editable.is-editing:not(img) { box-shadow: 0 0 0 3px var(--navy), 0 0 0 12px rgba(57, 255, 20, .25); }
.editing .editable.is-editing.ed-bad-box:not(img) { box-shadow: 0 0 0 3px var(--navy), 0 0 0 12px rgba(211, 47, 47, .25); }
.editing .ed-live-row { box-shadow: inset 0 0 0 2px var(--navy); }
.editing .editable:not([contenteditable]):focus-visible, .ed-switch:focus-visible { outline: 5px solid var(--navy); outline-offset: 3px; }
.edit-bar label.btn:focus-within { outline: 3px solid var(--navy); outline-offset: 2px; }
.ed-nudge { animation: ed-nudge .3s 2; }
@keyframes ed-nudge { 50% { background: var(--white); } }
