/* seattle.ad: shared tokens, type, the top bar with its porthole switch, the chart's colours,
   buttons and the footer. By day a paper chart on a chart table; by night a ship's bridge display. */

@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-regular-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-italic-latin.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-variable-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("../fonts/martian-mono-variable-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f1ead8;
  --paper-hi: #f8f3e6;
  --paper-lo: #e7dcc2;
  --ink: #1c2b3a;
  --ink-2: #3d4c59;
  --sound: #2b6a8f;
  --route: #c0392b;
  --route-text: #b23426;
  --brass: #a07c34;
  --brass-hi: #d9b871;
  --brass-lo: #6f5420;
  --brass-text: #77591c;
  --tint: #cfe1e4;
  --amber: #ffd678;
  --glass: #d7e5e6;
  --glass-hi: #ffffff;
  --rule: rgba(28, 43, 58, 0.18);
  --shadow: rgba(52, 40, 18, 0.18);
  /* the chart */
  --c-water: #f4eedf;
  --c-tint: #dde8e3;
  --c-tint-soft: #e8eadf;
  --c-ripple: #a9c4c9;
  --c-land: #ecdfb6;
  --c-stipple: rgba(120, 90, 30, 0.22);
  --c-coast: #1c2b3a;
  --c-contour: rgba(43, 106, 143, 0.55);
  --c-grid: rgba(28, 43, 58, 0.09);
  --c-sounding: #2b6a8f;
  --c-label-water: #2b6a8f;
  --c-label-land: #1c2b3a;
  --c-route: #c0392b;
  --c-ferry: #fbf8f0;
  --c-ferry-deck: #e9e2cf;
  --c-wake: rgba(43, 106, 143, 0.45);
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --bar-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0b1a26;
    --paper-hi: #10243a;
    --paper-lo: #071420;
    --ink: #dbe9f0;
    --ink-2: #a4bccb;
    --sound: #7fc4e0;
    --route: #f0705f;
    --route-text: #f58a7b;
    --brass: #c9a45a;
    --brass-hi: #ecd393;
    --brass-lo: #7e6128;
    --brass-text: #e2c27e;
    --tint: #123852;
    --glass: #0f2e44;
    --glass-hi: #7fc4e0;
    --rule: rgba(127, 196, 224, 0.2);
    --shadow: rgba(0, 0, 0, 0.45);
    --c-water: #0b1a26;
    --c-tint: #0f2c41;
    --c-tint-soft: #0d2333;
    --c-ripple: #1f5068;
    --c-land: #17232a;
    --c-stipple: rgba(255, 214, 120, 0.1);
    --c-coast: #7fc4e0;
    --c-contour: rgba(127, 196, 224, 0.32);
    --c-grid: rgba(127, 196, 224, 0.08);
    --c-sounding: #6fb3cf;
    --c-label-water: #7fc4e0;
    --c-label-land: #ffd678;
    --c-route: #f0705f;
    --c-ferry: #ffd678;
    --c-ferry-deck: #f2c45a;
    --c-wake: rgba(127, 196, 224, 0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0b1a26;
  --paper-hi: #10243a;
  --paper-lo: #071420;
  --ink: #dbe9f0;
  --ink-2: #a4bccb;
  --sound: #7fc4e0;
  --route: #f0705f;
  --route-text: #f58a7b;
  --brass: #c9a45a;
  --brass-hi: #ecd393;
  --brass-lo: #7e6128;
  --brass-text: #e2c27e;
  --tint: #123852;
  --glass: #0f2e44;
  --glass-hi: #7fc4e0;
  --rule: rgba(127, 196, 224, 0.2);
  --shadow: rgba(0, 0, 0, 0.45);
  --c-water: #0b1a26;
  --c-tint: #0f2c41;
  --c-tint-soft: #0d2333;
  --c-ripple: #1f5068;
  --c-land: #17232a;
  --c-stipple: rgba(255, 214, 120, 0.1);
  --c-coast: #7fc4e0;
  --c-contour: rgba(127, 196, 224, 0.32);
  --c-grid: rgba(127, 196, 224, 0.08);
  --c-sounding: #6fb3cf;
  --c-label-water: #7fc4e0;
  --c-label-land: #ffd678;
  --c-route: #f0705f;
  --c-ferry: #ffd678;
  --c-ferry-deck: #f2c45a;
  --c-wake: rgba(127, 196, 224, 0.55);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar-h) + 12px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* the paper's grain, laid over everything and never in the way */
.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background-image: url("../img/paper.webp");
  background-size: 192px 192px;
  mix-blend-mode: multiply;
  opacity: 0.2;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .grain {
    mix-blend-mode: screen;
    opacity: 0.05;
  }
}
:root[data-theme="dark"] .grain {
  mix-blend-mode: screen;
  opacity: 0.05;
}

