/* ==========================================================================
   DRS design system — layout, header, footer, buttons, cards, components
   ========================================================================== */

html { background: var(--bg); }

body {
    position: relative;
    background: transparent;
    color: var(--text);
    font-family: var(--font-sans);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    isolation: isolate;
}

/* Starfield: fixed GPU layer instead of background-attachment:fixed
   (no repaint on scroll, works on mobile, no gaps under the sticky header) */
body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
}
body::before {
    background-color: var(--bg);
    background-image: url("/assets/images/backgrounds/site-bg.jpg?v=3");
    background-image: image-set(
        url("/assets/images/backgrounds/site-bg.webp?v=3") type("image/webp"),
        url("/assets/images/backgrounds/site-bg.jpg?v=3") type("image/jpeg"));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: translateZ(0);
    animation: bg-drift 60s ease-in-out infinite alternate;
}
body::after {
    z-index: -1;
    background:
        radial-gradient(90% 60% at 50% -5%, rgba(99,102,241,0.22), transparent 60%),
        radial-gradient(60% 50% at 100% 100%, rgba(139,92,246,0.12), transparent 70%),
        linear-gradient(180deg, rgba(8,9,13,0.35) 0%, rgba(8,9,13,0.55) 45%, rgba(8,9,13,0.78) 100%);
}
@keyframes bg-drift {
    from { transform: translateZ(0) scale(1.04); }
    to   { transform: translateZ(0) scale(1.1) translate(-1%, -1%); }
}
@media (max-width: 860px) {
    body::before {
        background-image: url("/assets/images/backgrounds/site-bg-mobile.webp?v=3");
        animation: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    body::before { animation: none; }
}

.container {
    width: min(100% - 32px, var(--container));
    margin-inline: auto;
}

h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: clamp(2.25rem, 4vw, 3.75rem); }
h2 { font-size: clamp(1.65rem, 2.6vw, 2.35rem); margin-bottom: 12px; }
h3 { font-size: 1.25rem; }
p { color: var(--muted); line-height: 1.6; }
a { color: inherit; text-decoration: none; }

.section { padding: 72px 0; }
.section-tight { padding: 48px 0; }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head .eyebrow { color: var(--primary); }
.section-head p { margin-top: 10px; }
.section-foot { margin-top: 32px; display: flex; justify-content: center; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--secondary);
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(8, 9, 13, 0.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    transform: translateZ(0);
    will-change: transform;
}
.site-header-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 16px 0;
}
.brand { display: flex; align-items: center; }
.brand-logo { height: 44px; width: auto; display: block; }
.brand-mark {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.06em;
    background: linear-gradient(135deg, var(--text), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.nav-links { display: flex; align-items: center; gap: 24px; flex: 1; color: var(--muted); font-size: 0.94rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--muted);
    transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--primary); }
.cart-count {
    position: absolute;
    top: -6px; right: -6px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: 0; cursor: pointer; padding: 8px; }
.lang-switch { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; font-weight: 700; color: var(--muted); margin-right: 4px; }
.lang-btn { color: var(--muted); padding: 4px; }
.lang-btn.is-active { color: var(--text); }
.lang-sep { color: var(--border); }
.nav-toggle span { width: 20px; height: 2px; background: var(--text); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .1s ease, filter .15s ease, background .15s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; box-shadow: var(--shadow-glow); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-lg { padding: 15px 26px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.card-hover { transition: transform .18s ease, border-color .18s ease; }
.card-hover:hover { transform: translateY(-3px); border-color: rgba(99,102,241,0.4); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
}
.badge-primary { background: rgba(99,102,241,0.15); color: #b3b6ff; border-color: rgba(99,102,241,0.35); }
.badge-new { background: rgba(34,197,94,0.15); color: #7fe3a6; border-color: rgba(34,197,94,0.3); }
.badge-popular { background: rgba(245,158,11,0.15); color: #ffce7a; border-color: rgba(245,158,11,0.3); }
.badge-updated { background: rgba(139,92,246,0.15); color: #c9b3ff; border-color: rgba(139,92,246,0.35); }
.badge-bestseller { background: rgba(239,68,68,0.15); color: #ff9c9c; border-color: rgba(239,68,68,0.3); }
.badge-free { background: rgba(34,197,94,0.15); color: #7fe3a6; border-color: rgba(34,197,94,0.3); }
.framework-badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding: 96px 0 72px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}
.hero::before {
    content: "";
    position: absolute;
    inset: -20% -10% auto -10%;
    height: 60%;
    background: radial-gradient(600px 320px at 30% 0%, rgba(99,102,241,0.25), transparent 70%),
                radial-gradient(500px 280px at 80% 10%, rgba(139,92,246,0.2), transparent 70%);
    pointer-events: none;
}
.hero-inner { position: relative; max-width: 720px; }
.hero p.lead { font-size: 1.15rem; margin: 18px 0 28px; max-width: 560px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-banner { position: relative; margin-top: 48px; }
.hero-banner img { width: 100%; height: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-soft); display: block; }

/* ---------- Product card ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.product-card-media { position: relative; aspect-ratio: 16/9; background: var(--surface-2); overflow: hidden; }
.product-card-media img { width: 100%; height: 100%; object-fit: cover; }
.product-card-badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.product-card-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.product-card-cat { font-size: 0.78rem; color: var(--muted); }
.product-card-title { font-size: 1.05rem; font-weight: 700; }
.product-card-rating { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.product-card-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-weight: 800; font-size: 1.1rem; }
.price-old { color: var(--muted); text-decoration: line-through; font-size: 0.85rem; font-weight: 500; margin-right: 6px; }

/* ---------- Tabs / Accordion ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab-btn { padding: 12px 18px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; }
.tab-btn.is-active { color: var(--text); border-bottom-color: var(--primary); }
.tab-panel { display: none; padding: 28px 0; }
.tab-panel.is-active { display: block; }

.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-trigger { width: 100%; text-align: left; background: none; border: 0; color: var(--text); font-weight: 600; padding: 18px 0; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.accordion-body { display: none; padding-bottom: 18px; color: var(--muted); }
.accordion-item.is-open .accordion-body { display: block; }
.accordion-item.is-open .accordion-icon { transform: rotate(45deg); }
.accordion-icon { transition: transform .15s ease; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow-soft); font-size: 0.9rem; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; align-items: center; justify-content: center; z-index: 90; }
.modal-backdrop.is-open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; max-width: 480px; width: min(100% - 32px, 480px); }

/* ---------- Grids / utilities ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 56px 0 0; margin-top: 80px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 32px; padding-bottom: 40px; }
.footer-brand .brand-logo { height: 60px; margin-bottom: 4px; }
.footer-brand p { margin: 12px 0 16px; font-size: 0.9rem; }
.footer-col h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); margin-bottom: 14px; }
.footer-col a { display: block; color: var(--muted); font-size: 0.9rem; padding: 5px 0; }
.footer-col a:hover { color: var(--text); }
.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted); }

/* ---------- Skeleton loading ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
