.origin-story {
    max-width: 720px;
    margin: 0 auto;
}

.origin-story p {
    margin: 0 0 var(--space-sm);
    color: var(--muted);
    line-height: 1.7;
}

.origin-story p:last-child {
    margin-bottom: 0;
}

.origin-story a {
    color: var(--accent);
    text-decoration: underline;
}

.origin-story a:hover {
    color: var(--text);
}

.origin-story em {
    font-style: italic;
}

.origin-story strong {
    color: var(--text);
    font-weight: 500;
}

.section__subtitle {
    color: var(--muted);
    margin: calc(-1 * var(--space-sm)) 0 var(--space-md);
    font-size: var(--fs-0);
}

.gallery-viewer {
    width: 100%;
    height: 60vh;
    min-height: 400px;
    max-height: 600px;
    background: var(--panel);
    border: 1px solid var(--line);
    --poster-color: transparent;
}

.gallery-controls {
    display: flex;
    justify-content: center;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    flex-wrap: wrap;
}

.gallery-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--fs-0);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.gallery-btn:hover {
    border-color: var(--accent);
}

.gallery-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.gallery-btn[aria-pressed="true"],
.gallery-btn--copied {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

/* The vibrate button gently pulses and glows to invite a try, matching the
   transverse-sweep invite pattern used on the demo page (#btnPatw). */
@keyframes origin-vibrate-invite {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(111, 177, 255, 0);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 11px 1px rgba(111, 177, 255, 0.55);
        transform: scale(1.07);
    }
}

#btn-vibrate {
    animation: origin-vibrate-invite 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    #btn-vibrate {
        animation: none;
    }
}

/* Inline vibrate trigger in the gallery subtitle: the same 🌀 icon as the
   button, clickable to toggle the animation. Glows while active. */
.inline-vibrate {
    display: inline-block;
    padding: 0 0.1em;
    border: none;
    background: none;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    transition: transform var(--transition-fast), filter var(--transition-fast);
}

.inline-vibrate:hover {
    transform: scale(1.2) rotate(30deg);
}

.inline-vibrate:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.inline-vibrate[aria-pressed="true"] {
    filter: drop-shadow(0 0 6px rgba(111, 177, 255, 0.85));
}

.gallery-btn svg {
    width: 16px;
    height: 16px;
}

.gallery-divider {
    width: 1px;
    height: 24px;
    background: var(--line);
    margin: 0 var(--space-xs);
    align-self: center;
}

.gallery-btn--icon {
    padding: var(--space-xs);
    min-width: 36px;
    justify-content: center;
}

@media (max-width: 600px) {
    .gallery-btn span:not(.gallery-btn__icon) {
        display: none;
    }

    .gallery-btn {
        padding: var(--space-xs);
        min-width: 40px;
        justify-content: center;
    }
}

#origin-gallery:fullscreen,
#origin-gallery:-webkit-full-screen {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    padding: 0;
    margin: 0;
}

#origin-gallery:fullscreen .gallery-viewer,
#origin-gallery:-webkit-full-screen .gallery-viewer {
    flex: 1;
    height: auto;
    max-height: none;
    min-height: 0;
    border: none;
}

#origin-gallery:fullscreen .gallery-controls,
#origin-gallery:-webkit-full-screen .gallery-controls {
    flex-shrink: 0;
    padding: var(--space-sm);
    margin: 0;
    background: var(--panel);
    border-top: 1px solid var(--line);
}

/* iOS Safari has no element Fullscreen API, so the button falls back to this
   CSS cover (toggled in origin-page.js). Mirrors the native :fullscreen rules. */
#origin-gallery.pseudo-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    padding: 0;
    margin: 0;
}

#origin-gallery.pseudo-fullscreen .gallery-viewer {
    flex: 1;
    height: auto;
    max-height: none;
    min-height: 0;
    border: none;
}

#origin-gallery.pseudo-fullscreen .gallery-controls {
    flex-shrink: 0;
    padding: var(--space-sm);
    margin: 0;
    background: var(--panel);
    border-top: 1px solid var(--line);
}

body.has-pseudo-fullscreen {
    overflow: hidden;
}

/* Slotted load progress bar (the models are ~6 MB). */
.viewer-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--line);
}

.viewer-progress.hide {
    display: none;
}

.viewer-progress__bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.2s ease;
}

.demo-fallback {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md);
}

.demo-fallback__notice {
    background: rgba(111, 177, 255, 0.1);
    border: 1px solid var(--accent);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.demo-fallback__notice p {
    margin: 0;
}

.demo-fallback__notice p + p {
    margin-top: var(--space-xs);
}

.demo-fallback__figure {
    margin: var(--space-lg) 0;
    text-align: center;
}

.demo-fallback__figure img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
}

.demo-fallback__figure figcaption {
    margin-top: var(--space-sm);
    color: var(--muted);
    font-size: 0.875rem;
}

.demo-fallback h3 {
    color: var(--accent);
    margin: var(--space-md) 0 var(--space-sm);
    font-size: 1rem;
}

.demo-fallback dl {
    margin: 0;
}

.demo-fallback dt {
    font-weight: 500;
    margin-top: var(--space-sm);
}

.demo-fallback dd {
    margin: var(--space-xs) 0 0 0;
    color: var(--muted);
}

.demo-fallback__cta {
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
    text-align: center;
}

.demo-fallback__cta p {
    margin-bottom: var(--space-md);
}
