/* ==========================================================================
   Base — reset, page grounds, typography and the layout grid.
   ========================================================================== */

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

html {
  background: var(--ink); /* the Tide layer sits on top of this, under the content */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--fg);
  font-family: var(--font-text);
  font-size: var(--text-m);
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--aqua);
  color: var(--ink);
}

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

/* --- Grounds: every section sits on one of two surfaces ------------------ */

/* Dark, cinema ground. Transparent, so the Tide colour field shows through. */
.on-ink {
  --fg: var(--foam);
  --fg-muted: rgb(251 250 246 / 0.8);
  --line: rgb(251 250 246 / 0.2);
  --accent: var(--aqua);
  --btn-bg: var(--aqua);
  --btn-fg: var(--ink);
  --btn-hover: var(--foam);
  color: var(--fg);
}

/* Light, reading ground. Solid, so it slides over the Tide like a sheet. */
.on-paper {
  --fg: var(--ink);
  --fg-muted: rgb(3 11 25 / 0.68);
  --line: rgb(3 11 25 / 0.16);
  --accent: var(--deep);
  --btn-bg: var(--ink);
  --btn-fg: var(--foam);
  --btn-hover: var(--deep);
  background: var(--paper);
  color: var(--fg);
}

/* --- Typography ---------------------------------------------------------- */

.display {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: var(--display-m);
  line-height: var(--display-leading);
  letter-spacing: var(--display-tracking);
  text-transform: var(--display-case);
  text-wrap: balance;
}
.display--xl { font-size: var(--display-xl); line-height: calc(var(--display-leading) - 0.04); }
.display--l { font-size: var(--display-l); line-height: calc(var(--display-leading) - 0.02); }
.display--s { font-size: var(--display-s); line-height: 1.15; letter-spacing: var(--display-tracking); }

.lede {
  font-size: var(--text-l);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.005em;
  max-width: 24em;
  text-wrap: pretty;
}

.prose {
  max-width: var(--measure);
  text-wrap: pretty;
}
.prose > * + * {
  margin-top: 1em;
}

/* Small "slate" label: locations, runtimes, section numbers */
.label {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.accent {
  color: var(--accent);
}

/* --- Layout -------------------------------------------------------------- */

.wrap {
  width: min(100% - 2 * var(--gutter), 92rem);
  margin-inline: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
}

.section {
  padding-block: var(--section);
}

.rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

/* --- Accessibility helpers ---------------------------------------------- */

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--aqua);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}
.skip-link:focus {
  top: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Visitors who ask their device for less motion get a still site */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
