/* ================================================================
   HOME_FEATURES.CSS — Landing-page features showcase (#696/#697/#698)

   Below-the-fold feature cards, each containing a live HTML/CSS demo
   of the real interface (decision recorded on #698: DOM, not WebP/SVG).

   The demo visuals deliberately mirror the real components — colours
   and shapes are copied from their source of truth rather than the
   app CSS being imported wholesale (those bundles assume the celex
   page layout and would leak styles into the homepage):
     - defined-term links + definition popover .. celex.css (.internal-link,
       .celex-definition-popover; popover chrome is Bootstrap's)
     - diff colours ............................ diff_styles.css (.diff-insert,
       .diff-delete, .diff-modified)
     - skeleton shimmer ........................ loader.html (.skeleton-shimmer)
     - omni-search chunk/recital badges ........ celex_omni_search.js
     - marginalia/resources panel .............. loader.html marginalia section,
       celex.css (.floodlight-section)
     - coral tokens ............................ homepage-coral.css / base.css

   Performance discipline (#698): every looping motion animates only
   transform/opacity (GPU compositor). The handful of colour swaps
   (term hover, diff highlight) repaint a few-hundred-pixel area once
   per 9s loop. Demos are paused unless their card is .in-view
   (IntersectionObserver in home_features.js) and snap to an end-state
   under prefers-reduced-motion.
   ================================================================ */

/* JetBrains Mono (latin subset) @font-face moved to the globally-loaded
   base.css so it's available app-wide, not just on the homepage. (#716) */

/* ----------------------------------------------------------------
   Section snap + scroll cue (#697)
   ---------------------------------------------------------------- */

/* Proximity snap only — `mandatory` would fight the hero + search
   input and can trap users (see #696 cross-cutting notes). */
html:has(body.homepage) {
    scroll-snap-type: y proximity;
    scroll-padding-top: 80px;  /* account for fixed header (#753c) */
}

@media (prefers-reduced-motion: no-preference) {
    html:has(body.homepage) {
        scroll-behavior: smooth;
    }
}

.homepage .hero--home {
    scroll-snap-align: start;
}

#features {
    scroll-snap-align: start;
    scroll-margin-top: 70px; /* clear the fixed navbar when snapped */
}

/* Animated scroll cue — fixed at viewport bottom. Hidden by
   home_features.js once the user scrolls, and during search focus (#753d). */
.scroll-cue {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--lx-brand);
    font-size: 1.3rem;
    box-shadow: 0 4px 14px rgba(44, 0, 2, 0.25);
    transform: translateX(-50%);
    opacity: 1;
    transition: opacity 0.4s ease;
}

.scroll-cue:hover {
    color: var(--lx-brand-strong);
}

.scroll-cue.scroll-cue--hidden {
    opacity: 0;
    pointer-events: none;
}

.scroll-cue .bi {
    animation: cue-bob 2s ease-in-out infinite;
}

@keyframes cue-bob {
    0%, 100% { transform: translateY(-2px); }
    50%      { transform: translateY(4px); }
}

/* ----------------------------------------------------------------
   Features section + card chrome (#697, ported from stride_launch.html)
   ---------------------------------------------------------------- */

.features-section {
    min-height: 100vh;
    padding: 4.5rem 20px 5rem;
}

.features-head {
    max-width: 720px;
    margin: 0 auto 3rem;
    text-align: center;
    color: #fff;
}

.features-head h2 {
    color: #fff;
    font-size: clamp(1.6rem, 4vw, 2.3rem);
    margin: 0 0 0.4rem;
}

.features-head .ss-dot-divider-white {
    margin: 0.8rem auto;
}

.features-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    position: relative;
    overflow: hidden;
    background: var(--lx-on-brand-sheet);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 12px 32px rgba(44, 0, 2, 0.18);
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--lx-brand), var(--lx-brand-strong));
}

.feature-card.visible {
    opacity: 1;
    transform: scale(1);
}

.feature-card h3 {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0.2rem 0 0.3rem;
    font-family: var(--font-stack-mono);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #212529;
}

.feature-card .feature-num {
    color: var(--lx-brand);
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
}

