/* ==================================================
   AI ENGINEERING PROJECT PAGE (the page around the story)
   ==================================================
   vibe-coding/<slug>/index.html, generated by scripts/build-vibe.mjs from
   content/vibe-coding/_page.html. The case study itself is styled in
   css/vibe-story.css; this file is the page around it:
     - the wraps: the catalogue's column (1240px, 18 to 28px gutters), each
       one the size container the story follows
     - the hero band: a full-bleed stage tinted with the project accent
     - the breadcrumb bar: sticky under the site nav, with the section menu,
       previous / next project and a reading-progress hairline
     - more projects: the catalogue's own cards, starting from the next one
   Behaviour: js/vibe-project.js. The card-to-hero shared-element morph is
   in css/vibe-coding.css (the grid pages need it too).
   ================================================== */

body[data-vibe-project] {
    background: #ffffff;
}

/* One document scroll, and a body that is not a scroll container. html
   clips sideways (overflow-x: clip), so the body's own overflow no longer
   moves to the viewport: css/vibe-coding.css sets it to auto and the body
   would become a scroll box that never scrolls, which holds every sticky
   element (the breadcrumb bar) in place. clip keeps the sideways guard
   without that. The mobile menu and the viewer still lock the page. */
html body[data-page="vibe-coding"][data-vibe-project]:not(.nav-mobile-open) {
    overflow-x: clip !important;
    overflow-y: visible !important;
}

.vibe-page {
    display: block;
    background: var(--vs-paper);
}

.vibe-page__wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding-inline: clamp(18px, 2.4vw, 28px);
    container-type: inline-size;
    container-name: vstory;
}

@media (max-width: 767px) {
    .vibe-page__wrap {
        padding-inline: var(--site-shell-pad-mobile, 18px);
    }
}

/* ---------- Hero band ---------- */
.vibe-page__band {
    padding-block: clamp(20px, 4vw, 60px);
    border-top: 1px solid var(--vs-hairline);
    border-bottom: 1px solid var(--vs-hairline);
    background: var(--vs-stage);
}

/* Anchors land below the bar (and the nav, when it shows). */
.vibe-story [data-vs-section],
#overview,
#more-projects {
    scroll-margin-top: var(--vp-anchor-offset, 76px);
}

/* ==================================================
   BREADCRUMB BAR
   ==================================================
   In the flow under the site header, then sticky. While the site nav is
   stuck to the top the bar docks beneath it (top: --vp-bar-top, set by
   js/vibe-project.js); reading down tucks the nav away and the bar moves up
   to the edge, scrolling back up brings the nav back. */
.vibe-page__bar {
    --vp-bar-h: 52px;
    position: sticky;
    top: var(--vp-bar-top, 0px);
    z-index: 1300;
    /* no top border: the nav row's rule above is its top edge */
    border-bottom: 1px solid var(--vs-hairline);
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--vs-ink);
    font-family: var(--vs-font-ui);
    transition: top 380ms var(--vs-ease);
}

.vibe-page__bar-inner {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 1240px;
    min-height: var(--vp-bar-h);
    margin: 0 auto;
    padding-inline: clamp(18px, 2.4vw, 28px);
}

/* Trail: Rido Hendrawan / AI Engineering / the project */
.vibe-page__crumbs {
    flex: 1 1 auto;
    min-width: 0;
    /* style.css collapses every nav to height 0 on small screens */
    height: auto;
}

