/* redesign prototype: page shell + what each variant adds on top of the course
   components (vendor/course.css, /assets/course/*.css). throwaway. */
@font-face { font-family: "Shantell Sans"; src: url("/assets/shantell-sans-700.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--gray-1200); outline-offset: 2px; border-radius: 4px; }
#stage { min-height: 100vh; }

/* ---- shell: the course lesson column ---- */
.page { padding: 92px var(--s-4) 160px; }
.page article { max-width: var(--measure); margin: 0 auto; }
@media (max-width: 1023px) { .page { padding-top: 48px; } }
.sec { margin-top: var(--s-12); }
.sec-title { margin: 0 0 var(--s-3); font-size: var(--text-h2); line-height: var(--leading-heading); font-weight: var(--weight-medium); }
[id] { scroll-margin-top: 24px; }

/* links in prose: underline from the font, grey line that darkens on hover */
.page a:not(.win-open):not(.w-win):not(.w-empty):not(.hd-mascot) {
  text-decoration: underline; text-decoration-color: var(--gray-400); text-decoration-thickness: 1px;
  text-underline-offset: 3px; transition: text-decoration-color 150ms ease-out;
}
@media (hover: hover) and (pointer: fine) {
  .page a:not(.win-open):hover { text-decoration-color: currentColor; }
}

/* ---- header ---- */
.hd { display: grid; grid-template-columns: auto 1fr; column-gap: var(--s-3); align-items: center; }
.hd-mascot { display: block; width: 48px; border-radius: 6px; }
.mascot { display: block; width: 100%; height: auto; overflow: visible; }
.hd-name { margin: 0; font-size: var(--text-h1); line-height: var(--leading-heading); font-weight: var(--weight-medium); letter-spacing: -0.01em; }
.hd-handle { margin-inline-start: var(--s-1); font-size: var(--text-ui); font-weight: var(--weight-normal); color: var(--gray-1000); }
.hd-lede { grid-column: 1 / -1; margin: var(--s-4) 0 0; color: var(--gray-1100); text-wrap: pretty; }
@media (hover: hover) and (pointer: fine) {
  .hd-mascot .mascot { transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1); transform-origin: 50% 90%; }
  .hd-mascot:hover .mascot { transform: rotate(-6deg) translateY(-2px); }
}
.hd-mascot:active .mascot { transform: scale(0.96); }

/* file-card links: the name is the link, same colour as the tree */
.file-tree a { color: var(--gray-1200); }

/* ---- shot view (assets/course/components.css) ---- */
.shot-view { position: relative; display: block; overflow: hidden; aspect-ratio: 16 / 10; background: var(--gray-200); }
.shot-view img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; }

/* ======== round 2: the assembled page ======== */
:root {
  --mascot-width: 104px; --mascot-height: 68px;
  --rule: var(--gray-400); --divider-bump: var(--bar-3); --tooltip: var(--gray-1000);
  --lane-room: 88px; /* headroom above a line for the 68px mascot */
}
@media (max-width: 640px) { :root { --mascot-width: 80px; --mascot-height: 52px; --lane-room: 68px; } }

/* header: the name is the link to x; the handle shows on hover or focus (the .since pattern) */
.r-hd { display: block; }
.r-name { display: inline-flex; align-items: baseline; gap: var(--s-2); }
.page .r-name { text-decoration: none; }
.r-handle { order: 1; font-family: var(--font); font-size: var(--text-ui); }
@media (hover: hover) and (pointer: fine) { .r-name:hover .since { opacity: 1; transform: none; } }
.r-name:focus-visible .since { opacity: 1; transform: none; }

