:root {
  --bg: #e9f0f7;
  --stripe: #ffffff;
  --pane: #dde7f1;
  --pane-glow: #f6f9fc;
  --text: #17222f;
  --body: #3d4b5c;
  --muted: #6c7c8e;
  --line: #d2dde9;
  --accent: #2f6fde;
  --code-bg: #edf2f8;
  --stripe-pad-y: clamp(36px, 7vh, 72px);
  --stripe-pad-x: clamp(16px, 8vw, 160px);
  --media-h: clamp(200px, 32vh, 300px);
  --stripe-h: calc(var(--media-h) + 2 * var(--stripe-pad-y));
  --stripe-gap: clamp(56px, 14vh, 160px);
  --font: "Bricolage Grotesque", "Manrope", system-ui, sans-serif; /* Manrope covers Cyrillic */
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html {
  scroll-snap-type: y proximity;
  scroll-padding-top: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- intro ---------- */

.intro {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 var(--stripe-pad-x) 10vh;
}

.intro h1 {
  margin: 0;
  font-size: clamp(56px, 13vw, 200px);
  font-weight: 800;
  line-height: .86;
  letter-spacing: -.045em;
}

.intro h1 span { color: var(--accent); }

.intro p {
  margin: 24px 0 0;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
}

/* ---------- stripes ---------- */

.stripes {
  display: flex;
  flex-direction: column;
  gap: var(--stripe-gap);
}

.stripe {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 112px);
  min-height: var(--stripe-h); /* grows when the text needs more room */
  padding: var(--stripe-pad-y) var(--stripe-pad-x);
  background: var(--stripe);
  border-block: 1px solid var(--line);
  box-shadow: 0 12px 32px -18px rgb(31 66 112 / .22);
  scroll-snap-align: center;
  opacity: .5;
  transition: opacity .45s ease;
}

.stripe:nth-child(even) .visual { order: 2; }
/* right-align via auto margin, not justify-content, so overflowing slides stay scrollable */
.stripe:nth-child(even) .visual > :first-child { margin-left: auto; }
.stripe.no-visual { grid-template-columns: minmax(0, 1fr); }

.stripe::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform .45s ease;
  z-index: 2;
}

.stripe.is-active { opacity: 1; }
.stripe.is-active::before { transform: scaleY(1); }

@media (prefers-reduced-motion: reduce) {
  .stripe, .stripe::before { transition: none; }
}

/* ---------- visual pane ---------- */

.visual {
  display: flex;
  gap: 14px;
  height: var(--media-h);
  align-self: center;
  min-height: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.slide {
  flex: 0 0 auto;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  outline: 1px solid var(--line); /* keeps white screenshots from melting into the stripe */
  outline-offset: -1px;
  scroll-snap-align: start;
}

.slide.model {
  position: relative;
  flex-basis: 100%;
  background: radial-gradient(ellipse at 50% 60%, var(--pane-glow) 0%, var(--pane) 75%);
}

.slide.model canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.slide.model canvas:active { cursor: grabbing; }

.hint {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}

@media (pointer: coarse) { .hint { display: none; } }

.slide.image {
  padding: 0;
  border: 0;
  background: var(--pane);
  cursor: zoom-in;
}

.slide.image img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: cover;
}

.slide.video { position: relative; background: var(--pane); }
.slide.video video { display: block; height: 100%; width: auto; max-width: 100%; }
.slide.video:only-child { flex-basis: auto; }

.sound {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgb(16 28 44 / .6);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.sound svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sound svg path:first-child { fill: currentColor; }
.sound .i-on, .slide.video.unmuted .i-off { display: none; }
.slide.video.unmuted .i-on { display: block; }
.slide.video.unmuted .sound { background: var(--accent); }

/* fade the right edge while there's more to scroll to (class set in site.js) */
.visual.more-right { mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); }

/* a single wide image (usually a screenshot) is shown whole */
.slide.image:only-child { max-width: 100%; height: auto; max-height: 100%; align-self: center; }
.slide.image:only-child img { width: 100%; height: auto; max-height: var(--media-h); object-fit: contain; }

/* ---------- text pane ---------- */

.text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  max-width: 34rem;
}

.meta {
  display: flex;
  gap: 14px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.kind { color: var(--accent); }

.text h2 {
  margin: 10px 0 14px;
  font-size: clamp(28px, 3.4vw, 48px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
}

.desc {
  color: var(--body);
  padding-bottom: 12px;
}

.desc > :first-child { margin-top: 0; }
.desc p { margin: 0 0 .8em; }
.desc a, .links a { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.desc code { font-family: var(--mono); font-size: .85em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------- audio player ---------- */

.player {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.play {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.play svg { width: 18px; height: 18px; fill: currentColor; }
.play .i-pause, .player.playing .i-play { display: none; }
.player.playing .i-pause { display: block; }

.track {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  cursor: pointer;
}

.track::after { content: ""; position: absolute; inset: -10px 0; } /* bigger hit area */

.fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--text);
}

.time {
  flex: none;
  min-width: 4.5ch;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

/* ---------- misc ---------- */

.empty, footer {
  padding: 48px var(--stripe-pad-x);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

footer { min-height: 40vh; }

.lightbox {
  max-width: 96vw;
  max-height: 96vh;
  padding: 0;
  border: 0;
  background: none;
}

.lightbox::backdrop { background: rgb(16 28 44 / .85); }
.lightbox img { display: block; max-width: 96vw; max-height: 96vh; cursor: zoom-out; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- phones ---------- */

@media (max-width: 760px) {
  :root { --media-h: 220px; --stripe-pad-y: 28px; --stripe-gap: 48px; }
  .stripe {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--media-h) auto;
    gap: 24px;
    height: auto;
    min-height: 0;
  }
  .stripe:nth-child(even) .visual > :first-child { margin-left: 0; }
  .slide.image img { max-width: 75vw; }
  .stripe.no-visual { grid-template-rows: auto; }
  .stripe:nth-child(even) .visual { order: 0; }
  .stripe { scroll-snap-align: start; }
  html { scroll-snap-type: none; }
}