.feature-card .feature-desc {
    margin: 0 0 1rem;
    color: var(--lx-text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ----------------------------------------------------------------
   Demo stage — a mini viewport of the real (light-themed) app UI
   ---------------------------------------------------------------- */

.demo-stage {
    position: relative;
    overflow: hidden;
    height: 240px;
    border-radius: 12px;
    background: var(--lx-surface-muted);
    border: 1px solid var(--lx-border);
    color: #212529;
    font-size: 13px;
    line-height: 1.55;
    text-align: left;
}

/* All demo animations are 9s loops, paused until the card is in view */
.demo-stage *,
.demo-stage *::before,
.demo-stage *::after {
    animation-duration: 9s;
    animation-iteration-count: infinite;
    animation-play-state: paused;
}

.feature-card.in-view .demo-stage *,
.feature-card.in-view .demo-stage *::before,
.feature-card.in-view .demo-stage *::after {
    animation-play-state: running;
}

/* Shared: mini document */
.fd-doc {
    padding: 16px 18px;
}

.fd-doc p {
    margin: 0;
}

.fd-doc-h {
    font-weight: 600;
    font-size: 12px;
    color: #495057;
    margin-bottom: 8px;
}

/* Shared: defined-term link — coral, no underline (celex.css .internal-link) */
.fd-term,
.fd-link {
    color: var(--lx-brand);
    border-radius: 3px;
    padding: 0 1px;
}

/* Shared: fake cursor — transform-only motion. Its hover destination is
   measured per layout by home_features.js (the target element's actual
   position feeds --fd-tx/--fd-ty), so the pointer lands on the term at
   any viewport width; the literal fallbacks cover JS-off. */
.fd-cursor {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    z-index: 6;
    pointer-events: none;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
    animation-timing-function: cubic-bezier(0.6, 0.02, 0.2, 1);
    will-change: transform;
}

/* Shared: definition popover — Bootstrap popover chrome as rendered by
   .celex-definition-popover on the real celex page */
.fd-popover {
    position: absolute;
    left: 18px;
    right: 18px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    font-size: 12px;
    z-index: 4;
    opacity: 0;
    transform: translateY(8px);
    will-change: transform, opacity;
}

.fd-popover::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 110px;
    width: 12px;
    height: 12px;
    background: #f0f0f0;
    border-left: 1px solid rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(0, 0, 0, 0.2);
    transform: rotate(45deg);
}

.fd-popover-h {
    padding: 7px 12px;
    background: #f0f0f0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 7px 7px 0 0;
    font-weight: 600;
}

.fd-popover-b {
    padding: 9px 12px;
    line-height: 1.45;
}

/* Shared: floodlight-style side panel (marginalia / resources) */
.fd-flood {
    background: #fff;
    border: 1px solid var(--lx-border);
    border-radius: 6px;
    padding: 10px 12px;
}

.fd-flood-h {
    font-weight: 600;
    font-size: 12px;
    color: #495057;
    border-bottom: 1px solid var(--lx-surface-inset);
    padding-bottom: 5px;
    margin-bottom: 8px;
}

/* ============ 01 Inline definitions ============ */

.demo-def .fd-cursor { animation-name: fd1-cursor; }

@keyframes fd1-cursor {
    0%        { transform: translate(250px, 200px); }
    14%, 80%  { transform: translate(var(--fd-tx, 165px), var(--fd-ty, 92px)); }
    94%, 100% { transform: translate(250px, 200px); }
}

.demo-def .fd-hover { animation-name: fd1-hover; }

@keyframes fd1-hover {
    0%, 14%   { background: transparent; }
    17%, 82%  { background: rgba(var(--color-coral-base-rgb), 0.12); box-shadow: inset 0 -1.5px 0 var(--lx-brand); }
    88%, 100% { background: transparent; }
}

.demo-def .fd-popover {
    top: 116px;
    animation-name: fd1-popover;
}

@keyframes fd1-popover {
    0%, 18%   { opacity: 0; transform: translateY(8px); }
    24%, 82%  { opacity: 1; transform: translateY(0); }
    90%, 100% { opacity: 0; transform: translateY(8px); }
}

/* ============ 02 Remote definitions ============ */

.demo-remote .fd-cursor { animation-name: fd2-cursor; }

@keyframes fd2-cursor {
    0%, 6%    { transform: translate(60px, 200px); }
    20%, 82%  { transform: translate(var(--fd-tx, 40px), var(--fd-ty, 92px)); }
    96%, 100% { transform: translate(60px, 200px); }
}

.demo-remote .fd-hover { animation-name: fd2-hover; }

@keyframes fd2-hover {
    0%, 20%   { background: transparent; }
    23%, 84%  { background: rgba(var(--color-coral-base-rgb), 0.12); box-shadow: inset 0 -1.5px 0 var(--lx-brand); }
    90%, 100% { background: transparent; }
}

.demo-remote .fd-popover {
    top: 112px;
    animation-name: fd2-popover;
}

@keyframes fd2-popover {
    0%, 24%   { opacity: 0; transform: translateY(8px); }
    30%, 84%  { opacity: 1; transform: translateY(0); }
    92%, 100% { opacity: 0; transform: translateY(8px); }
}

.fd-src {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 10px;
    background: #ffecee;
    border: 1px solid var(--color-coral-200);
    color: var(--lx-brand-strong);
    font-size: 10.5px;
    font-weight: 600;
    vertical-align: 1px;
}

.fd-popover-f {
    padding: 5px 12px 7px;
    border-top: 1px dashed var(--lx-surface-inset);
    color: var(--lx-text-muted);
    font-size: 10.5px;
    font-family: var(--font-stack-mono);
}

/* ============ 03 Rapid loading ============ */

.demo-load .fd-browser {
    position: absolute;
    inset: 14px;
    background: #fff;
    border: 1px solid var(--lx-border);
    border-radius: 8px;
    overflow: hidden;
}

.fd-chrome {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    background: #f1f3f5;
    border-bottom: 1px solid var(--lx-border);
}

.fd-cdot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lx-border-strong);
}

