/* Hectopascal Software — a surface analysis chart at night, set in type.
   Instrument Serif for display, Instrument Sans for text, IBM Plex Mono for
   anything measured. Colours are tokens; the canvas reads the --chart ones. */

@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0c1320;
  --bg-glow: #13203a;
  --bg-shade: #090f19;
  --ink: #eaeef5;
  --ink-soft: #b1bbcc;
  --ink-faint: #8f99ab;
  --rule: rgb(234 238 245 / 0.13);
  --rule-strong: rgb(234 238 245 / 0.26);
  --link: #a9c8ff;
  --focus: #8fb8ff;
  --selection: rgb(143 184 255 / 0.24);

  --chart-line: 170 194 232;
  --chart-line-alpha: 0.24;
  --chart-label-alpha: 0.62;
  --chart-high: 128 176 255;
  --chart-low: 255 138 110;
  --chart-wind-alpha: 0.18;
  --grain: 0.07;

  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(20px, 5.2vw, 76px);
  --measure: 1320px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font: 400 1.0625rem/1.6 var(--sans);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* A soft glow over the navy ground, then the chart, then grain. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
body::before {
  z-index: 0;
  background:
    radial-gradient(120% 80% at 72% 18%, var(--bg-glow) 0%, transparent 62%),
    radial-gradient(90% 70% at 10% 110%, var(--bg-shade) 0%, transparent 70%);
}
body::after {
  z-index: 2;
  opacity: var(--grain);
  filter: invert(1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.2 -.25'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: var(--selection);
}

a {
  color: inherit;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.nowrap {
  white-space: nowrap;
}

/* ---- The chart ------------------------------------------------------- */

.chart {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  pointer-events: none;
  opacity: 0;
}
html:not(.js) .chart {
  display: none;
}

.probe {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  padding: 3px 7px;
  translate: 16px 18px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border: 1px solid var(--rule);
  border-radius: 999px;
  white-space: nowrap;
  will-change: transform, opacity;
}
.probe[data-flip="true"] {
  translate: calc(-100% - 16px) 18px;
}
.probe[data-mode="touch"] {
  translate: -50% calc(-100% - 44px);
  font-size: 12px;
  padding: 5px 9px;
}

/* ---- Page frame ------------------------------------------------------ */

.page {
  position: relative;
  z-index: 3;
}

.masthead,
.hero,
.section,
.footer {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.masthead {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-top: max(clamp(18px, 3.2vw, 36px), env(safe-area-inset-top));
}

.wordmark {
  font: 600 0.9375rem/1.25 var(--sans);
  letter-spacing: 0.005em;
  text-decoration: none;
  padding-block: 4px;
}
.wordmark span {
  font-weight: 400;
  color: var(--ink-soft);
}

/* The instrument in the corner: a barograph trace and the live reading. */
.gauge {
  margin: 0;
  display: grid;
  justify-items: end;
  gap: 5px;
  font-family: var(--mono);
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.gauge.is-shown {
  opacity: 1;
}
html:not(.js) .gauge {
  display: none;
}
.gauge-place {
  white-space: nowrap;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.gauge-reading {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  font-size: 0.9375rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.gauge-unit {
  color: var(--ink-soft);
  font-weight: 400;
}
.gauge-trend {
  font-size: 0.75rem;
  color: var(--ink-faint);
  margin-left: 0.35em;
}
.gauge-trace {
  width: 56px;
  height: 18px;
  align-self: center;
  margin-right: 0.5em;
  color: rgb(var(--chart-high));
  overflow: visible;
}
.gauge-trace[hidden] {
  display: none;
}

/* ---- Hero ------------------------------------------------------------ */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: clamp(120px, 20vh, 220px);
  padding-bottom: max(clamp(18px, 3vh, 34px), env(safe-area-inset-bottom));
}

.hero-copy {
  max-width: 13.5em;
  font-size: clamp(3rem, 1.2rem + 6.6vw, 8.75rem);
}

.display {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1em;
  line-height: 0.94;
  letter-spacing: -0.021em;
  text-wrap: balance;
  font-feature-settings: "kern", "liga";
}
.display em {
  font-style: italic;
  letter-spacing: -0.01em;
}
.lighter {
  display: inline-block;
  transition: transform 1.6s var(--ease);
}
.hero-copy:hover .lighter {
  transform: translateY(-0.07em);
}

.lede {
  margin: 0.62em 0 0;
  max-width: 30em;
  font-size: clamp(1.0625rem, 0.33em, 1.4rem);
  line-height: 1.45;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.hero-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 32px;
  position: relative;
  margin-top: clamp(44px, 9vh, 110px);
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font: 400 0.75rem/1.5 var(--mono);
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

.hero-rule {
  position: absolute;
  inset: -12px 0 auto;
  height: 24px;
}

.hero-mail {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-block: 10px 3px;
  transition: background-size 0.5s var(--ease);
}
.hero-mail:hover {
  background-size: 0 1px;
  background-position: 100% 100%;
}

.hero-tools {
  display: flex;
  align-items: center;
  gap: 8px 22px;
  flex-wrap: wrap;
}
.hint {
  margin: 0;
  text-wrap: balance;
}
.hint-touch,
.hint-still {
  display: none;
}
@media (hover: none), (pointer: coarse) {
  .hint-fine {
    display: none;
  }
  .hint-touch {
    display: inline;
  }
}
html:not(.js) .hero-tools {
  display: none;
}

/* ---- Sections -------------------------------------------------------- */

.section {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  padding-block: clamp(96px, 16vh, 188px);
}
@media (min-width: 900px) {
  .section {
    grid-template-columns: minmax(170px, 3fr) 9fr;
    gap: 40px;
  }
}

/* Each section opens on an isobar, labelled in its gap like on the chart. */
.isobar {
  position: absolute;
  top: 0;
  left: max(var(--gutter), env(safe-area-inset-left));
  right: max(var(--gutter), env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 12px;
  font: 500 0.6875rem/1 var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.isobar::before,
.isobar::after {
  content: "";
  height: 1px;
  background: var(--rule-strong);
}
.isobar::before {
  flex: 7;
}
.isobar::after {
  flex: 2;
}

.section .section-label {
  margin: 0;
  padding-top: 1.1em;
  font: 500 0.75rem/1.2 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.section-body {
  max-width: 900px;
}

.section h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.35rem, 1.2rem + 4vw, 5.25rem);
  line-height: 1;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.section p {
  font-size: clamp(1.0625rem, 0.98rem + 0.35vw, 1.3rem);
  line-height: 1.62;
  color: var(--ink-soft);
  max-width: 34em;
  text-wrap: pretty;
}
.section h2 + p {
  margin-top: 1.1em;
}

/* The name, as a dictionary entry. */
.entry {
  padding-bottom: clamp(36px, 6vh, 64px);
}
.section .entry-word {
  font-size: clamp(2.8rem, 1.2rem + 5.4vw, 6.5rem);
  letter-spacing: -0.012em;
}
.section .entry-meta {
  display: flex;
  gap: 18px;
  margin: 1.1em 0 0;
  font: 400 0.8125rem/1.4 var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.entry-meta span:first-child {
  font-style: italic;
}
.section .entry-def {
  margin: 0.55em 0 0;
  max-width: 24em;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.5rem, 1.1rem + 1.3vw, 2.25rem);
  line-height: 1.22;
  color: var(--ink);
}

.name-grid {
  display: grid;
  gap: 44px;
  align-items: start;
  padding-top: clamp(32px, 5vh, 56px);
  border-top: 1px solid var(--rule);
}
@media (min-width: 900px) {
  .name-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: clamp(40px, 5vw, 88px);
  }
}
.prose p {
  margin: 0 0 1.05em;
}
.section .prose-close {
  margin-bottom: 0;
  color: var(--ink);
}

.weight {
  margin: 0;
  padding-top: 0.3em;
}
.weight-label {
  display: block;
  margin-bottom: 14px;
  font: 500 0.6875rem/1.2 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.weight-reading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2em 0.5em;
}
.weight-value {
  font: 400 clamp(3rem, 2rem + 3vw, 4.75rem) / 1 var(--mono);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.weight-unit {
  font: 500 0.8125rem/1 var(--mono);
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.weight figcaption {
  margin-top: 16px;
  max-width: 26em;
  font: 400 0.8125rem/1.55 var(--mono);
  color: var(--ink-faint);
  text-wrap: pretty;
}

/* How we work: one principle per rule, the claim beside what it means. */
.principles {
  margin: 0;
}
.principle {
  display: grid;
  gap: 12px;
  padding-block: clamp(28px, 4.5vh, 44px);
  border-top: 1px solid var(--rule);
}
.principle:first-child {
  padding-top: 0;
  border-top: 0;
}
.principle:last-child {
  padding-bottom: 0;
}
@media (min-width: 900px) {
  .principle {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    gap: clamp(28px, 4vw, 64px);
    align-items: baseline;
  }
}
.principle dt {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 1.1rem + 1.9vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}
.principle dd {
  margin: 0;
}
.section .principle p {
  margin: 0;
}

/* Contact. */
.section-contact {
  padding-bottom: clamp(110px, 18vh, 200px);
}
.mail-large {
  display: inline-block;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 0.75rem + 2.7vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.008em;
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: 0.06em;
  transition: background-size 0.6s var(--ease), color 0.3s;
}
.mail-large:hover {
  background-size: 0 1px;
  background-position: 100% 100%;
  color: var(--link);
}
.section .place {
  margin-top: 1.2em;
  font: 400 0.8125rem/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---- Footer ---------------------------------------------------------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 28px;
  padding-top: 20px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  font: 400 0.75rem/1.6 var(--mono);
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}
.footer p {
  margin: 0;
}
.footer a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: var(--rule-strong);
}
.footer a:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

/* ---- Small screens --------------------------------------------------- */

@media (max-width: 640px) {
  .gauge-place {
    font-size: 0.625rem;
  }
  .gauge-reading {
    font-size: 0.875rem;
  }
  .gauge-trace {
    width: 40px;
    margin-right: 0.3em;
  }
  .gauge-trend {
    display: none;
  }
  .hero-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .hint {
    max-width: 26em;
    padding-top: 4px;
  }
  .footer-coords {
    order: 3;
  }
}

/* ---- Entrances --------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .js .display .w,
  .js .lede,
  .js .hero-foot {
    opacity: 0;
    transform: translateY(0.3em);
    filter: blur(6px);
  }
  .js .hero-foot {
    transform: translateY(8px);
  }
  .js.is-ready .display .w,
  .js.is-ready .lede,
  .js.is-ready .hero-foot {
    opacity: 1;
    transform: none;
    filter: none;
    transition:
      opacity 1.1s var(--ease),
      transform 1.3s var(--ease),
      filter 1.1s var(--ease);
  }
  .js.is-ready .display .w:nth-child(2) { transition-delay: 0.05s; }
  .js.is-ready .display .w:nth-child(3) { transition-delay: 0.1s; }
  .js.is-ready .display .w:nth-child(4) { transition-delay: 0.15s; }
  .js.is-ready .display .w:nth-child(5) { transition-delay: 0.2s; }
  .js.is-ready .display .w:nth-child(6) { transition-delay: 0.25s; }
  .js.is-ready .display .w:nth-child(7) { transition-delay: 0.32s; }
  .js.is-ready .lede { transition-delay: 0.5s; }
  .js.is-ready .hero-foot { transition-delay: 0.75s; }

  .js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition:
      opacity 1s var(--ease),
      transform 1.2s var(--ease);
  }
  .js .reveal.in {
    opacity: 1;
    transform: none;
  }
  .js .section-body.reveal.in,
  .js .prose.reveal.in {
    transition-delay: 0.08s;
  }
  .js .weight.reveal.in {
    transition-delay: 0.2s;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .lighter,
  .hero-mail,
  .mail-large,
  .gauge {
    transition: none;
  }
  .hero-copy:hover .lighter {
    transform: none;
  }
  .hint-fine,
  .hint-touch {
    display: none !important;
  }
  .hint-still {
    display: inline;
  }
}
