/* ─────────────────────────────────────────
   ZabanBom Download Page — v6
   375px canvas · ResponsiveScaledBox · RTL
───────────────────────────────────────── */

/* ── Spacing scale (8px grid) ── */
body.page-download-v2 {
    --dl-space-1: var(--space-1);
    --dl-space-2: var(--space-2);
    --dl-space-3: var(--space-3);
    --dl-space-4: var(--space-4);
    --dl-gap: var(--content-gap);
    --dl-gap-cards: var(--section-gap);
}

/* ── Page body ── */
body.page-download-v2 {
    background: #faf4ec !important;
    color: #241712 !important;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden !important;
}

body.page-download-v2 main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
}

/* Hide elements not needed on this page */
body.page-download-v2 #scroll-progress,
body.page-download-v2 #custom-cursor,
body.page-download-v2 .footer-group,
body.page-download-v2 .zb-ft {
    display: none !important;
}

/* ── Page layout (ResponsiveScaledBox — same as footer) ── */
.zb-download {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    background: #fff8f0;
    direction: rtl;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    /* padding: 0 0 calc(var(--dl-space-2) + env(safe-area-inset-bottom, 0px)); */
}

.zb-download__viewport {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: stretch;
    width: 100%;
    box-sizing: border-box;
    padding-top: var(--nav-h, 4.5rem);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

body.page-download-v2 .zb-download__viewport:not([data-ready]) {
    visibility: hidden;
}

.zb-download__viewport > .zb-scale__stage {
    flex-shrink: 0;
    overflow: hidden;
    margin-left: auto;
    margin-right: auto;
}

/* 375px fixed design canvas — scaled by download-scale.js */
.zb-download__canvas {
    width: 375px;
    flex-shrink: 0;
    box-sizing: border-box;
    padding: 0 var(--canvas-padding-x);
    transform-origin: top center;
    will-change: transform;
    display: flex;
    flex-direction: column;
    margin-top: auto;
    margin-bottom: auto;
}

.zb-download__content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

.zb-download__main {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.zb-download__cards {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

.zb-download__footer {
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
    text-align: center;
    padding-bottom: calc(var(--dl-space-2) + env(safe-area-inset-bottom, 0px));
}

/* Expanded — flexible vertical space (Flutter Expanded) */
.zb-download__expand {
    flex: 1 1 0;
    min-height: var(--dl-gap);
}

.zb-download__expand--top {
    flex: 1 1 0;
    min-height: var(--dl-gap);
}

/* Fixed gaps — percentages break flex measure/scale on resize */
.zb-download__gap {
    flex: 0 0 var(--dl-gap);
    height: var(--dl-gap);
    min-height: var(--dl-gap);
}

.zb-download__gap--cards {
    flex: 0 0 var(--dl-gap-cards);
    height: var(--dl-gap-cards);
    min-height: var(--dl-gap-cards);
}

.zb-download__gap--note {
    flex: 0 0 var(--dl-space-1);
    height: var(--dl-space-1);
    min-height: var(--dl-space-1);
}

.zb-download__canvas--fill {
    box-sizing: border-box;
    height: 100% !important;
    min-height: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.zb-download__intro {
    flex-shrink: 0;
    text-align: center;
}

.zb-download__header {
    flex-shrink: 0;
    margin: 0;
    text-align: center;
}

.zb-download__title {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.45;
    color: #241712;
    text-align: center;
}

.zb-download__subtitle {
    flex-shrink: 0;
    margin: var(--dl-space-1) 0 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.65;
    color: #7a7268;
    text-align: center;
    display: block;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

.zb-download__note {
    margin: 0;
    flex-shrink: 0;
    font-size: var(--box-body-size);
    font-weight: 400;
    line-height: 1.8;
    color: #6a5c50;
    text-align: center;
    padding: 0 var(--dl-space-2);
}

.zb-download__note-highlight {
    color: var(--primary, #cc3a21);
    font-weight: 700;
}

/* ── Diamond divider ── */
.zb-download__divider {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: var(--dl-space-2) auto var(--dl-gap);
    max-width: 220px;
    width: 100%;
}

.zb-download__line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #c5ad82, transparent);
}

.zb-download__diamond {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    background: #c9a96e;
    transform: rotate(45deg);
}

/* ── Download cards ── */
.zb-download-card {
    flex-shrink: 0;
    display: flex;
    direction: ltr;          /* icon LEFT, chevron RIGHT */
    align-items: center;
    gap: var(--dl-space-2);
    padding: var(--dl-space-2) var(--dl-space-3);
    border-radius: 22px;
    background: #FFF8F0;
    border: 1px solid #e8d9c4;
    box-shadow: 0 4px 22px rgba(72, 45, 30, 0.07);
    text-decoration: none;
    color: #241712;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    box-sizing: border-box;
}

.zb-download-card:hover {
    color: #241712;
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(72, 45, 30, 0.13);
}

/* Large icon circle */
.zb-download-card__icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fffaf6;
    color: #c94a30;
    font-size: 34px;
    box-shadow: 0 2px 14px rgba(39, 24, 16, 0.1);
}

/* Text block — force RTL text alignment */
.zb-download-card__content {
    flex: 1;
    min-width: 0;
    direction: rtl;
    text-align: right;
}

.zb-download-card__title {
    display: block;
    font-size: var(--box-title-size);
    font-weight: 700;
    line-height: 1.4;
    color: #241712;
}

.zb-download-card__version {
    display: block;
    font-size: var(--box-caption-size);
    color: #7a7268;
    margin-top: 3px;
}

/* Chevron circle (right side because direction: ltr on card) */
.zb-download-card__arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #d4bfa0;
    color: #8f816f;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.6);
}

/* ── Scale on very narrow phones (< 375px) — handled by site.js ── */

@media (max-width: 899.98px) {
    .zb-download__expand,
    .zb-download__expand--top {
        max-height: none;
    }
}

/* ── Tablet / desktop (no ResponsiveScaledBox) ── */
@media (min-width: 900px) {
    .zb-download__canvas {
        width: min(480px, 90vw) !important;
        max-width: 480px;
        padding: 0 var(--dl-space-3);
    }

    .zb-download__canvas--fill {
        height: 100% !important;
        min-height: 100% !important;
        max-height: 100%;
        padding-top: clamp(var(--dl-space-2), 2vh, var(--dl-space-3));
        padding-bottom: 0;
        box-sizing: border-box;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .zb-download__title {
        font-size: 2rem;
    }

    .zb-download__subtitle {
        font-size: 1rem;
    }

    .zb-download-card__icon {
        width: 72px;
        height: 72px;
        font-size: 2.2rem;
    }
}