.fd-url {
    flex: 1;
    min-width: 0;
    margin-left: 6px;
    padding: 2px 10px;
    background: #fff;
    border: 1px solid var(--lx-border);
    border-radius: 10px;
    color: var(--lx-text-muted);
    font-size: 10.5px;
    font-family: var(--font-stack-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fd-url .bi { font-size: 9px; color: var(--lx-success-solid); }

.fd-page { position: relative; padding: 12px 14px; }

.fd-skel { animation-name: fd3-skel; }

@keyframes fd3-skel {
    0%, 16%   { opacity: 1; }
    21%, 92%  { opacity: 0; }
    97%, 100% { opacity: 1; }
}

/* Skeleton bars — colours from loader.html .skeleton-shimmer; the sweep
   is a translateX'd gradient strip rather than background-position so it
   stays on the compositor. */
.fd-skel-bar {
    position: relative;
    overflow: hidden;
    height: 12px;
    border-radius: 4px;
    background: var(--lx-surface-inset);
    border: 1px solid var(--lx-border);
    margin-bottom: 9px;
}

.fd-skel-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 25%, var(--lx-surface-muted) 50%, transparent 75%);
    animation: fd3-shimmer 1.4s linear infinite;
    will-change: transform;
}

@keyframes fd3-shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.fd-skel-bar.w40 { width: 40%; height: 14px; }
.fd-skel-bar.w95 { width: 95%; }
.fd-skel-bar.w60 { width: 60%; }

.fd-loadedc {
    position: absolute;
    inset: 12px 14px auto;
    opacity: 0;
    animation-name: fd3-loaded;
}

@keyframes fd3-loaded {
    0%, 16%   { opacity: 0; }
    22%, 90%  { opacity: 1; }
    96%, 100% { opacity: 0; }
}

.fd-zap {
    position: absolute;
    right: 22px;
    bottom: 22px;
    padding: 4px 10px;
    border-radius: 12px;
    background: #212529;
    color: #fff;
    font-size: 11px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(8px);
    animation-name: fd3-zap;
    will-change: transform, opacity;
}

.fd-zap .bi { color: var(--lx-warning-solid); }

@keyframes fd3-zap {
    0%, 22%   { opacity: 0; transform: translateY(8px); }
    28%, 88%  { opacity: 1; transform: translateY(0); }
    94%, 100% { opacity: 0; transform: translateY(8px); }
}

/* ============ 04 Keyboard navigation ============ */