.vibe-page__crumb-list {
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: var(--vs-font-mono);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.vibe-page__crumb {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 0;
    white-space: nowrap;
    color: var(--vs-ink-60);
}

.vibe-page__crumb + .vibe-page__crumb::before {
    content: "/";
    flex: 0 0 auto;
    margin: 0 10px;
    color: var(--vs-ink-40);
}

.vibe-page__crumb a {
    color: inherit;
    text-decoration: none;
    transition: color 200ms var(--vs-ease);
}

.vibe-page__crumb a:hover,
.vibe-page__crumb a:focus-visible {
    color: var(--vs-ink);
}

.vibe-page__crumb-link {
    display: inline-flex;
    align-items: center;
}

/* the index glyph only shows when the trail folds into one button (phones) */
.vibe-page__crumb-link .vibe-page__crumb-icon {
    display: none;
}

.vibe-page__crumb--current {
    flex: 1 1 auto;
    color: var(--vs-ink);
}

.vibe-page__crumb--current > span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section menu: the section you are reading; opens a list of all of them. */
.vibe-page__toc {
    position: relative;
    flex: 0 0 auto;
}

.vibe-page__toc-toggle {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    max-width: 360px;
    margin: 0;
    padding: 0 10px 0 12px;
    border: 1px solid var(--vs-hairline-strong);
    border-radius: 0;
    background: var(--vs-paper);
    color: var(--vs-ink);
    font-family: var(--vs-font-ui);
    cursor: pointer;
    transition:
        border-color 200ms var(--vs-ease),
        background-color 200ms var(--vs-ease),
        color 200ms var(--vs-ease);
}

.vibe-page__toc-toggle:hover,
.vibe-page__toc-toggle[aria-expanded="true"] {
    border-color: var(--vs-ink);
}

.vibe-page__bar .vibe-page__toc-toggle:focus-visible,
.vibe-page__bar .vibe-page__pager-btn:focus-visible,
.vibe-page__bar .vibe-page__toc-link:focus-visible,
.vibe-page__bar .vibe-page__crumb-link:focus-visible {
    outline: 2px solid var(--vs-ink);
    outline-offset: 2px;
    border-radius: 0;
}

.vibe-page__toc-now {
    display: inline-flex;
    align-items: baseline;
    gap: 9px;
    min-width: 0;
}

.vibe-page__toc-index {
    flex: 0 0 auto;
    font-family: var(--vs-font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--vs-accent);
    font-variant-numeric: tabular-nums;
}

.vibe-page__toc-title {
    min-width: 0;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--vs-font-display);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.vibe-page__toc-count {
    flex: 0 0 auto;
    font-family: var(--vs-font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--vs-ink-40);
    font-variant-numeric: tabular-nums;
}

.vibe-page__toc-toggle .vibe-page__toc-chevron {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    transition: transform 260ms var(--vs-ease);
}

.vibe-page__toc-toggle[aria-expanded="true"] .vibe-page__toc-chevron {
    transform: rotate(180deg);
}

.vibe-page__toc-panel {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    z-index: 2;
    width: min(380px, calc(100vw - 32px));
    padding: 14px 0 8px;
    border: 1px solid var(--vs-ink);
    background: var(--vs-paper);
}

.vibe-page__toc-panel[hidden] {
    display: none;
}

.vibe-page__toc-kicker {
    margin: 0;
    padding: 0 16px 12px;
    border-bottom: 1px solid var(--vs-hairline);
    font-family: var(--vs-font-mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--vs-ink-40);
}

.vibe-page__toc-list {
    max-height: min(62vh, 540px);
    margin: 0;
    padding: 6px 0 0;
    overflow-y: auto;
    list-style: none;
    overscroll-behavior: contain;
}

.vibe-page__toc-link {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: baseline;
    padding: 10px 16px;
    color: var(--vs-ink);
    font-family: var(--vs-font-ui);
    font-size: 14px;
    line-height: 1.3;
    text-decoration: none;
    transition:
        background-color 180ms var(--vs-ease),
        color 180ms var(--vs-ease);
}

.vibe-page__toc-num {
    font-family: var(--vs-font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--vs-ink-40);
    font-variant-numeric: tabular-nums;
    transition: color 180ms var(--vs-ease);
}

.vibe-page__toc-link:hover,
.vibe-page__toc-link:focus-visible {
    background: var(--vs-ink);
    color: var(--vs-paper);
    text-decoration: none;
}

.vibe-page__toc-link:hover .vibe-page__toc-num,
.vibe-page__toc-link:focus-visible .vibe-page__toc-num {
    color: rgba(255, 255, 255, 0.6);
}

.vibe-page__toc-link[aria-current="location"] {
    font-weight: 700;
}

.vibe-page__toc-link[aria-current="location"] .vibe-page__toc-num {
    color: var(--vs-accent);
}

/* Pager: previous / "01 / 02" / next as one segmented control. */
.vibe-page__pager {
    display: inline-flex;
    align-items: stretch;
    flex: 0 0 auto;
}

.vibe-page__pager-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--vs-hairline-strong);
    background: var(--vs-paper);
    color: var(--vs-ink);
    text-decoration: none;
    transition:
        background-color 200ms var(--vs-ease),
        border-color 200ms var(--vs-ease),
        color 200ms var(--vs-ease);
}

