/* =========================================================================
   bekavisuals.com
   Two themes, one set of tokens. Everything else reads from these.
   ========================================================================= */

:root,
[data-theme="dark"] {
  --page:          #09090a;
  --bg:            radial-gradient(120% 90% at 50% 45%, #121213 0%, #09090a 62%, #050506 100%);
  --fg:            #E8E4DC;

  --card-bg:       #131315;
  --card-bd:       rgba(232, 228, 220, 0.10);
  --card-shadow:   0 18px 60px -20px rgba(0, 0, 0, 0.9);

  --stripe-bg:     #101012;
  --stripe-img:    repeating-linear-gradient(115deg, rgba(232,228,220,0.055) 0 2px, rgba(232,228,220,0) 2px 9px);

  --cap-grad:      linear-gradient(to top, rgba(5,5,6,0.86), rgba(5,5,6,0));
  --cap-title:     rgba(232, 228, 220, 0.92);
  --cap-tag:       rgba(232, 228, 220, 0.45);

  --back-bg:       #0d0d0f;
  --back-bd:       rgba(232, 228, 220, 0.16);
  --back-shadow:   0 30px 90px -24px rgba(0, 0, 0, 0.95);
  --rule:          rgba(232, 228, 220, 0.14);

  --body:          rgba(232, 228, 220, 0.68);
  --meta:          rgba(232, 228, 220, 0.5);
  --faint:         rgba(232, 228, 220, 0.34);
  --dim:           rgba(232, 228, 220, 0.55);
  --outline:       rgba(232, 228, 220, 0.28);
  --nav:           rgba(232, 228, 220, 0.75);
  --nav-bg:        rgba(9, 9, 10, 0.72);
  --nav-bg-hover:  rgba(232, 228, 220, 0.13);
  --nav-bd:        rgba(232, 228, 220, 0.3);

  --chip-bg:       rgba(232, 228, 220, 0.03);
  --chip-fg:       rgba(232, 228, 220, 0.6);
  --chip-bd:       rgba(232, 228, 220, 0.16);
  --chip-on-bg:    #E8E4DC;
  --chip-on-fg:    #09090a;
  --hover-wash:    rgba(232, 228, 220, 0.08);
}

[data-theme="light"] {
  --page:          #EFECE4;
  --bg:            radial-gradient(120% 90% at 50% 45%, #FAF8F3 0%, #EFECE4 62%, #E4E0D6 100%);
  --fg:            #17171A;

  --card-bg:       #FFFFFF;
  --card-bd:       rgba(23, 23, 26, 0.10);
  --card-shadow:   0 18px 50px -22px rgba(23, 23, 26, 0.35);

  --stripe-bg:     #F2EFE8;
  --stripe-img:    repeating-linear-gradient(115deg, rgba(23,23,26,0.07) 0 2px, rgba(23,23,26,0) 2px 9px);

  --cap-grad:      linear-gradient(to top, rgba(255,255,255,0.94), rgba(255,255,255,0));
  --cap-title:     rgba(23, 23, 26, 0.9);
  --cap-tag:       rgba(23, 23, 26, 0.45);

  --back-bg:       #FFFDF9;
  --back-bd:       rgba(23, 23, 26, 0.14);
  --back-shadow:   0 30px 80px -28px rgba(23, 23, 26, 0.4);
  --rule:          rgba(23, 23, 26, 0.14);

  --body:          rgba(23, 23, 26, 0.66);
  --meta:          rgba(23, 23, 26, 0.5);
  --faint:         rgba(23, 23, 26, 0.36);
  --dim:           rgba(23, 23, 26, 0.55);
  --outline:       rgba(23, 23, 26, 0.24);
  --nav:           rgba(23, 23, 26, 0.7);
  --nav-bg:        rgba(255, 253, 249, 0.8);
  --nav-bg-hover:  rgba(23, 23, 26, 0.09);
  --nav-bd:        rgba(23, 23, 26, 0.26);

  --chip-bg:       rgba(23, 23, 26, 0.02);
  --chip-fg:       rgba(23, 23, 26, 0.6);
  --chip-bd:       rgba(23, 23, 26, 0.14);
  --chip-on-bg:    #17171A;
  --chip-on-fg:    #FAF8F3;
  --hover-wash:    rgba(23, 23, 26, 0.06);
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--fg);
  overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.7; }
::selection { background: var(--fg); color: var(--page); }

.serif { font-family: 'Instrument Serif', Georgia, 'Times New Roman', serif; }
.mono  { font-family: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace; }

.root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Instrument Sans', Helvetica, Arial, sans-serif;
  color: var(--fg);
  user-select: none;
}

