.aptera-demo {
    --as-surface: #ffffff;
    --as-surface-2: #f5f5f9;
    --as-ink: #16161d;
    --as-ink-2: #5b5b67;
    --as-ink-3: #8a8a96;
    --as-line: #e7e7ee;
    --as-accent: #00206B;
    --as-accent-dark: #1E57CC;
    --as-accent-soft: color-mix(in srgb, var(--as-accent) 10%, transparent);
    --as-ok: #1e9e68;
    --as-mono: ui-monospace, 'JetBrains Mono', monospace;
    --as-r-sm: 9px;
    --as-r-md: 13px;
    --as-r-pill: 999px;

    display: flex;
    flex-direction: column;
    gap: 26px;
    width: 100%;
    max-width: 360px;
    /* без этого блок как flex-item не сжимается своим содержимым (тот же
       min-width:auto, что и у flex-карточек в projects.css) и раздвигает
       карточку шире родителя */
    min-width: 0;
}

.as-stack {
    display: grid;
    /* без явной колонки грид считает ширину по max-content самой широкой
       сцены (напр. чек-лист в "Генерации") и растягивает всё шире
       контейнера — тот же по сути баг, что и у флекс-карточек выше,
       только на стороне грида */
    grid-template-columns: minmax(0, 1fr);
}

.as-scene {
    grid-area: 1 / 1;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(10px) scale(.985);
    transition: opacity .5s ease, transform .5s cubic-bezier(.16, 1, .3, 1);
    pointer-events: none;
}

.as-scene.on {
    opacity: 1;
    transform: none;
}

.as-scene.on .as-lbl,
.as-scene.on .as-input,
.as-scene.on .as-chip,
.as-scene.on .as-cta,
.as-scene.on .as-row,
.as-scene.on .as-doc-h,
.as-scene.on .as-doc-p,
.as-scene.on .as-doc-img,
.as-scene.on .as-tile,
.as-scene.on .as-export {
    animation: as-in .5s cubic-bezier(.16, 1, .3, 1) backwards;
}

@keyframes as-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.as-scene.on .as-row {
    animation-name: as-in-x;
}

@keyframes as-in-x {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
}

.as-card {
    width: 100%;
    background: var(--as-surface);
    color: var(--as-ink);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(8, 8, 40, .18), 0 40px 70px -34px rgba(4, 4, 30, .7);
}

.as-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--as-line);
    color: var(--as-ink-2);
}

.as-card-head b {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--as-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.as-head-chip {
    margin-left: auto;
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--as-mono);
    font-size: 10.5px;
    padding: 4px 9px;
    border-radius: var(--as-r-pill);
    background: var(--as-surface-2);
    color: var(--as-ink-3);
}

.as-head-chip.ok {
    background: rgba(30, 158, 104, .12);
    color: var(--as-ok);
}

.as-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.as-lbl {
    font-family: var(--as-mono);
    font-size: 10.5px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--as-ink-3);
    margin-bottom: 7px;
}

.as-input {
    min-height: 42px;
    padding: 10px 13px;
    border-radius: var(--as-r-md);
    border: 1.5px solid var(--as-accent);
    box-shadow: 0 0 0 4px var(--as-accent-soft);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 15px;
}

.as-ch {
    display: inline-block;
    max-width: 2em;
    white-space: pre;
}

.as-scene.on .as-ch {
    animation: as-ch-in 1ms steps(1, end) backwards;
}

@keyframes as-ch-in {
    from {
        max-width: 0;
        opacity: 0;
    }
    to {
        max-width: 2em;
        opacity: 1;
    }
}

.as-caret {
    display: inline-block;
    width: 1.5px;
    height: 1.05em;
    margin-left: 1px;
    vertical-align: -.16em;
    background: var(--as-accent);
    animation: as-blink 1.06s steps(1, end) infinite;
}

@keyframes as-blink {
    0%, 50% {
        opacity: 1;
    }
    50.01%, 100% {
        opacity: 0;
    }
}

.as-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.as-chip {
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: var(--as-r-pill);
    background: var(--as-accent-soft);
    color: var(--as-accent);
}

.as-cta {
    display: flex;
    justify-content: flex-end;
    position: relative;
}

.as-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border-radius: var(--as-r-pill);
    background: var(--as-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.as-scene.on .as-cta-btn {
    animation: as-press .5s cubic-bezier(.16, 1, .3, 1) backwards;
}

@keyframes as-press {
    0% {
        transform: none;
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--as-accent) 50%, transparent);
    }
    35% {
        transform: scale(.95);
    }
    100% {
        transform: none;
        box-shadow: 0 0 0 18px color-mix(in srgb, var(--as-accent) 0%, transparent);
    }
}

