/* ------------------------------------------------------------------
   Petr Kirsanov — portfolio
   Tokens: cool paper, ink, ultramarine for "hits" (samples inside the arc)
   Type:   Bricolage Grotesque (display) · IBM Plex Sans (body) · IBM Plex Mono (data)
   ------------------------------------------------------------------ */

:root {
  --paper: #F5F5F2;
  --panel: #FFFFFF;
  --ink: #121417;
  --ink-2: #363B41;
  --mute: #6B7177;
  --rule: #DCDED9;
  --rule-strong: #B4B7B1;
  --blue: #1F3FDB;
  --blue-deep: #1530B4;
  --blue-wash: #E8EBFA;
  --miss: #C2C5BF;
  --shine: rgba(255, 255, 255, 0.35);

  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --body: "IBM Plex Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1120px;
  --gutter: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101214;
    --panel: #16191D;
    --ink: #F1F1EC;
    --ink-2: #C9CBC6;
    --mute: #8B9097;
    --rule: #262A30;
    --rule-strong: #3A3F47;
    --blue: #6B86FF;
    --blue-deep: #8FA3FF;
    --blue-wash: #1B2240;
    --miss: #3B4048;
    --shine: rgba(255, 255, 255, 0.14);
  }
}
:root[data-theme="dark"] {
  --paper: #101214;
  --panel: #16191D;
  --ink: #F1F1EC;
  --ink-2: #C9CBC6;
  --mute: #8B9097;
  --rule: #262A30;
  --rule-strong: #3A3F47;
  --blue: #6B86FF;
  --blue-deep: #8FA3FF;
  --blue-wash: #1B2240;
  --miss: #3B4048;
  --shine: rgba(255, 255, 255, 0.14);
}

@media (max-width: 480px) {
  :root { --gutter: 16px; }
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 76px;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--blue); color: #fff; }

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

/* horizontal axis only; sections own their vertical padding */
.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}

.arrow { display: inline-block; transition: transform 0.2s var(--ease); }

/* ---------- Custom cursor (fine pointers only, enabled by JS) ---------- */

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cursor.on { opacity: 1; }
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  border-radius: 50%;
  will-change: transform;
}
.cursor-dot {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  background: var(--blue);
  transition: width 0.2s ease, height 0.2s ease, margin 0.2s ease;
}
.cursor-ring {
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid var(--blue);
  opacity: 0.55;
  transition: width 0.25s var(--ease), height 0.25s var(--ease), margin 0.25s var(--ease), opacity 0.25s ease, background-color 0.25s ease;
}
.cursor.active .cursor-ring {
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  opacity: 1;
  background: color-mix(in srgb, var(--blue) 10%, transparent);
}
.cursor.active .cursor-dot { width: 4px; height: 4px; margin: -2px 0 0 -2px; }
html.custom-cursor, html.custom-cursor * { cursor: none !important; }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}

.wordmark {
  font-family: var(--display);
  font-variation-settings: "opsz" 24;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 22px;
  margin-left: auto;
}
.nav-links a {
  position: relative;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--mute);
  padding: 4px 0;
  transition: color 0.2s ease;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.nav-links a:hover, .nav-links a.is-active { color: var(--ink); }
.nav-links a.is-active::after { transform: scaleX(1); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  color: var(--mute);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.3s var(--ease);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--rule-strong); transform: rotate(20deg); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Phones: the section links move to a dock at the bottom of the screen
   (thumb reach, real tap targets); the top bar keeps the name and theme. */
.dock { display: none; }