.vibe-page__pager-btn .vibe-story__icon {
    width: 16px;
    height: 16px;
}

.vibe-page__pager-btn:hover,
.vibe-page__pager-btn:focus-visible {
    border-color: var(--vs-ink);
    background: var(--vs-ink);
    color: var(--vs-paper);
    position: relative;
    z-index: 1;
}

.vibe-page__pager-count {
    display: inline-grid;
    place-items: center;
    min-width: 64px;
    padding: 0 10px;
    border-top: 1px solid var(--vs-hairline-strong);
    border-bottom: 1px solid var(--vs-hairline-strong);
    font-family: var(--vs-font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--vs-ink-60);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    user-select: none;
}

/* Reading progress: an accent hairline along the bar's bottom rule. */
.vibe-page__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    pointer-events: none;
}

.vibe-page__progress span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--vs-accent);
    transform: scaleX(0);
    transform-origin: 0 50%;
}

/* The site nav tucks away while reading down (headroom), only here. */
body[data-vibe-project] .site-nav.is-sticky {
    transition: transform 380ms var(--vs-ease);
}

html.vp-nav-tucked body[data-vibe-project] .site-nav.is-sticky {
    transform: translate3d(0, -100%, 0);
}

/* Tablets: the trail drops its first step. */
@media (max-width: 991px) {
    .vibe-page__crumb--home {
        display: none;
    }

    .vibe-page__crumb--home + .vibe-page__crumb::before {
        content: none;
    }
}

/* Small screens: "AI Engineering", then the section menu takes the room the
   title had (the title is right there in the head) and fills it like a
   select; the pager keeps its arrows. */
@media (max-width: 767px) {
    .vibe-page__bar {
        --vp-bar-h: 50px;
    }

    .vibe-page__bar-inner {
        gap: 10px;
        padding-inline: var(--site-shell-pad-mobile, 18px);
    }

    .vibe-page__crumbs {
        flex: 0 0 auto;
    }

    .vibe-page__crumb--current {
        display: none;
    }

    .vibe-page__toc {
        position: static;
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
    }

    .vibe-page__toc-toggle {
        flex: 1 1 auto;
        justify-content: space-between;
        min-width: 0;
        max-width: 100%;
        height: 40px;
    }

    .vibe-page__toc-title {
        max-width: none;
    }

    .vibe-page__toc-count {
        display: none;
    }

    /* the menu spans the bar, below it, its numbers on the page gutter */
    .vibe-page__toc-panel {
        left: 0;
        right: 0;
        top: 100%;
        width: auto;
        border-width: 1px 0;
    }

    .vibe-page__toc-kicker,
    .vibe-page__toc-link {
        padding-inline: var(--site-shell-pad-mobile, 18px);
    }

    .vibe-page__pager-count {
        display: none;
    }

    .vibe-page__pager-btn {
        width: 40px;
        height: 40px;
    }

    .vibe-page__pager-btn + .vibe-page__pager-btn {
        border-left: 0;
    }
}

