/* ============================================================
   Prompt library — dark theme.
   Scoped to body.lib so it never leaks into the light pages.
   ============================================================ */
body.lib {
  --d-bg: #07080a;
  --d-panel: #0f1114;
  --d-panel-2: #14171c;
  --d-line: rgba(255,255,255,.10);
  --d-line-hi: rgba(255,255,255,.20);
  --d-ink: #f3f5f8;
  --d-ink-60: rgba(243,245,248,.64);
  --d-ink-40: rgba(243,245,248,.44);
  background: var(--d-bg);
  color: var(--d-ink);
}
body.lib ::selection { background: var(--cursor); color: #fff; }

/* nav sits on the dark ground */
body.lib .nav::before { background: rgba(10,11,14,.78); }
body.lib .nav.solid { border-bottom-color: var(--d-line); }
body.lib .brand, body.lib .brand-word { color: var(--d-ink); }
body.lib .nav .btn--ghost { color: var(--d-ink); border-color: var(--d-line); }
body.lib .nav .btn--solid { background: var(--d-ink); color: #0a0b0e; border-color: transparent; }
body.lib .nav .btn--solid::before { --btn-fill: var(--cursor); }
body.lib .lang span { color: var(--d-ink-40); }

/* ---------- hero ---------- */
.lib-hero {
  position: relative; overflow: hidden;
  max-width: var(--maxw); margin: 0 auto;
  padding: 150px var(--gutter) clamp(44px, 5vw, 76px);
  text-align: center;
}
.lib-hero > *:not(canvas) { position: relative; z-index: 1; }
.lib-hero canvas.dots { position: absolute; inset: 0; z-index: 0; }
.lib-eyebrow {
  display: inline-flex; align-items: center; gap: 9px; margin: 0;
  padding: 7px 15px; border: 1px solid var(--d-line); border-radius: 999px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--d-ink-60);
}
.lib-eyebrow i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--cursor); font-style: normal;
  box-shadow: 0 0 0 0 rgba(252,71,120,.55); animation: lib-pulse 2.4s infinite;
}
@keyframes lib-pulse {
  70% { box-shadow: 0 0 0 9px rgba(252,71,120,0); }
  100% { box-shadow: 0 0 0 0 rgba(252,71,120,0); }
}
.lib-hero h1 {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(42px, 7.4vw, 104px); line-height: .93; letter-spacing: -.05em;
  margin: 22px auto 0; max-width: 15ch; color: var(--d-ink);
}
.lib-hero h1 em { font-style: normal; color: var(--cursor); }
.lib-sub {
  margin: 22px auto 0; max-width: 56ch; color: var(--d-ink-60);
  font-size: clamp(15px, 1.2vw, 18.5px);
}
.lib-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 30px; }
.lib-cta .btn--solid { background: var(--d-ink); color: #0a0b0e; border-color: transparent; }
.lib-cta .btn--solid::before { --btn-fill: var(--cursor); }
.lib-cta .btn--ghost { color: var(--d-ink); border-color: var(--d-line-hi); }
.lib-cta .btn--ghost::before { --btn-fill: rgba(255,255,255,.10); }
.lib-facts {
  display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; align-items: center;
  margin: 26px 0 0; font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--d-ink-40);
}
.lib-facts b { color: var(--d-ink); font-weight: 400; }

/* ---------- grid ---------- */
.lib-wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) clamp(60px, 7vw, 110px); }
.lib-head {
  display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: baseline;
  justify-content: space-between; margin-bottom: 22px;
}
.lib-head h2 {
  font-family: var(--display); font-weight: 400; margin: 0;
  font-size: clamp(24px, 2.4vw, 36px); letter-spacing: -.04em; color: var(--d-ink);
}
.lib-head p { margin: 0; color: var(--d-ink-40); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }

