/* ===== Design tokens (from stitch_malaysian_kids_ebook_storefront) ===== */
:root {
    --bg: #faf9f5;
    --card: #ffffff;
    --divider: #efece6;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-tint: #eef2ff;
    --primary-tint-2: #e0e7ff;
    --coral: #f43f5e;
    --coral-tint: #ffe4e6;
    --amber: #f59e0b;
    --amber-tint: #fef3c7;
    --mint: #10b981;
    --mint-tint: #d1fae5;
    --ink: #131e29;
    --ink-2: #475569;
    --ink-3: #64748b;
    --radius-sm: 0.5rem;
    --radius: 1rem;
    --radius-md: 1.5rem;
    --radius-lg: 2rem;
    --radius-xl: 3rem;
    --radius-full: 9999px;
    --shadow-1: 0 2px 8px -2px rgba(19, 30, 41, 0.04), 0 8px 24px -4px rgba(19, 30, 41, 0.06);
    --shadow-2: 0 8px 20px -4px rgba(37, 99, 235, 0.12), 0 16px 36px -6px rgba(19, 30, 41, 0.08);
    --shadow-3: 0 20px 48px -8px rgba(19, 30, 41, 0.16);
    --container-max: 1240px;
    --font: "Plus Jakarta Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; }

/* ===== Typography scale ===== */
.display { font-size: 36px; line-height: 44px; font-weight: 800; letter-spacing: -0.02em; }
.headline-lg { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -0.02em; }
.headline-md { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.02em; }
.headline-sm { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.015em; }
.title-lg { font-size: 18px; line-height: 26px; font-weight: 700; letter-spacing: -0.01em; }
.title-md { font-size: 16px; line-height: 24px; font-weight: 600; }
.body-lg { font-size: 18px; line-height: 28px; font-weight: 400; }
.body-md { font-size: 15px; line-height: 24px; font-weight: 400; }
.body-sm { font-size: 13px; line-height: 20px; font-weight: 400; }
.label-lg { font-size: 14px; line-height: 20px; font-weight: 700; letter-spacing: 0.01em; }
.label-md { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; }
.currency-display { font-size: 22px; line-height: 26px; font-weight: 800; letter-spacing: -0.02em; }

h1, h2, h3, p { margin: 0; }
.ink-2 { color: var(--ink-2); }
.ink-3 { color: var(--ink-3); }

@media (min-width: 768px) {
    .display { font-size: 48px; line-height: 56px; }
    .headline-lg { font-size: 40px; line-height: 48px; }
}

/* ===== Layout ===== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1rem;
}
@media (min-width: 1024px) { .container { padding: 0 1.5rem; } }

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(250, 249, 245, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 8px rgba(19, 30, 41, 0.04);
}
.site-header-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 17px;
    color: var(--primary);
    letter-spacing: -0.01em;
}
.brand .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--primary-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-2);
    transition: background 0.15s;
}
.icon-btn:hover { background: var(--primary-tint); }

.site-main { flex: 1; }
.site-footer {
    margin-top: 3rem;
    padding: 2.5rem 1rem 3rem;
    background: #f2efe8;
    border-top: 1px solid var(--divider);
}
.footer-inner { max-width: var(--container-max); margin: 0 auto; display: flex; flex-direction: column; gap: 1.25rem; }
.footer-pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.footer-pill {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    background: var(--card);
    box-shadow: var(--shadow-1);
    font-weight: 700;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.01em;
    border: none;
    cursor: pointer;
    transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
    text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.35); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-coral { background: var(--coral); color: #fff; box-shadow: var(--shadow-1); }
.btn-ghost {
    background: var(--card);
    color: var(--primary);
    border: 1.5px solid rgba(19, 30, 41, 0.1);
}
.btn-ghost:hover { background: var(--primary-tint); }
.btn-block { width: 100%; }
.btn-lg { padding: 1rem 1.75rem; font-size: 15px; }

/* ===== Pills / badges ===== */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
}
.pill-primary { background: var(--primary-tint); color: var(--primary); }
.pill-coral { background: var(--coral-tint); color: #9f1239; }
.pill-amber { background: var(--amber-tint); color: #92400e; }
.pill-mint { background: var(--mint-tint); color: #065f46; }
.pill-neutral { background: var(--divider); color: var(--ink-2); }
.pill-onimage { background: rgba(255, 255, 255, 0.92); color: var(--ink); backdrop-filter: blur(4px); }

/* ===== Hero ===== */
.hero {
    padding: 2.5rem 1rem 1rem;
    text-align: center;
}
.hero-inner { max-width: var(--container-max); margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.trust-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    background: var(--card);
    box-shadow: var(--shadow-1);
    margin-bottom: 1.25rem;
}
.hero h1 { max-width: 20ch; }
.hero h1 .accent { color: var(--primary); position: relative; }
.hero p.subtitle { color: var(--ink-2); margin-top: 0.75rem; max-width: 40ch; }
.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
    max-width: 320px;
    margin-top: 1.5rem;
}
@media (min-width: 480px) { .hero-actions { flex-direction: row; max-width: 420px; } }

.book-fan {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2.5rem;
    padding-bottom: 0.5rem;
    gap: -1rem;
}
.book-fan .fan-book {
    width: 108px;
    height: 155px;
    border-radius: 0.85rem;
    overflow: hidden;
    box-shadow: var(--shadow-2);
    background: var(--card);
    flex-shrink: 0;
    border: 1px solid rgba(19,30,41,0.06);
}
.book-fan .fan-book img { width: 100%; height: 100%; object-fit: cover; }
.book-fan .fan-left { transform: rotate(-10deg) translateX(18px); z-index: 1; }
.book-fan .fan-right { transform: rotate(10deg) translateX(-18px); z-index: 1; }
.book-fan .fan-center { width: 138px; height: 198px; z-index: 2; transform: translateY(-8px); }

/* ===== Section scaffolding ===== */
.section { padding: 2.5rem 1rem; }
.section-inner { max-width: var(--container-max); margin: 0 auto; }
.section-alt { background: #f2f5fc; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 1.25rem; gap: 1rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; color: var(--primary); font-weight: 700; font-size: 12px; }
.section-head-center { text-align: center; margin-bottom: 1.75rem; }

/* ===== Bundle promo card ===== */
.bundle-card {
    background: linear-gradient(135deg, #dbe6ff 0%, #eef2ff 55%, #f5f0ff 100%);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px -6px rgba(37, 99, 235, 0.15);
    margin-bottom: 1.25rem;
}
.bundle-card:last-child { margin-bottom: 0; }
.bundle-fan {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.25rem 0;
    height: 150px;
}
.bundle-fan-track { display: flex; align-items: center; }
.bundle-fan .mini-book {
    width: 74px;
    height: 104px;
    border-radius: 0.6rem;
    overflow: hidden;
    box-shadow: var(--shadow-1);
    background: #fff;
    border: 1px solid rgba(19,30,41,0.06);
    margin-left: -22px;
    flex-shrink: 0;
}
.bundle-fan .mini-book:first-child { margin-left: 0; }
.bundle-fan .mini-book img { width: 100%; height: 100%; object-fit: cover; }
.bundle-fan .mini-book:nth-child(odd) { transform: rotate(-7deg); }
.bundle-fan .mini-book:nth-child(even) { transform: rotate(7deg) translateY(-6px); z-index: 1; }

.bundle-price-row { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.bundle-price-row .was { text-decoration: line-through; color: var(--ink-3); font-weight: 600; }
.bundle-save-badge {
    margin-left: auto;
    padding: 0.3rem 0.6rem;
    border-radius: 0.5rem;
    background: #ffd7dd;
    color: #9f1239;
    font-weight: 700;
    font-size: 12px;
}
.feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin: 0.75rem 0;
}
@media (min-width: 480px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
.feature-item { display: flex; align-items: center; gap: 0.5rem; font-size: 13px; }
.feature-item .check { color: var(--mint); flex-shrink: 0; }

/* ===== Book / product cards ===== */
.book-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (min-width: 640px) { .book-grid { grid-template-columns: repeat(3, 1fr); } }
.book-grid-single { display: flex !important; }
.book-grid-single .book-card { width: 200px; flex-shrink: 0; }
@media (min-width: 640px) { .book-grid-single .book-card { width: 220px; } }

.book-card {
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 0.6rem;
    box-shadow: var(--shadow-1);
    display: flex;
    flex-direction: column;
    transition: transform 0.15s, box-shadow 0.15s;
}
.book-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.cover-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 500 / 647;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--divider);
}
.cover-frame img { width: 100%; height: 100%; object-fit: cover; }
.cover-frame .spine-gloss {
    position: absolute;
    inset: 0 auto 0 0;
    width: 10px;
    background: linear-gradient(to right, rgba(0,0,0,0.18), transparent);
}
.cover-frame .badge-tl { position: absolute; top: 8px; left: 8px; }
.cover-frame .badge-tr { position: absolute; top: 8px; right: 8px; }

.book-card-body { padding: 0.65rem 0.15rem 0.15rem; display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.book-card-title { font-weight: 700; font-size: 14px; line-height: 1.3; }
.book-card-series { color: var(--ink-3); font-size: 12px; }
.price-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: auto; padding-top: 0.5rem; gap: 0.4rem; }
.price-now { color: var(--primary); font-weight: 800; font-size: 16px; }
.price-was { color: var(--ink-3); text-decoration: line-through; font-size: 12px; }
.buy-pill {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--primary-tint);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== Series header ===== */
.series-header { display: flex; align-items: center; gap: 0.6rem; margin: 2rem 0 1rem; }
.series-header:first-child { margin-top: 0; }
.series-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }

/* ===== Steps ===== */
.steps { display: flex; flex-direction: column; gap: 0.85rem; }
.step-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: 1.1rem;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}
.step-num {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== Trust grid ===== */
.trust-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
@media (min-width: 640px) { .trust-grid { grid-template-columns: repeat(4, 1fr); } }
.trust-item {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
}
.trust-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* ===== Sticky bundle bar ===== */
.sticky-bar-wrap {
    position: sticky;
    bottom: 16px;
    z-index: 40;
    padding: 0 1rem;
    pointer-events: none;
}
.sticky-bar {
    pointer-events: auto;
    max-width: var(--container-max);
    margin: 0 auto;
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius-full);
    padding: 0.5rem 0.5rem 0.5rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    box-shadow: 0 12px 36px rgba(19, 30, 41, 0.28);
}
.sticky-bar .label { font-weight: 700; font-size: 13px; }
.sticky-bar .sub { color: var(--mint); font-size: 11px; }

/* ===== Quick-view modal ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(19, 30, 41, 0.55);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.modal-backdrop.open { display: flex; }
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }
.modal-sheet {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.5rem;
    box-shadow: var(--shadow-3);
    max-height: 90vh;
    overflow-y: auto;
}
@media (min-width: 640px) { .modal-sheet { border-radius: var(--radius-lg); } }
.modal-close {
    width: 34px; height: 34px; border-radius: var(--radius-full);
    background: var(--divider); display: flex; align-items: center; justify-content: center;
    margin-left: auto; cursor: pointer;
}
.modal-cover { width: 100%; aspect-ratio: 500/647; border-radius: var(--radius); overflow: hidden; margin: 0.75rem 0; background: var(--divider); }
.modal-cover img { width: 100%; height: 100%; object-fit: cover; }

/* ===== Buy / checkout page ===== */
.buy-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.5rem 1rem; }
.buy-covers { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; margin: 1.25rem 0; max-width: 420px; }
.buy-covers img { width: 90px; aspect-ratio: 500/647; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow-2); border: 1px solid rgba(19,30,41,0.06); }
.buy-price { margin: 0.5rem 0 1.25rem; }