/* The narrowest phones keep the section name over its number. */
@media (max-width: 359px) {
    .vibe-page__toc-index {
        display: none;
    }
}

/* Phones: the trail folds into one square index button beside the menu,
   matching the pager's arrows; its name stays for screen readers. */
@media (max-width: 479px) {
    .vibe-page__crumb-link {
        position: relative;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: 1px solid var(--vs-hairline-strong);
        background: var(--vs-paper);
        color: var(--vs-ink);
        transition:
            background-color 200ms var(--vs-ease),
            border-color 200ms var(--vs-ease),
            color 200ms var(--vs-ease);
    }

    .vibe-page__crumb a.vibe-page__crumb-link:hover,
    .vibe-page__crumb a.vibe-page__crumb-link:focus-visible {
        border-color: var(--vs-ink);
        background: var(--vs-ink);
        color: var(--vs-paper);
    }

    .vibe-page__crumb-link .vibe-page__crumb-icon {
        display: block;
        width: 16px;
        height: 16px;
    }

    .vibe-page__crumb-label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
    }
}

/* ==================================================
   MORE PROJECTS
   ================================================== */
.vibe-page__more {
    display: block;
    padding: clamp(56px, 7vw, 104px) 0 clamp(72px, 9vw, 128px);
    border-top: 1px solid var(--vs-ink);
}

.vibe-page__more-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px 32px;
    margin-bottom: clamp(26px, 3.2vw, 44px);
}

.vibe-page__more-kicker {
    margin: 0 0 14px;
    font-family: var(--vs-font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--vs-ink-60);
}

.vibe-page__more-title {
    margin: 0;
    font-family: var(--vs-font-display);
    font-weight: 700;
    font-size: clamp(34px, 4.6vw, 64px);
    line-height: 1;
    letter-spacing: -0.03em;
    text-transform: none;
    color: var(--vs-ink);
}

.vibe-page__more-title:focus {
    outline: none;
}

.vibe-page__more-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.vibe-page__more-grid .vibe-card-col {
    width: 100%;
}

.vibe-page__more-fallback {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--vs-hairline);
}

.vibe-page__more-fallback li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 18px;
    padding: 16px 0;
    border-bottom: 1px solid var(--vs-hairline);
}

.vibe-page__more-fallback a {
    font-family: var(--vs-font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--vs-ink);
    text-decoration: none;
}

.vibe-page__more-fallback span {
    font-size: 14px;
    color: var(--vs-ink-60);
}

/* Preview cards: a page can close on its own cards (frontmatter `previews`)
   in place of the catalogue's. Text only, so a card never borrows another
   project's picture: a number, a title, a teaser and the way in. */
.vibe-page__more--previews .vibe-page__more-title {
    max-width: 18ch;
    font-size: clamp(30px, 3.6vw, 48px);
    line-height: 1.04;
    text-wrap: balance;
}

.vibe-page__previews {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vibe-page__previews > li {
    display: flex;
}

.vibe-preview {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 22px 22px 0;
    border: 1px solid #dddddd;
    background: #ffffff;
    color: inherit;
    text-decoration: none;
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), border-color 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.vibe-preview:hover,
.vibe-preview:focus-visible {
    transform: translateY(-3px);
    border-color: #111111;
    color: inherit;
}

.vibe-preview:focus-visible {
    outline: 2px solid #111111;
    outline-offset: 2px;
}

.vibe-preview__index {
    font-family: var(--vs-font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--vs-ink-60);
    font-variant-numeric: tabular-nums;
}

/* The card's icon. An SVG is pasted into the page and moves through its own
   styles while the card (class "pi-host") is hovered or focused; a picture
   may bring a second frame that flaps for the same reason. */
.vibe-preview__icon {
    position: relative;
    display: block;
    flex: none;
    width: 56px;
    height: 56px;
}

.vibe-preview__icon svg,
.vibe-preview__icon img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
}