.lib-grid {
  display: grid; gap: clamp(14px, 1.5vw, 22px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 900px) { .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .lib-grid { grid-template-columns: 1fr; } }

.lcard {
  position: relative; isolation: isolate; cursor: pointer;
  /* overflow clips the oversized ::before sweep — without it the rotating
     square pushes the page wider than the viewport on phones */
  overflow: hidden;
  border-radius: 18px; padding: 1px;          /* the 1px is the gradient border */
  background: var(--d-line);
  transition: transform .5s var(--ease);
}
/* the moving gradient line: a conic sweep that only shows through the 1px gutter */
.lcard::before {
  content: ""; position: absolute; inset: -40%; z-index: -1; border-radius: inherit;
  background: conic-gradient(from 0turn, transparent 0 62%, var(--cursor) 76%, #7ad7ff 84%, transparent 92% 100%);
  opacity: 0; transition: opacity .45s var(--ease);
  animation: lib-spin 3.4s linear infinite; animation-play-state: paused;
}
@keyframes lib-spin { to { transform: rotate(1turn); } }
.lcard:hover, .lcard:focus-within { transform: translateY(-3px); }
.lcard:hover::before, .lcard:focus-within::before, .lcard.is-open::before {
  opacity: 1; animation-play-state: running;
}
.lcard-in {
  position: relative; border-radius: 17px; overflow: hidden;
  background: var(--d-panel); height: 100%;
}
.lcard-media {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #0b0d10;
}
.lcard-media img, .lcard-media video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .8s var(--ease), opacity .4s linear;
}
.lcard:hover .lcard-media img, .lcard:hover .lcard-media video { transform: scale(1.04); }
.lcard-media video { position: absolute; inset: 0; opacity: 0; }
.lcard-media video.on { opacity: 1; }
.lcard-play {
  position: absolute; right: 12px; bottom: 12px; z-index: 2;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(10,11,14,.66); backdrop-filter: blur(6px); color: #fff; font-size: 10px;
  opacity: 0; transform: scale(.8); transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.lcard:hover .lcard-play { opacity: 1; transform: none; }
.lcard-body { display: flex; align-items: center; gap: 12px; padding: 14px 15px 16px; }
.lcard-body h3 {
  margin: 0; font-family: var(--sans); font-weight: 500; font-size: 15.5px;
  letter-spacing: -.01em; color: var(--d-ink); line-height: 1.25;
}
.lcard-kind { margin: 3px 0 0; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--d-ink-40); }
.lcard-tag {
  margin-left: auto; flex: none; align-self: flex-start;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--d-line);
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--d-ink-60);
}

/* ---------- modal ---------- */
.lib-modal {
  position: fixed; inset: 0; z-index: 200; display: none;
  padding: clamp(14px, 3vw, 44px); overflow-y: auto;
}
.lib-modal.on { display: flex; }
.lib-modal .scrim {
  position: fixed; inset: 0; background: rgba(4,5,7,.72);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  opacity: 0; transition: opacity .4s var(--ease);
}
.lib-modal.in .scrim { opacity: 1; }
.lib-sheet {
  position: relative; margin: auto; width: 100%; max-width: 820px;
  background: var(--d-panel); border: 1px solid var(--d-line); border-radius: 24px;
  box-shadow: 0 40px 120px -30px rgba(0,0,0,.85);
  overflow: hidden; opacity: 0; transform: translateY(18px) scale(.985);
  transition: opacity .45s var(--ease), transform .55s var(--ease);
}
.lib-modal.in .lib-sheet { opacity: 1; transform: none; }
.lib-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--d-line);
  background: rgba(10,11,14,.62); backdrop-filter: blur(8px); color: var(--d-ink);
  font-size: 16px; line-height: 1; cursor: pointer;
  transition: background .3s var(--ease), transform .3s var(--ease);
}
.lib-close:hover { background: var(--cursor); border-color: transparent; transform: rotate(90deg); }
.lib-stage { position: relative; aspect-ratio: 16 / 9; background: #0b0d10; }
.lib-stage img, .lib-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-stage video { position: absolute; inset: 0; opacity: 0; transition: opacity .4s linear; }
.lib-stage video.on { opacity: 1; }

.lib-doc { padding: clamp(20px, 2.4vw, 32px); }
.lib-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--d-line);
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--d-ink-60);
}
.pill--free { background: var(--d-ink); color: #0a0b0e; border-color: transparent; }
.lib-doc h2 {
  font-family: var(--display); font-weight: 500; margin: 16px 0 0;
  font-size: clamp(26px, 3.1vw, 42px); letter-spacing: -.045em; line-height: 1.02; color: var(--d-ink);
}
.lib-doc .desc { margin: 14px 0 0; color: var(--d-ink-60); max-width: 62ch; font-size: clamp(14.5px,1.05vw,16.5px); }
.lib-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 22px; }
.lib-actions .btn--solid { background: var(--d-ink); color: #0a0b0e; border-color: transparent; }
.lib-actions .btn--solid::before { --btn-fill: var(--cursor); }
.lib-actions .btn--ghost { color: var(--d-ink); border-color: var(--d-line-hi); }
.lib-actions .btn--ghost::before { --btn-fill: rgba(255,255,255,.10); }
.lib-note { margin: 14px 0 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--d-ink-40); }
.lib-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.lib-tags span { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--d-ink-40); border: 1px solid var(--d-line); border-radius: 6px; padding: 5px 8px; }