@media (max-width: 700px) {
  .nav-links { display: none; }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .dock {
    position: fixed;
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    width: min(calc(100% - 2 * var(--gutter)), 420px);
    height: 54px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--rule);
    background: var(--paper);
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 14px 36px -14px rgba(0, 0, 0, 0.4);
  }
  .dock a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--mute);
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease;
  }
  .dock a::after {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--blue);
    transform: scale(0);
    transition: transform 0.25s var(--ease);
  }
  .dock a.is-active { color: var(--ink); }
  .dock a.is-active::after { transform: scale(1); }
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  grid-template-rows: 1fr auto auto auto auto;
  grid-template-areas:
    "id sim"
    "name sim"
    "lead sim"
    "now sim"
    "actions sim";
  column-gap: 64px;
  align-items: end;
  padding-top: clamp(44px, 7vh, 88px);
  padding-bottom: clamp(44px, 7vh, 80px);
}
.hero-id { grid-area: id; }
.hero h1 { grid-area: name; }
.hero .lead { grid-area: lead; }
.hero .now { grid-area: now; }
.hero .actions { grid-area: actions; }
.hero .sim { grid-area: sim; }

.hero-id {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--rule);
  background: var(--panel);
}

.hero h1 {
  font-family: var(--display);
  font-variation-settings: "opsz" 96, "wdth" 100, "wght" 700;
  font-weight: 700;
  font-size: clamp(60px, 10.5vw, 128px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin-bottom: 28px;
}
.hero h1 .line { display: block; white-space: nowrap; }
/* the cursor lens: each letter's weight and width follow the pointer */
.hero h1 .ch {
  display: inline-block;
  transition: font-variation-settings 0.14s ease-out;
}

.lead {
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 34ch;
  margin-bottom: 28px;
}
.lead a {
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.lead a:hover { color: var(--blue); text-decoration-color: var(--blue); }

.now {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 20px;
  border-top: 1px solid var(--rule);
  padding-top: 18px;
  margin-bottom: 32px;
}
.now .eyebrow { padding-top: 5px; }
.now li {
  font-size: 15.5px;
  color: var(--ink-2);
  padding: 2px 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.now li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  position: relative;
  top: -2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 6px;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.35s var(--ease);
}
.btn:hover { background: var(--blue); color: #fff; }

.link {
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.link:hover { color: var(--blue); border-color: var(--blue); }
.link:hover .arrow { transform: translate(2px, -2px); }

/* the simulation */
.sim {
  justify-self: end;
  width: 100%;
  max-width: 420px;
}
.sim-stage { position: relative; }
.sim-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  border-radius: 2px;
}
.sim-probe {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--paper);
  background: var(--ink);
  padding: 3px 7px;
  border-radius: 4px;
  opacity: 0;
  transform: translate(12px, 14px);
  transition: opacity 0.15s ease;
}
.sim-probe.on { opacity: 1; }
.sim-probe.in { background: var(--blue); color: #fff; }
.sim-caption {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--mute);
}
.sim-stats {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}
.sim-stats strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.sim-caption .hit { color: var(--blue); }
.resample {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  border-bottom: 1px solid var(--rule-strong);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.resample:hover { color: var(--blue); border-color: var(--blue); }

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas: "id" "name" "lead" "now" "actions" "sim";
    align-items: start;
  }
  .sim { justify-self: start; max-width: 340px; margin-top: 40px; }
}

/* Phones: name first, then the living simulation, then the words. */
@media (max-width: 700px) {
  .hero {
    grid-template-areas: "id" "name" "sim" "lead" "now" "actions";
    padding-top: 22px;
    padding-bottom: 40px;
  }
  .hero-id { margin-bottom: 18px; }
  .hero h1 { margin-bottom: 20px; }
  .sim { justify-self: stretch; max-width: none; margin: 0 0 30px; }
  .sim-caption { font-size: 12px; }
  .lead { max-width: none; margin-bottom: 24px; }
  .now { margin-bottom: 26px; }
}

/* page-load rise */
.rise {
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.6s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Scroll reveals (classes applied by JS) ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; }

.js .split .wo {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
}
.js .split .w {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.8s var(--ease);
  transition-delay: var(--w, 0s);
}
.js .split.in .w { transform: none; }

/* ---------- Ledger sections ---------- */

.ledger {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px 48px;
  border-top: 1px solid var(--rule);
  padding-top: 56px;
  padding-bottom: 56px;
}

.ledger-head {
  position: sticky;
  top: 84px;
  align-self: start;
}
.ledger-head h2 {
  font-family: var(--display);
  font-variation-settings: "opsz" 32;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 8px;
}
.ledger-head .eyebrow { display: block; }

@media (max-width: 860px) {
  .ledger {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-top: 44px;
    padding-bottom: 44px;
  }
  .ledger-head { position: static; }
}
@media (max-width: 700px) {
  .ledger { gap: 20px; padding-top: 40px; padding-bottom: 40px; }
  .ledger-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
  }
  .ledger-head h2 { margin-bottom: 0; }
}