.vibe-preview__icon--frames {
    overflow: hidden;
    border-radius: 22.5%;
    background: linear-gradient(160deg, #fff8ea 0%, #f7e6cb 55%, #eccfa6 100%);
}

.vibe-preview__icon--frames img {
    object-fit: cover;
}

.vibe-preview__icon-frame {
    opacity: 0;
}

.vibe-preview:hover .vibe-preview__icon-frame,
.vibe-preview:focus-visible .vibe-preview__icon-frame {
    animation: vibe-preview-talk 380ms steps(1, end) infinite;
}

@keyframes vibe-preview-talk {
    0% { opacity: 1; }
    50% { opacity: 0; }
}

.vibe-preview__title {
    margin: 22px 0 12px;
    font-family: var(--vs-font-display);
    font-size: clamp(22px, 2.2vw, 30px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.025em;
    text-transform: none;
    text-wrap: pretty;
    color: var(--vs-ink);
}

.vibe-preview__teaser {
    margin: 0 0 28px;
    max-width: 52ch;
    font-size: 15px;
    line-height: 1.6;
    color: rgba(0, 0, 0, 0.66);
}

.vibe-preview__cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding: 16px 0 18px;
    border-top: 1px solid #ececec;
    color: #111111;
}

.vibe-preview__cta-label {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.vibe-preview__cta-arrow {
    width: 18px;
    height: 18px;
    flex: none;
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.vibe-preview:hover .vibe-preview__cta-arrow,
.vibe-preview:focus-visible .vibe-preview__cta-arrow {
    transform: translateX(4px);
}

@media (max-width: 767px) {
    .vibe-page__previews {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vibe-preview,
    .vibe-preview__cta-arrow {
        transition: none;
    }

    .vibe-preview:hover,
    .vibe-preview:focus-visible,
    .vibe-preview:hover .vibe-preview__cta-arrow,
    .vibe-preview:focus-visible .vibe-preview__cta-arrow {
        transform: none;
    }

    .vibe-preview:hover .vibe-preview__icon-frame,
    .vibe-preview:focus-visible .vibe-preview__icon-frame {
        animation: none;
    }
}

html[data-motion="reduced"] .vibe-preview,
html[data-motion="reduced"] .vibe-preview__cta-arrow {
    transition: none;
    transform: none;
}

html[data-motion="reduced"] .vibe-preview .vibe-preview__icon-frame,
html[data-motion="reduced"] .vibe-preview .vibe-preview__icon svg * {
    animation: none !important;
}

@media (max-width: 1023px) {
    .vibe-page__more-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
}

/* Two columns show two cards: a third would sit alone on its own row
   ("All projects" still leads to the rest). */
@media (min-width: 768px) and (max-width: 1023px) {
    .vibe-page__more-grid > .vibe-card-col:nth-child(n + 3) {
        display: none;
    }
}

@media (max-width: 767px) {
    .vibe-page__more-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
}

/* ==================================================
   REDUCED MOTION
   ================================================== */
@media (prefers-reduced-motion: reduce) {
    .vibe-page__bar,
    .vibe-page__toc-toggle .vibe-page__toc-chevron,
    body[data-vibe-project] .site-nav.is-sticky {
        transition: none !important;
    }
}

html[data-motion="reduced"] .vibe-page__bar,
html[data-motion="reduced"] .vibe-page__toc-toggle .vibe-page__toc-chevron,
html[data-motion="reduced"] body[data-vibe-project] .site-nav.is-sticky {
    transition: none !important;
}

/* ==================================================
   THE HERO'S SHARED NAME (view transitions)
   ==================================================
   The card cover morphs into this frame; the morph is styled in
   css/vibe-coding.css. */
.vibe-story__hero-media {
    view-transition-name: vp-hero;
}

/* ==================================================
   THE VIEWER: every figure full screen
   ==================================================
   js/vibe-project.js builds it on first use. The figure travels from its
   frame to the middle of an ink backdrop that opens as an aperture from the
   frame's row; the controls wipe in. Clips play large, with Play / Pause
   beside the close button. Click anywhere, Esc or swipe down to put it
   back; arrows, swipes and the keyboard step through every figure. */
html.vibe-viewer-open,
html.vibe-viewer-open body,
html.vibe-viewer-open body[data-page="vibe-coding"][data-vibe-project]:not(.nav-mobile-open) {
    overflow: hidden !important;
}

.vibe-viewer {
    position: fixed;
    inset: 0;
    /* above the sticky nav (1340) and the bar; below the cursor dot */
    z-index: 5000;
    color: #ffffff;
    font-family: var(--vs-font-ui);
}

.vibe-viewer[hidden] {
    display: none !important;
}

.vibe-viewer__backdrop {
    position: absolute;
    inset: 0;
    /* opaque: the nav would ghost through under the figure label */
    background: #0a0a0a;
    cursor: zoom-out;
}

.vibe-viewer__top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: calc(14px + env(safe-area-inset-top, 0px)) clamp(16px, 2.4vw, 28px) 14px;
    pointer-events: none;
}

.vibe-viewer__top > * {
    pointer-events: auto;
}

.vibe-viewer__index {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0;
    font-family: var(--vs-font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.78);
    font-variant-numeric: tabular-nums;
}

.vibe-viewer__count {
    color: rgba(255, 255, 255, 0.46);
}

.vibe-viewer__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* A clip's Play / Pause, beside the close button. */
.vibe-viewer__play {
    -webkit-appearance: none;
    appearance: none;
    display: inline-grid;
    place-items: center;
    min-width: 76px;
    height: 44px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 0;
    background: rgba(10, 10, 10, 0.4);
    color: #ffffff;
    font-family: var(--vs-font-mono);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition:
        background-color 200ms var(--vs-ease),
        border-color 200ms var(--vs-ease),
        color 200ms var(--vs-ease);
}

.vibe-viewer__play[hidden] {
    display: none;
}

.vibe-viewer__play:hover,
.vibe-viewer__play:focus-visible {
    border-color: #ffffff;
    background: #ffffff;
    color: #0a0a0a;
}

.vibe-viewer .vibe-viewer__play:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
    border-radius: 0;
}

.vibe-viewer__btn {
    -webkit-appearance: none;
    appearance: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 0;
    background: rgba(10, 10, 10, 0.4);
    color: #ffffff;
    cursor: pointer;
    transition:
        background-color 200ms var(--vs-ease),
        border-color 200ms var(--vs-ease),
        color 200ms var(--vs-ease);
}

.vibe-viewer__btn svg {
    display: block;
    width: 20px;
    height: 20px;
}

.vibe-viewer__btn:hover,
.vibe-viewer__btn:focus-visible {
    border-color: #ffffff;
    background: #ffffff;
    color: #0a0a0a;
}

.vibe-viewer .vibe-viewer__btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
    border-radius: 0;
}

/* a measuring box: the picture is placed in it, clicks pass to the backdrop */
.vibe-viewer__stage {
    position: absolute;
    top: calc(76px + env(safe-area-inset-top, 0px));
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    left: clamp(16px, 7vw, 112px);
    right: clamp(16px, 7vw, 112px);
    z-index: 1;
    pointer-events: none;
}

.vibe-viewer__img {
    position: fixed;
    z-index: 1;
    display: block;
    max-width: none;
    /* style.css gives every video min-width/min-height 100% (of the
       viewport, for a fixed one); the viewer sizes its own */
    min-width: 0;
    min-height: 0;
    object-fit: contain;
    background: #161616;
    pointer-events: none;
    user-select: none;
}

.vibe-viewer__img[hidden] {
    display: none;
}

.vibe-viewer__step {
    position: absolute;
    top: 50%;
    z-index: 3;
    margin-top: -22px;
}

.vibe-viewer__step--prev {
    left: clamp(10px, 1.8vw, 28px);
}

.vibe-viewer__step--next {
    right: clamp(10px, 1.8vw, 28px);
}

.vibe-viewer.is-single .vibe-viewer__step {
    display: none;
}

.vibe-viewer__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    max-width: 82ch;
    margin: 0 auto;
    padding: 0 clamp(16px, 2.4vw, 28px) calc(26px + env(safe-area-inset-bottom, 0px));
    font-size: 13.5px;
    line-height: 1.45;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
}