.lib-flow { margin-top: 30px; border-top: 1px solid var(--d-line); padding-top: 24px; }
.lib-flow > p.mono { margin: 0 0 16px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--d-ink-40); }
.lib-steps { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
@media (max-width: 680px) { .lib-steps { grid-template-columns: 1fr; } }
.lib-step { background: var(--d-panel-2); border: 1px solid var(--d-line); border-radius: 14px; padding: 16px; }
.lib-step b { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--cursor); font-weight: 400; }
.lib-step h4 { margin: 12px 0 0; font-family: var(--sans); font-weight: 500; font-size: 15px; color: var(--d-ink); }
.lib-step p { margin: 7px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--d-ink-60); }

.lib-foot {
  display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: center; justify-content: space-between;
  margin-top: 22px; padding: 18px 20px; border-radius: 16px;
  background: var(--d-panel-2); border: 1px solid var(--d-line);
}
.lib-foot h4 { margin: 0; font-family: var(--sans); font-weight: 500; font-size: 15.5px; color: var(--d-ink); }
.lib-foot p { margin: 5px 0 0; font-size: 13.5px; color: var(--d-ink-60); max-width: 46ch; }
.lib-foot .btn { flex: none; background: var(--d-ink); color: #0a0b0e; border-color: transparent; }
.lib-foot .btn::before { --btn-fill: var(--cursor); }
body.modal-open { overflow: hidden; }

/* ---------- ebook + lead form, darkened ---------- */
body.lib .section { background: transparent; }
body.lib .fan-head h2, body.lib .lead-copy h2, body.lib .fcard h3, body.lib .lead-copy h3 { color: var(--d-ink); }
body.lib .fan-head p, body.lib .fcard p, body.lib .lead-copy p, body.lib .lead-points li { color: var(--d-ink-60); }
body.lib .fan-head .mono, body.lib .lead-copy .mono { color: var(--d-ink-40); }
body.lib .fcard, body.lib .lead-wrap, body.lib .side-box {
  background: var(--d-panel); border-color: var(--d-line); box-shadow: none;
}
body.lib .fcard.is-lit { border-color: var(--d-line-hi); }
body.lib .fcard b, body.lib .fcard .fc-num, body.lib .lead-form input { color: var(--d-ink); }
body.lib .lead-form input {
  background: var(--d-panel-2); border: 1px solid var(--d-line); border-radius: 10px; padding: 14px 16px;
}
body.lib .lead-form input::placeholder { color: var(--d-ink-40); }
body.lib .lead-form .btn--solid { background: var(--d-ink); color: #0a0b0e; border-color: transparent; }
body.lib hr, body.lib .rule { border-color: var(--d-line); }

/* ---------- footer ---------- */
body.lib .foot { background: #0b0d10; }

/* anything still inheriting the light-theme ink tokens inside the dark page */
body.lib #ebook, body.lib #get-ebook, body.lib .lib-wrap {
  --ink: var(--d-ink);
  --ink-60: var(--d-ink-60);
  --ink-40: var(--d-ink-40);
  --hair: var(--d-line);
  --panel: var(--d-panel);
}
body.lib #ebook h2, body.lib #get-ebook h2 { color: var(--d-ink); }
/* ebook.css hardcodes a few light-theme colours rather than using tokens */
body.lib .fcard > p { color: var(--d-ink-60); }
body.lib .prod-meta li { color: var(--d-ink-60); }
body.lib .prod-meta .k { color: var(--d-ink-40); }
body.lib .fcard { background: var(--d-panel) !important; }
body.lib .fcard:hover, body.lib .fcard.is-lit { border-color: var(--d-line-hi); background: var(--d-panel-2) !important; }
body.lib .doc span { background: rgba(243,245,248,.18); }
body.lib .doc span:nth-child(1) { background: rgba(243,245,248,.36); }
body.lib .spread .sp { background: rgba(243,245,248,.24); }
body.lib .section-head p, body.lib .section-head .mono { color: var(--d-ink-60); }
body.lib .section-head h2 { color: var(--d-ink); }
/* ebook.css styles .lead-submit directly, so it out-specifies the generic rule */
body.lib .lead-form .btn--solid,
body.lib .lead-submit {
  background: var(--d-ink) !important; color: #0a0b0e !important; border-color: transparent;
}
body.lib .lead-submit::before { background: var(--cursor) !important; }

/* ============================================================
   Prompt detail pages, darkened to match the library.
   ============================================================ */
body.lib .pd-hero h1, body.lib .pd-body h2, body.lib .pd-body h3,
body.lib .pd-end h3, body.lib .pd-site h3, body.lib .sc-panel h1 { color: var(--d-ink); }
body.lib .pd-hero .lede, body.lib .pd-body p, body.lib .pd-end p,
body.lib .pd-site .desc, body.lib .pd-links p, body.lib .sc-lede { color: var(--d-ink-60); }
body.lib .pd-hero .crumbs a, body.lib .sc-panel .crumbs a { color: var(--d-ink-60); }
body.lib .pd-hero .crumbs a:hover, body.lib .sc-panel .crumbs a:hover { color: var(--d-ink); }
body.lib .pd-cap, body.lib .sc-kind, body.lib .pd-site .n { color: var(--d-ink-40); }
body.lib .pd-meta .chip {
  border-color: var(--d-line); color: var(--d-ink-60); background: transparent;
}
body.lib .pd-body code {
  background: rgba(255,255,255,.07); color: var(--d-ink); border-color: var(--d-line);
}
body.lib .pd-body a { color: var(--d-ink); }

/* the copy box, built like the modal sheet */
body.lib .pbox {
  background: var(--d-panel); border: 1px solid var(--d-line); border-radius: 18px;
  box-shadow: 0 24px 60px -24px rgba(0,0,0,.7); overflow: hidden;
}
body.lib .pbox-bar {
  background: var(--d-panel-2); border-bottom: 1px solid var(--d-line);
  padding: 12px 16px;
}
body.lib .pbox-bar .mono { color: var(--d-ink-40); }
body.lib .pbox pre {
  background: transparent; color: var(--d-ink-60); padding: 18px 20px 22px;
}
body.lib .pbox pre.is-code { color: #b7e3c6; }
body.lib .pbox .copy-btn {
  background: var(--d-ink); color: #0a0b0e; border: 0; border-radius: 999px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  padding: 8px 14px; cursor: pointer; transition: background .3s var(--ease), color .3s var(--ease);
}
body.lib .pbox .copy-btn:hover { background: var(--cursor); color: #fff; }
body.lib .pbox .copy-btn.done { background: var(--cursor); color: #fff; }

body.lib .pd-note {
  background: var(--d-panel-2); border: 1px solid var(--d-line);
  border-left: 2px solid var(--cursor); color: var(--d-ink-60);
}
body.lib .pd-img, body.lib .pd-cover .frame, body.lib .pd-showcase .sc-shot,
body.lib .pd-video { background: var(--d-panel); border-color: var(--d-line); }
body.lib .pd-site { border-color: var(--d-line); }
body.lib .pd-site .take { color: var(--d-ink-60); }
body.lib .pd-site .take b { color: var(--d-ink); }
body.lib .pd-links li { border-color: var(--d-line); }
body.lib .pd-links a { color: var(--d-ink); }
body.lib .pd-table th { color: var(--d-ink-40); border-color: var(--d-line); }
body.lib .pd-table td { color: var(--d-ink-60); border-color: var(--d-line); }
body.lib .pd-end .box, body.lib .pd-navcard {
  background: var(--d-panel); border-color: var(--d-line);
}
body.lib .pd-navcard:hover { background: var(--d-panel-2); border-color: var(--d-line-hi); }
body.lib .pd-navtext b { color: var(--d-ink); }
body.lib .pd-navtext .mono, body.lib .pd-navarrow { color: var(--d-ink-40); }
body.lib .pd-end .btn--solid, body.lib .sc-copy {
  background: var(--d-ink); color: #0a0b0e; border-color: transparent;
}
body.lib .pd-end .btn--solid::before, body.lib .sc-copy::before { --btn-fill: var(--cursor); }
body.lib .sc-panel { background: var(--d-panel); border-color: var(--d-line); }
body.lib .sc-link { color: var(--d-ink-60); border-bottom-color: var(--d-line); }
body.lib .sc-link:hover { color: var(--d-ink); border-bottom-color: var(--d-ink); }

/* ---------- tech marquee ---------- */
.lib-marquee {
  position: relative; margin-top: 34px;
  border-top: 1px solid var(--d-line); border-bottom: 1px solid var(--d-line);
  padding: 13px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  overflow: hidden;
}
.lib-track { display: flex; width: max-content; animation: lib-marquee 34s linear infinite; }
.lib-marquee:hover .lib-track { animation-play-state: paused; }
@keyframes lib-marquee { to { transform: translateX(-50%); } }
.lib-track span {
  display: inline-flex; align-items: center; gap: 9px; flex: none;
  padding: 0 22px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--d-ink-40); white-space: nowrap;
}
.lib-track span::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--cursor); opacity: .55;
}
@media (prefers-reduced-motion: reduce) { .lib-track { animation: none; } }

/* ============================================================
   Component pieces
   ============================================================ */
.pieces { max-width: var(--maxw); margin: 0 auto; padding: clamp(40px,5vw,80px) var(--gutter) clamp(60px,7vw,110px); }
.pieces-head { max-width: 62ch; }
.pieces-head .mono { margin: 0; color: var(--d-ink-40); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; }
.pieces-head h2 {
  font-family: var(--display); font-weight: 500; margin: 14px 0 0;
  font-size: clamp(32px, 4.4vw, 62px); letter-spacing: -.05em; line-height: .98; color: var(--d-ink);
}
.pieces-head p { margin: 16px 0 0; color: var(--d-ink-60); font-size: clamp(15px,1.15vw,17.5px); }
.pieces-grid {
  display: grid; gap: clamp(14px,1.5vw,22px); margin-top: clamp(26px,3vw,44px);
  grid-template-columns: repeat(3, minmax(0,1fr));
}
@media (max-width: 900px) { .pieces-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 620px) { .pieces-grid { grid-template-columns: 1fr; } }

.piece {
  position: relative; overflow: hidden; border-radius: 18px;
  background: var(--d-panel); border: 1px solid var(--d-line);
  transition: border-color .4s var(--ease), transform .5s var(--ease);
}
.piece:hover { border-color: var(--d-line-hi); transform: translateY(-3px); }
.piece-stage {
  position: relative; aspect-ratio: 16 / 11; overflow: hidden;
  background: radial-gradient(120% 100% at 50% 0%, #12161c, #0a0c0f);
  display: grid; place-items: center;
}
.piece-body { padding: 15px 16px 17px; display: flex; align-items: flex-start; gap: 12px; }
.piece-body h3 { margin: 0; font-family: var(--sans); font-weight: 500; font-size: 15.5px; color: var(--d-ink); }
.piece-body p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--d-ink-60); }
.piece-kind {
  margin-left: auto; flex: none; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--d-line); font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--d-ink-40);
}