a {
  color: inherit;
}
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--route);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  border-radius: 6px;
  text-decoration: none;
}
.skip:focus {
  top: 12px;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 em,
h2 em,
h3 em {
  font-style: italic;
}

.eyebrow,
.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-text);
  margin: 0;
}

/* ---------- top bar ---------- */
.bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(180deg, var(--paper) 30%, color-mix(in srgb, var(--paper) 0%, transparent));
}
.bar.solid {
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border-bottom: 1px solid var(--rule);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 25px;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.wordmark svg {
  width: 22px;
  height: 22px;
}
.wordmark .dot {
  color: var(--route);
}

/* the porthole theme switch: three brass portholes, the chosen one ringed red */
.portholes {
  display: flex;
  gap: 5px;
  padding: 3px;
  border-radius: 999px;
}
.portholes button {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  color: var(--ink);
}
.portholes svg {
  display: block;
  width: 28px;
  height: 28px;
  overflow: visible;
}
.ph-rim {
  fill: var(--brass);
  stroke: var(--brass-lo);
  stroke-width: 0.8;
}
.ph-rim-hi {
  fill: none;
  stroke: var(--brass-hi);
  stroke-width: 1.2;
  stroke-linecap: round;
  opacity: 0.85;
}
.ph-bolt {
  fill: var(--brass-lo);
}
.ph-glass {
  fill: var(--glass);
  stroke: var(--brass-lo);
  stroke-width: 0.7;
}
.ph-glint {
  fill: none;
  stroke: var(--glass-hi);
  stroke-width: 1.1;
  stroke-linecap: round;
  opacity: 0.7;
}
.ph-icon {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ph-icon.fill {
  fill: var(--ink);
  stroke: none;
}
.ph-ring {
  fill: none;
  stroke: var(--route);
  stroke-width: 2;
  opacity: 0;
  transition: opacity 0.2s;
}
.portholes button[aria-pressed="true"] .ph-ring {
  opacity: 1;
}
.portholes button[aria-pressed="false"] .ph-icon {
  opacity: 0.62;
}
.portholes button:hover .ph-icon {
  opacity: 1;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  font: 600 15px/1 var(--sans);
  letter-spacing: 0.01em;
  text-decoration: none;
  border: 1.5px solid var(--ink);
  cursor: pointer;
  transition: transform 0.15s, background-color 0.2s, color 0.2s;
}
.btn.primary {
  background: var(--ink);
  color: var(--paper);
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--route);
}
.btn.ghost::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--route);
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(1px);
}

