/* ==========================================================================
   Exploiters — dark phosphor-green design system (site-wide)
   Hand-crafted, no build step. Tokens → primitives → components.
   Green reskin: primary accent = terminal green, CTA/active = signal orange.
   ========================================================================== */

:root {
    /* Palette — pure-black surfaces, neutral white-alpha (green is accent only) */
    --bg-0: #000000;
    --bg-1: #070707;
    --bg-2: #0d0d0d;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);

    --text: #e9e9ec;
    --text-dim: #a2a6ad;
    --text-faint: #6b7079;

    /* Accent ramp (var names kept for compatibility; hues remapped to green/orange) */
    --violet: #16a34a;   /* primary accent (was violet) */
    --indigo: #0d7a3a;   /* deep green */
    --cyan: #22c55e;     /* secondary accent / links (was cyan) */
    --pink: #ff4105;     /* signal orange (was pink) — CTA emphasis */
    --green: #34d399;    /* success */
    --amber: #fbbf24;    /* warning */
    --red: #f87171;      /* danger */

    --grad-primary: linear-gradient(135deg, #16a34a 0%, #0d7a3a 45%, #22c55e 100%);
    --grad-pink: linear-gradient(135deg, #ff6a3d 0%, #ff4105 100%);
    --grad-text: linear-gradient(120deg, #86efac 0%, #4ade80 30%, #22c55e 100%);

    --glow: 0 0 40px rgba(22, 163, 74, 0.38);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
    --shadow-card: 0 12px 40px -12px rgba(0, 0, 0, 0.6);

    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;

    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, 'Cascadia Code', monospace;

    --maxw: 1240px;
    --nav-h: 68px;   /* sticky navbar height — hero fold math depends on it */
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg-0);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Ambient background glow */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(60% 50% at 15% -5%, rgba(22, 163, 74, 0.10), transparent 60%),
        radial-gradient(50% 45% at 100% 0%, rgba(34, 197, 94, 0.06), transparent 55%),
        radial-gradient(60% 60% at 50% 110%, rgba(13, 122, 58, 0.07), transparent 60%);
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(circle at 50% 0%, black, transparent 75%);
    opacity: 0.5;
}

a { color: var(--cyan); text-decoration: none; transition: color .15s ease; }
a:hover { color: #86efac; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; letter-spacing: -0.02em; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.main { flex: 1 0 auto; padding: 40px 0 80px; }
.section { padding: 56px 0; }
.stack > * + * { margin-top: 16px; }

.text-grad {
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.muted { color: var(--text-dim); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: .78rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: 14px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font-sans); font-weight: 600; font-size: .95rem;
    padding: 11px 22px; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
    white-space: nowrap; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--grad-primary); color: #041008;
    box-shadow: 0 10px 30px -10px rgba(22, 163, 74, .7);
}
.btn-primary:hover { color: #041008; box-shadow: 0 14px 40px -8px rgba(22, 163, 74, .9); transform: translateY(-2px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); color: #fff; border-color: var(--violet); }
.btn-danger { background: rgba(248,113,113,.12); color: var(--red); border-color: rgba(248,113,113,.35); }
.btn-danger:hover { background: rgba(248,113,113,.2); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-lg { padding: 15px 30px; font-size: 1.05rem; }

/* ---------- Badges / chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em;
    padding: 4px 10px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
}
.badge-accent { color: #bbf7d0; border-color: rgba(22,163,74,.45); background: rgba(22,163,74,.14); }
.badge-green { color: #a7f3d0; border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.1); }
.badge-amber { color: #fde68a; border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.1); }
.badge-red { color: #fecaca; border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.1); }
.badge-cyan { color: #bbf7d0; border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.1); }

/* ---------- Cards / glass ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-card);
}
.card-pad { padding: 24px; }
.glass {
    background: linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(16px);
}

/* ---------- Navbar ---------- */
.nav {
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(18px);
    background: rgba(0, 0, 0, 0.75);
    border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 28px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; letter-spacing: -.03em; color: #fff; }
.brand .logo {
    width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
    background: var(--grad-primary); box-shadow: var(--glow); font-family: var(--font-mono); font-weight: 800; color: #041008;
}
.brand:hover { color: #fff; }
.nav-links { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
.nav-links a {
    color: var(--text-dim); font-weight: 500; font-size: .93rem; padding: 8px 12px; border-radius: 8px;
}
.nav-links a:hover, .nav-links a.active { color: #fff; background: var(--surface); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-right .nav-form { display: inline-flex; align-items: center; margin: 0; }
/* every header action shares one height regardless of a/button element */
.nav-right .btn { height: 36px; padding-top: 0; padding-bottom: 0; }

.cart-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.cart-count {
    position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px;
    display: grid; place-items: center; border-radius: 999px;
    background: var(--grad-pink); color: #fff; font-size: .68rem; font-weight: 700; font-family: var(--font-mono);
}

/* mobile nav toggle */
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.4rem; cursor: pointer; }
.nav-links.open { display: flex; }
.nav-mobile-divider { display: none; }
.nav-links > a:nth-child(n+4),
.nav-links > .nav-form { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 90px 0 70px; }
.hero-actions { margin-top: 28px; }
.hero p.lead { margin-bottom: 32px; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); font-weight: 600; margin-bottom: 20px; }
.hero p.lead { font-size: 1.2rem; color: var(--text-dim); max-width: 620px; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 40px; margin-top: 56px; flex-wrap: wrap; }
.hero-stat .n { font-size: 2rem; font-weight: 800; font-family: var(--font-mono); }
.hero-stat .l { color: var(--text-faint); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; }

.terminal {
    font-family: var(--font-mono); font-size: .86rem;
    background: rgba(0,0,0,.85); border: 1px solid var(--border-strong); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); overflow: hidden;
}
.terminal-bar { display: flex; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.02); }
.terminal-bar span { width: 12px; height: 12px; border-radius: 50%; }
.term-body { padding: 20px; white-space: pre-wrap; color: #b8f7d4; line-height: 1.7; }
.term-body .c { color: var(--text-faint); }
.term-body .p { color: var(--cyan); }
.term-body .g { color: #4ade80; }

/* ---------- Section head ---------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 32px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--text-dim); }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 22px; }
.grid-products { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-cats { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-2 { grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Product card ---------- */
.product-card {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
    transition: transform .18s ease, border-color .18s ease, box-shadow .25s ease;
}
.product-card:hover { transform: translateY(-6px); border-color: rgba(22,163,74,.5); box-shadow: 0 26px 50px -20px rgba(22,163,74,.4); }
.product-thumb { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--grad-primary); }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb .placeholder {
    width: 100%; height: 100%; display: grid; place-items: center; font-size: 3rem;
    background: linear-gradient(135deg, rgba(22,163,74,.35), rgba(34,197,94,.22));
}
.product-thumb .type-badge { position: absolute; top: 12px; left: 12px; }
.product-thumb .feat-badge { position: absolute; top: 12px; right: 12px; }
.product-body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.product-cat { font-family: var(--font-mono); font-size: .74rem; color: var(--cyan); margin-bottom: 8px; letter-spacing: .03em; }
.product-title { font-size: 1.08rem; font-weight: 600; margin: 0 0 8px; color: #fff; }
.product-title a { color: inherit; }
.product-title a:hover { color: #86efac; }
.product-desc { color: var(--text-dim); font-size: .88rem; flex: 1; margin-bottom: 16px; }
.product-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price { font-family: var(--font-mono); font-weight: 800; font-size: 1.3rem; color: #fff; }
.price .cur { color: var(--green); }
.rating { color: var(--amber); font-size: .85rem; }

/* ---------- Discounts ---------- */
/* Old price sits above the new one so the current price keeps the visual weight it had
   before the sale existed — nothing shifts for products that aren't discounted. */
.price-block { display: flex; flex-direction: column; gap: 2px; }
.price-was {
    font-family: var(--font-mono); font-size: .9rem; color: var(--text-faint);
    text-decoration-color: var(--red); text-decoration-thickness: 2px;
}
.price-was .cur { color: inherit; }
.product-thumb .sale-badge { position: absolute; bottom: 12px; left: 12px; font-weight: 700; }

.buy-box .price-block { gap: 4px; margin-bottom: 18px; }
.buy-box .price-was { font-size: 1.15rem; }
.sale-badge-inline { align-self: flex-start; font-weight: 700; }

.sale-countdown {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    padding: 10px 14px; margin-bottom: 16px;
    border: 1px solid rgba(248,113,113,.35); border-radius: var(--radius);
    background: rgba(248,113,113,.08);
}
.sale-countdown-label { color: #fecaca; font-size: .82rem; }
.sale-countdown-clock {
    font-family: var(--font-mono); font-weight: 800; font-size: 1.1rem; color: #fff;
    font-variant-numeric: tabular-nums;   /* stops the digits jittering every tick */
}
.sale-countdown.is-urgent { border-color: rgba(248,113,113,.7); background: rgba(248,113,113,.16); }
.sale-countdown.is-urgent .sale-countdown-clock { color: #fecaca; animation: sale-pulse 1s ease-in-out infinite; }
.sale-countdown.is-expired .sale-countdown-clock { color: var(--text-faint); }

@keyframes sale-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
    .sale-countdown.is-urgent .sale-countdown-clock { animation: none; }
}

/* ---------- Category tile ---------- */
.cat-tile {
    display: block; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.cat-tile:hover { transform: translateY(-4px); border-color: var(--violet); background: var(--surface-2); }
.cat-tile .ic { font-size: 2rem; margin-bottom: 12px; }
.cat-tile h3 { font-size: 1.1rem; margin: 0 0 6px; color: #fff; }
.cat-tile p { color: var(--text-dim); font-size: .85rem; margin: 0; }
.cat-tile .count { margin-top: 14px; font-family: var(--font-mono); font-size: .78rem; color: var(--text-faint); }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: .85rem; color: var(--text-dim); margin-bottom: 7px; font-weight: 500; }
.input, .select, .textarea {
    width: 100%; padding: 12px 14px; font-size: .95rem; font-family: var(--font-sans);
    color: var(--text); background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(22,163,74,.28), inset 0 1px 0 rgba(255,255,255,.04);
}
.textarea { min-height: 130px; resize: vertical; }
select.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b8f7d4' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; padding-right: 42px;
    cursor: pointer;
}
select.select:hover {
    border-color: rgba(22,163,74,.5);
    transform: translateY(-1px);
}
select.select option {
    background: #0a0f0c;
    color: var(--text);
    padding: 10px;
}
.field .val { color: var(--red); font-size: .8rem; margin-top: 6px; display: block; }
.text-danger, .validation-summary-errors { color: var(--red); font-size: .85rem; }
.text-danger ul, .validation-summary-errors ul { margin: 0; padding-left: 18px; }

.auth-wrap { max-width: 440px; margin: 30px auto; }
.auth-card { padding: 36px; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 28px; }
.toolbar .input, .toolbar .select { width: auto; }
.toolbar .grow { flex: 1; min-width: 200px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
    font-size: .85rem; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
    color: var(--text-dim); background: var(--surface); transition: all .15s ease;
}
.pill:hover { color: #fff; border-color: var(--violet); }
.pill.active { background: var(--grad-primary); color: #041008; border-color: transparent; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th, table.tbl td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); }
table.tbl th { font-family: var(--font-mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); background: rgba(255,255,255,.02); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface); }

/* ---------- Alerts ---------- */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 20px; font-size: .92rem; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.4); color: #a7f3d0; }
.alert-error { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.4); color: #fecaca; }
.alert-info { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.4); color: #bbf7d0; }

/* ---------- Detail page ---------- */
/* minmax(0,…) lets both tracks shrink below their content's min-content — without it an
   fr track defaults to a min-content floor, so the gallery/description column refuses to
   shrink, steals width from the Buy box and overflows the viewport on mobile. */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.detail-content-top { grid-column: 1; grid-row: 1; min-width: 0; }
.detail-buy { grid-column: 2; grid-row: 1 / 3; min-width: 0; }
.detail-content-bottom { grid-column: 1; grid-row: 2; min-width: 0; }
/* Long unbroken tokens (URLs, hashes) in an admin description must wrap, not blow the track wide. */
.detail-grid h1, .detail-grid .lead, .detail-grid .prose { overflow-wrap: anywhere; }
@media (max-width: 900px) {
    .detail-grid { display: flex; flex-direction: column; }
    .detail-content-top { order: 0; }
    .detail-buy { order: 1; }
    .detail-content-bottom { order: 2; }
    .detail-buy .buy-box { position: static; }
}

/* Description collapse (product page). Applies on all viewports; JS adds .is-collapsed only
   when the text actually overflows, so short descriptions show in full with no button. */
.description-collapse { position: relative; transition: max-height .35s ease; }
.description-collapse.is-collapsed { max-height: 7.5em; overflow: hidden; }
.description-collapse.is-collapsed::after {
    content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 56px;
    background: linear-gradient(transparent, var(--bg-0)); pointer-events: none;
}
/* Placed after .btn so the equal-specificity tie-break hides the toggle until JS reveals it. */
.description-toggle { display: none; }
.description-toggle.is-visible { display: flex; }
.detail-hero-img { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16/9; background: var(--grad-primary); }
.detail-hero-img .placeholder { width: 100%; height: 100%; display: grid; place-items: center; font-size: 5rem; }
.buy-box { position: sticky; top: 90px; padding: 28px; }
.buy-box .price { font-size: 2.4rem; }
.feature-list { list-style: none; padding: 0; margin: 18px 0; }
.feature-list li { padding: 8px 0 8px 28px; position: relative; color: var(--text-dim); border-bottom: 1px dashed var(--border); }
.feature-list li::before { content: "▹"; position: absolute; left: 0; color: var(--cyan); }
.prose { color: var(--text-dim); line-height: 1.8; }
.prose h3 { color: #fff; margin-top: 28px; }

/* ---------- Product media gallery ---------- */
.gallery { --gallery-thumb-w: 104px; min-width: 0; }
.gallery-strip-row { min-width: 0; }

.gallery-stage {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
    aspect-ratio: 16/9;
}
.gallery-slide {
    position: absolute; inset: 0; margin: 0;
    opacity: 0; visibility: hidden;
    transition: opacity .45s ease;
}
.gallery-slide.is-active { opacity: 1; visibility: visible; }
.gallery-slide img, .gallery-slide video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-slide[data-kind="image"] { cursor: zoom-in; }
.gallery-slide video { object-fit: contain; background: #000; }

/* No-JS fallback: stack the slides instead of hiding all but one. */
.gallery-slide:only-child { opacity: 1; visibility: visible; }

.gallery-expand, .gallery-nav {
    position: absolute; z-index: 2;
    display: grid; place-items: center;
    border-radius: 999px; cursor: pointer;
    background: rgba(0,0,0,.6); color: #fff;
    border: 1px solid var(--border-strong);
    backdrop-filter: blur(8px);
    transition: background .15s ease, border-color .15s ease, transform .15s ease, opacity .15s ease;
}
.gallery-expand { top: 12px; right: 12px; width: 38px; height: 38px; font-size: .95rem; }
.gallery-nav { top: 50%; transform: translateY(-50%); width: 40px; height: 40px; font-size: 1.5rem; line-height: 1; padding-bottom: 4px; }
.gallery-nav-prev { left: 12px; }
.gallery-nav-next { right: 12px; }
.gallery-expand:hover, .gallery-nav:hover { background: rgba(22,163,74,.85); border-color: transparent; color: #041008; }
.gallery-nav:hover { transform: translateY(-50%) scale(1.06); }

.gallery-counter {
    position: absolute; bottom: 12px; right: 12px; z-index: 2;
    font-size: .74rem; padding: 4px 10px; border-radius: 999px;
    background: rgba(0,0,0,.65); color: var(--text-dim); border: 1px solid var(--border);
}

.gallery-strip-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.gallery-scroll {
    flex: 0 0 auto; width: 32px; height: 62px;
    display: grid; place-items: center; cursor: pointer;
    font-size: 1.3rem; line-height: 1;
    color: var(--text-dim); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.gallery-scroll:hover { color: #fff; border-color: var(--violet); background: var(--surface-2); }

.gallery-strip {
    display: flex; gap: 10px; flex: 1; min-width: 0;
    overflow-x: auto; scroll-behavior: smooth;
    padding: 2px; scrollbar-width: thin;
}
.gallery-strip::-webkit-scrollbar { height: 6px; }
.gallery-strip::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

.gallery-thumb {
    position: relative; flex: 0 0 var(--gallery-thumb-w);
    width: var(--gallery-thumb-w); height: 62px; padding: 0;
    border-radius: var(--radius-sm); overflow: hidden; cursor: pointer;
    background: #000; border: 1px solid var(--border);
    opacity: .6;
    transition: opacity .15s ease, border-color .15s ease, transform .15s ease;
}
.gallery-thumb img, .gallery-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.gallery-thumb:hover { opacity: .9; transform: translateY(-2px); }
.gallery-thumb.is-active { opacity: 1; border-color: var(--violet); box-shadow: 0 0 0 2px rgba(22,163,74,.35); }
.gallery-thumb-play {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-size: 1.1rem; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.9);
    background: rgba(0,0,0,.28); pointer-events: none;
}

/* Lightbox */
body.gallery-lightbox-open { overflow: hidden; }
.gallery-lightbox {
    position: fixed; inset: 0; z-index: 200;
    display: grid; place-items: center; padding: 32px;
    background: rgba(0,0,0,.9); backdrop-filter: blur(6px);
}
.gallery-lightbox[hidden] { display: none; }
.gallery-lightbox-body { max-width: min(1200px, 96vw); max-height: 90vh; display: grid; place-items: center; }
.gallery-lightbox-body img, .gallery-lightbox-body video {
    max-width: 100%; max-height: 90vh; width: auto; height: auto;
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.gallery-lightbox-close {
    position: absolute; top: 20px; right: 24px;
    width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer;
    font-size: 1.1rem; color: #fff; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border-strong);
}
.gallery-lightbox-close:hover { background: rgba(248,113,113,.25); border-color: rgba(248,113,113,.5); }

/* Media placed inside a description via a [[media:id]] tag */
.prose-media { margin: 22px 0; }
.prose-media img, .prose-media video {
    width: 100%; border-radius: var(--radius); border: 1px solid var(--border); display: block;
}
.prose-media figcaption { margin-top: 8px; font-size: .82rem; color: var(--text-faint); text-align: center; }

/* Admin gallery editor */
.gallery-admin { display: grid; gap: 12px; }
.gallery-admin-item {
    display: flex; gap: 14px; align-items: center; padding: 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
    transition: opacity .15s ease, border-color .15s ease;
}
.gallery-admin-item.is-removing { opacity: .45; border-color: rgba(248,113,113,.5); }
.gallery-admin-preview { position: relative; flex: 0 0 120px; height: 72px; border-radius: 8px; overflow: hidden; background: #000; }
.gallery-admin-preview img, .gallery-admin-preview video { width: 100%; height: 100%; object-fit: cover; }
.gallery-admin-kind { position: absolute; bottom: 4px; left: 4px; font-size: .62rem; padding: 2px 7px; }
.gallery-admin-body { flex: 1; min-width: 0; }
.gallery-admin-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.gallery-admin-remove { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--text-dim); font-family: var(--font-mono); }

@media (max-width: 600px) {
    .gallery { --gallery-thumb-w: 84px; }
    .gallery-admin-item { flex-direction: column; align-items: stretch; }
    .gallery-admin-preview { flex: 0 0 auto; height: 140px; }
}

/* ---------- Course curriculum & progress ---------- */
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--grad-primary); border-radius: 999px; transition: width .35s ease; }
.lesson-row { padding: 16px 18px; }
.lesson-row.lesson-locked { opacity: .72; }
.lesson-row video { display: block; }

/* ---------- Cart / checkout ---------- */
.cart-line { display: flex; gap: 16px; align-items: center; padding: 16px; }
.cart-line img, .cart-line .ph { width: 84px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--grad-primary); flex-shrink: 0; display: grid; place-items: center; }
.cart-line .info { flex: 1; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; color: var(--text-dim); }
.summary-row.total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 16px; color: #fff; font-size: 1.2rem; font-weight: 700; }

.coin-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.coin {
    font-family: var(--font-mono); font-size: .8rem; padding: 8px 14px; border-radius: 10px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text); display: inline-flex; gap: 7px; align-items: center;
}

/* ---------- Admin ---------- */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; gap: 28px; align-items: start; }
@media (max-width: 860px) { .admin-shell { grid-template-columns: 1fr; } }
.admin-side { position: sticky; top: 90px; padding: 16px; }
.admin-side a { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: 10px; color: var(--text-dim); font-weight: 500; font-size: .92rem; }
.admin-side a:hover, .admin-side a.active { background: var(--surface-2); color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat { padding: 22px; }
.stat .label { color: var(--text-faint); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.stat .value { font-size: 2rem; font-weight: 800; font-family: var(--font-mono); margin-top: 6px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 48px 0 32px; margin-top: auto; background: rgba(0,0,0,.5); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); margin-bottom: 14px; }
.footer a { display: block; color: var(--text-dim); font-size: .9rem; padding: 4px 0; }
.footer a:hover { color: #fff; }
.footer-bottom { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--text-faint); font-size: .85rem; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--text-dim); }
.empty .ic { font-size: 3.5rem; margin-bottom: 14px; opacity: .7; }

/* ---------- Utilities ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; } .gap { gap: 16px; }
.mt-sm { margin-top: 8px; } .mt { margin-top: 20px; } .mt-lg { margin-top: 40px; }
.mb { margin-bottom: 20px; }
.wrap { flex-wrap: wrap; }
.hide-mobile { }

@media (max-width: 760px) {
    .container { padding: 0 18px; }
    .main { padding: 28px 0 60px; }
    .hero { padding: 58px 0 50px; }
    .hero p.lead { font-size: 1rem; max-width: 100%; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions .btn { width: 100%; }
    .nav-inner { gap: 12px; padding: 0 18px; height: 68px; }
    .brand { width: auto; justify-content: flex-start; flex-shrink: 0; }
    .nav-links { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; gap: 12px; width: 100%; margin-left: 0; padding: 16px 24px 20px; background: rgba(0, 0, 0, 0.95); border-radius: 0; border: none; border-bottom: 1px solid var(--border); box-shadow: none; z-index: 40; }
    .nav-links.open { display: flex; }
    .nav-links a { color: #fff; padding: 14px 16px; background: rgba(255,255,255,.04); border-radius: 12px; font-weight: 500; }
    .nav-links a:hover, .nav-links a.active { color: #fff; background: rgba(255,255,255,.12); }
    .nav-mobile-divider { display: block; height: 1px; background: var(--border); margin: 8px 0; }
    .nav-links > a:nth-child(n+4),
    .nav-links > .nav-form { display: block; }
    .nav-links .nav-register { background: var(--grad-primary); color: #041008; font-weight: 600; }
    .nav-links .nav-register:hover { background: var(--grad-primary); color: #041008; }
    .nav-links .nav-form { width: 100%; }
    .nav-links .nav-form button { width: 100%; padding: 14px 16px; background: rgba(255,255,255,.04); color: #fff; border: 0; border-radius: 12px; cursor: pointer; font-weight: 500; font-family: var(--font-sans); }
    .nav-links .nav-form button:hover { background: rgba(255,255,255,.12); }
    .nav-right { margin-left: auto; }
    .nav-auth { display: none; }
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); font-size: 1.4rem; cursor: pointer; }
    .hero-stats { gap: 28px; }
    .admin-side { position: static; }
}

/* pager */
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 40px; }
.pager a, .pager span { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); color: var(--text-dim); font-family: var(--font-mono); font-size: .85rem; }
.pager a:hover { border-color: var(--violet); color: #fff; }
.pager .current { background: var(--grad-primary); color: #041008; border-color: transparent; }

/* ───────────────────────────────────────────────────────────────────────────
   Buy gate — the sign-in / verify dialog between "Buy now" and the payment
   provider. Panels are all present in the markup and toggled with [hidden],
   so switching step never waits on a repaint of new nodes.
   ─────────────────────────────────────────────────────────────────────────── */

.buy-gate { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.buy-gate[hidden] { display: none; }
body.buy-gate-open { overflow: hidden; }

.buy-gate-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .78); backdrop-filter: blur(6px); }

.buy-gate-dialog {
    position: relative; width: 100%; max-width: 430px; max-height: calc(100vh - 40px);
    overflow-y: auto; padding: 30px; border-radius: var(--radius);
    border: 1px solid rgba(22, 163, 74, .3); box-shadow: 0 34px 90px -30px rgba(0, 0, 0, .9);
    animation: buyGateIn .22s ease-out;
}

@keyframes buyGateIn { from { opacity: 0; transform: translateY(12px) scale(.985); } }

.buy-gate-close {
    position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
    display: grid; place-items: center; border-radius: 8px; cursor: pointer;
    background: transparent; border: 1px solid transparent; color: var(--text-dim); font-size: .95rem;
}
.buy-gate-close:hover { border-color: var(--border-strong); color: #fff; }

.buy-gate-head { margin-bottom: 20px; padding-right: 28px; }
.buy-gate-eyebrow { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: #22c55e; }
.buy-gate-title { font-size: 1.4rem; margin: 8px 0 6px; }
.buy-gate-sub { color: var(--text-dim); font-size: .87rem; line-height: 1.55; margin: 0; }

.buy-gate-message { padding: 11px 14px; border-radius: var(--radius-sm); font-size: .85rem; line-height: 1.5; margin-bottom: 16px; border: 1px solid rgba(34, 197, 94, .3); background: rgba(34, 197, 94, .08); color: #bbf7d0; }
.buy-gate-message.is-error { border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .09); color: #fecaca; }
.buy-gate-message[hidden] { display: none; }

.buy-gate-tabs { display: flex; gap: 6px; padding: 4px; margin-bottom: 20px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .04); border: 1px solid var(--border); }
.buy-gate-tab { flex: 1; padding: 9px 10px; border-radius: 7px; cursor: pointer; background: transparent; border: 0; color: var(--text-dim); font-size: .87rem; font-weight: 600; }
.buy-gate-tab:hover { color: #fff; }
.buy-gate-tab.is-active { background: var(--grad-primary); color: #041008; }

.buy-gate-form[hidden] { display: none; }
.buy-gate-hint { display: block; margin-top: 6px; color: var(--text-dim); font-size: .76rem; }
.buy-gate-sent { color: var(--text-dim); font-size: .88rem; line-height: 1.6; margin: 0 0 18px; }
.buy-gate-sent strong { color: #fff; font-family: var(--font-mono); }

.buy-gate-code { font-family: var(--font-mono); font-size: 1.5rem; text-align: center; letter-spacing: .3em; text-indent: .3em; }

.buy-gate-resend { display: block; width: 100%; margin-top: 14px; padding: 8px; cursor: pointer; background: none; border: 0; color: var(--text-dim); font-size: .83rem; }
.buy-gate-resend span { color: #22c55e; text-decoration: underline; text-underline-offset: 3px; }
.buy-gate-resend:disabled { cursor: default; opacity: .55; }
.buy-gate-resend:disabled span { color: var(--text-dim); text-decoration: none; }

.buy-gate-ready { text-align: center; padding: 12px 0; }
.buy-gate-ready .buy-gate-spinner { margin: 0 auto 18px; }

.buy-gate-busy { position: absolute; inset: 0; display: grid; place-items: center; border-radius: var(--radius); background: rgba(7, 7, 7, .62); }
.buy-gate-busy[hidden] { display: none; }

.buy-gate-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .14); border-top-color: #22c55e; animation: buyGateSpin .7s linear infinite; }
@keyframes buyGateSpin { to { transform: rotate(360deg); } }

/* A submit button that reads as an inline link (used for sign-out inside a sentence). */
.linklike { background: none; border: 0; padding: 0; cursor: pointer; color: #22c55e; font: inherit; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 520px) {
    .buy-gate { padding: 0; }
    .buy-gate-dialog { max-width: none; max-height: 100vh; min-height: 100vh; border-radius: 0; border: 0; padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .buy-gate-dialog { animation: none; }
    .buy-gate-spinner { animation-duration: 2s; }
}