/* the page: a block per piece, each with room above it for the mascot */
.r-block { margin-top: var(--s-12); }
.r-page:not(.is-sticky) .r-block[data-perch] { margin-top: var(--lane-room); }
/* perch: normal gaps. the mascot shrinks to the live site's phone size so it fits in them */
body:has(.is-perch) { --lane-room: 60px; --mascot-width: 80px; --mascot-height: 52px; }
.r-page.is-perch .lane-rule.is-home { margin-bottom: var(--s-8); }
@media (max-width: 640px) { body:has(.is-perch) { --lane-room: 52px; --mascot-width: 68px; --mascot-height: 44px; } }
.r-page.has-rules .r-block[data-perch] { margin-top: var(--s-8); }
.r-yours { margin-top: var(--s-4); }
.r-page.has-rules .r-yours { margin-top: var(--s-4); }
.lane-rule { height: 0; margin: var(--lane-room) 0 0; border: 0; border-top: 2px solid var(--rule); }
.lane-rule.is-home { margin: var(--lane-room) 0 var(--s-12); }
.r-page .demo { margin: 0; }
@media (min-width: 1024px) { .r-page .demo { margin-inline: -32px; } }
.r-page .r-block > .prompt:first-child, .r-page .r-block > .file { margin-top: 0; margin-bottom: 0; }
.r-page .file-kv dd { font-family: var(--font); font-size: var(--text-sm); color: var(--gray-1100); }

/* sticky: the strip the mascot walks along, pinned to the top of the window */
.sticky-lane {
  position: sticky; top: calc(var(--mascot-height) + 12px); z-index: 20; height: 0;
  margin-top: var(--lane-room); margin-bottom: var(--s-12);
  border-top: 2px solid var(--rule);
}
.sticky-lane::before { /* a band of page colour behind it, so text slides under instead of through */
  content: ""; position: absolute; left: -50vw; right: -50vw; bottom: 2px; height: calc(var(--mascot-height) + 14px);
  background: var(--gray-100); pointer-events: none;
  mask-image: linear-gradient(to top, #000 70%, transparent);
}
.is-sticky .r-block { margin-top: var(--s-12); }

/* link cards: the prompt card, but the whole card is a link and the corner icon opens it */
.prompt-link { display: block; color: inherit; text-decoration: none !important; transition: background-color 150ms ease-out; }
.prompt-link .prompt-text { color: var(--gray-1200); }
.prompt-link .copy { cursor: inherit; }
@media (hover: hover) and (pointer: fine) {
  .prompt-link:hover { background: var(--gray-300); }
  .prompt-link:hover .copy { color: var(--gray-1200); }
}
.prompt-link:active { transform: scale(0.99); }

/* builds rail: name and tagline above the frame */
.r-rail .rail-cmp.is-vertical .rail-id { margin: 0 0 var(--s-2); min-height: 0; font-size: var(--text-ui); }
/* the timeline takes the same 32px bleed on both sides as the cards, canvas and file around it */
@media (min-width: 1024px) { .r-rail { margin-inline: -32px; } }
.r-rail .rail-extra .prompt { margin-top: var(--s-3); }
@media (min-width: 1024px) { .r-rail .rail-extra .prompt { margin-inline: 0 ; padding-inline-start: var(--s-4); } }

/* investments: the canvas's handwritten note and note line give way to the company card */
#portfolio .flow-table { overflow: visible; }
#portfolio .flow-anchor::before, #portfolio .flow-anchor::after, #portfolio .flow-note { display: none !important; }
#portfolio .flow-foot { margin-top: var(--s-2); }
.co-peek {
  position: absolute; z-index: 8; padding: 6px 6px 8px; border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgb(var(--shadow) / 0.08), 0 2px 6px rgb(var(--shadow) / 0.06), 0 16px 32px -12px rgb(var(--shadow) / 0.24);
  cursor: auto; user-select: text; -webkit-user-select: text;
}
.co-peek.is-in { animation: co-peek-in 180ms cubic-bezier(0.23, 1, 0.32, 1); }
@keyframes co-peek-in { from { opacity: 0; transform: scale(0.96); } }
.co-peek-card { display: block; color: inherit; text-decoration: none !important; border-radius: 8px; }
.co-peek .win { display: block; border-radius: 8px; box-shadow: 0 0 0 1px rgb(var(--shadow) / 0.08); transition: box-shadow 150ms ease-out; } /* 14 − 6 */
.co-peek .win-chrome { display: flex; padding: 5px 8px; gap: 5px; }
.co-peek .win-dot { width: 7px; height: 7px; }
.co-peek .win-url { padding: 1px 8px; font-size: 11px; border-radius: 5px; color: var(--gray-1200); }
.co-peek-open { display: grid; place-items: center; color: var(--gray-1000); }
.co-peek-open svg { width: 13px; height: 13px; }
@media (hover: hover) and (pointer: fine) {
  .co-peek-card:hover .win { box-shadow: 0 0 0 1px rgb(var(--shadow) / 0.16); }
  .co-peek-card:hover .co-peek-open { color: var(--gray-1200); }
}
.co-peek-card:active { transform: scale(0.99); }
.co-peek-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin: 8px 6px 0; }
.co-peek-what { font-size: var(--text-sm); color: var(--gray-1200); }
.co-peek-round { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 11px; color: var(--gray-1000); white-space: nowrap; }
.co-peek-text { margin: 4px 6px; font-size: var(--text-sm); line-height: 1.5; color: var(--gray-1100); }
@media (prefers-reduced-motion: reduce) { .co-peek.is-in { animation: none; } }