/* ---------- the card cloud ---------- */

.stage {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
  perspective: 1600px;
}
.stage.is-dragging { cursor: grabbing; }
.stage.is-focused,
.stage.is-focused .card { cursor: default; }

/* an open piece reads like a page: its copy is selectable and gets a real
   text cursor, the player keeps its own. */
.stage.is-focused .card-back {
  cursor: auto;
  user-select: text;
  -webkit-user-select: text;
}

/* main.js adds .is-open once the flip has landed — the card leaves 3D so the
   copy and the player are what the mouse actually hits. */
.card.is-open,
.card.is-open .card-flip { transform-style: flat; }
.card.is-open .card-back {
  transform: none;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
}

.card {
  position: absolute;
  left: 0;
  top: 0;
  width: 220px;
  height: 124px;
  opacity: 0;
  transform: translate3d(-9999px, -9999px, 0);
  transform-style: preserve-3d;
  will-change: transform, width, height;
}

.card-flip {
  position: relative;
  width: 100%;
  height: 100%;
  transform: rotateY(0deg);
  transform-style: preserve-3d;
}

.card-face {
  position: absolute;
  inset: 0;
  visibility: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* front */

.card-front {
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  box-shadow: var(--card-shadow);
}

.card-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background-size: cover;
  background-position: center;
}

.card-stripes {
  width: 100%;
  height: 100%;
  background-color: var(--stripe-bg);
  background-image: var(--stripe-img);
}

.card-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 8px 9px;
  background: var(--cap-grad);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}
.cap-title {
  color: var(--cap-title);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cap-tag {
  color: var(--cap-tag);
  flex: 0 0 auto;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* back */

.card-back {
  transform: rotateY(180deg);
  background: var(--back-bg);
  border: 1px solid var(--back-bd);
  box-shadow: var(--back-shadow);
  padding: 30px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

.back-rule {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--meta);
}

.back-title {
  margin: 0;
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: 40px;
  line-height: 0.98;
  letter-spacing: -0.015em;
}

.back-blurb {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--body);
  max-width: 46ch;
  text-wrap: pretty;
}

.back-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.back-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--meta);
}

