/* Mason Kleinsorge resume site
   Concept: the page is a design-editor canvas. Sheets are artboards, magenta is
   reserved for snap guides, blue for selection, yellow for highlights. */

@property --i { syntax: '<number>'; inherits: false; initial-value: 0; }

:root {
  --board: #E7EAF0;
  --paper: #FFFFFF;
  --ink: #17173A;
  --ink-2: #5B6080;
  --line: #CDD2DE;
  --line-2: #E4E7EE;
  --guide: #FF2E88;
  --select: #2B66F6;
  --proof: #FFD12E;
  --pass: #1E7B5C;
  --deny: #C8323F;

  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --code: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --ruler: 0px;
  --pad: clamp(18px, 4vw, 56px);
  --snap: cubic-bezier(.2, .9, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.4l2.4 2.4 4.6-5.2' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: var(--ruler) 0 0 var(--ruler);
  background-color: var(--board);
  background-image: radial-gradient(circle, #C2C8D6 1px, transparent 1.3px);
  background-size: 24px 24px;
  color: var(--ink);
  font: 400 17px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}

main { overflow-x: hidden; overflow-x: clip; } /* hidden is the fallback for Safari before 16 */

h1, h2, h3, h4, h5 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
code, pre { font-family: var(--code); }

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

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ───────────── Rulers ───────────── */

.ruler, .ruler-corner { display: none; }

@media (min-width: 900px) and (pointer: fine) {
  :root { --ruler: 22px; }

  .ruler, .ruler-corner {
    display: block;
    position: fixed;
    z-index: 50;
    background-color: #F6F7FA;
    color: var(--ink-2);
    font: 500 10px/1 var(--body);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    pointer-events: none;
  }
  .ruler-corner { top: 0; left: 0; width: var(--ruler); height: var(--ruler); z-index: 51; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }

  .ruler-x {
    top: 0; left: 0; right: 0; height: var(--ruler);
    border-bottom: 1px solid var(--line);
    background-image: linear-gradient(90deg, var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 100px 100%, 10px 5px;
    background-position: var(--ruler) 0, var(--ruler) 100%;
    background-repeat: repeat-x;
  }
  .ruler-y {
    top: 0; left: 0; bottom: 0; width: var(--ruler);
    border-right: 1px solid var(--line);
    background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(var(--line) 1px, transparent 1px);
    background-size: 100% 100px, 5px 10px;
    background-position: 0 calc(var(--ruler) - var(--sy, 0px)), 100% calc(var(--ruler) - var(--sy, 0px));
    background-repeat: repeat-y;
  }
  .ruler span { position: absolute; }
  .ruler-x span { top: 3px; }
  .ruler-y span { left: 3px; writing-mode: vertical-rl; rotate: 180deg; }

  .ruler-x::after, .ruler-y::after { content: ""; position: absolute; background: var(--guide); }
  .ruler-x::after { top: 0; bottom: 0; width: 1px; left: var(--mx, -10px); }
  .ruler-y::after { left: 0; right: 0; height: 1px; top: var(--my, -10px); }
}

/* ───────────── Shared bits ───────────── */

.bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px var(--pad); }
.bar-name { font: 700 18px/1 var(--display); text-decoration: none; white-space: nowrap; }
@media (max-width: 720px) {
  .bar nav a:not(.btn) { display: none; }
}
@media (max-width: 360px) {
  .bar { gap: 10px; }
  .bar-name { font-size: 16px; }
  .bar .btn { padding-inline: 12px; font-size: 14px; }
}
.bar nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 26px); font-size: 15px; font-weight: 500; }
.bar nav a:not(.btn) { text-decoration: none; }
/* Hover styles only where there is a real hover: on a touchscreen :hover
   sticks after a tap and makes a button look held down. Touch gets :active. */
