/* Skerrow Point Tide Station - shared stylesheet */

:root {
  --paper: #f3eee2;
  --paper-deep: #e9e1cf;
  --ink: #1b2a3a;
  --ink-soft: #4a5866;
  --rule: #c4b89c;
  --sea: #2c6a80;
  --sea-wash: #d7e3e2;
  --signal: #b5381f;
  --focus: #b5381f;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;

  --measure: 40rem;
  --wide: 66rem;
  --gutter: clamp(1rem, 4vw, 2rem);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1922;
    --paper-deep: #15232f;
    --ink: #e7e1d2;
    --ink-soft: #a7b0b5;
    --rule: #34495a;
    --sea: #74b8cc;
    --sea-wash: #17303c;
    --signal: #ff8a6b;
    --focus: #ff8a6b;
  }
}

/* ---------- base ---------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  background-image: url("/assets/contours.svg");
  background-size: 1100px auto;
  background-position: right -480px top -300px;
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
}

h2 {
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  margin-top: 2.5rem;
}

h3 {
  font-size: 1.2rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1em;
}

a {
  color: var(--sea);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--signal);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.skip:focus {
  top: 1rem;
  color: var(--paper);
}

.mono {
  font-family: var(--mono);
  font-size: 0.88em;
  letter-spacing: 0.02em;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 0.75rem;
}

.lede {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.4vw, 1.35rem);
  line-height: 1.5;
  max-width: var(--measure);
  color: var(--ink-soft);
}

.prose {
  max-width: var(--measure);
}

/* ---------- masthead: a chart title block ---------- */

.masthead {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: var(--gutter) var(--gutter) 0;
}

.titleblock {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 3px;
  background: var(--paper);
}

.titleblock__mark {
  grid-row: span 2;
  width: 2.75rem;
  height: 2.75rem;
}

.titleblock__name {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.1;
}

.titleblock__name:hover {
  color: var(--signal);
}

.titleblock__coords {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.nav {
  margin-top: 0.9rem;
  border-bottom: 1px solid var(--rule);
}

.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  display: block;
  padding: 0.55rem 0.8rem 0.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--rule);
}

.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--signal);
}

/* ---------- page header ---------- */

.pagehead {
  padding: clamp(2.5rem, 7vw, 4.5rem) 0 1.5rem;
}

/* ---------- home: tide panel ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: end;
  padding: clamp(2.5rem, 7vw, 4.5rem) 0 2rem;
}

.panel {
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  padding: 1.1rem 1.1rem 0.9rem;
}

.panel__label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}

.curve {
  display: block;
  width: 100%;
  overflow: visible;
}

.curve__grid {
  stroke: var(--rule);
  stroke-width: 1;
  stroke-dasharray: 2 6;
}

.curve__mean {
  stroke: var(--rule);
  stroke-width: 1;
}

.curve__fill {
  fill: var(--sea-wash);
}

.curve__line {
  fill: none;
  stroke: var(--sea);
  stroke-width: 3;
  stroke-linejoin: round;
}

.curve__tick {
  fill: var(--ink-soft);
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.02em;
}

.curve__now {
  stroke: var(--signal);
  stroke-width: 1.5;
}

.curve__dot {
  fill: var(--signal);
  stroke: var(--paper-deep);
  stroke-width: 3;
}

.reading {
  margin: 0.75rem 0 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink);
}

.reading strong {
  color: var(--signal);
  font-weight: 600;
}

.reading--fallback {
  color: var(--ink-soft);
}

/* ---------- home: three facts ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  margin: 1rem 0 0;
}

.fact {
  padding: 1.25rem 1.25rem 1.25rem 0;
}

.fact + .fact {
  padding-left: 1.25rem;
  border-left: 1px solid var(--rule);
}

.fact dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.fact dd {
  margin: 0.2rem 0 0;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  line-height: 1.1;
}

.fact dd small {
  display: block;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 0.35rem;
}

/* ---------- cards (home: where to next) ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.1rem 1.25rem;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.card:hover {
  border-color: var(--ink);
}

.card__no {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--signal);
  letter-spacing: 0.1em;
}

.card h3 {
  margin: 0.35rem 0 0.4rem;
}

.card h3 a {
  color: var(--ink);
  text-decoration: none;
}

/* whole card is the click target */
.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card h3 a:focus-visible {
  outline: none;
}

