/*
 * shop/css/shop.css — styles for the product detail page.
 *
 * The homepage grid reuses styles already defined in index.html (store-grid,
 * product-card, product-info, product-btn), so this file scopes itself to
 * the detail page only. The brand tokens are redeclared at :root because
 * index.html's <style> block isn't accessible from /shop/product.php.
 *
 * Cart drawer styles are extracted to cart-drawer.css so index.html can
 * include them without inheriting shop.css's global resets (which would
 * nuke the band site layout).
 */
@import url("cart-drawer.css");

:root {
    --gold: #c8a86e;
    --gold-light: #e0c992;
    --gold-dark: #9a7555;
    --bg-dark: #0a0a0a;
    --bg-card: #131313;
    --bg-card-hover: #1a1a1a;
    --text-primary: #d4c5b0;
    --text-muted: #8a7e70;
    --border: #2a2420;
    --max-width: 1100px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 300;
    line-height: 1.6;
    min-height: 100%;
    /* Hard guard against any descendant overflowing the viewport (long
       Printify description text, embedded images, etc.). Vertical scroll
       still works as normal. */
    max-width: 100%;
    overflow-x: hidden;
}

/* Anything embedded by Printify inside .detail-desc — images, tables,
   iframes — must stay within the column width. */
img, video, iframe, table { max-width: 100%; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

.detail-wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 48px 24px 72px;
}

.detail-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.detail-back:hover { color: var(--gold); }

.detail-cart-link {
    color: var(--gold);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 20px;
    transition: border-color 0.2s, color 0.2s;
}
.detail-cart-link:hover {
    border-color: var(--gold-dark);
    color: var(--gold-light);
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}
/* Grid items with intrinsically wide content (long titles, fixed-width
   buttons) need min-width:0 so the track can shrink below the content's
   natural width. Without this, a tall product title or a wide select
   pushes the column wider than the viewport on mobile. */
.detail-grid > * { min-width: 0; }

@media (max-width: 760px) {
    .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}

/* ---------- Mockup gallery ---------- */

.mockup-main {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.mockup-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    /* width:100% + min-width:0 are what actually let overflow-x:auto kick
       in. Without them, the flex container takes its intrinsic content
       width (sum of all thumbs) and pushes past the viewport on mobile
       instead of scrolling inside its bounds. */
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 4px;
}
.mockup-thumb {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s;
}
.mockup-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.mockup-thumb:hover { border-color: var(--gold-dark); }
.mockup-thumb.is-active { border-color: var(--gold); }

/* ---------- Title + price + description ---------- */

.detail-title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.7rem;
    color: var(--gold);
    line-height: 1.2;
    margin-bottom: 12px;
    /* Long product titles like "Honky Tonk Hustlas T-Shirt | Skull and
       Saber" can land on a single line that exceeds a phone's width;
       allow break inside words as a last resort. */
    overflow-wrap: anywhere;
    word-break: break-word;
}

.detail-price {
    font-size: 1.6rem;
    color: var(--text-primary);
    margin-bottom: 24px;
    font-weight: 500;
}

.detail-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 32px;
    max-height: 200px;
    overflow-y: auto;
    /* Description HTML comes from Printify and may contain unbreakable
       tokens (long URLs, SKUs). Force them to wrap rather than overflow. */
    overflow-wrap: anywhere;
    word-break: break-word;
}
.detail-desc p { margin-bottom: 12px; }
.detail-desc p:last-child { margin-bottom: 0; }
.detail-desc img { max-width: 100%; height: auto; }

/* ---------- Variant picker ---------- */

.picker { margin-bottom: 24px; }

.picker-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.color-swatch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.color-swatch:hover { border-color: var(--gold-dark); }
.color-swatch.is-active { border-color: var(--gold); }
.color-swatch .dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
}

#size-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    min-width: 180px;
}
#size-select:focus {
    outline: none;
    border-color: var(--gold-dark);
}

/* ---------- Buy button (stub for Prompt 02) ---------- */

.buy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--gold);
    color: var(--bg-dark);
    border: none;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    margin-top: 8px;
}
.buy-btn:hover:not(:disabled) { background: var(--gold-light); }
.buy-btn:disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}
.buy-btn + .buy-note {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 8px;
}

/* ---------- Not-found state ---------- */

.detail-missing {
    max-width: 520px;
    margin: 120px auto;
    text-align: center;
    padding: 0 24px;
}
.detail-missing h1 {
    font-family: 'Cinzel', Georgia, serif;
    color: var(--gold);
    font-size: 1.8rem;
    margin-bottom: 16px;
}
.detail-missing p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Cart drawer + nav-cart styles live in cart-drawer.css (imported above)
   so index.html can load them without inheriting our global resets. */

/* ============================================================
   Full-page cart at /shop/cart.php.
   ============================================================ */