.fd-list {
    position: relative;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fd-row {
    position: relative;
    z-index: 1;
    height: 38px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: #fff;
    border: 1px solid var(--lx-border);
    border-radius: 6px;
    font-size: 12.5px;
}

/* translucent overlay ABOVE the white rows so the highlight ring +
   tint read through while the row text stays visible */
.fd-sel {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 14px;
    height: 38px;
    z-index: 2;
    border-radius: 6px;
    background: rgba(var(--color-coral-base-rgb), 0.1);
    box-shadow: inset 0 0 0 1.5px var(--lx-brand);
    animation-name: fd4-sel;
    animation-timing-function: cubic-bezier(0.6, 0.02, 0.2, 1);
    will-change: transform;
}

@keyframes fd4-sel {
    0%, 12%   { transform: translateY(0); }
    18%, 32%  { transform: translateY(46px); }
    38%, 52%  { transform: translateY(92px); }
    58%, 76%  { transform: translateY(138px); }
    82%, 100% { transform: translateY(0); }
}

.fd-keys {
    position: absolute;
    right: 14px;
    bottom: 12px;
    display: flex;
    gap: 6px;
}

.fd-keys kbd {
    font-family: var(--font-stack-mono);
    font-size: 12px;
    background: #fff;
    border: 1px solid var(--lx-border-strong);
    border-bottom-width: 2px;
    border-radius: 6px;
    padding: 2px 9px;
    color: #212529;
    opacity: 0.4;
    animation-timing-function: step-end;
}

.fd-k-down { animation-name: fd4-down; }
.fd-k-up   { animation-name: fd4-up; }

@keyframes fd4-down {
    0%, 13%  { opacity: 0.4; transform: none; }
    14%, 17% { opacity: 1; transform: translateY(1px); }
    18%, 33% { opacity: 0.4; transform: none; }
    34%, 37% { opacity: 1; transform: translateY(1px); }
    38%, 53% { opacity: 0.4; transform: none; }
    54%, 57% { opacity: 1; transform: translateY(1px); }
    58%, 100% { opacity: 0.4; transform: none; }
}

@keyframes fd4-up {
    0%, 77%   { opacity: 0.4; transform: none; }
    78%, 81%  { opacity: 1; transform: translateY(1px); }
    82%, 100% { opacity: 0.4; transform: none; }
}

/* ============ 05 Grounded AI (MCP) ============ */

.demo-mcp { background: #fff; }

.fd-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    font-size: 12.5px;
}

.fd-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    opacity: 0;
    transform: translateY(8px);
    will-change: transform, opacity;
}

.fd-user {
    align-self: flex-end;
    background: var(--lx-surface-inset);
    border-bottom-right-radius: 3px;
    animation-name: fd5-user;
}

@keyframes fd5-user {
    0%, 4%    { opacity: 0; transform: translateY(8px); }
    9%, 90%   { opacity: 1; transform: translateY(0); }
    96%, 100% { opacity: 0; transform: translateY(8px); }
}

.fd-tool {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--lx-surface-muted);
    border: 1px dashed var(--lx-border-strong);
    border-radius: 8px;
    color: #495057;
    font-size: 11px;
    opacity: 0;
    transform: translateY(8px);
    animation-name: fd5-tool;
    will-change: transform, opacity;
}

.fd-tool code {
    font-family: var(--font-stack-mono);
    font-size: 10.5px;
    color: #495057;
    background: none;
    padding: 0;
}

@keyframes fd5-tool {
    0%, 16%   { opacity: 0; transform: translateY(8px); }
    21%, 90%  { opacity: 1; transform: translateY(0); }
    96%, 100% { opacity: 0; transform: translateY(8px); }
}

/* spinner dots: visible while the "tool runs" (21%-38%), then the tick */
.fd-spin { display: inline-flex; gap: 2px; animation-name: fd5-spin; opacity: 0; }

.fd-spin span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #adb5bd;
    animation: fd5-dot 0.9s ease-in-out infinite;
}

.fd-spin span:nth-child(2) { animation-delay: 0.15s; }
.fd-spin span:nth-child(3) { animation-delay: 0.3s; }

@keyframes fd5-spin {
    0%, 20%   { opacity: 0; }
    21%, 37%  { opacity: 1; }
    38%, 100% { opacity: 0; }
}

@keyframes fd5-dot {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}

