/* =========================================================
   BANGRO Script — Base layout & structure
   Themes only override CSS variables + a few signature touches.
   Do not remove this file; theme files are loaded AFTER this one.
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    transition: background .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

::selection { background: var(--accent); color: var(--accent-contrast); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(140%) blur(8px);
}
.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-top: 16px;
    padding-bottom: 16px;
}
.header-inner { }
.btn-contact-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text);
    font-weight: 700;
    font-size: 13.5px;
    transition: border-color .2s ease, color .2s ease, transform .15s ease;
}
.btn-contact-header svg { width: 15px; height: 15px; }
.btn-contact-header:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.brand {
    font-family: var(--font-display);
    font-weight: var(--brand-weight, 800);
    font-size: 28px;
    letter-spacing: var(--brand-tracking, -0.02em);
    color: var(--text);
    white-space: nowrap;
}
.brand span { color: var(--accent); }
.brand-logo-img {
    display: block;
    max-height: 40px;
    width: auto;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding: 44px 0 28px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: var(--hero-bg, transparent);
    overflow: hidden;
}
.hero-blob {
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .18;
    pointer-events: none;
    background: var(--accent);
}
.hero-blob-a { top: -220px; left: -120px; }
.hero-blob-b { top: -180px; right: -140px; opacity: .12; }
.hero .wrap { position: relative; z-index: 1; }
.hero-eyebrow {
    display: inline-block;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 6px 14px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
}
.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(28px, 4.5vw, 46px);
    line-height: 1.1;
    margin: 0 0 12px;
    letter-spacing: var(--brand-tracking, -0.02em);
    font-weight: var(--brand-weight, 800);
}
.accent-text { color: var(--accent); }
.hero p {
    margin: 0 auto;
    max-width: 560px;
    color: var(--muted);
    font-size: 17px;
}

/* ---------- First-run empty state (zero products yet) ---------- */
.first-run-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--muted);
    max-width: 420px;
    margin: 0 auto;
}
.first-run-state svg { width: 52px; height: 52px; color: var(--accent); margin-bottom: 18px; opacity: .8; }
.first-run-state h3 {
    color: var(--text);
    font-family: var(--font-display);
    font-size: 22px;
    margin: 0 0 10px;
}
.first-run-state p { margin: 0; line-height: 1.6; font-size: 14.5px; }

/* ---------- Search ---------- */
.search-wrap {
    max-width: 560px;
    margin: 22px auto 0;
    position: relative;
}
.search-input {
    width: 100%;
    padding: 15px 48px 15px 20px;
    font-size: 16px;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}
.search-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--muted);
    pointer-events: none;
}
.search-spinner {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    display: none;
    animation: spin .7s linear infinite;
}
.search-spinner.active { display: block; }
.search-icon.hidden { display: none; }
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

.search-status {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-top: 10px;
    min-height: 20px;
}

/* ---------- Product grid ---------- */
main.content { padding: 24px 0 80px; }

.grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    transition: opacity .25s ease;
}
.grid.transitioning { opacity: 0; }

@media (max-width: 1200px) {
    .grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 980px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
    .grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
@media (max-width: 460px) {
    .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .btn-check { font-size: 12.5px; padding: 10px 10px; gap: 5px; }
    .card-body { padding: 12px; }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(14px);
    animation: cardIn .45s ease forwards;
    transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: var(--card-hover-shadow);
}
@keyframes cardIn {
    to { opacity: 1; transform: translateY(0); }
}

.card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--img-bg);
    overflow: hidden;
}
.badge-new {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 5px;
}
.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.card:hover .card-img img { transform: scale(1.06); }

.card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

.btn-check {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-contrast);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .01em;
    border: none;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-check:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--btn-hover-shadow);
}
.btn-check svg { width: 15px; height: 15px; }

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--muted);
    grid-column: 1 / -1;
}
.empty-state h3 {
    color: var(--text);
    font-family: var(--font-display);
    font-size: 22px;
    margin-bottom: 8px;
}

/* ---------- Skeleton loading ---------- */
.skeleton-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.skeleton-img, .skeleton-line {
    background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 37%, var(--skeleton-a) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
}
.skeleton-img { aspect-ratio: 1/1; }
.skeleton-line { height: 14px; margin: 16px; border-radius: 4px; }
.skeleton-line.short { width: 60%; }
@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ---------- Load more ---------- */
.load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}
.btn-load-more {
    padding: 14px 36px;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border);
    font-weight: 700;
    font-size: 15px;
    transition: all .2s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.btn-load-more:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-load-more:disabled { opacity: .6; cursor: default; }
.btn-load-more .dot-spinner {
    width: 14px; height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    display: none;
    animation: spin .7s linear infinite;
}
.btn-load-more.loading .dot-spinner { display: inline-block; }
.btn-load-more.loading .label-text { opacity: .7; }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    background: var(--header-bg);
}
.site-footer p { max-width: 720px; margin: 0 auto 6px; line-height: 1.6; }
.site-footer .brand-mini { color: var(--text); font-weight: 700; }
.footer-contact a { color: var(--text); font-weight: 600; }
.footer-contact a:hover { color: var(--accent); }
.footer-sep { margin: 0 8px; opacity: .5; }
.footer-credit {
    margin-top: 14px !important;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    opacity: .75;
}
.footer-credit a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.footer-credit a:hover { color: var(--accent); }

/* ---------- Contact modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal-box {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px 28px;
    transform: translateY(16px) scale(.97);
    transition: transform .25s ease;
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }

.modal-box h3 {
    font-family: var(--font-display);
    font-size: 22px;
    margin: 0 0 6px;
    color: var(--text);
}
.modal-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }

.modal-close {
    position: absolute;
    top: 16px; right: 16px;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--muted);
    display: flex; align-items: center; justify-content: center;
    transition: background .15s ease, color .15s ease;
}
.modal-close svg { width: 16px; height: 16px; }
.modal-close:hover { background: var(--img-bg); color: var(--text); }

#contactForm { display: flex; flex-direction: column; gap: 4px; }
#contactForm label {
    font-size: 12.5px;
    font-weight: 700;
    margin-top: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}
#contactForm input[type=text],
#contactForm input[type=email],
#contactForm textarea {
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    transition: border-color .2s ease;
}
#contactForm input:focus, #contactForm textarea:focus { border-color: var(--accent); }

.honeypot-field { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

.form-msg {
    font-size: 13.5px;
    margin-top: 12px;
    min-height: 18px;
    line-height: 1.5;
}
.form-msg.success { color: #1F9254; }
.form-msg.error { color: #E5484D; }

.modal-submit {
    width: 100%;
    margin-top: 18px;
    padding: 13px;
    position: relative;
}
.dot-spinner-alt {
    display: none;
    width: 15px; height: 15px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: currentColor;
    border-radius: 50%;
    margin-left: 8px;
    animation: spin .7s linear infinite;
}
.modal-submit.loading .dot-spinner-alt { display: inline-block; }
.modal-submit.loading .label-text { opacity: .8; }
.modal-submit:disabled { opacity: .75; cursor: default; }

@media (max-width: 500px) {
    .trust-bar { gap: 16px 22px; }
    .btn-contact-header span { display: none; }
}