@media (hover: hover) {
  .bar nav a:not(.btn):hover { text-decoration: underline; text-decoration-color: var(--guide); text-decoration-thickness: 2px; text-underline-offset: 5px; }
  .btn:hover { background: var(--select); }
  .link:hover { text-decoration-color: var(--guide); }
  .btn-mini:hover { background: var(--ink); color: #fff; }
  .email-fit:hover { color: var(--select); }
}
.btn:active { background: var(--select); }
.link:active { text-decoration-color: var(--guide); }
.email-fit:active { color: var(--select); }

.btn {
  display: inline-flex; align-items: center;
  padding: 10px 16px;
  background: var(--ink); color: #fff;
  border-radius: 8px;
  font: 600 15px/1.2 var(--body);
  white-space: nowrap;
  text-decoration: none;
  transition: background .15s;
}

.link { font-weight: 500; text-decoration: underline; text-decoration-color: var(--select); text-decoration-thickness: 2px; text-underline-offset: 5px; }

.btn-mini {
  font: 600 13px/1 var(--body);
  padding: 8px 10px;
  border: 1.5px solid var(--ink); border-radius: 6px;
  background: #fff; color: var(--ink);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-mini:active, .btn-mini[aria-pressed="true"] { background: var(--ink); color: #fff; }

.frame-label { font: 500 13px/16px var(--body); color: var(--ink-2); margin: 0 0 8px; }

.sheet, .stage { background: var(--paper); border: 1px solid var(--line); }
.stage { position: relative; overflow: hidden; transition: border-color .35s, box-shadow .35s; }

/* The one demo that is playing right now reads as the selected artboard. */
.stage.is-live { border-color: var(--select); box-shadow: 0 0 0 1px var(--select); }
.piece .frame-label { transition: color .35s; }
.piece:has(.stage.is-live) .frame-label { color: var(--select); }

.cursor { position: absolute; left: 0; top: 0; width: 20px; height: 24px; z-index: 9; pointer-events: none; opacity: 0; transition: opacity .25s; }
.cursor path { fill: var(--ink); stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; }
.cursor.on { opacity: 1; }

mark {
  color: inherit;
  background: linear-gradient(var(--proof), var(--proof)) no-repeat 0 88% / 0% 46%;
  transition: background-size .35s var(--snap);
}
mark.on { background-size: 100% 46%; }

.hint { color: var(--ink-2); font-size: 15px; }

/* Instructions and controls adapt to how the visitor points. */
.for-touch { display: none; }
@media (pointer: coarse) {
  .for-mouse { display: none; }
  .for-touch { display: inline; }

  /* comfortable tap targets */
  .btn { min-height: 44px; }
  .btn-mini { min-height: 44px; padding-inline: 14px; font-size: 14px; }
  .link { padding-block: 10px; }
  .bar-name { padding-block: 13px; }
  .email-fit { padding-block: 4px; }
  .bar nav a:not(.btn) { padding-block: 13px; }

  /* the scripted demos show a fingertip instead of a mouse arrow */
  .cursor { width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 2px solid #fff; background: rgba(43, 102, 246, .35); box-shadow: 0 0 0 1.5px var(--select); }
  .cursor path { display: none; }
}

/* ───────────── Hero ───────────── */

.hero { max-width: 1380px; margin-inline: auto; padding: 8px var(--pad) 88px; }

.canvas {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(210px, 1fr);
  gap: 24px clamp(24px, 4vw, 64px);
  align-items: start;
  padding: clamp(22px, 4.5vw, 64px);
  padding-bottom: 26px;
  min-height: min(780px, calc(100vh - 150px));
}

.name {
  margin: 0;
  width: fit-content;
  font: 700 clamp(3.4rem, 10.4vw, 11rem)/.84 var(--display);
  font-stretch: 80%;
  letter-spacing: -.022em;
}
.name span { display: block; }

.hero-copy { margin-top: clamp(20px, 3vw, 40px); max-width: 60ch; transition: opacity .5s .05s, translate .6s .05s var(--snap); }
.role { font: 600 clamp(1.15rem, 2vw, 1.5rem)/1.25 var(--display); margin: 0 0 12px; }
.summary { margin: 0 0 22px; }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin: 0; }
@media (max-width: 380px) {
  /* Three across no longer fits: give the button its own row so one link is not orphaned. */
  .hero-links .btn { flex-basis: 100%; justify-content: center; }
}

.hero-side { display: flex; flex-direction: column; align-items: center; gap: 28px; padding-top: 8px; }

.photo {
  margin: 0;
  width: min(250px, 100%);
  padding: 10px 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 30px -20px rgba(23, 23, 58, .55);
  rotate: 3deg;
}

.stickers { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.sticker {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 148px; aspect-ratio: 1; padding: 14px;
  border-radius: 50%;
  text-align: center;
}
.sticker b { font: 700 2.3rem/1 var(--display); font-stretch: 85%; letter-spacing: -.02em; }
.sticker span { font-size: 13px; line-height: 1.25; font-weight: 500; margin-top: 4px; }
.s-commits { background: var(--proof); rotate: -6deg; width: 164px; }
.s-releases { background: var(--select); color: #fff; rotate: 5deg; }
.s-upgrades { background: #fff; border: 2px dashed var(--guide); rotate: -3deg; margin-top: -18px; }

.obj { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; position: relative; }
.obj.dragging { cursor: grabbing; z-index: 4; }
.obj.homing { transition: translate .45s var(--snap); }
.obj.lifted { scale: 1.04; }
.photo img { pointer-events: none; }
.photo, .sticker { transition: opacity .4s, scale .5s var(--spring); }
@media (hover: hover) {
  .obj:hover { outline: 1.5px solid var(--select); outline-offset: 5px; }
}
/* the selection frame replaces the outline; never both */
.obj.is-selected, .obj.is-selected:hover, .obj.is-selected:focus-visible { outline: none; }

.canvas-hint {
  grid-column: 1 / -1; align-self: end;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  margin: 0; font-size: 14px; color: var(--ink-2);
  transition: opacity .5s .6s;
}
/* "Put everything back" is always there, and greyed out until something has
   been dragged, so the sheet is the same size before and after. */
.btn-mini:disabled { border-color: var(--line); background: transparent; color: var(--ink-2); opacity: .7; cursor: default; }

.guide { position: absolute; background: var(--guide); pointer-events: none; opacity: 0; z-index: 5; }
.guide-v { top: 0; bottom: 0; left: 0; width: 1px; }
.guide-h { left: 0; right: 0; top: 0; height: 1px; }
.guide.on { opacity: 1; }

.sel { position: absolute; left: 0; top: 0; border: 1.5px solid var(--select); pointer-events: none; z-index: 6; display: none; }
.sel.on { display: block; }
.sel i, .h-sel i { position: absolute; width: 9px; height: 9px; background: #fff; border: 1.5px solid var(--select); }
.sel i:nth-child(1), .h-sel i:nth-child(1) { left: -5px; top: -5px; }
.sel i:nth-child(2), .h-sel i:nth-child(2) { right: -5px; top: -5px; }
.sel i:nth-child(3), .h-sel i:nth-child(3) { left: -5px; bottom: -5px; }
.sel i:nth-child(4), .h-sel i:nth-child(4) { right: -5px; bottom: -5px; }
.sel b {
  position: absolute; left: -1.5px; bottom: calc(100% + 7px);
  background: var(--select); color: #fff;
  font: 600 11px/1 var(--body); font-variant-numeric: tabular-nums;
  padding: 4px 6px; border-radius: 3px; white-space: nowrap;
}

.cursor-wrap { position: absolute; left: 0; top: 0; width: 0; height: 0; }

/* intro: the name starts off its mark; everything else waits for the snap */
.js .hero.is-intro .name { translate: min(14vw, 150px) 54px; }
.js .hero.is-intro .hero-copy { opacity: 0; translate: 0 18px; }
.js .hero.is-intro .photo, .js .hero.is-intro .sticker { opacity: 0; scale: .6; }
.js .hero.is-intro .canvas-hint { opacity: 0; }
.s-commits { transition-delay: .12s; }
.s-releases { transition-delay: .2s; }
.s-upgrades { transition-delay: .28s; }

@media (max-width: 820px) {
  .canvas { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .hero-side { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 16px; }
  .photo { width: 150px; }
  .stickers { justify-content: flex-start; gap: 6px; }
  .sticker { width: 118px; padding: 10px; }
  .s-commits { width: 128px; }
  .sticker b { font-size: 1.7rem; }
  .sticker span { font-size: 11.5px; }
  .s-upgrades { margin-top: 0; }
}

/* ───────────── Bands ───────────── */

.band { max-width: 1380px; margin-inline: auto; padding: 24px var(--pad) 104px; scroll-margin-top: 30px; }

.snap-h {
  position: relative;
  width: fit-content;
  margin: 0 0 44px;
  font: 700 clamp(2.7rem, 6.4vw, 5.4rem)/1 var(--display);
  font-stretch: 82%;
  letter-spacing: -.022em;
}
.snap-h::before, .snap-h::after { content: ""; position: absolute; background: var(--guide); opacity: 0; pointer-events: none; }
/* guides run along the selection frame's bottom and left edges, as in the hero */
.snap-h::before { left: -100vw; right: -100vw; top: 100%; height: 1px; translate: 0 var(--fy, 0px); }
.snap-h::after { left: 0; top: -45vh; bottom: -45vh; width: 1px; translate: var(--fx, 0px) 0; }
.h-sel { position: absolute; inset: 0; border: 1.5px solid var(--select); pointer-events: none; opacity: 0; }
.js .snap-h { translate: 44px -18px; }
.js .snap-h .h-sel { opacity: 1; }
.js .snap-h.snapped { translate: 0 0; transition: translate .9s var(--snap); }
.js .snap-h.snapped .h-sel { opacity: 0; transition: opacity .3s 1.5s; }
.js .snap-h.snapped::before, .js .snap-h.snapped::after { animation: guide-flash 1.2s .5s both; }
@keyframes guide-flash { 0% { opacity: 0; } 12%, 70% { opacity: 1; } 100% { opacity: 0; } }

.job-head {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; align-items: baseline;
  border-top: 3px solid var(--ink); padding-top: 18px;
}
.job-head h3 { margin: 0; font: 700 clamp(1.5rem, 2.8vw, 2.2rem)/1.1 var(--display); letter-spacing: -.01em; }
.at { font-weight: 400; color: var(--ink-2); }
.dates { margin: 0; color: var(--ink-2); font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.job-lead { grid-column: 1 / -1; max-width: 70ch; margin: 8px 0 0; }
.job-plain { margin-top: 96px; }

.project { margin-top: 72px; }
.project-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px 24px; flex-wrap: wrap;
  border-top: 1px solid var(--ink); padding-top: 14px; margin-bottom: 36px;
}
.project-head h4 { margin: 0; font: 600 clamp(1.25rem, 2.1vw, 1.65rem)/1.2 var(--display); }

/* One column until 900px: twelve columns carry eleven 32px gaps, a 352px
   floor that is wider than a small phone. */
.pieces { display: grid; grid-template-columns: minmax(0, 1fr); gap: 64px 32px; }
.piece { min-width: 0; }
.piece > p, .piece-under p { margin: 14px 0 0; max-width: 64ch; }
.piece-text p { margin: 0 0 14px; }
.piece-under { display: grid; gap: 0 40px; }

@media (min-width: 900px) {
  .pieces { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .piece { grid-column: span 12; }
  .p-7 { grid-column: span 7; }
  .p-6 { grid-column: span 6; }
  .p-5 { grid-column: span 5; }
  .p-4 { grid-column: span 4; }
  .piece-split { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 32px; align-items: start; }
  .piece-split .piece-text { position: sticky; top: 60px; }
  .piece-split .piece-text p:first-of-type { font-size: 1.13rem; }
  .piece-under { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}

/* ───────────── Demo A: imprint editor ───────────── */

.imprint {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(16px, 4vw, 56px);
  padding: 40px 24px 64px;
  min-height: 500px;
}
.cover {
  position: relative;
  flex: 0 1 340px; width: 340px; max-width: 100%;
  aspect-ratio: 5 / 6;
  background-color: #1F5A48;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .055) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .09) 0 1px, transparent 1px 3px);
  border-radius: 2px 7px 7px 2px;
  box-shadow: inset 12px 0 14px -10px rgba(0, 0, 0, .5), 0 22px 30px -24px rgba(23, 23, 58, .7);
}
.safe { position: absolute; inset: 9%; border: 1px dashed transparent; transition: border-color .2s; pointer-events: none; }
.imprint.is-dragging .safe, .imprint.show-safe .safe { border-color: rgba(255, 255, 255, .5); }

.imp-line {
  position: absolute; left: 50%; top: 0;
  height: 38px; padding: 0 5px;
  border: 0; border-radius: 2px;
  font: 600 22px/38px var(--display);
  white-space: nowrap;
  color: #E9CD7C;
  background: linear-gradient(100deg, #C9A04A, #F8E7A8 38%, #CDA552 62%, #F1DB94);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: grab;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  transition: transform .3s var(--snap), opacity .25s, font-size .5s var(--snap), scale .15s;
}
.imp-line.dragging { transition: scale .15s; cursor: grabbing; z-index: 3; }
.imp-line.lifted { scale: 1.07; }
.imp-line.off { opacity: 0; pointer-events: none; }
.imp-line.selected, .imp-line:focus-visible { outline: 1.5px solid #9CBDFF; outline-offset: 1px; }
.imp-line.nofit { transition: transform .3s var(--snap), opacity .25s; }

.g { position: absolute; left: 0; top: 0; background: var(--guide); opacity: 0; pointer-events: none; z-index: 2; }
.g-v { bottom: 0; width: 1px; }
.g-h { right: 0; height: 1px; }
.g.on { opacity: 1; }

.measure {
  position: absolute; left: 50%; top: 0; height: 12px; width: 0; z-index: 4;
  translate: -50% 0;
  border-inline: 1.5px solid var(--proof);
  opacity: 0; pointer-events: none;
  transition: width .5s var(--snap), opacity .2s;
}
.measure::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px; margin-top: -.75px; background: var(--proof); }
.imprint.fitting .imp-line:not(.focus) { opacity: .2; }
.measure span { position: absolute; left: 50%; top: 16px; translate: -50% 0; padding: 4px 7px; border-radius: 3px; background: var(--ink); color: #fff; font: 600 11px/1 var(--body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.measure.on { opacity: 1; }

.phone {
  flex: 0 0 176px; aspect-ratio: 9 / 17.5;
  padding: 7px;
  border: 2px solid var(--ink); border-radius: 26px;
  background: #fff;
}
.phone-screen { position: relative; height: 100%; border-radius: 17px; overflow: hidden; background: var(--board); }
.mini-cover {
  position: absolute; left: 24%; right: 24%; top: 8%; aspect-ratio: 5 / 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  background: #1F5A48; border-radius: 1px 3px 3px 1px;
}
.mini-cover i { height: 3px; border-radius: 2px; background: #E9CD7C; transition: width .3s; }
.bs {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 10px 10px;
  background: #fff; border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 18px -10px rgba(23, 23, 58, .4);
  transform: translateY(calc(100% - var(--peek, 66px)));
  transition: transform .55s var(--snap);
}
.bs.open { transform: none; }
.bs-handle { position: relative; display: block; width: 100%; padding: 16px 0 6px; border: 0; background: none; color: inherit; text-align: center; font: 600 11px/1 var(--body); cursor: pointer; }
.bs-handle::before { content: ""; position: absolute; left: 50%; top: 6px; width: 30px; height: 3px; margin-left: -15px; border-radius: 2px; background: var(--line); }
.bs-total { display: flex; justify-content: space-between; margin: 6px 0 8px; padding-bottom: 8px; border-bottom: 1.5px solid var(--ink); font-size: 11px; }
.bs-total b { font-variant-numeric: tabular-nums; }
.bs-list { list-style: none; margin: 0; padding: 0; font-size: 10px; line-height: 1.3; }
.bs-list li { display: flex; justify-content: space-between; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.bs-list li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-list li span:last-child { font-variant-numeric: tabular-nums; color: var(--ink-2); }

.price-tag { position: absolute; left: 18px; bottom: 14px; margin: 0; display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ink-2); }
.price-tag b { color: var(--ink); font: 700 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.price-tag b.bump { animation: bump .35s var(--spring); }
@keyframes bump { 0% { scale: 1; } 40% { scale: 1.22; } 100% { scale: 1; } }

/* On a phone there is no phone mock: the sheet becomes a real bottom sheet
   attached to the stage, with a handle you can tap. */
@media (max-width: 560px) {
  .imprint { padding: 24px 16px 116px; min-height: 0; gap: 0; }
  .phone { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; height: 0; flex: none; aspect-ratio: auto; padding: 0; border: 0; border-radius: 0; background: none; }
  .phone-screen { position: static; height: auto; overflow: visible; border-radius: 0; background: none; }
  .mini-cover, .price-tag { display: none; }
  .bs { --peek: 88px; padding: 0 16px 12px; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 24px -14px rgba(23, 23, 58, .4); }
  .bs-handle { padding: 22px 0 10px; font-size: 14px; }
  .bs-handle::before { top: 9px; width: 38px; height: 4px; margin-left: -19px; }
  .bs-total { margin: 4px 0 10px; padding-bottom: 12px; font-size: 15px; line-height: 1.5; }
  .bs-list { font-size: 14px; }
  .bs-list li { padding: 9px 0; }
}

/* ───────────── Demo B: layers ───────────── */

.layers { display: grid; grid-template-columns: minmax(0, 1fr) 196px; min-height: 400px; }
.iso-wrap { display: grid; place-items: center; perspective: 1500px; padding: 40px 12px; overflow: hidden; }
.iso {
  --gap: 0px;
  position: relative;
  width: min(360px, 76%); aspect-ratio: 32 / 20;
  margin-top: 56px;
  transform: rotateX(57deg) rotateZ(-32deg);
  transform-style: preserve-3d;
}
.lyr { position: absolute; inset: 0; transform: translateZ(calc(var(--i) * var(--gap))); transition: --i .55s var(--snap); }
.lyr-fabric {
  --i: 0;
  display: grid; grid-template-columns: 45fr 10fr 45fr;
  background-color: #DCCDB4;
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, .25) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(23, 23, 58, .06) 0 1px, transparent 1px 3px);
  box-shadow: 0 0 0 1px rgba(23, 23, 58, .3), -14px 18px 26px -8px rgba(23, 23, 58, .28);
}
.lyr-fabric i { border-right: 1px dashed rgba(23, 23, 58, .4); }
.lyr-fabric i:last-child { border: 0; }
.lyr-photo { --i: 1; }
.lyr-text { --i: 2; }
.lyr-photo, .lyr-text { outline: 1px solid rgba(43, 102, 246, .55); background: rgba(43, 102, 246, .035); }
.pic {
  position: absolute; left: 30%; right: 0; top: 0; bottom: 0;
  background:
    radial-gradient(circle at 62% 56%, #FFD12E 0 12%, transparent 12.6%),
    linear-gradient(#FF8A5C 0%, #FF2E88 56%, #2B66F6 56.4%, #17173A 100%);
  clip-path: inset(0 0 0 var(--clip, 0%));
}
.clip-box { position: absolute; left: 55%; right: 0; top: 0; bottom: 0; outline: 1.5px dashed var(--guide); opacity: var(--clip-o, 0); }
.front-t { position: absolute; left: 55%; right: 0; top: 13%; text-align: center; color: var(--ink); font: 700 22px/1 var(--display); }
.spine-t { position: absolute; left: 45%; width: 10%; top: 0; bottom: 0; display: grid; place-items: center; writing-mode: vertical-rl; color: var(--ink); font: 700 11px/1 var(--display); }
.layers.merged .lyr-text { --i: 1; }

.strip { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-left: 1px solid var(--line); background: #FAFBFC; }
.strip-title { margin: 0; font: 600 13px/1.2 var(--body); color: var(--ink-2); }
.strip ol { list-style: none; margin: 0; padding: 0; }
.strip li {
  display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: center;
  max-height: 64px; padding: 8px 0; overflow: hidden;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px; line-height: 1.25;
  transition: max-height .4s var(--snap), padding .4s var(--snap), opacity .25s;
}
.layers.merged .row-text { max-height: 0; padding-block: 0; opacity: 0; border-bottom-width: 0; }
.th { display: grid; place-items: center; width: 28px; height: 20px; border: 1px solid var(--line); font: 700 12px/1 var(--display); font-style: normal; }
.th-photo { background: linear-gradient(#FF8A5C, #FF2E88 56%, #2B66F6 57%); }
.th-fabric { background: #DCCDB4; }
.strip .btn-mini { margin-top: auto; }

@media (max-width: 560px) {
  .layers { grid-template-columns: minmax(0, 1fr); }
  .iso-wrap { min-height: 300px; }
  .strip { border-left: 0; border-top: 1px solid var(--line); }
  /* room for all three rows, so merging two does not resize the box */
  .strip ol { min-height: 112px; }
}

/* ───────────── Demo C: wrapping paper ───────────── */

.pat-dots {
  --pat: radial-gradient(circle, #FFD12E 0 24%, transparent 26%) 0 0 / 30px 30px, radial-gradient(circle, #fff 0 11%, transparent 13%) 15px 15px / 30px 30px, #2B66F6;
  --ribbon: #FF2E88;
}
.pat-stripes { --pat: repeating-linear-gradient(45deg, #FF2E88 0 10px, #fff 10px 20px); --ribbon: #FFC61A; }
.pat-confetti {
  --pat:
    radial-gradient(circle at 20% 28%, #FF2E88 0 5px, transparent 6px) 0 0 / 50px 50px,
    radial-gradient(circle at 72% 18%, #fff 0 4px, transparent 5px) 0 0 / 50px 50px,
    radial-gradient(circle at 46% 74%, #1E7B5C 0 5px, transparent 6px) 0 0 / 50px 50px,
    radial-gradient(circle at 88% 66%, #17173A 0 3px, transparent 4px) 0 0 / 50px 50px,
    #FFD12E;
  --ribbon: #2B66F6;
}

.wrap { display: grid; grid-template-rows: 1fr auto; min-height: 400px; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.wrap.grabbing { cursor: grabbing; }
.scene { position: relative; display: grid; place-items: center; min-height: 310px; perspective: 800px; }
.spin { transform-style: preserve-3d; transform: rotateX(var(--rx, -24deg)); }
.box3d { --s: 150px; position: relative; width: var(--s); height: var(--s); transform-style: preserve-3d; transform: rotateY(var(--ry, 32deg)); }
.f { position: absolute; inset: 0; background: var(--pat); filter: brightness(var(--b, 1)); }
.f::before, .f::after { content: ""; position: absolute; background: var(--ribbon); }
.f::before { left: 42%; width: 16%; top: 0; bottom: 0; }
.f::after { top: 42%; height: 16%; left: 0; right: 0; }
.f-front { transform: translateZ(calc(var(--s) / 2)); --b: var(--b0, 1); }
.f-right { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); --b: var(--b1, .86); }
.f-back { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); --b: var(--b2, .8); }
.f-left { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); --b: var(--b3, .86); }
.f-top { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); --b: 1.07; }
.f-bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); --b: .7; }
.box-shadow { position: absolute; left: 50%; bottom: 7%; width: 230px; height: 30px; margin-left: -115px; background: radial-gradient(closest-side, rgba(23, 23, 58, .3), transparent); }
/* The lit three.js scene (gift.js) fades in over the CSS cube once it has drawn. */
.gift-gl { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; transition: opacity .45s; }
.spin, .box-shadow { transition: opacity .3s .15s, visibility 0s .45s; }
.wrap.gl .gift-gl { opacity: 1; }
.wrap.gl .spin, .wrap.gl .box-shadow { opacity: 0; visibility: hidden; }
/* only promise the moving light once the lit scene is actually showing */
.if-lit { display: none; }
.piece:has(.wrap.gl) .if-lit { display: inline; }

.swatches { display: flex; justify-content: center; gap: 12px; padding: 0 16px 20px; }
.sw { width: 38px; height: 38px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--pat); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--ink); }
.wrap { -webkit-tap-highlight-color: transparent; }
@media (pointer: coarse) {
  .sw { width: 44px; height: 44px; }
}

/* ───────────── Demo D: serializer migration ───────────── */

.json { display: flex; flex-direction: column; gap: 16px; padding: 22px; min-height: 380px; }
.code {
  margin: 0; padding: 14px 16px;
  background: var(--ink); color: #E7EAF0;
  border-radius: 6px;
  font: 400 12.5px/1.75 var(--code);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
/* Each source line is a block with a hanging indent, so a line that has to
   wrap on a phone reads as a continuation. A renamed call is one unit: it
   drops to the next line whole instead of splitting mid-identifier. */
.code .ln { display: block; padding-left: 2ch; text-indent: -2ch; }
.code .ln .swap { display: inline-block; max-width: 100%; text-indent: 0; vertical-align: top; }
@media (max-width: 400px) {
  .json { padding: 16px; }
  .code { padding: 12px; font-size: 11.5px; }
}
.swap { color: #FF9CC6; transition: color .3s; }
.swap.done { color: #8FE3C0; }
.golden { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
.golden code { padding: 4px 8px; border-radius: 4px; background: var(--board); font-size: 12.5px; }
.g-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--pass); font-weight: 600; }
.g-badge::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--pass) var(--check) center / 10px no-repeat; }
.g-badge.pulse::before { animation: bump .4s var(--spring); }
.bridge { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: auto; }
.lib { font: 500 12px/1 var(--code); transition: color .3s; }
.lib-from.done { color: var(--ink-2); text-decoration: line-through; }
.lib-to { color: var(--ink-2); }
.lib-to.done { color: var(--pass); }
.miles { list-style: none; display: flex; gap: 3px; margin: 0; padding: 0; }
.miles li { flex: 1; height: 20px; border-radius: 2px; background: var(--line-2); transition: background .2s, scale .25s var(--spring); }
.miles li.done { background: var(--pass); }
.miles li.tip { scale: 1 1.35; }
.mile-count { margin: 0; font-size: 14px; color: var(--ink-2); }
.mile-count b { color: var(--ink); font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .bridge { grid-template-columns: minmax(0, 1fr); }
}

/* ───────────── Demo E: releases ───────────── */

.releases { display: flex; flex-direction: column; gap: 12px; padding: 22px; min-height: 380px; }
.jobs { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; font-size: 13px; font-weight: 500; }
.jobs li { display: flex; align-items: center; gap: 7px; padding: 5px 12px 5px 7px; border: 1px solid var(--line); border-radius: 999px; }
.ring { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); }
.jobs li.run .ring { border-top-color: var(--ink); animation: spin .8s linear infinite; }
.jobs li.ok .ring { border-color: var(--pass); background: var(--pass) var(--check) center / 10px no-repeat; }
@keyframes spin { to { rotate: 360deg; } }
.graph { width: 100%; height: auto; margin-block: auto; overflow: visible; }
.graph .main { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.graph .hump { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .4s ease-out; }
.graph .hump.on { stroke-dashoffset: 0; }
.graph .rel { stroke: var(--select); }
.graph .hot { stroke: var(--guide); }
.graph .dot { fill: #fff; stroke: var(--ink); stroke-width: 2; scale: 0; transform-box: fill-box; transform-origin: center; transition: scale .25s var(--spring) .25s; }
.graph .dot.on { scale: 1; }
.graph .tick { stroke: var(--line); stroke-width: 1; }
.tally { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 0; }
.tally div { display: flex; flex-direction: column-reverse; }
.tally dt { font-size: 13px; color: var(--ink-2); }
.tally dd { margin: 0; font: 700 2.4rem/1 var(--display); font-variant-numeric: tabular-nums; }
.t-rel dd { color: var(--select); }
.t-hot dd { color: var(--guide); }

/* ───────────── Demo G: notifications ───────────── */

.notify {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 34px 12px;
  padding: 26px 16px;
  align-items: center;
}
.wires { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.wire { fill: none; stroke: var(--line); stroke-width: 2; }
.wire.socket { stroke: var(--pass); stroke-dasharray: 5 6; animation: march .9s linear infinite; }
@keyframes march { to { stroke-dashoffset: -22; } }
.pkt { fill: var(--select); stroke: #fff; stroke-width: 1.5; }

.node { position: relative; z-index: 1; min-width: 0; padding: 12px; background: #fff; border: 1.5px solid var(--ink); border-radius: 8px; transition: box-shadow .2s; }
.node.hit { animation: node-hit .55s; }
@keyframes node-hit { 0% { box-shadow: 0 0 0 0 rgba(43, 102, 246, .55); } 100% { box-shadow: 0 0 0 12px rgba(43, 102, 246, 0); } }
.node-t { margin: 0 0 8px; font: 600 13px/1.2 var(--body); }
.n-event, .n-dispatch, .n-strategy, .n-prefs { grid-column: 1 / -1; justify-self: center; width: min(100%, 300px); }

.evt { display: block; margin-bottom: 10px; padding: 6px 8px; border-radius: 4px; background: var(--board); font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.queue { display: flex; gap: 4px; min-height: 12px; }
.queue i { width: 12px; height: 12px; border-radius: 3px; background: var(--select); animation: pop .25s var(--spring); }
.recips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.recips li { padding: 3px 8px; border: 1px solid var(--line-2); border-radius: 4px; transition: background .2s, border-color .2s; }
.recips li.on { background: var(--proof); border-color: var(--ink); }

.tog { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; cursor: pointer; border-radius: 4px; }
.tog input { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 30px; height: 18px; margin: 0; border-radius: 9px; background: var(--line); cursor: pointer; transition: background .2s; }
.tog input::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: translate .2s var(--snap); }
.tog input:checked { background: var(--pass); }
.tog input:checked::after { translate: 12px 0; }
.tog.blocked span { animation: blocked .5s; }
@keyframes blocked { 0%, 100% { translate: 0; color: inherit; } 25% { translate: -3px 0; color: var(--guide); } 75% { translate: 3px 0; color: var(--guide); } }

.n-chan { text-align: center; padding: 10px 6px; }
.n-chan .node-t { margin: 0; }
.n-dev { border-color: var(--line); background: #FAFBFC; font-size: 13px; }
.n-dev p { margin: 0; }
.n-dev p { font-weight: 600; font-variant-numeric: tabular-nums; }
.d-inbox, .d-phone { display: flex; align-items: center; justify-content: center; gap: 8px; }
.ico { flex: none; width: 24px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.d-inbox.hit .ico { animation: bump .4s var(--spring); }
.d-phone.hit .ico { animation: buzz .45s; }
@keyframes buzz { 0%, 100% { rotate: 0deg; } 20% { rotate: -14deg; } 40% { rotate: 12deg; } 60% { rotate: -9deg; } 80% { rotate: 6deg; } }

.d-browser { padding: 0; overflow: hidden; }
.b-chrome { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: #fff; }
.b-chrome > i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.live { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; font-size: 11px; font-weight: 600; color: var(--pass); }
.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--pass); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.bell { position: relative; margin-left: auto; display: inline-flex; }
.bell svg { width: 16px; height: 16px; fill: var(--ink); }
.bell b { position: absolute; left: 9px; top: -5px; min-width: 14px; padding: 2px 3px; border-radius: 7px; background: var(--guide); color: #fff; font: 700 9px/1 var(--body); text-align: center; }
.bell.ring-it svg { animation: buzz .45s; transform-origin: 50% 0; }
/* A fixed height, so the diagram never resizes as toasts come and go. In the
   stacked layout the column is narrow and each toast wraps to two lines. */
.toasts { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; height: 92px; padding: 6px; overflow: hidden; }
.toast { flex: none; }
.toast { padding: 5px 7px; border-radius: 5px; background: var(--ink); color: #fff; font-size: 11px; line-height: 1.25; animation: toast-in .35s var(--snap); }
@keyframes toast-in { from { opacity: 0; translate: 0 10px; } }
@keyframes pop { from { scale: 0; } }

/* Stacked layout (phones and tablets): keep the flow short enough to follow
   from event to delivery, and line each preference up over its channel. */
@media (max-width: 999px) {
  .n-event, .n-dispatch, .n-strategy { width: min(100%, 420px); }
  .n-event { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
  .n-event .node-t { grid-column: 1 / -1; margin: 0; }
  .n-event .evt { margin: 0; }
  .n-dispatch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .n-dispatch .node-t { margin: 0; }
  .recips { flex-direction: row; }
  .recips li { flex: 1; padding-inline: 4px; text-align: center; }
  .n-prefs { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; padding-inline: 0; }
  .n-prefs .node-t { grid-column: 1 / -1; padding-inline: 12px; margin-bottom: 2px; }
  .n-prefs .tog { flex-direction: column; justify-content: center; gap: 4px; padding: 6px 0; }
}
@media (max-width: 480px) {
  .d-inbox, .d-phone { flex-direction: column; gap: 4px; padding: 10px 4px; text-align: center; }
}
@media (max-width: 360px) {
  .notify { padding-inline: 10px; column-gap: 8px; }
  .n-chan .node-t { font-size: 12px; }
  .b-chrome { padding-inline: 6px; }
  .b-chrome > i { display: none; }
  .live { margin-left: 0; }
}
@media (pointer: coarse) {
  .tog { min-height: 44px; }
}

@media (min-width: 1000px) {
  .notify {
    grid-template-columns: 1.2fr 1fr 1fr 1fr .9fr 1.35fr;
    grid-template-rows: repeat(3, auto);
    gap: 20px 46px;
    padding: 44px 28px;
    min-height: 430px;
  }
  .n-event, .n-dispatch, .n-strategy, .n-prefs { grid-row: 1 / 4; width: auto; justify-self: stretch; }
  .n-event { grid-column: 1; } .n-dispatch { grid-column: 2; } .n-strategy { grid-column: 3; } .n-prefs { grid-column: 4; }
  .n-hub { grid-column: 5; grid-row: 1; } .n-ses { grid-column: 5; grid-row: 2; } .n-sns { grid-column: 5; grid-row: 3; }
  .d-browser { grid-column: 6; grid-row: 1; } .d-inbox { grid-column: 6; grid-row: 2; } .d-phone { grid-column: 6; grid-row: 3; }
  .tog { padding: 6px 0; }
  .toasts { height: 64px; }
}

/* ───────────── Demo F: claims ───────────── */

.claims { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); min-height: 400px; }
.c-left { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-right: 1px solid var(--line); background: #FAFBFC; }
.wizard { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.wizard li { position: relative; flex: 1; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.wizard li::after { content: ""; position: absolute; inset: 0; background: var(--select); transform: scaleX(0); transform-origin: left; transition: transform .35s ease-out; }
.wizard li.on::after { transform: none; }
.wizard.reset li::after { transition: none; }
.c-queue { list-style: none; display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; }
.c-queue li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; line-height: 1.3; transition: border-color .2s, box-shadow .2s; }
.c-queue li small { grid-column: 1; color: var(--ink-2); font-size: 12px; }
.c-queue li .chip { grid-column: 2; grid-row: 1 / 3; }
.c-queue li.new { animation: row-in .45s var(--snap); }
.c-queue li.picked { border-color: var(--select); box-shadow: 0 0 0 1px var(--select); }
@keyframes row-in { from { opacity: 0; translate: 0 -12px; } }

.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--board); font: 600 12px/1.3 var(--body); white-space: nowrap; }
.chip[data-s="Filed"] { background: #FFF0B0; color: #5F4A00; }
.chip[data-s="Authorized"] { background: #DCE7FF; color: #1A46B8; }
.chip[data-s="Approved"] { background: #D3F0E3; color: #125C43; }
.chip[data-s="Denied"] { background: #FBDDE0; color: #9B1E2A; }
.chip.stamp { animation: stamp .4s var(--spring); }
@keyframes stamp { from { scale: 1.7; opacity: 0; rotate: -8deg; } }

.c-right { display: flex; flex-direction: column; gap: 10px; padding: 18px; min-width: 0; }
.c-detail { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.c-num { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; font: 700 20px/1.2 var(--display); }
.lock { display: inline-flex; align-items: center; gap: 5px; font: 500 12px/1 var(--body); color: var(--ink-2); opacity: 0; transition: opacity .3s; }
.lock svg { width: 11px; height: 13px; fill: var(--ink-2); stroke: var(--ink-2); stroke-width: 1.5; }
.lock.on { opacity: 1; }
.c-status { margin: 8px 0 12px; min-height: 28px; }
.c-status .chip { padding: 5px 12px; font-size: 14px; }
.c-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.audit { list-style: none; display: flex; flex-direction: column; gap: 4px; min-height: 80px; margin: 0; padding: 0; font-size: 12.5px; line-height: 1.35; color: var(--ink-2); }
.audit li { animation: row-in .35s var(--snap); }
.audit b { color: var(--ink); font-weight: 600; }

@media (max-width: 560px) {
  .claims { grid-template-columns: minmax(0, 1fr); }
  .c-left { border-right: 0; border-bottom: 1px solid var(--line); }
}
/* On a narrow phone the lock note only just fits beside the claim number, and
   whether it wraps would depend on the digits. It gets its own line instead. */
@media (max-width: 400px) {
  .c-num .lock { flex-basis: 100%; }
}

/* ───────────── Demo H: form engine ───────────── */

.formd { min-height: 400px; }
.tpl { list-style: none; display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #FAFBFC; font-size: 13px; }
.tpl li { padding: 3px 8px; border-left: 3px solid var(--line); color: var(--ink-2); transition: border-color .25s, color .25s, background .25s; }
.tpl .sub { margin-left: 18px; }
.tpl li.on { border-left-color: var(--guide); background: #fff; color: var(--ink); }
.insp { padding: 18px; }
.insp-title { margin: 0 0 12px; font: 700 19px/1.2 var(--display); }
.insp fieldset { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.insp legend { float: left; width: 100%; margin-bottom: 8px; padding: 0; font-weight: 600; font-size: 15px; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-block; padding: 7px 20px; border: 1.5px solid var(--ink); border-radius: 6px; font-weight: 600; font-size: 14px; transition: background .15s, color .15s; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--select); outline-offset: 3px; }
/* The follow-up always keeps its space and is unrolled into it, so answering
   the question never moves what is below the form. */
.follow-in { opacity: 0; visibility: hidden; clip-path: inset(0 0 100% 0); translate: 0 -6px; transition: clip-path .45s var(--snap), opacity .3s, translate .45s var(--snap), visibility 0s .45s; }
.follow.open .follow-in { opacity: 1; visibility: visible; clip-path: inset(0 -4px -4px -4px); translate: 0 0; transition: clip-path .45s var(--snap), opacity .3s, translate .45s var(--snap), visibility 0s; }
.fld { display: block; margin-top: 16px; font-weight: 600; font-size: 14px; }
/* 16px keeps iOS from zooming the page when the field is focused */
.fld input { display: block; width: 100%; margin-top: 6px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 6px; font: 16px/1.3 var(--body); color: var(--ink); }
@media (pointer: coarse) {
  .seg span { padding: 11px 26px; }
  .fld input { padding-block: 11px; }
}
.fld input:focus { border-color: var(--select); outline: none; }
.drop { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 12px 0 2px; padding: 12px; border: 1.5px dashed var(--line); border-radius: 6px; font-size: 13px; color: var(--ink-2); }
.file { padding: 3px 8px; border-radius: 4px; background: var(--board); color: var(--ink); font: 12px/1.3 var(--code); scale: 0; transition: scale .3s var(--spring); }
.file.on { scale: 1; }

/* ───────────── Demo I: HiLo ───────────── */

.hilo { display: flex; flex-direction: column; gap: 12px; padding: 18px; min-height: 330px; container-type: inline-size; }
.db { align-self: center; display: flex; flex-direction: column; align-items: center; padding: 8px 16px; border: 1.5px solid var(--ink); border-radius: 8px; font-size: 12.5px; }
.db b { font: 700 24px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.db.hit, .srv.hit { animation: node-hit .55s; }
.servers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.srv { padding: 8px 10px; border: 1px solid var(--line); border-top: 4px solid var(--select); border-radius: 6px; font-size: 13px; }
.srv-b { border-top-color: var(--guide); }
.srv p { margin: 0; font-weight: 600; }
.srv span { display: block; min-height: 1.4em; font: 12px/1.4 var(--code); color: var(--ink-2); }
/* in a narrow box a full range wraps to a second line and a single number does not */
@container (max-width: 330px) { .srv span { min-height: 2.8em; } }
.stream { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 5px; min-height: 84px; }
.stream b { padding: 3px 6px; border-radius: 4px; background: var(--select); color: #fff; font: 500 12px/1.3 var(--code); animation: pop .3s var(--spring); }
.stream b.b { background: var(--guide); }
/* in the narrowest box (three demos side by side on a small laptop) the numbers take a fourth row */
@container (max-width: 232px) { .stream { min-height: 102px; } }
/* two lines of room: the tally wraps once its numbers get longer */
.hilo-note { margin: auto 0 0; min-height: 3.2em; min-height: 2lh; font-size: 13px; color: var(--ink-2); }
.hilo-note b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ───────────── Demo J: upgrades ───────────── */

.upgrade { display: flex; flex-direction: column; gap: 16px; padding: 18px; min-height: 330px; }
.rollers { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.roller { display: flex; align-items: center; gap: 8px; font: 700 26px/1 var(--display); }
.digit { width: 36px; height: 46px; overflow: hidden; border-radius: 6px; background: var(--ink); color: #fff; }
.digit.wide { width: 54px; }
.col { display: flex; flex-direction: column; transition: transform .8s var(--snap); }
.col b { height: 46px; line-height: 46px; text-align: center; font-weight: 700; }
.col.rolled { transform: translateY(-46px); }
.code.sig { font-size: 12px; min-height: 4.6em; }
/* on a narrow phone the two lines wrap differently before and after the migration */
@media (max-width: 400px) { .upgrade { min-height: 356px; } }
.adds { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; margin: auto 0 0; padding: 0; font-size: 13px; line-height: 1.25; }
.adds li { display: flex; align-items: center; gap: 6px; color: var(--ink-2); transition: color .3s; }
.adds li::before { content: ""; flex: none; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--line); transition: background-color .3s, border-color .3s; }
.adds li.on { color: var(--ink); }
.adds li.on::before { border-color: var(--pass); background: var(--pass) var(--check) center / 10px no-repeat; }

/* ───────────── Demo K: access control ───────────── */

.pii { display: flex; flex-direction: column; gap: 16px; padding: 18px; min-height: 330px; }
.viewas { align-self: flex-start; display: inline-flex; border: 1.5px solid var(--ink); border-radius: 8px; overflow: hidden; }
.viewas button { padding: 7px 12px; border: 0; background: #fff; color: var(--ink); font: 600 13px/1 var(--body); cursor: pointer; transition: background .15s, color .15s; }
.viewas button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.viewas button:focus-visible { outline-offset: -3px; outline-color: var(--proof); }
@media (pointer: coarse) {
  .viewas button { min-height: 44px; padding-inline: 16px; font-size: 14px; }
}
.record { display: flex; flex-direction: column; gap: 7px; margin: 0; font-size: 14px; line-height: 1.35; }
.record div { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; }
.record dt { color: var(--ink-2); }
.record dd { margin: 0; }
.record dd span { position: relative; display: inline-block; }
.pii-f dd span::after { content: ""; position: absolute; inset: 1px -4px; border-radius: 2px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform .45s cubic-bezier(.7, 0, .2, 1); }
.pii-f:nth-child(2) dd span::after { transition-delay: .08s; }
.pii-f:nth-child(3) dd span::after { transition-delay: .16s; }
.pii.dealer .pii-f dd span::after { transform: none; }
.perms { list-style: none; display: flex; flex-direction: column; gap: 5px; margin: auto 0 0; padding: 0; font-size: 13px; }
.perms li { display: flex; align-items: center; gap: 7px; transition: color .3s; }
.perms li::before { content: ""; flex: none; width: 15px; height: 15px; border-radius: 50%; background: var(--pass) var(--check) center / 10px no-repeat; transition: background-color .3s; }
.perms li.no { color: var(--ink-2); text-decoration: line-through; }
.perms li.no::before { background: var(--line) linear-gradient(var(--ink-2), var(--ink-2)) center / 7px 1.8px no-repeat; }

/* ───────────── Skills, education, contact ───────────── */

.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 44px 32px; }
.skill-group h3, .edu h3 { margin: 0 0 16px; padding-top: 12px; border-top: 3px solid var(--ink); font: 700 1.3rem/1.2 var(--display); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.chips li { padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 15px; font-weight: 500; line-height: 1.3; }
.js .chips li { translate: var(--tx, 0) var(--ty, 0); rotate: var(--tr, 0deg); transition: translate .55s var(--snap) var(--d, 0ms), rotate .55s var(--snap) var(--d, 0ms); }
.js .chips.snapped li { translate: 0 0; rotate: 0deg; }

.edu { margin-top: 72px; max-width: 520px; }
.edu p { margin: 0; }
.edu-degree { font-weight: 600; }

/* ───────────── Currently learning ───────────── */

.learn { display: grid; grid-template-columns: minmax(0, 1fr); gap: 44px 32px; }
.learn-lead { margin: -20px 0 28px; max-width: 44ch; font-size: 1.13rem; }
.books { list-style: none; margin: 0; padding: 0; border-top: 3px solid var(--ink); }
.book { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.book p { margin: 0; }
.book-ico {
  grid-row: 1 / 4; align-self: start; position: relative;
  width: 36px; height: 48px; margin-top: 2px;
  border-radius: 2px 4px 4px 2px;
  background: var(--c, var(--select));
  box-shadow: inset 6px 0 0 rgba(23, 23, 58, .22), 0 8px 10px -7px rgba(23, 23, 58, .55);
}
.book-ico::after { content: ""; position: absolute; left: 12px; right: 6px; top: 9px; height: 9px; border-radius: 1px; background: rgba(255, 255, 255, .82); }
.book:nth-child(1) .book-ico { --c: var(--select); --r: -9deg; }
.book:nth-child(2) .book-ico { --c: var(--proof); --r: 7deg; --d: 70ms; }
.book:nth-child(3) .book-ico { --c: var(--pass); --r: -6deg; --d: 140ms; }
/* The books lean until the list scrolls in, then stand up straight, like the skill chips. */
.js .book-ico { rotate: var(--r, 0deg); translate: 0 -3px; transition: rotate .55s var(--spring) var(--d, 0ms), translate .55s var(--snap) var(--d, 0ms); }
.js .books.snapped .book-ico { rotate: 0deg; translate: 0 0; }
.book-t { font: 600 1.15rem/1.25 var(--display); }
.book-a { color: var(--ink-2); font-size: 14px; }
.book-d { padding-top: 6px; font-size: 15px; }

.train { padding: 22px; container-type: inline-size; }
.train-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@container (min-width: 620px) {
  .train-in { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: center; }
}
.t-plot { display: block; width: 100%; height: auto; border: 1px solid var(--line-2); border-radius: 6px; background: #FAFBFC; cursor: crosshair; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.t-grid line { stroke: var(--line-2); stroke-width: 1; }
.t-grid line.axis { stroke: var(--line); }
.t-res line { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 3; transition: stroke .2s, stroke-width .2s; }
/* while the walk-through is on `pred = model(x)`, the gaps it measures stand out */
.train.at-pred .t-res line { stroke: var(--guide); stroke-width: 1.75; }
.t-fit { stroke: var(--select); stroke-width: 3; stroke-linecap: round; }
.t-pts circle { fill: var(--ink); stroke: #fff; stroke-width: 1.5; transform-box: fill-box; transform-origin: center; }
.t-pts circle.mine { fill: var(--proof); stroke: var(--ink); }
.t-pts circle.new { animation: pop .3s var(--spring); }
.t-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; justify-items: start; }
.t-side .code { justify-self: stretch; }
.train .code .ln { margin-inline: -8px; padding-left: calc(8px + 2ch); padding-right: 8px; border-radius: 3px; transition: background .2s, color .2s; }
.train .code .ln.on { background: rgba(255, 209, 46, .2); color: #fff; }
.t-read { display: flex; align-items: flex-end; gap: 8px 24px; margin: 0; justify-self: stretch; }
.t-read p { display: flex; flex-direction: column; margin: 0; }
.t-read span { font-size: 13px; color: var(--ink-2); }
.t-read b { min-width: 2ch; font: 700 1.9rem/1 var(--display); font-variant-numeric: tabular-nums; }
.t-spark { flex: 1; min-width: 60px; height: 38px; overflow: visible; }
.t-spark polyline { fill: none; stroke: var(--ink); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.t-eq { margin: 0; font: 500 13px/1.7 var(--code); color: var(--ink-2); font-variant-numeric: tabular-nums; }
#demo-train .hint { margin: 14px 0 0; max-width: 64ch; }
#demo-train .hint code { font-size: .92em; }

@media (min-width: 900px) {
  .learn { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .learn .piece { grid-column: auto; }
}

.contact-lead { margin: -20px 0 28px; }
.email-fit {
  display: block; width: fit-content;
  font: 700 clamp(1.25rem, 6.6vw, 6.4rem)/1.05 var(--display);
  font-stretch: 78%;
  letter-spacing: -.018em;
  white-space: nowrap;
  text-decoration: none;
  transition: color .15s;
}
.contact-links { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin: 36px 0 0; }

.foot { padding: 0 var(--pad) 40px; max-width: 1380px; margin-inline: auto; color: var(--ink-2); font-size: 14px; }
.foot p { margin: 0; padding-top: 16px; border-top: 1px solid var(--line); }

/* ───────────── Demo: payment gateway ───────────── */

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.job-pieces { margin-top: 44px; }
#demo-pay .hint { margin: 14px 0 0; max-width: 72ch; }

.pay { padding: 22px; container-type: inline-size; }
.pay-in { display: grid; gap: 28px; }
@container (min-width: 700px) {
  .pay-in { grid-template-columns: minmax(0, 270px) minmax(0, 1fr); gap: 56px; align-items: center; max-width: 1000px; margin-inline: auto; padding: 14px 10px; }
}

/* the checkout */
.till { display: flex; flex-direction: column; gap: 12px; }
.till-top { display: flex; justify-content: space-between; align-items: baseline; margin: 0; font-size: 14px; color: var(--ink-2); }
.till-top b { font: 700 1.7rem/1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.plastic {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 12px;
  padding: 14px 16px; border-radius: 12px; background: var(--ink); color: #fff;
}
.plastic-chip { width: 30px; height: 22px; border-radius: 5px; background: linear-gradient(135deg, var(--proof), #E2A400); }
.plastic-no { font: 500 14.5px/1 var(--code); letter-spacing: .02em; white-space: nowrap; transition: color .25s; }
.plastic small { grid-column: 1 / -1; font-size: 12px; opacity: .7; }
.plastic.sending .plastic-no { color: var(--guide); }
.plastic.bad { animation: blocked .5s; }
.pay .viewas { align-self: stretch; }
.pay .viewas button { flex: 1; }
.pay-btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; padding: 0 16px;
  border: 0; border-radius: 8px; background: var(--select); color: #fff;
  font: 600 15px/1 var(--body); cursor: pointer;
  transition: background .25s, scale .12s;
}
.pay-btn:active, .pay-btn.pressed { scale: .97; }
.pay-btn .ring { display: none; border-color: rgba(255, 255, 255, .4); }
.pay-btn.busy { background: var(--ink); }
.pay-btn.busy .ring { display: block; border-top-color: #fff; animation: spin .8s linear infinite; }
.pay-btn.ok { background: var(--pass); }
.pay-btn.ok .ring { display: block; border-color: #fff; background: var(--check) center / 10px no-repeat; }
.pay-btn.bad { background: var(--deny); }
.pay-status { margin: -2px 0 0; min-height: 1.4em; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.pay-status.ok { color: var(--pass); }
.pay-status.bad { color: var(--deny); }

/* the sequence diagram: three lifelines, one message per row */
.seq { min-width: 0; }
.lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.lanes span {
  justify-self: center; display: grid; place-items: center;
  max-width: calc(100% - 6px); padding: 7px 10px;
  border: 1.5px solid var(--ink); border-radius: 8px; background: #fff;
  font: 600 13px/1.2 var(--body); text-align: center; text-wrap: balance;
}
.lanes span.hit { animation: node-hit .55s; }
.msgs {
  list-style: none; margin: 0; padding: 18px 0 14px;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 15px;
  background:
    linear-gradient(var(--line), var(--line)) 16.667% 0 / 1.5px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) 50% 0 / 1.5px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) 83.333% 0 / 1.5px 100% no-repeat;
}
.msg { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 4px; color: var(--ink); font: 500 12.5px/1.25 var(--body); opacity: 0; transition: opacity .25s; }
/* a message draws itself in; when the diagram resets it only fades */
.msg.on { opacity: 1; }
.m-13 { grid-column: 2 / 6; }
.m-12 { grid-column: 2 / 4; }
.m-23 { grid-column: 4 / 6; }
/* one message per row, in the order they are sent */
.msg:nth-child(1) { grid-row: 1; } .msg:nth-child(2) { grid-row: 2; } .msg:nth-child(3) { grid-row: 3; }
.msg:nth-child(4) { grid-row: 4; } .msg:nth-child(5) { grid-row: 5; } .msg:nth-child(6) { grid-row: 6; }
.msg-t { padding: 0 6px; background: #fff; white-space: nowrap; opacity: 0; translate: 0 4px; transition: opacity 0s .25s, translate 0s .25s; }
.msg-l { justify-self: stretch; height: 2px; background: currentColor; transform-origin: 0 50%; scale: 0 1; transition: scale 0s .25s; }
.msg.back .msg-l { transform-origin: 100% 50%; }
.msg::after {
  content: ""; position: absolute; bottom: -4px; right: -1px;
  border: 5px solid transparent; border-right: 0; border-left: 8px solid currentColor;
  opacity: 0; transition: opacity 0s .25s;
}
.msg.back::after { right: auto; left: -1px; border-left: 0; border-right: 8px solid currentColor; }
.msg.on .msg-t { opacity: 1; translate: 0 0; transition: opacity .3s .12s, translate .3s .12s; }
.msg.on .msg-l { scale: 1 1; transition: scale .5s var(--snap); }
.msg.on::after { opacity: 1; transition: opacity .15s .32s; }
/* the card number crosses the server's lifeline without touching it */
.msg.over { color: var(--guide); gap: 12px; }
.msg.over .msg-t { justify-self: start; margin-left: 9%; }
.msg.over .msg-l { background: linear-gradient(90deg, currentColor calc(50% - 8px), transparent 0, transparent calc(50% + 8px), currentColor 0); }
.msg.over::before {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 18px; height: 10px; translate: -50% 0;
  border: 2px solid currentColor; border-bottom: 0; border-radius: 10px 10px 0 0;
  opacity: 0; transition: opacity 0s .25s;
}
.msg.over.on::before { opacity: 1; transition: opacity .2s .2s; }
.msg.good { color: var(--pass); }
.msg.bad { color: var(--deny); }
.msg.good .msg-t, .msg.bad .msg-t { font-weight: 600; }

.pay-note { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }
.pay-note b { color: var(--ink); font-variant-numeric: tabular-nums; }

@media (max-width: 400px) {
  .pay { padding: 16px 12px; }
  .lanes span { padding-inline: 6px; font-size: 12px; }
  .msg { font-size: 12px; }
  .msg-t { padding-inline: 3px; }
}

/* ───────────── Reduced motion ───────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .js .snap-h { translate: 0 0; }
  .js .snap-h .h-sel { display: none; }
  .js .snap-h::before, .js .snap-h::after { display: none; }
  .js .chips li { translate: 0 0; rotate: 0deg; }
  .js .book-ico { rotate: 0deg; translate: 0 0; }
}