.rise {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.rise.in {
  opacity: 1;
  transform: none;
}
html:not(.js) .rise {
  opacity: 1;
  transform: none;
}

/* ---------- the chart's colours (shared by every chart on the site) ---------- */
svg.chart {
  display: block;
}
.ch-water {
  fill: var(--c-water);
}
.ch-grid path {
  fill: none;
  stroke: var(--c-grid);
  stroke-width: 1;
}
.ch-gridlabels text {
  fill: var(--ink-2);
  font-family: var(--mono);
}
/* a halo of water behind lettering, so names stay readable over lines, as cartographers do */
.ch-gridlabels text,
.ch-label,
.ch-note text,
.ch-scalebar text,
.ch-soundings text {
  paint-order: stroke;
  stroke: var(--c-water);
  stroke-linejoin: round;
}
.ch-label.land {
  stroke: var(--c-land);
}
.ch-contour {
  fill: none;
  stroke: var(--c-contour);
  stroke-width: 0.8;
}
.ch-contour.fm5 {
  stroke-dasharray: 1 3;
  stroke-linecap: round;
  stroke-width: 1.1;
}
.ch-contour.fm10 {
  stroke-dasharray: 5 3;
}
.ch-contour.fm20 {
  stroke-dasharray: 9 3 1.5 3;
}
.ch-contour.fm50 {
  stroke-dasharray: 14 4;
}
.ch-tint-soft {
  stroke: var(--c-tint-soft);
}
.ch-tint {
  stroke: var(--c-tint);
}
.ch-ripple {
  stroke: var(--c-ripple);
}
.ch-land {
  fill: var(--c-land);
}
.ch-stipple {
  fill: var(--c-stipple);
}
.ch-lake {
  fill: var(--c-water);
}
.ch-coast {
  fill: none;
  stroke: var(--c-coast);
  stroke-width: 1.25;
  stroke-linejoin: round;
}
.ch-coast-lake {
  stroke-width: 1;
}
.ch-soundings text {
  fill: var(--c-sounding);
  font-family: var(--mono);
  font-weight: 400;
}
.ch-label {
  font-family: var(--serif);
}
.ch-label.water {
  fill: var(--c-label-water);
  font-style: italic;
  letter-spacing: 0.02em;
}
.ch-label.water.big {
  letter-spacing: 0.3em;
}
.ch-label.land {
  fill: var(--c-label-land);
}
.ch-label.land.small,
.ch-label.land.tiny {
  font-style: italic;
}
.ch-label.land.mid {
  letter-spacing: 0.12em;
}
.ch-label.city {
  letter-spacing: 0.42em;
  text-transform: uppercase;
}
.ch-route {
  fill: none;
  stroke: var(--c-route);
  stroke-width: 2;
  stroke-dasharray: 9 6;
  stroke-linecap: round;
}
.ch-terminal {
  fill: var(--c-water);
  stroke: var(--c-route);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.ch-rose .rose-ring {
  fill: none;
  stroke: var(--c-coast);
  stroke-width: 1.1;
}
.ch-rose .rose-ring.thin {
  stroke-width: 0.6;
}
.ch-rose .rose-ticks {
  fill: none;
  stroke: var(--c-coast);
  stroke-width: 0.8;
}
.ch-rose .p1.a,
.ch-rose .p2.a {
  fill: var(--c-coast);
}
.ch-rose .p1.b,
.ch-rose .p2.b {
  fill: var(--c-water);
  stroke: var(--c-coast);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}
.ch-rose .p3.a {
  fill: var(--brass);
}
.ch-rose .p3.b {
  fill: var(--c-water);
  stroke: var(--brass);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}
.ch-rose .rose-hub {
  fill: var(--c-route);
}
.ch-rose .rose-n {
  fill: var(--c-route);
  font-family: var(--serif);
  font-style: italic;
}
.ch-scalebar rect {
  stroke: var(--c-coast);
  stroke-width: 0.8;
}
.ch-scalebar .bar-a {
  fill: var(--c-coast);
}
.ch-scalebar .bar-b {
  fill: var(--c-water);
}
.ch-scalebar text,
.ch-note text {
  fill: var(--ink-2);
  font-family: var(--mono);
  letter-spacing: 0.06em;
}
.ferry-hull {
  fill: var(--c-ferry);
  stroke: var(--c-coast);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}
.ferry-deck {
  fill: var(--c-ferry-deck);
}
.ferry-house {
  fill: var(--c-coast);
  opacity: 0.85;
}
.ferry-stack {
  fill: var(--c-route);
}

/* ---------- footer ---------- */
.foot {
  position: relative;
  z-index: 2;
  background: var(--paper);
  padding: 34px var(--gutter) calc(30px + env(safe-area-inset-bottom));
  font-size: 14px;
  color: var(--ink-2);
}
.foot::before {
  content: "";
  display: block;
  height: 6px;
  margin: 0 0 26px;
  border: 1px solid var(--ink);
  background: repeating-linear-gradient(90deg, var(--ink) 0 48px, transparent 48px 96px);
  opacity: 0.85;
}
.foot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: baseline;
  justify-content: space-between;
}
.foot nav {
  display: flex;
  gap: 22px;
}
.foot nav a,
.foot .line a {
  text-decoration-color: var(--route);
  text-underline-offset: 4px;
}
.foot .line {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.foot .nobr {
  white-space: nowrap;
}
.foot .small {
  margin: 14px 0 0;
  font-size: 12.5px;
  max-width: 70ch;
}

/* calm mode: nothing travels; things that change cross-fade instead */
@media (prefers-reduced-motion: reduce) {
  .rise {
    transform: none;
    transition: opacity 0.6s ease;
  }
  .btn,
  .btn:hover,
  .btn:active {
    transform: none;
  }
  html {
    scroll-behavior: auto;
  }
}
