/* The dithered field with mint smoke behind the grid: the opening of a made-up executive search firm (Meridel Search).
   One WebGL canvas fills the whole stage; the panels of the grid sit on top of it and the empty cells are windows on
   it. Without WebGL the same dither is drawn once on a 2D canvas, still. */
:root {
  --paper: #ffffff;         /* the page and the title panel */
  --ink: #232323;           /* the words, the hairlines, the dark panel */
  --mint: #a1ffcb;          /* the one accent: the smoke, the mint panel, the pill */
  --grey: #d9d9d9;          /* the grey panel */
  --dot-dark: #232323;      /* the dark dots of the dither */
  --dot-light: #ffffff;     /* the light dots of the dither */
  --wave-dark: #888888;     /* the noise where it is dark, before the dither */
  --wave-light: #e0e0e0;    /* the noise where it is light, before the dither */
  --muted: #6b6b6b;         /* the small words */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
}

body {
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--paper);
}

.field {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

/* ---- the bar ---- */
.bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  height: clamp(38px, 6.4vh, 56px);
  padding: 0 0 0 clamp(12px, 1.6vw, 22px);
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: clamp(12px, 1.05vw, 15px);
  font-weight: 560;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand__mark {
  width: clamp(18px, 1.6vw, 22px);
  height: clamp(18px, 1.6vw, 22px);
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: miter;
}

.bar__nav {
  display: flex;
  gap: clamp(12px, 1.6vw, 24px);
  margin-left: auto;
  font-size: clamp(12px, 1vw, 14px);
}

.bar__nav a,
.bar__contact {
  color: inherit;
  text-decoration: none;
}

.bar__nav a {
  position: relative;
  transition: font-stretch 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
}

.bar__contact {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 clamp(14px, 2vw, 30px);
  background: var(--ink);
  color: var(--paper);
  font-size: clamp(12px, 1vw, 14px);
  transition: background-color 0.35s, color 0.35s;
}

@media (hover: hover) {
  .bar__nav:hover a {
    opacity: 0.45;
  }

  .bar__nav a:hover {
    opacity: 1;
    font-stretch: 116%;
  }

  .bar__contact:hover {
    background: var(--mint);
    color: var(--ink);
  }
}

/* ---- the grid ---- */
.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    't t w1 w1'
    't t d w2'
    'w3 m w4 g';
  min-height: 0;
  margin: 0 -1px -1px 0;
}

.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  overflow: hidden;
}

.cell--title { grid-area: t; }
.cell--w1 { grid-area: w1; }
.cell--dark { grid-area: d; }
.cell--w2 { grid-area: w2; }
.cell--w3 { grid-area: w3; }
.cell--mint { grid-area: m; }
.cell--w4 { grid-area: w4; }
.cell--grey { grid-area: g; }

/* the panels are lids over the field; a window is a hole with a soft recess at its top edge */
.cell--title,
.cell--data {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(12px, 1.6vw, 24px);
}

.cell--title {
  background: var(--paper);
}

.cell--window {
  box-shadow: inset 0 14px 18px -16px rgba(0, 0, 0, 0.32), inset 0 -1px 0 rgba(255, 255, 255, 0.4);
}

