/* Gold & Gun app styles. Brand colors are variables so they can be matched
   to the store's exact palette later. */
:root {
  --ink: #1c1a17;
  --ink-2: #3b3732;
  --muted: #5f5850;
  --bg: #f7f4ee;
  --surface: #ffffff;
  --line: #e2dbcf;
  --gold: #c9973a;        /* backgrounds / accents (use with --ink text) */
  --gold-light: #e7c27a;  /* accents on dark */
  --gold-text: #7a5a12;   /* gold-toned text on light backgrounds (AA) */
  --danger: #a32020;
  --ok: #2e6b30;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 16px; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold-text); }
a:hover { color: var(--ink); }
h1, h2, h3 { line-height: 1.2; }
h1 { font-family: var(--font-display); font-size: 1.75rem; margin: .5rem 0 1rem; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1:focus { outline: none; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: .5rem; top: -3rem; background: var(--gold); color: var(--ink); padding: .5rem 1rem; z-index: 100; border-radius: var(--radius); font-weight: 600; }
.skip-link:focus { top: .5rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--ink); color: #fff; padding: env(safe-area-inset-top) .75rem .75rem; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 56px; }
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--gold); color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: .85rem; }
.brand-name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; letter-spacing: .02em; }
.brand-name .amp { color: var(--gold-light); }
.icon-btn { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; padding: 4px 6px; color: #fff; background: transparent; border: 0; border-radius: var(--radius); cursor: pointer; text-decoration: none; font: inherit; }
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-label { font-size: .7rem; letter-spacing: .03em; }
.cart-count { position: absolute; top: 2px; right: 2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--gold); color: var(--ink); font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.cart-count[hidden] { display: none; }
.search-form { display: flex; max-width: 720px; margin: .25rem auto 0; background: #fff; border-radius: 999px; overflow: hidden; }
.search-form input { flex: 1; border: 0; padding: .7rem 1rem; font: inherit; font-size: 16px; min-width: 0; color: var(--ink); background: transparent; }
.search-form input:focus { outline: none; }
.search-form:focus-within { outline: 3px solid var(--gold); }
.search-submit { border: 0; background: var(--gold); color: var(--ink); padding: 0 1.1rem; cursor: pointer; min-width: 52px; }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(88vw, 360px); background: var(--surface); z-index: 40; overflow-y: auto; padding: env(safe-area-inset-top) 0 1rem; box-shadow: var(--shadow); transform: translateX(-100%); transition: transform .2s ease; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: .5rem .5rem .5rem 1rem; background: var(--ink); color: #fff; }
.drawer-title { margin: 0; font-family: var(--font-display); font-size: 1.2rem; }
.nav-tree { padding: .5rem 0; }
.nav-list, .nav-sub { list-style: none; margin: 0; padding: 0; }
.nav-sub { padding-left: 1rem; border-left: 3px solid var(--line); margin-left: 1rem; }
.nav-link { display: flex; align-items: center; gap: .35rem; min-height: 48px; padding: .5rem 1rem; color: var(--ink); text-decoration: none; font-weight: 500; cursor: pointer; }
.nav-link:hover { background: var(--bg); color: var(--ink); }
summary.nav-link { list-style: none; justify-content: space-between; }
summary.nav-link::-webkit-details-marker { display: none; }
summary.nav-link::after { content: "+"; font-size: 1.3rem; color: var(--gold-text); }
details[open] > summary.nav-link::after { content: "−"; }
.nav-tree > p { padding: 0 1rem; }

/* Layout */
main { max-width: 1100px; margin: 0 auto; padding: 1rem; min-height: 60vh; }
main:focus { outline: none; }
.hero { background: linear-gradient(135deg, var(--ink) 0%, #3a3125 100%); color: #fff; border-radius: var(--radius); padding: 1.5rem 1.25rem; margin-bottom: 1.5rem; }
.hero h1 { margin-top: 0; color: #fff; }
.hero h1::after { content: ""; display: block; width: 56px; height: 3px; background: var(--gold); margin-top: .6rem; }
.hero p { margin: 0; color: #eee6d8; }
.section-heading { font-family: var(--font-display); font-size: 1.3rem; }
.lede { color: var(--ink-2); }
.breadcrumb { font-size: .9rem; color: var(--muted); }

.cat-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.cat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .25rem .25rem .5rem; border-top: 4px solid var(--gold); }
.cat-link { display: flex; align-items: center; min-height: 48px; padding: .5rem .75rem; font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.cat-children { list-style: none; padding: 0 .75rem; margin: 0; font-size: .92rem; }
.cat-children a { display: inline-block; padding: .3rem 0; }

/* Product grid */
.grid { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.card-img { position: relative; aspect-ratio: 1; background: #efe9df; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.card-body { padding: .6rem .75rem .8rem; }
.card-title { font-size: .95rem; font-weight: 600; margin: 0 0 .3rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badges { position: absolute; top: .4rem; left: .4rem; display: flex; flex-wrap: wrap; gap: .25rem; }
.badge { font-size: .72rem; font-weight: 700; padding: .15rem .45rem; border-radius: 4px; }
.badge-out { background: #555; color: #fff; }
.badge-sale { background: var(--danger); color: #fff; }
.badge-web { background: var(--ink); color: var(--gold-light); }
.img-placeholder { display: grid; place-items: center; width: 100%; height: 100%; aspect-ratio: 1; color: #b9ad98; font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; background: #efe9df; }

.price { margin: 0; font-weight: 700; }
.price .from { font-weight: 400; color: var(--muted); }
.price-sale { color: var(--danger); }
.price-compare { color: var(--muted); font-weight: 400; margin-left: .35rem; }
.price-lg { font-size: 1.4rem; }

.skeleton { aspect-ratio: .78; background: linear-gradient(90deg, #ece6dc 25%, #f5f1ea 50%, #ece6dc 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .6rem 1.25rem; border-radius: var(--radius); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border: 2px solid transparent; }
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { background: #b98a31; color: var(--ink); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: #fff; }
.btn:disabled { background: #d8d2c8; color: #57514a; border-color: transparent; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; margin-top: .6rem; }
.load-more { display: flex; margin: 1rem auto; }
.link-btn { background: none; border: 0; color: var(--danger); font: inherit; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 .5rem; }

/* States */
.state { text-align: center; padding: 2.5rem 1rem; }
.state h1 { font-size: 1.5rem; }
.state-loading { display: flex; align-items: center; justify-content: center; gap: .6rem; color: var(--muted); padding: 1rem; }
.state-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-top: 1rem; }
.state-error h1 { color: var(--danger); }
.spinner { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Product page */
.product { display: grid; gap: 1.25rem; }
@media (min-width: 820px) { .product { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.gallery-main { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.thumbs { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; gap: .5rem; overflow-x: auto; }
.thumb { padding: 0; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); width: 64px; height: 64px; cursor: pointer; overflow: hidden; flex: none; }
.thumb[aria-pressed="true"] { border-color: var(--gold); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.vendor { margin: 0; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--gold-text); font-weight: 700; }
.product-info h1 { margin-top: .2rem; }
.stock { font-weight: 600; margin: .3rem 0 .8rem; }
.stock-in { color: var(--ok); }
.stock-out { color: var(--danger); }
.option-group { border: 0; padding: 0; margin: 0 0 1rem; }
.option-group legend { font-weight: 600; margin-bottom: .4rem; padding: 0; }
.option-values { display: flex; flex-wrap: wrap; gap: .5rem; }
.option-value input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option-value label { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; justify-content: center; padding: .4rem .9rem; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.option-value input:checked + label { border-color: var(--ink); background: var(--ink); color: #fff; }
.option-value input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: 2px; }
.option-value label.unavailable { color: var(--muted); text-decoration: line-through; border-style: dashed; }
.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.qty-label { font-weight: 600; }
.qty { display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.qty-btn { width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
.qty-btn:disabled { color: #aaa; cursor: not-allowed; }
.qty-input { width: 3rem; height: 44px; border: 0; text-align: center; font: inherit; font-size: 16px; -moz-appearance: textfield; background: transparent; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.notice { background: #fbf4e4; border: 1px solid #e6cf9b; border-left: 5px solid var(--gold); border-radius: var(--radius); padding: .8rem 1rem; }
.notice-title { font-size: 1.05rem; margin: 0 0 .3rem; }
.notice p { margin: 0; }
.description { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.description h2 { font-family: var(--font-display); font-size: 1.2rem; }

/* Cart */
.cart-lines { list-style: none; padding: 0; margin: 0; }
.cart-line { display: grid; grid-template-columns: 80px 1fr auto; gap: .75rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.cart-line.is-unavailable { opacity: .85; }
.cart-img img, .cart-img .img-placeholder { width: 80px; height: 80px; object-fit: contain; border-radius: 8px; background: var(--surface); }
.cart-line-title { font-size: 1rem; margin: 0 0 .15rem; }
.cart-line-title a { color: var(--ink); }
.cart-line-body p { margin: .1rem 0; }
.cart-line-actions { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.cart-line-total { font-weight: 700; margin: 0; }
.line-warning { color: var(--danger); font-weight: 600; font-size: .9rem; }
.cart-summary { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-top: 1rem; }
.summary-row { display: flex; justify-content: space-between; font-size: 1.1rem; margin: 0 0 .3rem; }
.secure-note { text-align: center; }
@media (min-width: 820px) { .cart { display: grid; grid-template-columns: 1.6fr 1fr; gap: 0 2rem; align-items: start; } .cart h1 { grid-column: 1 / -1; } .cart-summary { margin-top: 0; position: sticky; top: 140px; } }

/* Footer & social */
.site-footer { background: var(--ink); color: #e9e2d4; padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); margin-top: 2rem; text-align: center; }
.footer-heading { font-family: var(--font-display); color: #fff; font-size: 1.2rem; margin: 0 0 .75rem; }
.social-list { list-style: none; padding: 0; margin: 0 auto; display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; max-width: 720px; }
.social-btn { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .5rem 1rem; border-radius: 999px; background: var(--gold); color: var(--ink); text-decoration: none; font-weight: 700; }
.social-btn:hover { background: var(--gold-light); color: var(--ink); }
.social-placeholder, .social-placeholder:hover { background: transparent; color: #e9e2d4; border: 2px dashed #8d8473; cursor: not-allowed; font-weight: 600; }
.placeholder-tag { font-size: .72rem; background: #8d8473; color: #fff; padding: .1rem .45rem; border-radius: 4px; font-weight: 700; }
.footer-links a { color: var(--gold-light); font-weight: 600; }
.fine-print { font-size: .8rem; color: #bfb6a5; max-width: 560px; margin: .75rem auto 0; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translate(-50%, 150%); background: var(--ink); color: #fff; padding: .8rem 1.1rem; border-radius: var(--radius); box-shadow: var(--shadow); max-width: min(92vw, 480px); z-index: 50; transition: transform .2s ease, visibility .2s; border-left: 5px solid var(--gold); visibility: hidden; }
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast[data-kind="error"] { border-left-color: #e06a6a; }
.toast[data-kind="success"] { border-left-color: #6fbf73; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