.cart-page-list {
    margin-top: 16px;
    margin-bottom: 24px;
}
.cart-page-line {
    display: grid;
    grid-template-columns: 96px 1fr auto;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.cart-page-img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    background: var(--bg-card);
    border-radius: 6px;
}
.cart-page-title {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.cart-page-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}
.cart-page-qty {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
}
.cart-page-qty-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    font-family: inherit;
}
.cart-page-qty-btn:hover { border-color: var(--gold-dark); }
.cart-page-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0 0 0 16px;
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
}
.cart-page-remove:hover { color: var(--gold); }
.cart-page-price {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--gold);
    text-align: right;
}
.cart-page-footer {
    padding: 24px 0;
    border-top: 1px solid var(--border);
}
.cart-page-subtotal {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ============================================================
   Checkout page — two columns, Stripe Elements container styling.
   ============================================================ */
.checkout-wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 48px 24px 72px;
}
.checkout-title {
    font-family: 'Cinzel', Georgia, serif;
    color: var(--gold);
    font-size: 1.8rem;
    margin-bottom: 24px;
}
.checkout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}
@media (max-width: 860px) {
    .checkout-grid { grid-template-columns: 1fr; gap: 32px; }
    .checkout-summary { order: 2; }
    .checkout-form    { order: 1; }
}

.checkout-summary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    position: sticky;
    top: 24px;
}
.checkout-summary h2 {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.1rem;
    color: var(--gold);
    margin-bottom: 16px;
}
.checkout-line {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.checkout-line:last-of-type { border-bottom: none; }
.checkout-line img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    background: #0f0f0f;
    border-radius: 4px;
}
.checkout-line-title {
    font-size: 0.88rem;
    line-height: 1.3;
}
.checkout-line-sub {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 2px;
}
.checkout-line-price {
    color: var(--gold);
    font-size: 0.9rem;
    white-space: nowrap;
}

.checkout-totals {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.95rem;
}
.checkout-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    color: var(--text-muted);
}
.checkout-totals-row.total {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.checkout-form > * + * { margin-top: 24px; }

.checkout-section-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

#express-checkout, #address-element, #payment-element {
    min-height: 44px;
}

/* Plain HTML email field — must visually match the dark/gold Stripe Elements
   on this page. The hex values below mirror the elements appearance config
   in shop/js/checkout.js (theme: 'night', .Input rules) so the input box
   reads as a sibling of the Address/Payment Elements rather than a stray
   white form field on a dark page.
   - background  #0a0a0a  → matches `.Input { backgroundColor: '#0a0a0a' }`
   - border      #2a2420  → matches `.Input { border: '1px solid #2a2420' }`
   - focus border #9a7555 → matches `.Input:focus { borderColor: '#9a7555' }`
   - text        #d4c5b0  → matches Stripe `colorText`
   - radius      6px      → matches Stripe `borderRadius`
   - padding     ~10–12px → matches Stripe's internal Input padding (visual)
   - font 16px / Inter    → matches Stripe Elements + prevents iOS focus zoom
*/
.checkout-email-input {
    display: block;
    width: 100%;
    padding: 11px 12px;
    background: #0a0a0a;
    color: #d4c5b0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    border: 1px solid #2a2420;
    border-radius: 6px;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.checkout-email-input::placeholder {
    color: #6b6157;
    opacity: 1;
}
.checkout-email-input:hover {
    border-color: #3a322c;
}
.checkout-email-input:focus {
    outline: none;
    border-color: #9a7555;
    /* No box-shadow on focus — Stripe's Elements use a flat focus state too. */
}
/* Auto-fill background on Chrome/Edge would otherwise paint pale yellow
   over our dark theme. Force-keep the dark fill + gold-ish text. */
.checkout-email-input:-webkit-autofill,
.checkout-email-input:-webkit-autofill:hover,
.checkout-email-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #d4c5b0;
    -webkit-box-shadow: 0 0 0 1000px #0a0a0a inset;
    transition: background-color 9999s ease-in-out 0s;
}
.checkout-email-input[aria-invalid="true"] {
    border-color: #e57373;
}

.checkout-field-help {
    display: block;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}
.checkout-field-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(229, 115, 115, 0.10);
    border: 1px solid rgba(229, 115, 115, 0.4);
    border-radius: 4px;
    font-size: 0.85rem;
    color: #e57373;
}

.checkout-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 18px 0;
}
.checkout-divider::before,
.checkout-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.checkout-pay-btn {
    display: block;
    width: 100%;
    padding: 16px 24px;
    background: var(--gold);
    color: var(--bg-dark);
    border: none;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 24px;
}
.checkout-pay-btn:hover:not(:disabled) { background: var(--gold-light); }
.checkout-pay-btn:disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}

.checkout-error {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(200, 0, 0, 0.12);
    border: 1px solid rgba(200, 0, 0, 0.35);
    color: #f0b8b8;
    border-radius: 6px;
    font-size: 0.88rem;
}

/* Order-complete page */
.complete-wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 80px 24px;
    text-align: center;
}
.complete-wrap h1 {
    font-family: 'Cinzel', Georgia, serif;
    color: var(--gold);
    font-size: 2rem;
    margin-bottom: 18px;
}
.complete-wrap p { color: var(--text-muted); margin-bottom: 16px; }
.complete-order-id {
    display: inline-block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 6px;
    font-family: 'Menlo', 'Consolas', monospace;
    color: var(--gold);
    margin: 20px 0;
}