.cell--dark {
  background: var(--ink);
  color: var(--paper);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.cell--mint {
  background: linear-gradient(170deg, #b4ffd6 0%, var(--mint) 60%, #97f7c2 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.cell--grey {
  background: var(--grey);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ---- the title panel ---- */
.eyebrow,
.label,
.tag,
.note {
  margin: 0;
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: clamp(9px, 0.78vw, 11px);
  font-weight: 450;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--muted);
}

.title {
  margin: auto 0 0;
  font-size: clamp(56px, min(10.4vw, 21vh), 210px);
  font-weight: 450;
  line-height: 0.8;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.title__mask {
  display: inline-block;
  overflow: hidden;
  padding: 0.04em 0 0.1em;
  margin: -0.04em 0 -0.1em;
  vertical-align: bottom;
}

.title__char {
  display: inline-block;
  will-change: transform;
}

.lede {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(12px, 2vw, 32px);
  margin-top: clamp(14px, 3vh, 34px);
}

.lede__line {
  max-width: 32ch;
  margin: 0;
  font-size: clamp(13px, min(1.25vw, 2.3vh), 19px);
  line-height: 1.3;
  letter-spacing: -0.005em;
}

/* ---- the pill ---- */
.pill {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 12px;
  height: clamp(38px, min(3.4vw, 6vh), 50px);
  padding: 0 5px 0 clamp(14px, 1.3vw, 20px);
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: clamp(12px, min(1vw, 1.9vh), 15px);
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 10px 24px -14px rgba(0, 0, 0, 0.55);
  -webkit-tap-highlight-color: transparent;
}

.pill__fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--mint);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.pill__words {
  display: grid;
  height: 1.25em;
  overflow: hidden;
  line-height: 1.25;
  font-stretch: 100%;
  white-space: nowrap;
}

.pill__word {
  grid-area: 1 / 1;
  display: block;
}

.pill__word + .pill__word {
  transform: translateY(110%);
}

.pill__icon {
  display: grid;
  place-items: center;
  width: calc(clamp(38px, min(3.4vw, 6vh), 50px) - 10px);
  height: calc(clamp(38px, min(3.4vw, 6vh), 50px) - 10px);
  border-radius: 50%;
  background: var(--mint);
  color: var(--ink);
}

.pill__icon svg {
  width: 44%;
  height: 44%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

/* ---- the data panels ---- */
.label {
  color: var(--muted);
}

.cell--dark .label {
  color: rgba(255, 255, 255, 0.58);
}

.cell--mint .label,
.cell--grey .label {
  color: rgba(35, 35, 35, 0.62);
}

.data {
  display: grid;
  gap: clamp(6px, 1.2vh, 12px);
}

.figure {
  margin: 0;
  font-size: clamp(26px, min(3.6vw, 6.6vh), 64px);
  font-weight: 450;
  line-height: 0.9;
  letter-spacing: -0.04em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: font-weight 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.figure--range {
  font-size: clamp(22px, min(2.7vw, 5.4vh), 50px);
}

.figure__unit {
  font-size: 0.42em;
  letter-spacing: 0;
}

.figure__dash {
  padding: 0 0.04em;
}

.odo {
  display: inline-block;
  height: 0.9em;
  overflow: hidden;
  vertical-align: top;
}

.odo__col {
  display: flex;
  flex-direction: column;
  line-height: 0.9;
}

.spark {
  width: min(100%, 150px);
  height: clamp(14px, 3vh, 26px);
  fill: none;
  stroke: var(--mint);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.spark path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
}

.meter {
  position: relative;
  display: block;
  height: 2px;
  background: rgba(35, 35, 35, 0.16);
  overflow: hidden;
}

.meter__fill {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.note {
  font-size: clamp(8px, 0.68vw, 10px);
  color: rgba(35, 35, 35, 0.6);
  text-transform: none;
  letter-spacing: 0.02em;
}

@media (hover: hover) {
  .cell--data:hover .figure {
    font-weight: 560;
  }
}

/* ---- the windows ---- */
.tick {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 0 solid var(--ink);
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s;
}

.tick--tl { top: 8px; left: 8px; border-top-width: 1px; border-left-width: 1px; }
.tick--tr { top: 8px; right: 8px; border-top-width: 1px; border-right-width: 1px; }
.tick--bl { bottom: 8px; left: 8px; border-bottom-width: 1px; border-left-width: 1px; }
.tick--br { bottom: 8px; right: 8px; border-bottom-width: 1px; border-right-width: 1px; }

.cell--window.is-stirred .tick--tl { transform: translate(-3px, -3px); }
.cell--window.is-stirred .tick--tr { transform: translate(3px, -3px); }
.cell--window.is-stirred .tick--bl { transform: translate(-3px, 3px); }
.cell--window.is-stirred .tick--br { transform: translate(3px, 3px); }

.tag {
  position: absolute;
  left: 22px;
  bottom: 22px;
  padding: 5px 8px 4px;
  background: var(--paper);
  border: 1px solid var(--ink);
  font-size: clamp(9px, 0.72vw, 10px);
  white-space: nowrap;
  box-shadow: 2px 2px 0 var(--ink);
}

/* ---- the pointer that passes by itself ---- */
.cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -5px;
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 1.4;
  stroke-linejoin: round;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.28));
}

/* ---- narrow screens: two columns, the title on top ---- */
@media (max-width: 640px) {
  .bar__nav {
    display: none;
  }

  .bar__contact {
    margin-left: auto;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      't t'
      'w1 d'
      'm w3';
  }

  .cell--w2,
  .cell--w4,
  .cell--grey {
    display: none;
  }

  .title {
    margin-top: clamp(10px, 3vh, 40px);
    font-size: min(19vw, 11vh);
  }

  .lede {
    flex-direction: column;
    align-items: flex-start;
    gap: clamp(8px, 1.8vh, 16px);
    margin-top: clamp(8px, 2vh, 20px);
  }

  .lede__line {
    font-size: clamp(12px, min(3.6vw, 2.1vh), 15px);
  }

  .figure {
    font-size: min(9vw, 6vh);
  }

  .tag {
    left: 14px;
    bottom: 14px;
  }
}

@media (max-height: 480px) and (max-width: 640px) {
  .eyebrow,
  .note {
    display: none;
  }
}
