:root {
  --ink: #f1f3ed;
  --muted: rgba(232, 237, 227, 0.64);
  --faint: rgba(232, 237, 227, 0.18);
  --line: rgba(232, 237, 227, 0.16);
  --accent: #afffc9;
  --surface: #090b0a;
  --density-positive: #afffc9;
  --density-negative: #67c5d8;
  --density-neutral: #27332d;
  --terrain-surface: #aab6ad;
  --terrain-low: #26372f;
  --terrain-mid: #6f7055;
  --terrain-high: #d3c7a9;
  --density-line: rgba(220, 235, 226, 0.2);
  --density-plane: rgba(175, 255, 201, 0.04);
  --density-text: rgba(232, 237, 227, 0.52);
  --gutter: clamp(1.25rem, 4vw, 4.75rem);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--surface);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 73% 51%, rgba(49, 82, 62, 0.24), transparent 33%),
    linear-gradient(115deg, #090b0a 0%, #0b0e0c 56%, #101512 100%);
}

.hero__video,
.hero__wash,
.hero__grid,
.hero__grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__video {
  z-index: -6;
  object-fit: cover;
}

.inversion-widget {
  position: absolute;
  z-index: 0;
  top: 12%;
  right: 1.25%;
  bottom: 8%;
  left: 42%;
  pointer-events: none;
}

.inversion-widget__canvas {
  width: 100%;
  height: 100%;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

.inversion-widget__canvas.is-dragging {
  cursor: grabbing;
}

.inversion-widget__heading,
.inversion-widget__hint,
.inversion-widget__legend,
.inversion-widget__detail,
.inversion-widget__controls {
  position: absolute;
  z-index: 1;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.inversion-widget__heading {
  top: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
}

.inversion-widget__title {
  color: var(--ink);
  pointer-events: auto;
  text-decoration: none;
}

.inversion-widget__title:hover,
.inversion-widget__title:focus-visible {
  color: var(--accent);
}

.inversion-widget__hint {
  top: 1rem;
  right: 1rem;
  color: rgba(232, 237, 227, 0.38);
}

.inversion-widget__legend {
  right: 1rem;
  bottom: 7.7rem;
  display: grid;
  grid-template-columns: auto minmax(5rem, 8rem) auto;
  align-items: center;
  gap: 0.55rem;
  color: rgba(232, 237, 227, 0.45);
}

.inversion-widget__legend-bar {
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--density-negative),
    var(--density-neutral) 50%,
    var(--density-positive)
  );
}

.inversion-widget__detail {
  bottom: 7.7rem;
  left: 1rem;
  color: rgba(232, 237, 227, 0.45);
}

.inversion-widget__controls {
  right: 1rem;
  bottom: 1rem;
  width: min(20rem, calc(100% - 2rem));
  color: var(--muted);
  pointer-events: auto;
}

.inversion-widget__controls label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
}

.inversion-widget__controls label:first-child {
  margin-top: 0;
}

.inversion-widget__controls output {
  color: var(--ink);
  font: inherit;
}

.inversion-widget__controls input[type="range"] {
  width: 100%;
  height: 1rem;
  margin: 0.3rem 0 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: ew-resize;
}

.inversion-widget__controls input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: rgba(232, 237, 227, 0.26);
}

.inversion-widget__controls input[type="range"]::-webkit-slider-thumb {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: -0.27rem;
  border: 0;
  border-radius: 50%;
  appearance: none;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(175, 255, 201, 0.1);
}

.inversion-widget__controls input[type="range"]::-moz-range-track {
  height: 1px;
  background: rgba(232, 237, 227, 0.26);
}

.inversion-widget__controls input[type="range"]::-moz-range-thumb {
  width: 0.55rem;
  height: 0.55rem;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(175, 255, 201, 0.1);
}

.inversion-widget__controls input[type="range"]:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 0.2rem;
}

.hero__wash {
  z-index: -4;
  background:
    linear-gradient(90deg, rgba(7, 9, 8, 0.94) 0%, rgba(7, 9, 8, 0.72) 34%, transparent 62%),
    linear-gradient(0deg, rgba(7, 9, 8, 0.68) 0%, transparent 35%);
  pointer-events: none;
}

.hero__grid {
  z-index: -3;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: linear-gradient(90deg, transparent 0%, black 36%, black 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 36%, black 100%);
  pointer-events: none;
}

.hero__grain {
  z-index: -2;
  opacity: 0.13;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.site-header {
  position: absolute;
  z-index: 2;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 7.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
}

.brand__mark {
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 0.8;
}

.brand__mark .brand__core {
  fill: var(--accent);
  stroke: none;
}

.brand__name {
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.095em;
  text-transform: uppercase;
}

.hero__corner {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero__content {
  position: absolute;
  z-index: 1;
  left: var(--gutter);
  top: 50%;
  width: min(49rem, calc(100% - (2 * var(--gutter))));
  transform: translateY(-48%);
}

h1 {
  max-width: 10ch;
  margin: 0;
  font-size: clamp(4.5rem, 9.2vw, 9.25rem);
  font-weight: 400;
  line-height: 0.84;
  letter-spacing: -0.072em;
}

.hero__lede {
  max-width: 32rem;
  margin: 2.15rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.25vw, 1.17rem);
  line-height: 1.55;
  letter-spacing: -0.01em;
}

.brand:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 0.45rem;
}

.hero__corner {
  position: absolute;
  bottom: 3.8rem;
  left: var(--gutter);
  color: rgba(232, 237, 227, 0.38);
}

@media (max-width: 760px) {
  .site-header {
    min-height: 5.8rem;
  }

  .brand__mark {
    width: 1.8rem;
    height: 1.8rem;
  }

  .hero__content {
    top: 44%;
    width: min(33rem, calc(100% - (2 * var(--gutter))));
    transform: translateY(-58%);
  }

  h1 {
    font-size: clamp(4rem, 20vw, 6.6rem);
    line-height: 0.87;
  }

  .hero__lede {
    max-width: 27rem;
    margin-top: 1.7rem;
    font-size: 0.95rem;
  }

  .inversion-widget {
    top: 40%;
    right: -7%;
    bottom: 4.8rem;
    left: -7%;
  }

  .hero__wash {
    background:
      linear-gradient(180deg, rgba(7, 9, 8, 0.82) 0%, rgba(7, 9, 8, 0.55) 38%, transparent 66%),
      linear-gradient(0deg, rgba(7, 9, 8, 0.75) 0%, transparent 38%);
  }

  .inversion-widget__heading {
    top: 2rem;
    left: calc(7% + var(--gutter));
  }

  .inversion-widget__hint {
    display: none;
  }

  .inversion-widget__detail {
    display: none;
  }

  .inversion-widget__legend,
  .inversion-widget__controls {
    right: calc(7% + var(--gutter));
  }

  .inversion-widget__controls {
    width: min(17rem, calc(86% - (2 * var(--gutter))));
  }

  .hero__corner {
    bottom: 1.7rem;
  }
}

@media (max-width: 420px) {
  .hero__lede {
    max-width: 92%;
  }

  .inversion-widget__legend {
    grid-template-columns: auto minmax(3rem, 5rem) auto;
  }

  .inversion-widget__controls {
    width: calc(86% - (2 * var(--gutter)));
  }
}