.card:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ---------- logbook ---------- */

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}

.entry {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--rule);
}

.entry__meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.entry__meta time {
  display: block;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.6rem;
}

.entry__meta dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.75rem;
  margin: 0;
}

.entry__meta dt {
  color: var(--signal);
}

.entry__meta dd {
  margin: 0;
}

.entry h2 {
  margin-top: 0;
  font-size: 1.45rem;
}

.entry__body {
  max-width: var(--measure);
}

.entry__body p:last-child {
  margin-bottom: 0;
}

.entry__sign {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
}

/* ---------- tide table ---------- */

.tablewrap {
  overflow-x: auto;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.tides {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.92rem;
}

.tides caption {
  text-align: left;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
  padding: 0 0 0.75rem;
  caption-side: bottom;
  padding-top: 0.75rem;
}

.tides th,
.tides td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

.tides thead th {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
}

.tides tbody th {
  font-weight: 600;
}

.tides tbody tr:last-child th,
.tides tbody tr:last-child td {
  border-bottom: 0;
}

.tides tbody tr:nth-child(odd) {
  background: var(--paper-deep);
}

.tides .hw {
  color: var(--ink);
}

.tides .lw {
  color: var(--sea);
}

.tides .h {
  color: var(--ink-soft);
  margin-left: 0.4rem;
  font-size: 0.85em;
}

.tides .none {
  color: var(--rule);
}

.key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.key b {
  color: var(--ink);
  font-weight: 600;
}

.note {
  border-left: 3px solid var(--signal);
  padding: 0.25rem 0 0.25rem 1rem;
  max-width: var(--measure);
  color: var(--ink-soft);
}

/* ---------- station ---------- */

.instruments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
}

.instrument {
  padding: 1.4rem 1.5rem 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.instrument:nth-child(even) {
  padding-left: 1.5rem;
  padding-right: 0;
  border-left: 1px solid var(--rule);
}

.instrument__tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal);
}

.instrument h3 {
  margin: 0.3rem 0 0.5rem;
}

.instrument p {
  margin: 0;
  color: var(--ink-soft);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 18rem);
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: start;
}

.diagram {
  margin: 2.5rem 0 0;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  padding: 1rem;
}

.diagram figcaption {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 0.6rem;
}

.well__ground {
  fill: var(--rule);
}

.well__water {
  fill: var(--sea-wash);
}

.well__surface {
  stroke: var(--sea);
  stroke-width: 2;
  fill: none;
}

.well__pipe {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
}

.well__float {
  fill: var(--signal);
}

.well__wire {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.well__label {
  fill: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  max-width: var(--measure);
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.75rem;
  margin-bottom: 1rem;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--signal);
}

/* ---------- 404 ---------- */

.lost {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 16rem);
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: center;
  padding: clamp(3rem, 9vw, 6rem) 0 2rem;
}

.lost__code {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--signal);
}

.rose__ring {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1.5;
}

.rose__point {
  fill: var(--ink);
}

.rose__point--alt {
  fill: var(--rule);
}

.rose__hub {
  fill: var(--paper-deep);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.rose__q {
  fill: var(--signal);
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 600;
}

/* ---------- footer ---------- */

.footer {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--gutter) 2rem;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.footer p {
  margin: 0;
}

/* ---------- narrow screens ---------- */

@media (max-width: 52rem) {
  .hero,
  .split,
  .lost {
    grid-template-columns: minmax(0, 1fr);
  }

  .lost__rose {
    max-width: 11rem;
    order: -1;
  }

  .cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 40rem) {
  body {
    background-size: 700px auto;
    background-position: right -300px top -200px;
  }

  .facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .fact,
  .fact + .fact {
    padding: 1rem 0;
    border-left: 0;
  }

  .fact + .fact {
    border-top: 1px solid var(--rule);
  }

  .entry {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .entry__meta dl {
    grid-template-columns: repeat(2, auto 1fr);
  }

  .instruments {
    grid-template-columns: minmax(0, 1fr);
  }

  .instrument,
  .instrument:nth-child(even) {
    padding: 1.25rem 0;
    border-left: 0;
  }

  .titleblock__mark {
    width: 2.25rem;
    height: 2.25rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .curve__dot {
    transition: cx 0.6s ease, cy 0.6s ease;
  }
}

@media print {
  body {
    background: none;
  }

  .nav,
  .skip {
    display: none;
  }
}
