/* Plimsoll project page. Colours are taken from a ship's hull: paint white, hull blue-grey, the red of the
   antifouling below the waterline, and the sea. Headings use Big Shoulders; its stencil cut is kept for what a ship
   would have painted on it: the draft-mark numbers in the chart and the rule ids. */

@font-face {
  font-family: "Big Shoulders";
  src: url("fonts/big-shoulders.woff2") format("woff2");
  font-weight: 500 900;
  font-display: swap;
}

@font-face {
  font-family: "Big Shoulders Stencil";
  src: url("fonts/big-shoulders-stencil.woff2") format("woff2");
  font-weight: 500 900;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --paint: #eef1f0;
  --ink: #17242f;
  --steel: #56636b;
  --rule: #cbd3d1;
  --plate: #e2e7e5;
  --red: #b0282c;
  --sea: #2c6e73;
  --hull: #17242f;
  --hull-ink: #e3e9e7;
  --hull-steel: #9fb0b6;

  --display: "Big Shoulders", "Arial Narrow", sans-serif;
  --stencil: "Big Shoulders Stencil", "Arial Narrow", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --measure: 62ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paint: #121c24;
    --ink: #e3e9e7;
    --steel: #98a6ac;
    --rule: #26343f;
    --plate: #0e171e;
    --red: #e5484d;
    --sea: #4e9a9c;
    --hull: #0b1218;
    --hull-ink: #e3e9e7;
    --hull-steel: #8a9ba2;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paint);
  color: var(--ink);
  font: 400 1.125rem/1.65 var(--serif);
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--red); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

code { font-family: var(--mono); font-size: 0.85em; }
p code, li code, dd code, figcaption code { background: var(--plate); padding: 0.08em 0.3em; border-radius: 3px; }

h1, h2 { font-family: var(--display); font-weight: 800; letter-spacing: 0.01em; margin: 0; }
h2 { font-size: clamp(2rem, 4.5vw, 2.75rem); line-height: 1.05; margin-bottom: 0.5em; }

/* Masthead */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px var(--gutter); max-width: 1180px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand span { font: 800 1.6rem/1 var(--display); }
.logo .ink { fill: var(--ink); } .logo .ring { stroke: var(--ink); } .logo .red { fill: var(--red); } .logo .sea { fill: var(--sea); }
.masthead nav { display: flex; gap: clamp(14px, 3vw, 28px); font-size: 1rem; }
.masthead nav a { text-decoration: none; }
.masthead nav a:hover { text-decoration: underline; text-decoration-color: var(--red); }

/* Hero */
.hero { max-width: 1180px; margin: 0 auto; padding: clamp(40px, 9vw, 112px) var(--gutter) clamp(48px, 8vw, 96px); }
.hero h1 { font-size: clamp(3rem, 10vw, 7.5rem); line-height: 1; max-width: 9.5em; }
.tagline { font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.25; margin: 0.6em 0 0; color: var(--steel); }
.lede { max-width: var(--measure); margin: 1.6em 0 2em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.button {
  display: inline-block; padding: 12px 22px; border: 2px solid var(--ink); border-radius: 2px;
  background: var(--ink); color: var(--paint); font: 700 1.2rem/1 var(--display); letter-spacing: 0.03em;
  text-decoration: none;
}
.button:hover { background: var(--red); border-color: var(--red); color: #fff; }
.button.quiet { background: transparent; color: var(--ink); }
.button.quiet:hover { background: transparent; color: var(--red); border-color: var(--red); }

/* The hull: the one dark, full-width band, carrying the chart. */
.hull { background: var(--hull); color: var(--hull-ink); }
.hull-inner { max-width: 1180px; margin: 0 auto; padding: clamp(48px, 8vw, 88px) var(--gutter); }
.hull-inner > p { max-width: var(--measure); color: var(--hull-steel); margin: 0 0 32px; }
.chart { margin: 0; }
.chart svg { display: block; width: 100%; height: auto; max-width: 900px; }
.chart figcaption { max-width: var(--measure); color: var(--hull-steel); font-size: 0.95rem; margin-top: 20px; }
.chart figcaption code { background: rgba(227, 233, 231, 0.12); }
.chart .keel { stroke: var(--hull-steel); stroke-width: 2; }
.chart .water { fill: var(--sea); }
.chart .overload { fill: var(--red); }
.chart .limit circle { fill: none; stroke: var(--hull-ink); stroke-width: 6; }
.chart .limit rect { fill: var(--hull-ink); }
.chart .limit text { fill: var(--hull-ink); font: 700 24px var(--display); letter-spacing: 0.02em; }
.chart .value { fill: var(--hull-ink); font: 800 38px var(--stencil); text-anchor: middle; }
.chart .over .value { fill: var(--red); }
.chart .name { fill: var(--hull-steel); font: 400 20px var(--serif); text-anchor: middle; }

/* The water rises once when the page opens. */
@media (prefers-reduced-motion: no-preference) {
  .chart .water, .chart .overload { transform-box: fill-box; transform-origin: 50% 100%; animation: rise 900ms cubic-bezier(.2, .7, .2, 1) both; }
  .chart .bar:nth-of-type(2) .water { animation-delay: 150ms; }
  .chart .bar:nth-of-type(3) .water { animation-delay: 300ms; }
  .chart .bar:nth-of-type(4) .water { animation-delay: 450ms; }
  .chart .overload { animation-delay: 1050ms; animation-duration: 700ms; }
}
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Bands */
.band { max-width: 1180px; margin: 0 auto; padding: clamp(48px, 7vw, 80px) var(--gutter); border-bottom: 1px solid var(--rule); }
.band .text { max-width: var(--measure); }
.band .text p { margin: 0 0 1em; }

.log { margin: 28px 0 0; }
.log figcaption { margin-bottom: 10px; }
pre.report, pre.code {
  margin: 0; padding: 20px; overflow: auto; background: var(--plate); border-left: 4px solid var(--sea);
  font: 0.8rem/1.5 var(--mono); tab-size: 2;
}
pre.report { max-height: 30em; }
pre.code { margin-top: 8px; font-size: 0.9rem; }
.note { max-width: var(--measure); margin: 20px 0 0; }

.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 48px; margin: 24px 0 0; }
.rules > div { padding: 18px 0; border-top: 1px solid var(--rule); }
.rules dt { font-weight: 700; display: flex; align-items: baseline; gap: 12px; }
.rules .id { font: 800 1.6rem/1 var(--stencil); color: var(--red); min-width: 2.2em; }
.rules dd { margin: 6px 0 0; color: var(--steel); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
.pair > div { max-width: var(--measure); }
.pair ul { padding-left: 1.1em; }
.pair li { margin-bottom: 0.5em; }
@media (max-width: 760px) { .pair { grid-template-columns: 1fr; gap: 0; } }

.footer {
  max-width: 1180px; margin: 0 auto; padding: 32px var(--gutter) 56px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: var(--steel); font-size: 0.95rem;
}
.footer p { margin: 0; }
.footer .links { display: flex; gap: 20px; flex-wrap: wrap; }