/* roam: the rigged mascot draws on a layer over the window; only the mascot takes the pointer */
.roam-layer { position: fixed; inset: 0; width: 100vw; height: 100vh; overflow: visible; pointer-events: none; z-index: 30; }
.roam-body { pointer-events: auto; cursor: grab; touch-action: none; outline: none; }
.roam-body.is-held { cursor: grabbing; }
.roam-body:focus-visible { filter: drop-shadow(0 0 2px var(--gray-1200)); }

/* roam/perch: the rig layer; only the mascot itself takes the pointer */
.play-layer { position: fixed; inset: 0; width: 100vw; height: 100vh; overflow: visible; pointer-events: none; z-index: 30; }
.play-rig { pointer-events: auto; cursor: grab; touch-action: none; outline: none; }
.play-rig.is-held { cursor: grabbing; }
.play-rig:focus-visible { filter: drop-shadow(0 0 1.5px var(--gray-1200)); }
.play-hit { pointer-events: all; }
.play-rig.is-hidden, .play-rig.is-hidden .play-hit { pointer-events: none; }
.play-door { pointer-events: auto; cursor: pointer; }
/* what it says: a bubble that pops from its head, types itself out, and follows it with a little lag */
.play-say {
  --tail: 50%;
  position: fixed; left: 0; top: 0; z-index: 32; max-width: 210px; padding: 5px 10px 6px; border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgb(var(--shadow) / 0.09), 0 1px 2px rgb(var(--shadow) / 0.06), 0 8px 20px -8px rgb(var(--shadow) / 0.22);
  font-family: 'Shantell Sans', cursive; font-weight: 700; font-size: 13px; line-height: 1.25; color: var(--gray-1200);
  pointer-events: none; opacity: 0; transform-origin: var(--tail) calc(100% + 6px);
  display: grid;
}
.play-say::after { /* the tail, pointing at its head */
  content: ""; position: absolute; left: var(--tail); bottom: -5px; width: 10px; height: 10px; margin-left: -5px;
  background: var(--surface); transform: rotate(45deg); border-radius: 0 0 3px 0;
  box-shadow: 1px 1px 0 0 rgb(var(--shadow) / 0.09);
}
.say-ghost, .say-text { grid-area: 1 / 1; text-wrap: balance; }
.say-ghost { visibility: hidden; } /* holds the full size while the text types in */
.play-say.is-on { opacity: 1; animation: say-in 340ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.play-say.is-out { opacity: 0; transform: translateY(-4px) scale(0.96); transition: opacity 160ms ease-in, transform 160ms ease-in; }
@keyframes say-in { from { opacity: 0; transform: translateY(4px) scale(0.7); } 60% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .play-say.is-on { animation: none; } .play-say.is-out { transition: none; } }

/* the kit: a small dial panel for playing with Bites (appears once you have met it) */
.kit-handle {
  position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 31;
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px;
  background: rgb(var(--shadow) / 0.03); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 0 1px rgb(var(--shadow) / 0.08); color: var(--gray-1100); font: 500 12px/1 var(--font); cursor: pointer;
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity 180ms ease-out, transform 180ms ease-out, color 150ms ease-out;
}
.kit-handle.is-on { opacity: 0.9; transform: none; pointer-events: auto; }
@media (hover: hover) and (pointer: fine) { .kit-handle:hover { color: var(--gray-1200); } }
.kit-handle:active { transform: scale(0.97); }
.kit-panel {
  position: fixed; left: 16px; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 33;
  width: min(300px, calc(100vw - 32px)); max-height: calc(100vh - 90px); overflow-y: auto;
  display: grid; gap: 10px; padding: 12px 14px 14px; border-radius: 14px;
  background: var(--surface); box-shadow: 0 0 0 1px rgb(var(--shadow) / 0.08), 0 16px 40px -12px rgb(var(--shadow) / 0.28);
  font-size: 12px; color: var(--gray-1100);
  animation: kit-in 180ms cubic-bezier(0.23, 1, 0.32, 1); transform-origin: bottom left;
}
@keyframes kit-in { from { opacity: 0; transform: scale(0.96) translateY(4px); } }
.kit-head { display: flex; align-items: center; justify-content: space-between; }
.kit-head strong { font-size: 13px; font-weight: 500; color: var(--gray-1200); }
.kit-reset { border: 0; background: none; padding: 4px 6px; font: inherit; color: var(--gray-1000); cursor: pointer; border-radius: 6px; }
@media (hover: hover) and (pointer: fine) { .kit-reset:hover { color: var(--gray-1200); background: var(--gray-200); } }
.kit-row { display: grid; grid-template-columns: 60px 1fr; align-items: center; column-gap: 10px; }
.kit-label { font-family: var(--mono); font-size: 11px; color: var(--gray-1000); }
.kit-row input[type=range] { width: 100%; margin: 0; accent-color: var(--gray-1200); height: 20px; }
.kit-ends { grid-column: 2; display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--gray-1000); margin-top: -2px; }
.kit-swatches, .kit-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kit-swatch { position: relative; width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); }
.kit-swatch::before { content: ""; position: absolute; inset: -6px; }
.kit-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gray-1200); }
.kit-chip { min-height: 28px; padding: 0 10px; border: 0; border-radius: 999px; background: var(--gray-200); color: var(--gray-1100); font: 500 12px/1 var(--font); cursor: pointer; transition: background-color 150ms ease-out, color 150ms ease-out; }
@media (hover: hover) and (pointer: fine) { .kit-chip:hover { background: var(--gray-300); color: var(--gray-1200); } }
.kit-chip:active, .kit-swatch:active { transform: scale(0.96); }
.kit-chip[aria-pressed="true"] { background: var(--gray-1200); color: var(--on-ink); }
.kit-do { align-items: start; }
.kit-do .kit-label { padding-top: 7px; }
@media (prefers-reduced-motion: reduce) { .kit-handle, .play-say, .kit-chip { transition: none; } .kit-panel { animation: none; } }