.fd-ok { color: var(--lx-success-solid); font-size: 12px; opacity: 0; animation-name: fd5-ok; }

@keyframes fd5-ok {
    0%, 37%   { opacity: 0; }
    40%, 90%  { opacity: 1; }
    96%, 100% { opacity: 0; }
}

.fd-ai {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--lx-border);
    border-bottom-left-radius: 3px;
    animation-name: fd5-ai;
}

@keyframes fd5-ai {
    0%, 42%   { opacity: 0; transform: translateY(8px); }
    48%, 90%  { opacity: 1; transform: translateY(0); }
    96%, 100% { opacity: 0; transform: translateY(8px); }
}

.fd-cite {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 7px;
    border-radius: 10px;
    background: #ffecee;
    border: 1px solid var(--color-coral-200);
    color: var(--lx-brand-strong);
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

/* ============ 06 Semantic search ============ */

.fd-omni {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px;
    padding: 9px 13px;
    background: #fff;
    border: 1px solid var(--lx-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.fd-omni .bi { color: var(--lx-text-muted); font-size: 13px; }

.fd-typed {
    font-family: var(--font-stack-mono);
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    width: 0;
    border-right: 2px solid var(--lx-brand);
    animation: fd6-type 9s steps(5, end) infinite, fd6-caret 0.7s step-end infinite;
}

@keyframes fd6-type {
    0%, 8% { width: 0; }
    20%    { width: 5ch; }
    88%    { width: 5ch; }
    100%   { width: 0; }
}

@keyframes fd6-caret {
    0%, 100% { border-color: var(--lx-brand); }
    50%      { border-color: transparent; }
}

.fd-results {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 0 16px;
}

.fd-res {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    background: #fff;
    border: 1px solid var(--lx-border);
    border-radius: 6px;
    font-size: 11.5px;
    opacity: 0;
    transform: translateY(8px);
    animation-name: fd6-res;
    will-change: transform, opacity;
}

.fd-res:nth-child(2) { animation-delay: 0.15s; }
.fd-res:nth-child(3) { animation-delay: 0.3s; }

@keyframes fd6-res {
    0%, 30%   { opacity: 0; transform: translateY(8px); }
    36%, 88%  { opacity: 1; transform: translateY(0); }
    95%, 100% { opacity: 0; transform: translateY(8px); }
}

/* badge colours from celex_omni_search.js (chunk-badge / --recital) */
.fd-chunk {
    flex: 0 0 auto;
    padding: 1px 7px;
    border-radius: 3px;
    background: #e8868a;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
}

.fd-chunk-rct { background: #5c6bc0; }

.fd-match { margin-left: auto; font-size: 10px; font-weight: 600; }
.fd-m-sem  { color: #1565c0; }
.fd-m-lit  { color: #d84315; }
.fd-m-both { color: #5c6bc0; }

/* matched terms in result titles — the real highlight colours from
   celex_ui.css: ::highlight(search-match) yellow for exact-word hits,
   ::highlight(semantic-match) pink for synonym hits */
.fd-mark {
    border-radius: 2px;
    padding: 0 2px;
    color: inherit;
}

.fd-mark-exact { background: #ffeb3b; }
.fd-mark-sem   { background: #f8bbd0; }

/* ============ 07 Version differences ============ */

.fd-vbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    padding: 12px 16px 0;
    font-size: 11px;
    color: var(--lx-text-muted);
}

.fd-vpill {
    padding: 2px 9px;
    border-radius: 11px;
    background: #fff;
    border: 1px solid var(--lx-border);
    font-weight: 600;
    color: #495057;
}

.fd-vpill-uk { border-color: var(--color-coral-200); color: var(--lx-brand-strong); background: #ffecee; }

.fd-legend { margin-left: auto; display: flex; gap: 5px; }

.fd-lg {
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

/* diff colours from diff_styles.css */
.fd-lg-add { background: #ccffcc; color: #155724; }
.fd-lg-del { background: #ffcccc; color: #721c24; }

.fd-diffcard {
    margin: 12px 16px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--lx-border);
    border-left: 4px solid var(--lx-warning-solid); /* .diff-modified */
    border-radius: 6px;
}

.fd-diffbody { display: grid; }

.fd-diffbody p {
    grid-area: 1 / 1;
    margin: 0;
    font-size: 12.5px;
}

.fd-v1 { animation-name: fd7-v1; }

@keyframes fd7-v1 {
    0%, 24%   { opacity: 1; }
    30%, 92%  { opacity: 0; }
    98%, 100% { opacity: 1; }
}

.fd-v2 { opacity: 0; animation-name: fd7-v2; }

@keyframes fd7-v2 {
    0%, 24%   { opacity: 0; }
    30%, 92%  { opacity: 1; }
    98%, 100% { opacity: 0; }
}

.fd-del {
    background: #ffcccc;
    color: #721c24;
    text-decoration: line-through;
    padding: 1px 4px;
    border-radius: 3px;
}

.fd-ins {
    background: #ccffcc;
    color: #155724;
    font-weight: 500;
    padding: 1px 4px;
    border-radius: 3px;
}

.fd-attr {
    margin-top: 10px;
    font-size: 11px;
    color: var(--lx-text-muted);
    opacity: 0;
    transform: translateY(6px);
    animation-name: fd7-attr;
    will-change: transform, opacity;
}

.fd-attr .bi { color: var(--lx-brand); }

@keyframes fd7-attr {
    0%, 40%   { opacity: 0; transform: translateY(6px); }
    48%, 92%  { opacity: 1; transform: translateY(0); }
    98%, 100% { opacity: 0; transform: translateY(6px); }
}

/* ============ 08 Marginalia ============ */

.fd-split {
    display: flex;
    gap: 10px;
    padding: 14px;
    height: 100%;
}

.fd-prov {
    flex: 1 1 52%;
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--lx-border);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 10.5px;
    line-height: 1.5;
}

.fd-prov .fd-doc-h {
    font-size: 11px;
}

.fd-split .fd-flood { flex: 1 1 48%; }

.fd-marg {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 10.5px;
    line-height: 1.4;
    margin-bottom: 9px;
    opacity: 0;
    transform: translateX(14px);
    will-change: transform, opacity;
}

.fd-marg .bi { font-size: 13px; margin-top: 1px; }
.fd-i-note { color: var(--lx-warning-solid); }
.fd-i-pdf  { color: var(--lx-danger-solid); }
.fd-i-chat { color: var(--lx-blue-solid); }

/* nth-child(1) is the panel heading */
.fd-marg:nth-child(2) { animation-name: fd8-in1; }
.fd-marg:nth-child(3) { animation-name: fd8-in2; }
.fd-marg:nth-child(4) { animation-name: fd8-in3; }

@keyframes fd8-in1 {
    0%, 10%   { opacity: 0; transform: translateX(14px); }
    16%, 90%  { opacity: 1; transform: translateX(0); }
    96%, 100% { opacity: 0; transform: translateX(14px); }
}

@keyframes fd8-in2 {
    0%, 26%   { opacity: 0; transform: translateX(14px); }
    32%, 90%  { opacity: 1; transform: translateX(0); }
    96%, 100% { opacity: 0; transform: translateX(14px); }
}

@keyframes fd8-in3 {
    0%, 42%   { opacity: 0; transform: translateX(14px); }
    48%, 90%  { opacity: 1; transform: translateX(0); }
    96%, 100% { opacity: 0; transform: translateX(14px); }
}

/* ============ 09 Resources ============ */

.fd-flood-full {
    margin: 14px;
}

.fd-resrow {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 11px;
    color: #212529;
    opacity: 0;
    transform: translateY(8px);
    will-change: transform, opacity;
}

.fd-resrow .bi { flex: 0 0 auto; color: var(--lx-brand); font-size: 12px; }

.fd-restext {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* nth-child(1) is the panel heading */
.fd-resrow:nth-child(2) { animation-name: fd9-in1; }
.fd-resrow:nth-child(3) { animation-name: fd9-row2; }
.fd-resrow:nth-child(4) { animation-name: fd9-in3; }

@keyframes fd9-in1 {
    0%, 4%    { opacity: 0; transform: translateY(8px); }
    10%, 90%  { opacity: 1; transform: translateY(0); }
    96%, 100% { opacity: 0; transform: translateY(8px); }
}

/* row 2 reveals, then highlights while the cursor hovers it */
@keyframes fd9-row2 {
    0%, 8%    { opacity: 0; transform: translateY(8px); background: transparent; }
    14%, 36%  { opacity: 1; transform: translateY(0); background: transparent; }
    40%, 86%  { opacity: 1; transform: translateY(0); background: #f0f4ff; }
    92%       { opacity: 1; transform: translateY(0); background: transparent; }
    97%, 100% { opacity: 0; transform: translateY(8px); background: transparent; }
}

@keyframes fd9-in3 {
    0%, 12%   { opacity: 0; transform: translateY(8px); }
    18%, 90%  { opacity: 1; transform: translateY(0); }
    96%, 100% { opacity: 0; transform: translateY(8px); }
}

.demo-res .fd-cursor { animation-name: fd9-cursor; }

@keyframes fd9-cursor {
    0%, 22%   { transform: translate(250px, 200px); }
    38%, 86%  { transform: translate(var(--fd-tx, 110px), var(--fd-ty, 96px)); }
    98%, 100% { transform: translate(250px, 200px); }
}

/* instant PDF preview popover — mirrors celex_ui.css .resource-preview-popover */
.fd-pdfprev {
    position: absolute;
    right: 16px;
    top: 64px;
    width: 44%;
    max-width: 150px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
    padding: 10px 10px 7px;
    z-index: 4;
    opacity: 0;
    transform: translateY(6px) scale(0.94);
    transform-origin: top right;
    animation-name: fd9-prev;
    will-change: transform, opacity;
}

@keyframes fd9-prev {
    0%, 40%   { opacity: 0; transform: translateY(6px) scale(0.94); }
    46%, 86%  { opacity: 1; transform: translateY(0) scale(1); }
    93%, 100% { opacity: 0; transform: translateY(6px) scale(0.94); }
}

/* a miniature document page: title bar + greeked text lines */
.fd-pdfpage {
    background: #fff;
    border: 1px solid var(--lx-surface-inset);
    border-radius: 3px;
    padding: 8px;
}

.fd-pdfline {
    height: 5px;
    border-radius: 2px;
    background: var(--lx-border);
    margin-bottom: 5px;
}

.fd-pdfline-title {
    width: 70%;
    height: 7px;
    background: #adb5bd;
    margin-bottom: 7px;
}

.fd-pdfline.w80 { width: 80%; }
.fd-pdfline.w50 { width: 50%; margin-bottom: 0; }

.fd-pdflabel {
    margin-top: 5px;
    text-align: center;
    font-size: 9.5px;
    font-weight: 600;
    color: var(--lx-text-muted);
}

.fd-pdflabel .bi { color: var(--lx-danger-solid); }

/* ----------------------------------------------------------------
   Reduced motion — snap every demo to its end-state, no loops
   ---------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .feature-card { opacity: 1; transform: none; transition: none; }
    .scroll-cue .bi { animation: none; }

    .demo-stage *,
    .demo-stage *::before,
    .demo-stage *::after { animation: none !important; }

    .demo-def .fd-cursor    { transform: translate(var(--fd-tx, 165px), var(--fd-ty, 92px)); }
    .demo-remote .fd-cursor { transform: translate(var(--fd-tx, 40px), var(--fd-ty, 92px)); }
    .demo-res .fd-cursor    { transform: translate(var(--fd-tx, 110px), var(--fd-ty, 96px)); }

    .fd-hover { background: rgba(var(--color-coral-base-rgb), 0.12); box-shadow: inset 0 -1.5px 0 var(--lx-brand); }
    .fd-popover { opacity: 1; transform: none; }

    .fd-skel { opacity: 0; }
    .fd-loadedc, .fd-zap { opacity: 1; transform: none; }

    .fd-sel { transform: translateY(46px); }

    .fd-msg, .fd-tool, .fd-ok { opacity: 1; transform: none; }
    .fd-spin { opacity: 0; }

    .fd-typed { width: 5ch; border-color: transparent; }
    .fd-res { opacity: 1; transform: none; }

    .fd-v1 { opacity: 0; }
    .fd-v2, .fd-attr { opacity: 1; transform: none; }

    .fd-marg, .fd-resrow { opacity: 1; transform: none; }
    .fd-resrow:nth-child(3) { background: #f0f4ff; }
    .fd-pdfprev { opacity: 1; transform: none; }
}
