/*
 * Widgets Page v2
 * Hero + Intro (text/carousel) + Download cards
 */

.aszv2-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (min-width: 769px) {
    .site-main.aszv2-page {
        padding: 76px 0 0;
    }
}

/* ── Buttons (used outside hero) ─────────────── */
.aszv2-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.aszv2-btn--primary {
    background: var(--accent-primary, #3d72fe);
    color: #fff;
    border-color: var(--accent-primary, #3d72fe);
}

.aszv2-btn--primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(61, 114, 254, 0.3);
}

.aszv2-btn--secondary {
    background: transparent;
    color: var(--text-body, #213364);
    border-color: rgba(33, 51, 100, 0.2);
}

.aszv2-btn--secondary:hover {
    background: rgba(33, 51, 100, 0.08);
    border-color: rgba(33, 51, 100, 0.3);
}

/* ── Hero — spaced like analysis-v2-hero ─────── */
.aszv2-hero {
    width: 100vw;
    margin-inline: calc(50% - 50vw);
    background: var(--nav-bg, #f8fafc);
    border-block-end: 1px solid var(--border-color, rgba(33, 51, 100, 0.1));
    padding-block: 32px;
}

.aszv2-hero__breadcrumb {
    max-width: 1200px;
    margin: 0 auto 20px;
    padding-inline: 20px;
}

.aszv2-hero__breadcrumb .breadcrumb-container {
    max-width: none;
    margin: 0;
    padding: 0;
}

.aszv2-hero__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding-inline: 20px;
    display: grid;
    /* RTL: info (right) + aside 340px (left) — same ratio as analysis-v2 */
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
    align-items: center;
}

.aszv2-hero__info {
    direction: rtl;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

.aszv2-hero__title {
    margin: 0;
    font-size: clamp(1.375rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-body, #1a1a1a);
}

.aszv2-hero__lead {
    width: 100%;
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.8;
    color: var(--text-body);
}

.aszv2-hero__seo {
    width: 100%;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.75;
    color: #64748b;
    text-align: justify;
}

.aszv2-hero__aside {
    min-width: 0;
}

/* Side card — mirrors analysis-v2-side-card (frosted glass) */
.aszv2-side-card {
    position: relative;
    z-index: 0;
    overflow: hidden;
    padding: 24px 22px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.50) 0%, rgba(255, 255, 255, 0.80) 55%, rgba(255, 255, 255, 0.90) 100%);
    border: 1px solid rgba(61, 114, 254, 0.18);
    box-shadow:
        0 18px 40px rgba(33, 51, 100, 0.14),
        0 6px 18px rgba(61, 114, 254, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.aszv2-side-card::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -45px;
    left: -45px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle,
        rgba(210, 227, 255, 0.62) 0%,
        rgba(150, 185, 255, 0.30) 42%,
        rgba(120, 162, 255, 0) 72%);
    filter: blur(14px);
    pointer-events: none;
}

.aszv2-side-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: radial-gradient(140px 140px at top left, rgba(61, 114, 254, 0.65) 0%, rgba(61, 114, 254, 0) 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.aszv2-side-card h3 {
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--text-primary, #213364);
    margin: 0 0 0.7rem;
    letter-spacing: -0.01em;
}

.aszv2-side-list {
    list-style: none;
    margin: 0 0 1.15rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.aszv2-side-list li {
    position: relative;
    padding-inline-start: 1.7rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary, rgba(33, 51, 100, 0.82));
}

.aszv2-side-list li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0.15rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") center / 12px 12px no-repeat,
        linear-gradient(135deg, var(--accent-primary, #3D72FE) 0%, #5b8cff 100%);
}

.aszv2-side-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--accent-primary, #3D72FE) 0%, #5b8cff 100%);
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(61, 114, 254, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.aszv2-side-btn:hover,
.aszv2-side-btn:focus,
.aszv2-side-btn:focus-visible,
.aszv2-side-btn:visited,
.aszv2-side-btn:active {
    color: #fff;
    text-decoration: none;
}

.aszv2-side-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow: 0 12px 28px rgba(61, 114, 254, 0.45);
}

[data-theme="dark"] .aszv2-hero {
    background: var(--card-bg, #1a2332);
    border-color: var(--border-color, rgba(255, 255, 255, 0.1));
}

[data-theme="dark"] .aszv2-hero__seo {
    color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .aszv2-side-card {
    background: linear-gradient(180deg, rgba(20, 30, 55, 0.55) 0%, rgba(15, 23, 42, 0.86) 60%, rgba(15, 23, 42, 0.92) 100%);
    border-color: rgba(61, 114, 254, 0.28);
    box-shadow:
        0 18px 44px rgba(2, 6, 23, 0.5),
        0 6px 18px rgba(61, 114, 254, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .aszv2-side-card::before {
    background: radial-gradient(60% 100% at 50% 0%, rgba(61, 114, 254, 0.60) 0%, rgba(61, 114, 254, 0) 72%);
}

[data-theme="dark"] .aszv2-side-card h3 {
    color: var(--text-primary, #f1f5f9);
}

[data-theme="dark"] .aszv2-side-list li {
    color: var(--text-secondary, #94a3b8);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .aszv2-hero {
        background: var(--card-bg, #1a2332);
        border-color: var(--border-color, rgba(255, 255, 255, 0.1));
    }

    :root:not([data-theme="light"]) .aszv2-hero__seo {
        color: rgba(255, 255, 255, 0.6);
    }

    :root:not([data-theme="light"]) .aszv2-side-card {
        background: linear-gradient(180deg, rgba(20, 30, 55, 0.55) 0%, rgba(15, 23, 42, 0.86) 60%, rgba(15, 23, 42, 0.92) 100%);
        border-color: rgba(61, 114, 254, 0.28);
    }

    :root:not([data-theme="light"]) .aszv2-side-card h3 {
        color: #f1f5f9;
    }

    :root:not([data-theme="light"]) .aszv2-side-list li {
        color: #94a3b8;
    }
}

/* ── Intro (text + carousel) ─────────────────── */
.aszv2-intro {
    padding-block: 48px 40px;
    scroll-margin-top: 100px;
}

.aszv2-intro__layout {
    display: grid;
    /* RTL: first column (content) on the right, second (carousel) on the left */
    grid-template-columns: minmax(0, 1fr) minmax(280px, 440px);
    gap: 40px;
    align-items: center;
}

.aszv2-intro__title {
    margin: 0 0 14px;
    font-size: clamp(1.35rem, 2.4vw, 1.85rem);
    font-weight: 900;
    color: var(--text-body, #213364);
    line-height: 1.4;
}

.aszv2-intro__lead,
.aszv2-intro__how {
    margin: 0 0 14px;
    color: var(--text-secondary, #64748b);
    line-height: 1.9;
    font-size: 1rem;
}

.aszv2-checklist {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: grid;
    gap: 10px;
}

.aszv2-checklist__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.97rem;
    line-height: 1.7;
    color: var(--text-body, #213364);
    font-weight: 600;
}

.aszv2-checklist__check {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: rgba(43, 186, 67, 0.12);
    border: 1px solid rgba(43, 186, 67, 0.22);
    color: #2bba43;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 0.85rem;
    font-weight: 900;
}

/* Live widget preview — flush, no outer halo/padding */
.aszv2-intro__media {
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.aszv2-live-widget {
    display: block;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.aszv2-live-widget .arzlw {
    max-width: none;
    width: 100%;
    margin: 0;
    box-shadow: none;
    border: none;
}

.aszv2-live-widget__fallback {
    width: 100%;
    max-width: 380px;
    margin-inline: auto;
    padding: 28px 20px;
    border-radius: 16px;
    background: #0b1c33;
    color: rgba(255, 255, 255, 0.82);
    text-align: center;
    line-height: 1.8;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.aszv2-live-widget__fallback strong {
    color: #fff;
}

/* ── Downloads ───────────────────────────────── */
.aszv2-downloads {
    padding-block: 28px 56px;
    scroll-margin-top: 100px;
}

.aszv2-downloads__title {
    margin: 0 0 8px;
    font-size: 1.55rem;
    font-weight: 950;
    color: var(--text-body, #213364);
}

.aszv2-downloads__subtitle {
    margin: 0 0 24px;
    color: var(--text-secondary, #64748b);
    line-height: 1.8;
}

.aszv2-downloads__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.aszv2-dl-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #eceef2);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    position: relative;
}

.aszv2-dl-card--soon {
    opacity: 0.82;
}

.aszv2-dl-card__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.aszv2-dl-card__identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.aszv2-dl-card__icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(100, 116, 139, 0.08);
    border: 1px solid var(--border-color, #eceef2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aszv2-dl-card__icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

/* macOS: apple-dark in light, apple-light in dark */
.aszv2-dl-card__icon--theme .aszv2-dl-card__icon-img--dark {
    display: none;
}

[data-theme="dark"] .aszv2-dl-card__icon--theme .aszv2-dl-card__icon-img--light {
    display: none;
}

[data-theme="dark"] .aszv2-dl-card__icon--theme .aszv2-dl-card__icon-img--dark {
    display: block;
}

[data-theme="light"] .aszv2-dl-card__icon--theme .aszv2-dl-card__icon-img--light {
    display: block;
}

[data-theme="light"] .aszv2-dl-card__icon--theme .aszv2-dl-card__icon-img--dark {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .aszv2-dl-card__icon--theme .aszv2-dl-card__icon-img--light {
        display: none;
    }

    :root:not([data-theme="light"]) .aszv2-dl-card__icon--theme .aszv2-dl-card__icon-img--dark {
        display: block;
    }
}

[data-theme="dark"] .aszv2-dl-card__icon {
    background: rgba(255, 255, 255, 0.06);
}

.aszv2-dl-card__titles {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.aszv2-dl-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--text-body, #213364);
}

.aszv2-dl-card__badge {
    display: inline-flex;
    align-self: flex-start;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 900;
    background: rgba(100, 116, 139, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.18);
}

.aszv2-dl-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.aszv2-dl-card__download,
.aszv2-dl-card__more {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color, #eceef2);
    background: transparent;
    color: var(--text-body, #213364);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.aszv2-dl-card__download {
    background: rgba(43, 186, 67, 0.12);
    border-color: rgba(43, 186, 67, 0.28);
    color: #1d8a30;
}

.aszv2-dl-card__download:hover {
    background: rgba(43, 186, 67, 0.2);
}

.aszv2-dl-card__download--disabled {
    background: rgba(100, 116, 139, 0.08);
    border-color: rgba(100, 116, 139, 0.18);
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
}

.aszv2-dl-card__more:hover,
.aszv2-dl-card__more[aria-expanded="true"] {
    background: rgba(61, 114, 254, 0.1);
    border-color: rgba(61, 114, 254, 0.28);
    color: var(--accent-primary, #3d72fe);
}

/* How-to: desktop modal / mobile bottom sheet (share-v2 pattern) */
body.aszv2-howto-open {
    overflow: hidden;
}

.aszv2-howto-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.aszv2-howto-overlay.is-visible {
    opacity: 1;
}

.aszv2-howto-panel {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    visibility: hidden;
}

.aszv2-howto-panel.is-open,
.aszv2-howto-panel.is-animating {
    visibility: visible;
}

.aszv2-howto-panel.is-open {
    pointer-events: auto;
}

.aszv2-howto-panel__sheet {
    width: 100%;
    max-width: 100%;
    background: var(--card-bg, #fff);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
    transform: translate3d(0, calc(100% + 24px), 0);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    outline: none;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    will-change: transform;
    direction: rtl;
}

.aszv2-howto-panel.is-open .aszv2-howto-panel__sheet {
    transform: translate3d(0, 0, 0);
}

.aszv2-howto-panel__handle {
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-color, #d1d5db);
    margin: 10px auto 0;
    flex-shrink: 0;
}

.aszv2-howto-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 8px;
}

.aszv2-howto-panel__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-body, #213364);
    line-height: 1.4;
}

.aszv2-howto-panel__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.aszv2-howto-panel__close:hover {
    background: rgba(100, 116, 139, 0.18);
    color: var(--text-body, #213364);
}

.aszv2-howto-panel__body {
    padding: 8px 20px 24px;
    overflow-y: auto;
}

.aszv2-howto-panel__list {
    margin: 0;
    padding-inline-start: 22px;
    display: grid;
    gap: 10px;
    color: var(--text-secondary, #64748b);
    font-size: 0.92rem;
    line-height: 1.75;
}

.aszv2-howto-panel__empty {
    margin: 0;
    color: var(--text-secondary, #64748b);
    font-size: 0.92rem;
    line-height: 1.75;
}

@media (min-width: 769px) {
    .aszv2-howto-panel {
        align-items: center;
        padding: 24px;
    }

    .aszv2-howto-panel__sheet {
        width: min(100%, 420px);
        max-width: 420px;
        border-radius: 16px;
        max-height: min(85vh, 520px);
        transform: translate3d(0, 24px, 0) scale(0.96);
        opacity: 0;
        transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
        box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
    }

    .aszv2-howto-panel.is-open .aszv2-howto-panel__sheet {
        transform: translate3d(0, 0, 0) scale(1);
        opacity: 1;
    }

    .aszv2-howto-panel__handle {
        display: none;
    }

    .aszv2-howto-panel__header {
        padding: 20px 20px 12px;
        border-bottom: 1px solid var(--border-color, #eceef2);
    }

    .aszv2-howto-panel__body {
        padding: 16px 20px 22px;
    }
}

[data-theme="dark"] .aszv2-howto-panel__sheet {
    background: var(--card-bg, #1a2332);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .aszv2-howto-panel__title {
    color: var(--text-body, #f1f5f9);
}

[data-theme="dark"] .aszv2-howto-panel__close {
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

[data-theme="dark"] .aszv2-howto-panel__close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #f1f5f9;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .aszv2-howto-panel__sheet {
        background: var(--card-bg, #1a2332);
    }

    :root:not([data-theme="light"]) .aszv2-howto-panel__title {
        color: #f1f5f9;
    }
}

/* Textual */
.aszv2-textual {
    padding-block: 20px 56px;
    border-top: 1px solid var(--border-color, #eceef2);
}

.aszv2-textual__content {
    max-width: 800px;
    margin: 0 auto;
    color: var(--text-secondary, #64748b);
    line-height: 1.9;
}

.aszv2-textual__content p {
    margin: 0 0 14px;
}

/* Dark */
[data-theme="dark"] .aszv2-dl-card {
    border-color: var(--border-color);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

/* Responsive */
@media (max-width: 1024px) {
    .aszv2-hero__inner,
    .aszv2-intro__layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .aszv2-hero__inner {
        direction: rtl;
    }

    .aszv2-intro__media {
        order: -1;
    }
}

@media (max-width: 768px) {
    .aszv2-hero {
        padding-block: 24px;
    }

    .aszv2-hero__breadcrumb,
    .aszv2-hero__inner,
    .aszv2-container {
        padding-inline: 16px;
    }

    .aszv2-hero__inner {
        gap: 24px;
    }

    .aszv2-hero__title {
        font-size: 1.35rem;
    }

    .aszv2-hero__seo {
        font-size: 0.85rem;
    }

    .aszv2-intro {
        padding-block: 32px 24px;
    }

    .aszv2-downloads__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .aszv2-hero__breadcrumb,
    .aszv2-hero__inner,
    .aszv2-container {
        padding-inline: 12px;
    }

    .aszv2-dl-card__main {
        gap: 12px;
    }

    .aszv2-dl-card__download,
    .aszv2-dl-card__more {
        width: 40px;
        height: 40px;
    }
}