/* handwritten notes beside components (margin when there is room, above when not) */
.hn-host { position: relative; }
.hand-note {
  --hn-color: #8657c8;
  display: flex; align-items: flex-end; gap: 4px; margin: 0 0 6px; color: var(--hn-color);
  font-family: 'Shantell Sans', cursive; font-weight: 700; font-size: 15px; line-height: 1; pointer-events: none;
}
.hand-note .hn-text { transform: rotate(-3deg); white-space: nowrap; }
.hand-note .hn-arrow { flex: none; }
.hand-note:not(.is-margin) { position: static; width: fit-content; }
.hand-note[data-side="right"]:not(.is-margin) { margin-inline-start: auto; flex-direction: row-reverse; }
.hand-note:not(.is-margin) svg:first-of-type { display: none; }
.hand-note.is-margin { position: absolute; top: var(--hn-top, 40px); align-items: center; }
.hand-note.is-margin svg:last-of-type { display: none; }
.hand-note.is-margin[data-side="left"] { right: calc(100% + 14px); }
.hand-note.is-margin[data-side="right"] { left: calc(100% + 14px); flex-direction: row-reverse; }
.hand-note.is-margin[data-side="right"] .hn-arrow { transform: scaleX(-1); }
@media (min-width: 1024px) { #portfolio .demo .hand-note.is-margin[data-side="right"] { left: calc(100% + 14px); } }
/* the timeline's note needs room above it when it sits there */
.r-rail.hn-host { scroll-margin-top: 40px; }

/* the mascot, lifted out of its lane and drawn over the page */
.mascot-float .mascot-runner { position: fixed; top: 0; left: 0; bottom: auto; z-index: 30; }
.mascot-float .divider-bump { position: fixed; z-index: 29; }
@media (prefers-reduced-motion: reduce) {
  .mascot-float .mascot-runner { transform: translate3d(var(--mascot-x), var(--mascot-jump), 0); }
  .prompt-link { transition: none; }
}

/* ======== the prototype picker: verbatim from emil-prototype PICKER.md ======== */
.proto-picker {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483647;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.82);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  backdrop-filter: blur(12px) saturate(1.4);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 8px 24px rgba(0, 0, 0, 0.24),
    0 2px 6px rgba(0, 0, 0, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
.proto-picker-highlight {
  position: absolute;
  top: 4px;
  left: 0;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  will-change: transform;
}
.proto-picker[data-ready] .proto-picker-highlight {
  transition:
    transform 250ms cubic-bezier(0.23, 1, 0.32, 1),
    width 250ms cubic-bezier(0.23, 1, 0.32, 1);
}
@media (prefers-reduced-motion: reduce) {
  .proto-picker[data-ready] .proto-picker-highlight { transition: none; }
}
.proto-picker-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font: inherit;
  cursor: pointer;
  transition: color 150ms ease-out;
}
.proto-picker-item:hover { color: rgba(255, 255, 255, 0.85); }
.proto-picker-item:active { transform: scale(0.97); }
.proto-picker-item:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.4); outline-offset: 2px; }
.proto-picker-item[data-active] { color: #fff; }
.proto-picker-divider { width: 1px; height: 16px; margin: 0 4px; background: rgba(255, 255, 255, 0.12); }
.proto-picker-replay { padding: 0 10px; font-size: 14px; }
.proto-picker[data-position="top"] { bottom: auto; top: 24px; }
.r-page { padding-top: 24px; }
.r-rail.ann { display: block; background: none; box-shadow: none; }
.kit-panel[hidden] { display: none; }

/* phones: the picker pill sits bottom centre, so the kit handle sits above it */
@media (max-width: 640px) {
  .kit-handle { bottom: calc(68px + env(safe-area-inset-bottom)); }
  .kit-panel { bottom: calc(108px + env(safe-area-inset-bottom)); }
}

/* the canvas: no put-the-cards-back button under it; logos on the company cards */
#portfolio .flow-foot { display: none; }
.flow-card .co-logo {
  display: block; width: 24px; height: 24px; border-radius: 6px; object-fit: cover; pointer-events: none; user-select: none;
  background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.08);
}
.flow-card { gap: 6px; }

/* ~/past: the folder and its name line up with the rows beneath */
@media (min-width: 1024px) { .r-page .file-head { padding-inline-start: var(--s-4); } }

/* the Play with Bites button is hidden for now (the kit is still in play.js) */
.kit-handle, .kit-panel { display: none !important; }

/* the name, in the handwriting (the handle beside it stays in Inter) */
.r-name { font-family: 'Shantell Sans', cursive; font-weight: 700; letter-spacing: 0; }
.page a.r-name { text-decoration: none !important; }