/* 1 focus reveal */
.fr-stage { position: relative; width: 100%; padding: 0 clamp(14px,4%,26px); }
.fr-copy {
  position: relative; z-index: 2; margin: 0; text-align: center;
  font-family: var(--display); font-weight: 500; letter-spacing: -.035em;
  font-size: clamp(19px, 7.4cqw, 44px); line-height: 1.16; color: var(--d-ink);
}
.piece-stage { container-type: inline-size; }
.fr-w { display: inline-block; transition: none; }
.fr-frame {
  position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;
  border: 1px solid rgba(252,71,120,.85); border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(252,71,120,.16), 0 0 22px rgba(252,71,120,.22);
}
.fr-frame::before, .fr-frame::after {
  content: ""; position: absolute; width: 7px; height: 7px; border: 1px solid var(--cursor);
}
.fr-frame::before { top: -4px; left: -4px; border-right: 0; border-bottom: 0; }
.fr-frame::after { bottom: -4px; right: -4px; border-left: 0; border-top: 0; }

/* 3 carousel ring */
.cr-stage { position: absolute; inset: 0; perspective: 900px; }
.cr-card {
  position: absolute; left: 50%; top: 50%;
  width: 17%; aspect-ratio: 3/4; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 10px 26px rgba(0,0,0,.5);
  will-change: transform;
}