.form-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    padding: 1.5rem;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 0.4rem; }
.field input {
    width: 100%;
    height: 52px;
    padding: 0 1.1rem;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--divider);
    background: var(--bg);
    font-family: var(--font);
    font-size: 15px;
    color: var(--ink);
}
.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.error-box {
    background: #fff1f2;
    border: 1px solid var(--coral);
    color: #9f1239;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 14px;
}
.fine-print { color: var(--ink-3); font-size: 12px; text-align: center; margin-top: 1rem; max-width: 340px; margin-left: auto; margin-right: auto; }

/* ===== Order status / downloads page ===== */
.status-card {
    max-width: 480px;
    margin: 0 auto;
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    padding: 1.75rem;
    text-align: center;
}
.status-icon { width: 56px; height: 56px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; margin: 0 auto 0.75rem; font-size: 26px; }
.status-icon.pending { background: var(--amber-tint); color: #92400e; }
.status-icon.paid { background: var(--mint-tint); color: #065f46; }
.status-icon.failed { background: var(--coral-tint); color: #9f1239; }

.download-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.25rem; text-align: left; }
.download-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
}
.download-row .thumb { width: 40px; aspect-ratio: 500/647; object-fit: cover; border-radius: 0.4rem; flex-shrink: 0; }
.download-row .name { flex: 1; font-weight: 600; font-size: 13px; }

/* ===== Admin table ===== */
.admin-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--divider); white-space: nowrap; }
th { color: var(--ink-3); font-weight: 700; background: var(--bg); }
.status-pending { color: #92400e; font-weight: 700; }
.status-paid { color: #065f46; font-weight: 700; }
.status-failed { color: #9f1239; font-weight: 700; }

/* ===================================================================
   DESKTOP (1024px+) layout overrides.
   Mobile/tablet rules above are untouched -- these only re-lay-out the
   same markup into wider, two-column / multi-column arrangements so the
   page doesn't just look like a stretched phone screen on a large display.
   =================================================================== */
@media (min-width: 1024px) {
    .hero { padding: 4rem 1.5rem 2rem; text-align: left; }
    .hero-inner {
        display: grid;
        grid-template-columns: 1fr 0.9fr;
        align-items: center;
        gap: 3rem;
        text-align: left;
    }
    .hero-copy { display: flex; flex-direction: column; align-items: flex-start; }
    .hero h1 { max-width: 12ch; }
    .hero p.subtitle { max-width: 42ch; }
    .hero-actions { max-width: none; flex-direction: row; justify-content: flex-start; margin-top: 2rem; }
    .book-fan { margin-top: 0; justify-self: end; transform: scale(1.15); }

    .bundle-card {
        display: grid;
        grid-template-columns: 1fr 0.85fr;
        align-items: center;
        gap: 2.5rem;
        padding: 2.5rem;
    }
    .bundle-card-left { display: flex; flex-direction: column; align-items: flex-start; }
    .bundle-card-left .btn-block { width: auto; padding-left: 2.5rem; padding-right: 2.5rem; margin-top: 0.5rem; }
    .bundle-fan { height: auto; margin: 0; transform: scale(1.15); }

    .steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
    .step-card { flex-direction: column; text-align: left; height: 100%; }

    .section-head-center { max-width: 640px; margin-left: auto; margin-right: auto; }
}

@media (min-width: 1280px) {
    .hero h1 { max-width: 14ch; }
}