.vibe-viewer__caption[hidden] {
    display: none;
}

@media (max-width: 767px) {
    .vibe-viewer__stage {
        top: calc(68px + env(safe-area-inset-top, 0px));
        bottom: calc(96px + env(safe-area-inset-bottom, 0px));
        left: 10px;
        right: 10px;
    }

    /* phones swipe between pictures */
    .vibe-viewer__step {
        display: none;
    }

    .vibe-viewer__caption {
        font-size: 12.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vibe-viewer__btn,
    .vibe-viewer__play {
        transition: none !important;
    }
}

/* ==================================================
   CONTENTS RAIL
   ==================================================
   From 1120px wide the story reads in a column beside its own contents: a
   sticky list of every section on a hairline track, the one being read
   marked by an accent bar that wipes down its length, with its sub-sections
   folded open under it. The story inside the column is one column (head,
   then prose, then pictures) and the column is its own size container, so
   everything in it is sized to it. Below 1120px the rail is hidden and the
   bar's section menu does the job. */
.vibe-page__content {
    min-width: 0;
    container-type: inline-size;
    container-name: vstory;
}

.vibe-page__rail {
    display: none;
}

@media (min-width: 1120px) {
    .vibe-page__layout:has(> .vibe-page__rail) {
        display: grid;
        grid-template-columns: 208px minmax(0, 1fr);
        column-gap: 56px;
        align-items: start;
        padding-top: clamp(56px, 5vw, 76px);
    }

    .vibe-page__rail {
        display: block;
        position: sticky;
        top: var(--vp-anchor-offset, 128px);
        max-height: calc(100vh - var(--vp-anchor-offset, 128px) - 24px);
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: none;
        padding-bottom: 8px;
        transition:
            top 380ms var(--vs-ease),
            max-height 380ms var(--vs-ease);
    }

    .vibe-page__rail::-webkit-scrollbar {
        display: none;
    }

    /* the bar's section menu would only repeat the rail */
    html:has(.vibe-page__rail) .vibe-page__toc {
        display: none;
    }

    .vibe-page__layout:has(> .vibe-page__rail) .vibe-story__specs {
        grid-template-columns: minmax(0, 1fr);
        padding-top: 0;
    }

    .vibe-page__layout:has(> .vibe-page__rail) .vibe-story__specs-kicker {
        padding-top: 0;
    }

    .vibe-page__layout:has(> .vibe-page__rail) .vibe-story__group {
        grid-template-columns: minmax(0, 1fr);
    }

    .vibe-page__layout:has(> .vibe-page__rail) .vibe-story__section-head,
    .vibe-page__layout:has(> .vibe-page__rail) .vibe-story__sub-head,
    .vibe-page__layout:has(> .vibe-page__rail) .vibe-story__flow,
    .vibe-page__layout:has(> .vibe-page__rail) .vibe-story__stack {
        grid-column: auto;
    }

    .vibe-page__layout:has(> .vibe-page__rail) .vibe-story__sub-head + .vibe-story__flow {
        padding-top: 0;
    }
}

.vibe-page__rail-kicker {
    margin: 0;
    padding: 0 0 12px;
    font-family: var(--vs-font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--vs-ink-60);
}

.vibe-page__rail-list,
.vibe-page__rail-sublist {
    margin: 0;
    padding: 0;
    list-style: none;
}

.vibe-page__rail-list {
    border-top: 1px solid var(--vs-ink);
    padding-top: 8px;
}

.vibe-page__rail-item {
    position: relative;
    padding-left: 14px;
}

/* the track, and the accent bar that marks the section being read */
.vibe-page__rail-item::before,
.vibe-page__rail-item::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    pointer-events: none;
}