/* 4 card folder — three on a rail */
.cf-row { position: absolute; inset: 11% 6%; display: flex; gap: 3.5%; align-items: center; justify-content: center; }
.cf-card {
  position: relative; flex: 1 1 0; max-width: 31%; aspect-ratio: 3/4;
  border-radius: 11px; overflow: hidden; cursor: pointer; outline: none;
  transition: transform .6s var(--ease), opacity .5s var(--ease), filter .5s var(--ease);
}
.cf-row:hover .cf-card, .cf-row:focus-within .cf-card { transform: scale(.93); opacity: .6; filter: saturate(.6); }
.cf-row .cf-card:hover, .cf-row .cf-card:focus {
  transform: translateY(-7%) scale(1.07); opacity: 1; filter: none; z-index: 2;
}
.cf-sheen { position: absolute; inset: 0; border-radius: 11px; filter: saturate(1.1); }
.cf-object {
  position: absolute; left: 50%; bottom: 14%; width: 52%; aspect-ratio: 1;
  display: grid; place-items: center; border-radius: 9px; background: var(--g, #fff);
  transform: translate(-50%, 40%) rotate(-7deg);
  box-shadow: 0 12px 26px rgba(0,0,0,.5); transition: transform .7s var(--ease);
}
.cf-object span { font-size: clamp(12px, 3.6cqw, 22px); color: #10131a; }
.cf-face { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform .7s var(--ease); }
.cf-tab {
  position: absolute; left: 0; right: 0; bottom: 7%; text-align: center;
  font-family: var(--mono); font-size: clamp(7px, 1.7cqw, 9.5px); letter-spacing: .12em;
  text-transform: uppercase; color: rgba(243,245,248,.72); transition: opacity .4s var(--ease);
}
.cf-card:hover .cf-face, .cf-card:focus .cf-face { transform: translateY(52%); }
.cf-card:hover .cf-object, .cf-card:focus .cf-object { transform: translate(-50%, -4%) rotate(3deg); }
.cf-card:hover .cf-tab, .cf-card:focus .cf-tab { opacity: 0; }

/* 5 card bookmark — three on a rail */
.cb-row { position: absolute; inset: 10% 6%; display: flex; gap: 3.5%; align-items: center; justify-content: center; }
.cb-card {
  position: relative; flex: 1 1 0; max-width: 31%; aspect-ratio: 3/4;
  border-radius: 11px; overflow: hidden; cursor: pointer; background: #0d1014; outline: none;
  -webkit-mask-image: radial-gradient(16px at 50% 100%, transparent 15px, #000 16px);
          mask-image: radial-gradient(16px at 50% 100%, transparent 15px, #000 16px);
  transition: transform .55s var(--ease), opacity .5s var(--ease);
}
.cb-row:hover .cb-card, .cb-row:focus-within .cb-card { opacity: .58; transform: scale(.96); }
.cb-row .cb-card:hover, .cb-row .cb-card:focus { opacity: 1; transform: translateY(-6%) scale(1.04); z-index: 2; }
.cb-art {
  position: absolute; inset: 0; background: linear-gradient(160deg, #5a6376, #12161e 70%);
  filter: grayscale(1) contrast(1.05); transition: filter .7s var(--ease);
}
.cb-art::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(68% 52% at 32% 26%, rgba(255,255,255,.26), transparent 62%);
}
.cb-bloom {
  position: absolute; inset: 0; opacity: 0; transition: opacity .7s var(--ease);
  background: var(--bloom); mix-blend-mode: screen; filter: blur(7px) saturate(1.3);
}
.cb-flag {
  position: absolute; top: 0; right: 13%; width: 17%; height: 28%;
  background: var(--cursor); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
  transform: translateY(-8%); transition: transform .55s var(--ease);
}
.cb-meta { position: absolute; left: 0; right: 0; bottom: 13%; text-align: center; padding: 0 6px; }
.cb-meta b { display: block; font-family: var(--sans); font-weight: 500; font-size: clamp(9px,2.1cqw,12.5px); color: #fff; }
.cb-meta span { font-family: var(--mono); font-size: clamp(6.5px,1.5cqw,8.5px); letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.62); }
.cb-card:hover .cb-art, .cb-card:focus .cb-art { filter: grayscale(0) contrast(1.08) saturate(1.25); }
.cb-card:hover .cb-bloom, .cb-card:focus .cb-bloom { opacity: .8; }
.cb-card:hover .cb-flag, .cb-card:focus .cb-flag { transform: translateY(0); }

/* 6 expanded cards */
.ec-rail { position: absolute; inset: 10% 7%; display: flex; gap: 8px; }
.ec-item {
  position: relative; flex: 0 0 auto; width: 13%; height: 100%; border-radius: 10px;
  background: #11151b; border: 1px solid rgba(255,255,255,.12); overflow: hidden; cursor: pointer;
  transition: width .62s cubic-bezier(.22,1,.36,1), filter .5s var(--ease);
  filter: brightness(.8); outline: none;
}
.ec-item.on { width: 44%; filter: brightness(1.05); }
.ec-blob {
  position: absolute; inset: 0;
  background: radial-gradient(70% 55% at 50% 34%, rgba(255,255,255,.34), transparent 62%), var(--art);
  opacity: .92;
}
.ec-blob::after {
  content: ""; position: absolute; left: 50%; top: 38%; width: 58%; aspect-ratio: 1;
  transform: translate(-50%,-50%); border-radius: 46% 54% 58% 42% / 52% 44% 56% 48%;
  background: radial-gradient(60% 60% at 36% 30%, rgba(255,255,255,.85), rgba(255,255,255,.08) 58%, transparent 72%);
  filter: blur(.5px);
}
.ec-item::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(6,8,11,.86) 0%, rgba(6,8,11,.12) 48%, transparent 70%);
}
.ec-cap {
  position: absolute; left: 0; bottom: 0; z-index: 2; width: 44cqw;
  padding: 10px 12px; opacity: 0; transform: translateY(6px);
  transition: opacity .4s var(--ease) .12s, transform .5s var(--ease) .12s;
}
.ec-item.on .ec-cap { opacity: 1; transform: none; }
.ec-cap b { display: block; font-family: var(--sans); font-weight: 500; font-size: 13px; color: #fff; white-space: nowrap; }
.ec-cap span { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.66); white-space: nowrap; }

/* 7 particle cloak */
.pc-under { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; }
.pc-under b {
  font-family: var(--display); font-weight: 500; font-size: clamp(20px, 6cqw, 40px);
  letter-spacing: -.045em;
  background: linear-gradient(120deg, #ff6ea9, #ffd36e 45%, #6ef0ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pc-under span { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--d-ink-40); }

/* 8 glow ring button */
.gr-btn {
  display: inline-flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 9px 20px 9px 9px; border-radius: 999px;
  background: rgba(255,255,255,.05); border: 1px solid var(--d-line); color: var(--d-ink);
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  transition: background .4s var(--ease), border-color .4s var(--ease);
}
.gr-btn:hover { background: rgba(255,255,255,.09); border-color: var(--d-line-hi); }
.gr-disc {
  position: relative; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; background: #0c0e12; color: var(--d-ink);
}
.gr-disc svg { width: 15px; height: 15px; position: relative; z-index: 2; }
.gr-ring {
  position: absolute; inset: -2px; border-radius: 50%; z-index: 1;
  background: conic-gradient(from 0turn, transparent 0 58%, #ff6ea9 68%, #ffd36e 76%, #6ef0ff 84%, transparent 92%);
  animation: gr-orbit 2.6s linear infinite, gr-hue 7s linear infinite;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
}
.gr-btn:hover .gr-ring { animation-play-state: paused, running; }
@keyframes gr-orbit { to { transform: rotate(1turn); } }
@keyframes gr-hue { to { filter: hue-rotate(360deg); } }
.gr-label { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .gr-ring, .lib-track { animation: none; }
}

/* the component modal runs the piece live instead of showing a video */
.piece-live {
  aspect-ratio: 16 / 9; position: relative; container-type: inline-size;
  background: radial-gradient(120% 100% at 50% 0%, #12161c, #0a0c0f);
  display: grid; place-items: center; overflow: hidden;
}
.piece-modal .lib-actions .btn[disabled] { opacity: .5; pointer-events: none; }
.piece { cursor: pointer; outline: none; }
.piece:focus-visible { border-color: var(--cursor); }

/* 10 scroll key */
.sk-stage { position: absolute; inset: 0; display: grid; place-items: center; perspective: 620px; }
.sk-cap {
  position: relative; width: 42%; aspect-ratio: 1.18/1; border-radius: 15px;
  transform-style: preserve-3d; cursor: pointer; outline: none;
  background:
    radial-gradient(120% 100% at var(--lx,50%) var(--ly,50%), rgba(168,120,255,.5), transparent 58%),
    linear-gradient(165deg, rgba(255,255,255,.16), rgba(255,255,255,.02) 46%, rgba(0,0,0,.34));
  border: 1px solid rgba(255,255,255,.16);
  box-shadow:
    0 calc(18px - var(--press,0) * 14px) calc(34px - var(--press,0) * 20px) rgba(0,0,0,.6),
    inset 0 1px 0 rgba(255,255,255,.34),
    inset 0 -8px 16px rgba(0,0,0,.42);
  backdrop-filter: blur(3px);
  will-change: transform;
}
.sk-rim {
  position: absolute; inset: -1px; border-radius: 16px; pointer-events: none;
  background: conic-gradient(from 210deg, transparent, #a878ff 22%, transparent 42%, transparent 62%, #6ef0ff 78%, transparent);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  opacity: .8;
}
.sk-face { position: absolute; inset: 0; display: grid; place-items: center; }
/* the label is carved, not printed: a dark top shadow and a light bottom one */
.sk-face b {
  font-family: var(--mono); font-size: clamp(8px, 2.4cqw, 13px); letter-spacing: .2em;
  text-transform: uppercase; color: rgba(12,10,20,.62);
  text-shadow: 0 -1px 0 rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.30);
}
.sk-gloss {
  position: absolute; left: 8%; right: 8%; top: 6%; height: 34%; border-radius: 12px 12px 40% 40%;
  background: linear-gradient(180deg, rgba(255,255,255,.34), rgba(255,255,255,0));
  pointer-events: none;
}

/* 11 spotlight carousel */
.sp-rail { position: absolute; inset: 12% 6%; display: flex; gap: 6px; align-items: stretch; }
.sp-frame {
  position: relative; flex: 0 0 auto; width: 15%; margin: 0; border-radius: 9px;
  overflow: hidden; cursor: pointer; outline: none;
  background: #0d1015; border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 12px 26px rgba(0,0,0,.45);
  transition: width .6s cubic-bezier(.22,1,.36,1), filter .5s var(--ease);
  filter: brightness(.74) saturate(.8);
}
.sp-frame.on { width: 40%; filter: none; }
/* the picture is wider than the closed frame and re-crops as it opens:
   background-size stays fixed, so nothing stretches */
.sp-pic {
  position: absolute; inset: 0;
  background-image: radial-gradient(60% 50% at 34% 30%, rgba(255,255,255,.4), transparent 60%), var(--art);
  background-size: 260% 100%; background-position: 50% 50%;
  transition: background-size .6s cubic-bezier(.22,1,.36,1), background-position .6s cubic-bezier(.22,1,.36,1);
}
.sp-frame.on .sp-pic { background-size: 118% 100%; background-position: 46% 50%; }
.sp-frame figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 10px 12px;
  width: 40cqw; opacity: 0; transform: translateY(6px);
  background: linear-gradient(to top, rgba(6,8,11,.9), transparent);
  transition: opacity .38s var(--ease) .14s, transform .5s var(--ease) .14s;
}
.sp-frame.on figcaption { opacity: 1; transform: none; }
.sp-frame figcaption b { display: block; font-family: var(--sans); font-weight: 500; font-size: 12.5px; color: #fff; white-space: nowrap; }
.sp-frame figcaption span { font-family: var(--mono); font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.66); white-space: nowrap; }

/* 12 send hello */
.sh-form {
  position: relative; display: flex; align-items: center; gap: 8px; width: 74%;
  padding: 6px 6px 6px 16px; border-radius: 999px;
  background: rgba(255,255,255,.05); border: 1px solid var(--d-line);
  transition: width .5s var(--ease), padding .5s var(--ease), background .4s var(--ease);
}
.sh-input {
  flex: 1 1 auto; min-width: 0; background: none; border: 0; outline: none; color: var(--d-ink);
  font-family: var(--sans); font-size: clamp(12px, 2.6cqw, 15px);
  transition: opacity .3s var(--ease), transform .45s var(--ease);
}
.sh-input::placeholder { color: var(--d-ink-40); }
.sh-send {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; border: 0; cursor: pointer; background: var(--d-ink); color: #0a0b0e;
  transition: background .4s var(--ease), transform .5s var(--ease);
}
.sh-send svg { width: 16px; height: 16px; }
.sh-ico { position: absolute; display: grid; place-items: center; transition: opacity .3s var(--ease), transform .4s var(--ease); }
.sh-ico--tick { opacity: 0; transform: scale(.5) rotate(-40deg); }
.sh-flight {
  position: absolute; left: 16px; top: 50%; z-index: 3; color: var(--cursor);
  opacity: 0; transform: translateY(-50%); pointer-events: none;
}
.sh-flight svg { width: 18px; height: 18px; }
/* sending: the text leaves as a plane, the field closes up behind it */
.sh-form.sending .sh-input { opacity: 0; transform: translateX(14px); }
.sh-form.sending .sh-flight { animation: sh-fly .62s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes sh-fly {
  0%   { opacity: 0; transform: translate(0,-50%) scale(.7); }
  18%  { opacity: 1; }
  100% { opacity: 0; transform: translate(240%, -190%) scale(1.15) rotate(12deg); }
}
.sh-form.sent { width: 48%; padding-left: 6px; background: rgba(252,71,120,.10); }
.sh-form.sent .sh-input { opacity: 0; }
.sh-form.sent .sh-send { background: var(--cursor); color: #fff; transform: scale(1.06); }
.sh-form.sent .sh-ico--plane { opacity: 0; transform: scale(.5) rotate(30deg); }
.sh-form.sent .sh-ico--tick { opacity: 1; transform: none; }

/* 13-16 mesh shaders */
.mesh-fallback { position: absolute; inset: 0; }