.as-cursor {
    position: absolute;
    top: 13px;
    right: 52px;
    line-height: 0;
    filter: drop-shadow(0 3px 6px rgba(10, 10, 40, .35));
}

.as-scene.on .as-cursor {
    animation: as-cursor-go .9s cubic-bezier(.4, 0, .2, 1) backwards;
}

@keyframes as-cursor-go {
    0% {
        opacity: 0;
        transform: translate(70px, 78px);
    }
    14% {
        opacity: 1;
    }
}

.as-outline {
    gap: 8px;
}

.as-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--as-line);
    border-radius: var(--as-r-md);
    font-size: 13px;
    font-weight: 600;
}

.as-row-num {
    width: 20px;
    height: 20px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--as-accent-soft);
    color: var(--as-accent);
    font-family: var(--as-mono);
    font-size: 11px;
}

.as-row-txt {
    flex: 1;
}

.as-row-drag {
    flex: none;
    color: var(--as-ink-3);
}

.as-row-add {
    justify-content: center;
    gap: 6px;
    border-style: dashed;
    color: var(--as-ink-3);
}

.as-bar {
    height: 3px;
    background: var(--as-line);
}

.as-bar i {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--as-accent), var(--as-accent-dark));
}

.as-scene.on .as-bar i {
    animation-name: as-grow;
    animation-timing-function: cubic-bezier(.3, .7, .4, 1);
}

@keyframes as-grow {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.as-steps {
    gap: 12px;
}

.as-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
}

.as-mark {
    position: relative;
    width: 20px;
    height: 20px;
    flex: none;
}

.as-mark-num,
.as-mark-ring,
.as-mark-check {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
}

.as-mark-num {
    border: 1.5px solid var(--as-line);
    color: var(--as-ink-3);
    font-family: var(--as-mono);
    font-size: 10.5px;
    opacity: 0;
}

.as-scene.on .as-mark-num {
    animation-name: as-hold;
    animation-timing-function: linear;
}

@keyframes as-hold {
    from {
        opacity: 1;
    }
    to {
        opacity: 1;
    }
}

.as-mark-ring {
    border: 2px solid var(--as-accent-soft);
    border-top-color: var(--as-accent);
    opacity: 0;
}

.as-scene.on .as-mark-ring {
    animation-name: as-hold, as-spin;
    animation-duration: 1150ms, .7s;
    animation-timing-function: linear, linear;
    animation-iteration-count: 1, infinite;
}

@keyframes as-spin {
    to {
        transform: rotate(360deg);
    }
}

.as-mark-check {
    background: var(--as-accent);
    color: #fff;
}

.as-scene.on .as-mark-check {
    animation: as-pop .34s cubic-bezier(.16, 1, .3, 1) backwards;
}

@keyframes as-pop {
    from {
        opacity: 0;
        transform: scale(.3);
    }
}

.as-step-txt {
    color: var(--as-ink-3);
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-position: 0 58%;
    background-size: 100% 1px;
}

.as-scene.on .as-step-txt {
    animation: as-strike .42s ease backwards;
}

@keyframes as-strike {
    from {
        color: var(--as-ink);
        background-size: 0 1px;
    }
    to {
        color: var(--as-ink-3);
        background-size: 100% 1px;
    }
}

.as-doc-h {
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--as-ink);
    margin-bottom: 7px;
}

.as-doc-p {
    font-size: 10.5px;
    line-height: 1.5;
    color: var(--as-ink-2);
}

.as-doc-split .as-doc-p {
    flex: 1;
}

.as-doc-split {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 13px 0 15px;
}

.as-doc-img {
    width: 76px;
    height: 58px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: var(--as-r-sm);
    border: 1px solid var(--as-line);
    background: var(--as-surface-2);
    color: var(--as-ink-3);
}

.as-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 13px;
}

.as-tile {
    padding: 9px 11px;
    border-radius: var(--as-r-md);
    background: var(--as-surface-2);
}

.as-tile b {
    display: block;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.as-tile span {
    font-size: 10.5px;
    color: var(--as-ink-3);
}

.as-export {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 14px;
    border-radius: var(--as-r-pill);
    background: var(--as-accent);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    .aptera-demo *,
    .aptera-demo *::before,
    .aptera-demo *::after {
        animation: none !important;
        transition: none !important;
    }
}
