:root {
  --ink: #000;
  --paper: #fff;
  --rule: #fff;
  --rule-faint: rgba(255, 255, 255, 0.25);
  --font-display: "Plus Jakarta Sans", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, p, figure, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--ink);
}

.wordmark { font: 800 28px/1.15 var(--font-display); letter-spacing: -0.045em; }
.slogan { font: 400 13px/1.25 var(--font-body); }
.tag { font: 500 11px/16px var(--font-mono); letter-spacing: 0.3em; }
.domain { font: 500 12px/18px var(--font-mono); letter-spacing: 0.2em; }
.year { font: 400 16px/24px var(--font-body); font-variant-numeric: tabular-nums; }
figcaption, .sq-label { font: 500 11px/16px var(--font-mono); letter-spacing: 0.2em; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* The tile sits above the squares so the conveyor slides them in behind the mark. */
.mark { container-type: inline-size; position: relative; z-index: 2; }
.mark-tile {
  aspect-ratio: 1;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 9.8cqw;
}
.mark-glyph {
  font: 800 86.7cqw/1 var(--font-display);
  letter-spacing: -0.05em;
  white-space: nowrap;
  background: url("assets/fern.jpg") 50% / 121.4cqw no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: grayscale(100%) contrast(140%);
}

.squares { position: relative; z-index: 1; display: flex; align-items: flex-end; }
.squares li { display: flex; flex-direction: column; }
.sq { display: block; background: 50% / cover no-repeat; transform-origin: 0 100%; filter: grayscale(100%) contrast(130%); }
.sq-128 { background-image: url("assets/sq-128.jpg"); }
.sq-64 { background-image: url("assets/sq-64.jpg"); }
.sq-32 { background-image: url("assets/sq-32.jpg"); }
.sq-16 { background-image: url("assets/sq-16.jpg"); }

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url("assets/grain.png") 0 0 / 256px 256px;
  mix-blend-mode: overlay;
  opacity: 0.55;
}

/* Phones and tablets: the board's parts stacked in one column, ruled by full-width lines. */
@media (max-width: 1023.98px) {
  .grid { display: none; }
  .stage {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
  }
  .stage::before {
    content: "";
    position: absolute;
    inset: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    border-inline: 1px solid var(--rule);
    pointer-events: none;
  }
  .top, .bottom {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 16px;
  }
  .top::after, .bottom::before {
    content: "";
    position: absolute;
    left: -100vw;
    right: -100vw;
    border-top: 1px solid var(--rule);
  }
  .top::after { bottom: 0; }
  .bottom { margin-top: auto; padding-top: 28px; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .bottom::before { top: 0; }
  .lockup { display: flex; align-items: center; gap: 12px; }
  .tag { display: none; }

  .mark { margin: 40px 16px 0; width: min(100% - 32px, 440px); }
  .mark figcaption { margin-top: 16px; padding-left: 4px; }

  .squares { gap: 20px; margin: 44px 16px 56px; }
  .squares .sq-label { margin-top: 12px; }
  .sq-128 { width: 96px; height: 96px; }
  .sq-64 { width: 48px; height: 48px; }
  .sq-32 { width: 24px; height: 24px; }
  .sq-16 { width: 12px; height: 12px; }
}

@media (min-width: 640px) and (max-width: 1023.98px) {
  .top, .bottom { padding-inline: 24px; }
  .wordmark { font-size: 34px; }
  .slogan { font-size: 15px; }
  .tag { display: block; }
  .mark, .squares { margin-left: 24px; }
  .mark { width: min(100% - 48px, 480px); }
}

/* Desktop: the 1440×900 board, scaled by one unit to fit the window, with its rules running to the edges. */
@media (min-width: 1024px) {
  .hero { --u: min(calc(100vw / 1440), calc(100svh / 900)); min-height: max(600px, 100vh); min-height: max(600px, 100svh); }
  .stage {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(1440 * var(--u));
    height: calc(900 * var(--u));
    transform: translate(-50%, -50%);
  }
  .grid {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    fill: none;
  }
  .grid path { vector-effect: non-scaling-stroke; }
  .rule { stroke: var(--rule); }
  .rule-faint { stroke: var(--rule-faint); }

  .top, .bottom {
    position: absolute;
    left: calc(36 * var(--u));
    width: calc(1368 * var(--u));
    padding-inline: calc(24 * var(--u));
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .top { top: 0; height: calc(126 * var(--u)); }
  .bottom { top: calc(806 * var(--u)); height: calc(94 * var(--u)); }
  .lockup { display: flex; align-items: center; gap: calc(16 * var(--u)); }

  .wordmark { font-size: max(24px, calc(34 * var(--u))); }
  .slogan { font-size: max(12px, calc(15 * var(--u))); }
  .tag { font-size: max(10px, calc(12 * var(--u))); }
  .domain { font-size: max(11px, calc(14 * var(--u))); }
  .year { font-size: max(14px, calc(19 * var(--u))); }
  figcaption, .sq-label { font-size: max(10px, calc(12 * var(--u))); }

  .mark {
    position: absolute;
    left: calc(366 * var(--u));
    top: calc(254 * var(--u));
    width: calc(346 * var(--u));
  }
  .mark figcaption {
    position: absolute;
    left: calc(24 * var(--u));
    top: calc(100% + 26 * var(--u));
  }

  .squares {
    position: absolute;
    left: calc(738 * var(--u));
    top: calc(472 * var(--u));
    gap: calc(32 * var(--u));
  }
  .squares .sq-label { margin-top: calc(26 * var(--u)); }
  .sq-128 { width: calc(128 * var(--u)); height: calc(128 * var(--u)); }
  .sq-64 { width: calc(64 * var(--u)); height: calc(64 * var(--u)); }
  .sq-32 { width: calc(32 * var(--u)); height: calc(32 * var(--u)); }
  .sq-16 { width: calc(16 * var(--u)); height: calc(16 * var(--u)); }
}

@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: reveal 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .squares li:nth-child(1) { animation-delay: 0.25s; }
  .squares li:nth-child(2) { animation-delay: 0.35s; }
  .squares li:nth-child(3) { animation-delay: 0.45s; }
  .squares li:nth-child(4) { animation-delay: 0.55s; }
  @keyframes reveal {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }
}