.vibe-page__rail-item::before {
    width: 1px;
    background: var(--vs-hairline);
}

.vibe-page__rail-item::after {
    width: 2px;
    background: var(--vs-accent);
    transform: scaleY(0);
    transform-origin: 50% 0;
    transition: transform 420ms var(--vs-ease);
}

.vibe-page__rail-item.is-open::after {
    transform: scaleY(1);
}

.vibe-page__rail-link,
.vibe-page__rail-sublink {
    display: grid;
    align-items: baseline;
    font-family: var(--vs-font-ui);
    text-decoration: none;
    transition: color 180ms var(--vs-ease);
}

.vibe-page__rail-link {
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 6px 0;
    font-size: 14px;
    line-height: 1.3;
    color: var(--vs-ink-60);
}

.vibe-page__rail-sublink {
    grid-template-columns: minmax(0, 1fr);
    padding: 4px 0 4px 28px;
    font-size: 13px;
    line-height: 1.3;
    color: var(--vs-ink-40);
}

.vibe-page__rail-num {
    font-family: var(--vs-font-mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    color: var(--vs-ink-40);
    font-variant-numeric: tabular-nums;
    transition: color 180ms var(--vs-ease);
}

.vibe-page__rail-link:hover,
.vibe-page__rail-sublink:hover,
.vibe-page__rail-link:focus-visible,
.vibe-page__rail-sublink:focus-visible {
    color: var(--vs-ink);
    text-decoration: none;
}

.vibe-page__rail-link:focus-visible,
.vibe-page__rail-sublink:focus-visible {
    outline: 2px solid var(--vs-ink);
    outline-offset: 2px;
}

.vibe-page__rail-link[aria-current="location"] {
    color: var(--vs-ink);
    font-weight: 700;
}

.vibe-page__rail-link[aria-current="location"] .vibe-page__rail-num {
    color: var(--vs-accent);
}

.vibe-page__rail-sublink[aria-current="true"] {
    color: var(--vs-ink);
}

/* Sub-sections fold open under the section being read (all open without
   scripts). The fold is a height change, never a fade. */
.vibe-page__rail-subs {
    display: grid;
    grid-template-rows: 1fr;
}

.vibe-page__rail-sublist {
    min-height: 0;
    overflow: hidden;
}

.vibe-page__rail-sublist > li:last-child {
    padding-bottom: 6px;
}

html.vs-js .vibe-page__rail-subs {
    grid-template-rows: 0fr;
    visibility: hidden;
    transition:
        grid-template-rows 420ms var(--vs-ease),
        visibility 0s linear 420ms;
}

html.vs-js .vibe-page__rail-item.is-open > .vibe-page__rail-subs {
    grid-template-rows: 1fr;
    visibility: visible;
    transition:
        grid-template-rows 420ms var(--vs-ease),
        visibility 0s linear 0s;
}

html[data-motion="reduced"] .vibe-page__rail,
html[data-motion="reduced"] .vibe-page__rail-item::after,
html[data-motion="reduced"] .vibe-page__rail-subs,
html.vs-js[data-motion="reduced"] .vibe-page__rail-subs,
html.vs-js[data-motion="reduced"] .vibe-page__rail-item.is-open > .vibe-page__rail-subs {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .vibe-page__rail,
    .vibe-page__rail-item::after,
    html.vs-js .vibe-page__rail-subs,
    html.vs-js .vibe-page__rail-item.is-open > .vibe-page__rail-subs {
        transition: none;
    }
}
