
:root {
  --paper: #fbfdfd;     /* deep water: charts leave it white */
  --water: #d9ebf0;     /* shallow-water tint */
  --contour: #8fb6c6;   /* depth contours */
  --land: #eee2b8;      /* land tint */
  --ink: #1b2a35;
  --sounding: #566f7c;  /* the grey-blue of depth soundings, for secondary text */
  --light: #a41f6c;     /* chart magenta, for actions */
  --light-dark: #7f1754;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "URW Palladio L", P052, "Book Antiqua", Georgia, serif;
  --sans: "Avenir Next", Avenir, "Segoe UI", Ubuntu, "Noto Sans", system-ui, sans-serif;
  --gutter: clamp(1rem, 4vw, 2rem);
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 1.125rem/1.7 var(--serif);
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 70rem; margin: 0 auto; padding: 0 var(--gutter); }
a { color: inherit; text-decoration-color: var(--contour); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--light); }
:focus-visible { outline: 3px solid var(--light); outline-offset: 3px; border-radius: 2px; }
h1, h2 { font-weight: 700; margin: 0; text-wrap: balance; }
h1 a, h2 a { text-decoration: none; }
h1 a:hover, h2 a:hover { text-decoration: underline; text-decoration-color: var(--light); }
p { margin: 0; }

/* Header bar, on every page */
.site-header { background: var(--water); }
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.bar-name { font: 600 1rem/1.2 var(--sans); text-decoration: none; }
.account { display: flex; align-items: center; gap: 0.25rem 1rem; flex-wrap: wrap; justify-content: flex-end; }
.account form { margin: 0; }
.guest { font: 0.875rem/1.4 var(--sans); color: var(--sounding); }
.guest-id { color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
body:not(.front) .site-header { border-bottom: 1px solid var(--contour); }

/* Front page masthead: the estuary's contours under the nameplate */
.masthead { position: relative; overflow: hidden; padding: 2.5rem 0 3rem; }
.chart { position: absolute; inset: 0; width: 100%; height: 100%; }
.chart path { fill: none; stroke: var(--contour); stroke-width: 1.25; }
.chart path:nth-child(odd) { stroke-dasharray: 1 0; opacity: 0.9; }
.chart path:nth-child(even) { opacity: 0.55; }
.masthead .wrap { position: relative; }
.nameplate {
  display: inline-block;
  font: 700 clamp(2.4rem, 8vw, 5.25rem)/0.95 var(--serif);
  letter-spacing: -0.025em;
  text-decoration: none;
  background: var(--water);
  padding: 0 0.15em 0.08em 0;
}
.nameplate:hover { color: var(--light-dark); }
.tagline {
  display: inline-block;
  margin-top: 0.75rem;
  font-style: italic;
  font-size: 1.125rem;
  color: var(--sounding);
  background: var(--water);
  padding-right: 0.3em;
}

/* Buttons */
button { font: 600 1rem/1 var(--sans); cursor: pointer; border-radius: 6px; }
button:disabled { opacity: 0.5; cursor: default; }
.primary {
  background: var(--light);
  color: #fff;
  border: 0;
  padding: 0.9rem 1.4rem;
  font-size: 1.05rem;
}
.primary:not(:disabled):hover { background: var(--light-dark); }
.quiet {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  padding: 0.8rem 1.2rem;
}
.end-session {
  background: none;
  border: 0;
  padding: 0.4rem 0;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--contour);
  text-underline-offset: 0.2em;
}
.end-session:hover { text-decoration-color: var(--light); }

/* Shared story text */
.section { font: italic 1rem/1.3 var(--serif); color: var(--light); }
.standfirst { font-style: italic; color: var(--sounding); }
.byline { font: 0.8125rem/1.4 var(--sans); color: var(--sounding); }

/* Front page */
main.wrap { padding-top: clamp(2rem, 5vw, 3.5rem); padding-bottom: 4rem; }
.lead { max-width: 52rem; padding-bottom: clamp(2rem, 5vw, 3.5rem); }
.lead h1 { font-size: clamp(2.25rem, 6vw, 4rem); line-height: 1.04; letter-spacing: -0.02em; margin-top: 0.35rem; max-width: 20ch; }
.lead .standfirst { font-size: clamp(1.15rem, 2.2vw, 1.4rem); line-height: 1.5; max-width: 38rem; margin-top: 1rem; }
.lead .byline { margin-top: 1rem; }
@media (min-width: 60rem) {
  .lead {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    column-gap: 3.5rem;
    align-items: end;
  }
  .lead .section, .lead h1 { grid-column: 1; }
  .lead h1 { grid-row: 2 / span 2; }
  .lead .standfirst, .lead .byline { grid-column: 2; }
  .lead .standfirst { grid-row: 2; margin-top: 0; }
  .lead .byline { grid-row: 3; }
}
.stories {
  list-style: none;
  margin: 0;
  padding: 2rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 2.5rem clamp(1.5rem, 4vw, 3rem);
  border-top: 3px solid var(--ink);
}
.stories h2 { font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.01em; margin-top: 0.3rem; }
.stories .teaser { font-size: 1rem; line-height: 1.6; margin-top: 0.6rem; }
.stories .byline { margin-top: 0.6rem; }

/* Article */
.story { max-width: 40rem; }
.story-head h1 { font-size: clamp(2rem, 5.5vw, 3.25rem); line-height: 1.06; letter-spacing: -0.02em; margin-top: 0.35rem; }
.story-head .standfirst { font-size: clamp(1.15rem, 2.2vw, 1.35rem); line-height: 1.5; margin-top: 1rem; }
.story-head .byline { margin-top: 1rem; }
.story-body { margin-top: 2rem; }
.story-body p + p { margin-top: 1.1em; }
.meter { font: 0.875rem/1.5 var(--sans); color: var(--sounding); margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--contour); }
.back { font: 0.95rem/1.5 var(--sans); margin-top: 1.5rem; }

/* The gate: the story runs aground on the shore */
.shore { display: block; width: calc(100% + 2 * var(--gutter)); height: 5rem; margin: 2.5rem calc(-1 * var(--gutter)) -1px; }
.shore .offshore { fill: none; stroke: var(--contour); stroke-width: 1.25; }
.shore .land { fill: var(--land); }
.gate {
  background: var(--land);
  margin: 0 calc(-1 * var(--gutter));
  padding: 0.5rem var(--gutter) 2rem;
  border-radius: 0 0 10px 10px;
}
.gate h2 { font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.15; letter-spacing: -0.01em; }
.gate > p { max-width: 34rem; margin-top: 0.75rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
#gate-status { font: 0.95rem/1.5 var(--sans); min-height: 1.5em; margin-top: 0.75rem; }
.gate .hint { font: 0.875rem/1.5 var(--sans); color: var(--sounding); margin-top: 0.5rem; max-width: 34rem; }

.colophon { border-top: 1px solid var(--contour); background: var(--water); }
.colophon p { font: 0.8125rem/1.6 var(--sans); color: var(--sounding); max-width: 40rem; padding: 1.5rem 0 2rem; }

@media (max-width: 34rem) {
  .bar-name { font-size: 0.95rem; }
  .gate { border-radius: 0; }
  .guest { font-size: 0.8125rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