.back-pos {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- focused-card navigation ---------- */

.nav {
  position: absolute;
  z-index: 40000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  color: var(--nav);
}

.nav-btn {
  background: var(--nav-bg);
  border: 1px solid var(--nav-bd);
  color: var(--fg);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.nav-btn:hover { background: var(--nav-bg-hover); border-color: var(--fg); }

.nav-arrow {
  top: 50%;
  margin-top: -27px;
  width: 54px;
  height: 54px;
  font-size: 21px;
  line-height: 1;
}
.nav-prev { left: 26px; }
.nav-next { right: 26px; }
.nav-prev:hover { transform: translateX(-2px); }
.nav-next:hover { transform: translateX(2px); }

.nav-close {
  top: 28px;
  right: 30px;
  width: 46px;
  height: 46px;
  font-size: 17px;
  line-height: 1;
}
.nav-close:hover { transform: rotate(90deg); }

.nav-copy {
  top: 28px;
  right: 84px;
  height: 46px;
  padding: 0 16px;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-copy.is-copied { border-color: var(--fg); background: var(--nav-bg-hover); }

/* ---------- persistent UI ---------- */

.ui {
  position: absolute;
  z-index: 20000;
  transition: opacity 200ms ease;
}

.ui-brand {
  top: 30px;
  left: 34px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.ui-brand h1 {
  pointer-events: auto;
  cursor: pointer;
  margin: 0;
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: 34px;
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.ui-brand p {
  margin: 0;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--meta);
}

.ui-links {
  top: 32px;
  right: 86px;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.ui-links a { color: var(--dim); }
.ui-links a.boxed,
.ui-links button {
  border: 1px solid var(--outline);
  color: var(--fg);
  padding: 8px 14px;
}
.ui-links button {
  font: inherit;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 8px 11px;
  cursor: pointer;
  background: transparent;
}
.ui-links button:hover { background: var(--hover-wash); }

.ui-intro {
  bottom: 34px;
  left: 34px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.ui-intro p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--body);
  text-wrap: pretty;
}
.ui-intro .hint {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

/* sections: a menu button top right, a plain list drops down from it */
.ui-menu {
  top: 32px;
  right: 34px;
}
.menu-btn {
  width: 40px;
  height: 31px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--outline);
}
.menu-btn span {
  display: block; width: 16px; height: 1px; background: var(--fg);
  transition: transform 200ms ease, opacity 200ms ease;
}
.menu-btn:hover { background: var(--hover-wash); }
.is-open .menu-btn span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.is-open .menu-btn span:nth-child(2) { opacity: 0; }
.is-open .menu-btn span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

.ui-filters {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  background: var(--back-bg);
  box-shadow: var(--back-shadow);
  border: 1px solid var(--outline);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms;
}
.ui-menu.is-open .ui-filters {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.chip {
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 11px 18px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: 0;
  color: var(--dim);
  transition: color 160ms ease, background 160ms ease;
}
.chip:hover { color: var(--fg); background: var(--hover-wash); }
.chip[aria-pressed="true"] { color: var(--fg); box-shadow: inset 2px 0 0 var(--fg); }
.chip .count { opacity: 0.45; }

/* ---------- the opened panel ----------
   A piece with a `video` opens wider than its card: the finished film on one
   side, the copy on the other. main.js sizes the card; this lays out the two
   halves. Specificity beats the small-screen .card-back overrides on purpose. */

.card-back.card-back-wide {
  flex-direction: row;
  align-items: stretch;
  padding: 0;
  gap: 0;
}

.back-media {
  position: relative;
  flex: 0 0 auto;
  height: 100%;
  background: #000;
  border-right: 1px solid var(--rule);
}

.back-video {
  display: block;
  cursor: default;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* A piece of stills fills its half of the panel and keeps going below the fold —
   the column is taller than one still, so the next one shows underneath and you
   scroll straight down through the set. */
.back-gallery {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background: #000;
  scrollbar-width: none;
}
.back-gallery::-webkit-scrollbar { width: 0; height: 0; }

.back-image {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  object-fit: cover;      /* the reserved slot is the set's ratio, not each file's */
  background: #000;
}

.gal-count {
  position: absolute;
  right: 12px;
  bottom: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.74);
  pointer-events: none;
}

.gal-hint {
  position: absolute;
  left: 12px;
  bottom: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.back-copy {
  flex: 1 1 auto;
  min-width: 0;
  padding: 30px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

/* Stacked: the film on top, the description under it. main.js adds the class
   from the film's shape and the viewport — a landscape film beside a text
   column makes a panel wider than the screen. */
.card-back.card-back-wide.card-back-stack { flex-direction: column; }
.card-back-stack .back-media {
  flex: 0 0 auto;
  width: 100%;
  height: auto;            /* the inline aspect-ratio sets it from the width */
  border-right: 0;
  border-bottom: 1px solid var(--rule);
}
.card-back-stack .back-copy { flex: 1 1 auto; }
.card-back-stack .back-blurb { max-width: 62ch; }

@media (max-width: 760px) {
  .back-copy { padding: 18px 20px; gap: 10px; }
  .back-copy .back-title { font-size: 26px; }
  .back-copy .back-blurb {
    font-size: 12px;
    max-width: none;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ---------- a written-up piece ----------
   `story` in work.js opens the panel as one column you scroll straight down:
   the film, the chapters, the sheets. Same tokens as everything else — the
   dividers between sections are what give it the rhythm of a page. */

.card-back.card-back-doc {
  padding: 0;
  gap: 0;
  display: block;
}

.doc-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;              /* the stage sets touch-action: none */
  scrollbar-width: thin;
  padding: 40px clamp(24px, 5vw, 72px) 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* the header block reads bigger here — the panel is the page */
.card-back-doc .back-title { font-size: clamp(36px, 5vw, 62px); }
.card-back-doc .back-blurb { max-width: 62ch; font-size: 15px; line-height: 1.62; }
.card-back-doc .back-foot  { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--rule); }

/* the film sits at the top of the column */
.doc-film {
  position: relative;
  width: 100%;
  margin-top: 14px;
  background: #000;
  border: 1px solid var(--card-bd);
}
.doc-video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.doc-img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 26px;
  border: 1px solid var(--card-bd);
  background: var(--card-bg);
}

.doc-cap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 11px;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

/* a chapter — the rule above it is the divider */
.doc-sec {
  margin-top: 44px;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
}

.doc-num {
  margin: 0 0 22px;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}
.doc-num b { font-weight: 400; color: var(--meta); margin-right: 14px; }

.doc-head {
  margin: 0 0 22px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  max-width: 22ch;
}

.doc-body {
  margin: 0 0 15px;
  max-width: 64ch;
  font-size: 14px;
  line-height: 1.72;
  color: var(--body);
  text-wrap: pretty;
}
.doc-body:last-child { margin-bottom: 0; }

.doc-quote {
  margin: 30px 0 0;
  padding-left: 20px;
  border-left: 1px solid var(--outline);
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 22px;
  line-height: 1.35;
  color: var(--fg);
  max-width: 34ch;
}
.doc-quote span {
  display: block;
  margin-top: 10px;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

/* a vertical film — held to a column its caption shares */
.doc-vert {
  width: min(100%, calc(74vh * 9 / 16));
  margin-inline: auto;
}

/* a sheet read beside its notes — image left, reading column right */
.doc-split {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 30px 48px;
  align-items: start;
  margin-top: 44px;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
}
/* the row that opens the piece — it starts on the media, so no divider above */
.doc-split-lead { margin-top: 0; padding-top: 0; border-top: 0; }
.doc-split-txt .back-rule  { margin-bottom: 22px; }
.doc-split-txt .back-title { margin-bottom: 16px; font-size: clamp(30px, 3.4vw, 46px); }
.doc-split-txt .back-blurb { margin-bottom: 0; font-size: 14px; line-height: 1.62; }
.doc-split-img .doc-img { margin-top: 0; }
.doc-split-img .doc-film { margin-top: 0; }
.doc-split-txt .doc-num { margin-bottom: 18px; }
.doc-split-txt .doc-head {
  font-size: clamp(22px, 2.4vw, 31px);
  max-width: 20ch;
  margin-bottom: 18px;
}
.doc-split-txt .doc-body { font-size: 13.5px; }
.doc-split-meta {
  margin-top: 26px;
  border-top: 1px solid var(--rule);
}
.doc-split-meta div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
}
.doc-split-meta .doc-k { padding-top: 3px; }

/* source material, two up and two down */
.doc-quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px 24px;
  margin-top: 44px;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
}
.doc-quad-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border: 1px solid var(--card-bd);
  background: var(--card-bg);
}
.doc-quad-cell .doc-cap { margin-top: 9px; }
.doc-quad-note {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 0 0;
}
/* a full grid takes its notes as a heading across the top instead */
.doc-quad-lead {
  grid-column: 1 / -1;
  display: block;
  padding: 0;
  margin-bottom: 6px;
}
.doc-quad-lead .doc-head { max-width: 24ch; }
.doc-quad-lead .doc-body { max-width: 62ch; }
.doc-quad-note .doc-num  { margin-bottom: 16px; }
.doc-quad-note .doc-head { font-size: clamp(21px, 2.2vw, 28px); margin-bottom: 16px; max-width: 18ch; }
.doc-quad-note .doc-body { font-size: 13.5px; }

/* a character */
.doc-who {
  margin-top: 44px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.doc-who-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.doc-who-name {
  margin: 0;
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: 32px;
  line-height: 1.05;
}
.doc-who-role {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.doc-who-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-top: 22px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.doc-who-meta div { display: flex; flex-direction: column; gap: 7px; }

.doc-k {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 400;
  margin: 0;
}
.doc-v { font-size: 13.5px; color: var(--fg); }

/* the craft notes */
.doc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 38px 44px;
  margin-top: 38px;
}
.doc-item { padding-top: 18px; border-top: 1px solid var(--rule); }
.doc-item .doc-k { margin-bottom: 7px; }
.doc-lead {
  margin: 0 0 9px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 20px;
  line-height: 1.25;
}
.doc-item .doc-body { font-size: 13px; margin: 0; }

/* the pipeline */
.doc-steps {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
  margin: 38px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: s;
}
.doc-steps li {
  padding-top: 15px;
  border-top: 1px solid var(--rule);
  font-size: 12.5px;
  line-height: 1.45;
}
.doc-steps li::before {
  counter-increment: s;
  content: "0" counter(s);
  display: block;
  margin-bottom: 9px;
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--faint);
}

/* who made it */
.doc-credits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 44px;
  margin-top: 34px;
}
.doc-credits div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.doc-credits .doc-k { padding-top: 3px; }

@media (max-width: 860px) {
  .doc-scroll { padding: 26px 20px 36px; }
  .doc-grid { grid-template-columns: 1fr; gap: 28px; }
  .doc-split { grid-template-columns: 1fr; gap: 26px; margin-top: 32px; padding-top: 28px; }
  .doc-quad { gap: 20px 16px; margin-top: 32px; padding-top: 28px; }
  .doc-vert { width: 100%; }
  .doc-who-meta { grid-template-columns: 1fr 1fr; }
  .doc-steps { grid-template-columns: 1fr 1fr 1fr; }
  .doc-credits { grid-template-columns: 1fr; }
  .doc-sec { margin-top: 32px; padding-top: 28px; }
}

/* ---------- small screens ---------- */

@media (max-width: 720px) {
  /* a phone is too narrow for name and links side by side, so they stack */
  .ui-brand    { top: calc(20px + env(safe-area-inset-top)); left: 20px; }
  .ui-brand h1 { font-size: 26px; }
  .ui-links    { top: calc(80px + env(safe-area-inset-top)); left: 20px; right: auto; gap: 8px; font-size: 8.5px; }
  .ui-links a:not(.boxed) { display: none; }
  .ui-links a.boxed, .ui-links button { padding: 7px 10px; }
  .ui-intro    { bottom: calc(24px + env(safe-area-inset-bottom)); left: 20px; right: 20px; max-width: 320px; gap: 8px; }
  .ui-intro p  { font-size: 12px; }
  .ui-menu     { top: calc(20px + env(safe-area-inset-top)); right: 20px; }
  .menu-btn    { width: 40px; height: 36px; }
  .chip        { font-size: 10px; padding: 13px 18px; }
  .card-back   { padding: 20px 22px; gap: 12px; }
  .back-title  { font-size: 28px; }
  .back-blurb  { font-size: 12.5px; }
  .nav-prev    { left: 10px; }
  .nav-next    { right: 10px; }
  .nav-arrow   { width: 44px; height: 44px; margin-top: -22px; font-size: 18px; }
  .nav-close   { top: 18px; right: 16px; width: 40px; height: 40px; font-size: 15px; }
  .nav-copy    { top: 18px; right: 62px; height: 40px; padding: 0 12px; font-size: 8px; }
}

/* Respect reduced-motion: the cloud stops drifting on its own. */
@media (prefers-reduced-motion: reduce) {
  .chip, .nav-btn { transition: none; }
  .nav-prev:hover, .nav-next:hover, .nav-close:hover { transform: none; }
}

/* No-JS fallback: the cloud can't render, so say so rather than show a void. */
.noscript {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  color: var(--body);
}