.meta {
  font-size: 14px;
  color: var(--mute);
  margin: 3px 0 12px;
}

/* ---------- Work ---------- */

.projects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 28px;
}

.project { text-decoration: none; display: block; min-width: 0; }

.project.wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 28px;
  align-items: end;
}

.shot {
  position: relative;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  transform-style: preserve-3d;
  transition: border-color 0.25s ease, transform 0.35s var(--ease), box-shadow 0.35s ease;
}
/* spotlight that follows the pointer (JS sets --mx / --my) */
.shot::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), var(--shine), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.project:hover .shot {
  border-color: var(--rule-strong);
  box-shadow: 0 24px 50px -28px rgba(0, 0, 0, 0.45);
}
.project:hover .shot::after { opacity: 1; }
/* touch: cards tilt and catch light as they scroll past (JS drives --my) */
html.touch .shot { transition: border-color 0.25s ease; }
html.touch .shot::after { opacity: 1; }
html.touch .project:active .shot { border-color: var(--rule-strong); }

.project h3 {
  font-family: var(--display);
  font-variation-settings: "opsz" 24;
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}
.tags .live {
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tags .live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--blue) 45%, transparent); }
  60% { box-shadow: 0 0 0 6px transparent; }
}

.project p {
  font-size: 15.5px;
  color: var(--ink-2);
  margin-top: 10px;
  max-width: 52ch;
}

.project blockquote {
  margin-top: 12px;
  padding-left: 14px;
  border-left: 2px solid var(--blue-wash);
  font-size: 15px;
  color: var(--ink-2);
}
.project blockquote cite {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
}

.project .link { display: inline-block; margin-top: 14px; }
.project:hover .link { color: var(--blue); border-color: var(--blue); }
.project:hover .arrow { transform: translate(2px, -2px); }

@media (max-width: 760px) {
  .projects { grid-template-columns: 1fr; gap: 36px; }
  .project.wide { grid-template-columns: 1fr; gap: 0; }
  .project.wide h3 { margin-top: 16px; }
}

/* ---------- Playground ---------- */

.lab { display: grid; gap: 26px; }

.lab-intro {
  font-size: 17px;
  color: var(--ink-2);
  max-width: 60ch;
}

.lab-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 18px 28px;
  align-items: end;
}
.lab-controls label { display: grid; gap: 10px; }
.lab-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}
.lab-label output {
  font-family: var(--display);
  font-variation-settings: "opsz" 24;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--rule-strong);
  border-radius: 2px;
}
input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--rule-strong);
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--blue);
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px var(--blue);
  transition: transform 0.2s var(--ease);
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blue);
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px var(--blue);
}
input[type="range"]:hover::-webkit-slider-thumb, input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--blue-wash), 0 0 0 5px var(--blue); }

.hist {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  border-bottom: 1px solid var(--rule-strong);
}
.bar {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.bar i {
  display: block;
  height: var(--h, 0%);
  min-height: 1px;
  background: var(--blue);
  border-radius: 3px 3px 0 0;
  transition: height 0.6s var(--ease), background-color 0.2s ease;
}
.bar.zero i { background: var(--miss); }
.bar:hover i { background: var(--blue-deep); }
.bar b {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  text-align: center;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10.5px;
  color: var(--mute);
}
.bar em {
  position: absolute;
  left: 50%;
  bottom: calc(var(--h, 0%) + 6px);
  transform: translateX(-50%);
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  white-space: nowrap;
  color: var(--paper);
  background: var(--ink);
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s ease, bottom 0.6s var(--ease);
  pointer-events: none;
  z-index: 1;
}
.bar:hover em { opacity: 1; }
.bar.on i { background: var(--blue-deep); }
.bar.on em { opacity: 1; }

.hist-axis {
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  text-align: center;
}

.lab-stats {
  margin-top: 18px;
  font-size: 16px;
  color: var(--ink-2);
}
.lab-stats strong {
  font-family: var(--display);
  font-variation-settings: "opsz" 24;
  font-weight: 600;
  font-size: 20px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lab-stats .dim { color: var(--mute); }
.lab-stats .dim strong { font-size: 16px; color: var(--mute); }

.lab-note {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--mute);
  max-width: 70ch;
}

.touch-hint { display: none; }
html.touch .touch-hint { display: inline; }

@media (max-width: 640px) {
  .lab-controls { grid-template-columns: 1fr; gap: 16px; }
  .lab-controls .btn { justify-content: center; }
  .hist { height: 150px; }
  .bar b { font-size: 9px; }
  .hist.dense .bar:nth-child(even) b { visibility: hidden; }
}

/* ---------- Awards ---------- */

.award {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 20px;
  padding: 26px 0;
  border-top: 1px solid var(--rule);
}
.award:first-child { border-top: 0; padding-top: 0; }
.award:last-child { padding-bottom: 0; }

.place {
  font-family: var(--display);
  font-variation-settings: "opsz" 48;
  font-weight: 800;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--blue);
}
.place sup {
  font-size: 0.4em;
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: top;
  position: relative;
  top: 0.25em;
}

.award h3 {
  font-family: var(--display);
  font-variation-settings: "opsz" 24;
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.award p {
  font-size: 15.5px;
  color: var(--ink-2);
  margin-top: 8px;
  max-width: 60ch;
}
.award .meta {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--mute);
  margin: 4px 0 0;
}

@media (max-width: 640px) {
  .award { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; }
  .place { font-size: 36px; }
}

/* ---------- Contact ---------- */

.contact {
  border-top: 1px solid var(--rule);
  padding-top: 72px;
  padding-bottom: 72px;
}
.contact .eyebrow #clock { color: var(--ink); font-variant-numeric: tabular-nums; }
.contact h2 {
  font-family: var(--display);
  font-variation-settings: "opsz" 64;
  font-weight: 700;
  font-size: clamp(30px, 4.6vw, 52px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  max-width: 20ch;
  margin: 12px 0 30px;
}
.contact h2 a {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 3px solid var(--blue-wash);
  transition: border-color 0.2s ease;
}
.contact h2 a:hover { border-color: var(--blue); }
.contact .copy { font-family: var(--body); }

@media (max-width: 860px) {
  .contact { padding-top: 56px; padding-bottom: 56px; }
}

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

footer {
  padding-bottom: 44px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--mute);
}
footer .wrap {
  border-top: 1px solid var(--rule);
  padding-top: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
}
footer ul { display: flex; flex-wrap: wrap; gap: 8px 20px; }
footer a { text-decoration: none; transition: color 0.2s ease; }
footer a:hover { color: var(--blue); }

/* ---------- Touch screens ---------- */

@media (hover: none) {
  .btn, .link, .resample, .dock a, .theme-toggle, .bar { -webkit-tap-highlight-color: transparent; }
  .btn { transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease; }
  .btn:active { transform: scale(0.97); background: var(--blue); color: #fff; }
  .link:active, .resample:active, .contact h2 a:active { color: var(--blue); border-color: var(--blue); }
  .theme-toggle:hover { transform: none; }
  .theme-toggle:active { transform: rotate(20deg); color: var(--ink); }
  input[type="range"] { height: 34px; }
  input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -11px; }
  input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; }
  input[type="range"]:hover::-webkit-slider-thumb { transform: none; }
  input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
  /* horizontal swipes drive the lens and the probe; vertical swipes still scroll */
  .hero h1, .sim-canvas { touch-action: pan-y; }
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise { animation: none; opacity: 1; transform: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .js .split .w { transform: none; transition: none; }
  .tags .live::before { animation: none; }
  .hero h1 .ch { transition: none; }
  .cursor { display: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
