/* ═══════════════════════════════════════════════════════════
   Physical Store — store.html (route: /test)
   Image tiles are a fixed pixel size regardless of source image
   dimensions, by clamping every dimension that could grow.
   ═══════════════════════════════════════════════════════════ */

/* ── Page wrapper ──────────────────────────────────────── */

.shop-page {
    box-sizing: border-box;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 6rem;
    overflow: hidden; /* belt-and-suspenders: never let a child push width */
}

.shop-loading,
.shop-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: rgba(240, 236, 230, 0.45);
    font-family: 'HwyGothic', sans-serif;
    font-size: 1rem;
}

/* ── Grid ──────────────────────────────────────────────── */

.shop-grid {
    box-sizing: border-box;
    width: 100%;
    display: grid;
    /* minmax(0, 1fr) prevents a wide intrinsic image from expanding its column */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

/* ── Tile ──────────────────────────────────────────────── */

.shop-tile {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;            /* allow grid track to constrain content */
    background: #1c1c1c;
    border: 1px solid rgba(255, 191, 0, 0.16);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.shop-tile:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 191, 0, 0.42);
}

/* ── Image area — fixed pixel height, image cropped to fill ── */

.shop-tile-image {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    /* Triple-locked height so nothing — flex stretch, intrinsic image
       size, grid row sizing — can grow this box. */
    height: 240px;
    min-height: 240px;
    max-height: 240px;
    flex: 0 0 240px;
    background: #0e0e0e;
    overflow: hidden;
}

.shop-tile-image > img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    object-position: center;
}

.shop-tile-fallback {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 191, 0, 0.18);
    font-size: 3rem;
}

.shop-tile-oos {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(200, 50, 50, 0.92);
    color: #fff;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.68rem;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.08em;
    pointer-events: none;
}

/* In-cart count badge — corner of the image area, hidden until > 0 */
.shop-tile-incart {
    position: absolute;
    top: 10px;
    left: 10px;
    display: none;
    background: #ffbf00;
    color: #0e0e0e;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.68rem;
    font-weight: bold;
    padding: 3px 9px;
    border-radius: 999px;
    letter-spacing: 0.06em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    transform-origin: center;
    animation: shopBadgePop 0.18s ease-out;
}

.shop-tile-incart.shown {
    display: inline-block;
}

@keyframes shopBadgePop {
    0%   { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1);   opacity: 1; }
}

/* ── Tile action area: hosts ADD button OR stepper ─────── */

.shop-tile-action {
    display: flex;
    align-items: center;
}

.shop-tile-stepper {
    display: inline-flex;
    align-items: stretch;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 191, 0, 0.55);
    background: #1c1c1c;
}

.shop-step-btn {
    background: transparent;
    border: none;
    color: #ffbf00;
    font-family: 'HwyGothic', sans-serif;
    font-size: 1rem;
    font-weight: bold;
    line-height: 1;
    padding: 0 0.7rem;
    cursor: pointer;
    transition: background 0.12s ease;
}

.shop-step-btn:hover  { background: rgba(255, 191, 0, 0.18); }
.shop-step-btn:active { background: rgba(255, 191, 0, 0.32); }

.shop-step-count {
    min-width: 1.9rem;
    text-align: center;
    align-self: center;
    color: #ffbf00;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.88rem;
    font-weight: bold;
    padding: 0.4rem 0.2rem;
    border-left: 1px solid rgba(255, 191, 0, 0.28);
    border-right: 1px solid rgba(255, 191, 0, 0.28);
    user-select: none;
}

/* Smaller image area on small viewports — still fixed, still uniform */
@media (max-width: 720px) {
    .shop-tile-image {
        height: 200px;
        min-height: 200px;
        max-height: 200px;
        flex-basis: 200px;
    }
}

/* ── Tile body ─────────────────────────────────────────── */

.shop-tile-body {
    flex: 1;
    min-width: 0;
    padding: 1rem 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.shop-tile-category {
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.65rem;
    color: rgba(255, 191, 0, 0.55);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.shop-tile-name {
    font-family: 'HwyGothic', sans-serif;
    font-size: 1rem;
    color: rgba(240, 236, 230, 0.95);
    font-weight: bold;
    letter-spacing: 0.01em;
    word-break: break-word;
}

.shop-tile-desc {
    margin: 0;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.82rem;
    color: rgba(240, 236, 230, 0.62);
    line-height: 1.4;
    flex: 1;
    word-break: break-word;
}

.shop-tile-foot {
    margin-top: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.shop-tile-price {
    font-family: 'HwyGothic', sans-serif;
    font-size: 1.1rem;
    color: #ffbf00;
    font-weight: bold;
}

.shop-tile-add {
    background: #ffbf00;
    color: #0e0e0e;
    border: none;
    border-radius: 4px;
    padding: 0.45rem 0.95rem;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.shop-tile-add:hover:not(:disabled) { background: #ffd040; }

.shop-tile-add:disabled {
    background: rgba(255, 255, 255, 0.10);
    color: rgba(240, 236, 230, 0.35);
    cursor: not-allowed;
}

/* ── Action-bar cart toggle (absolute so it doesn't shift the centered title) ─── */

.shop-cart-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: #ffbf00;
    color: #0e0e0e;
    border: none;
    border-radius: 50px;
    padding: 0.35rem 1rem;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.82rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s ease;
    z-index: 2;
}

.shop-cart-toggle:hover { background: #ffd040; }
.shop-cart-toggle.hidden { display: none; }

/* On appearance: gold-glow pulse for ~3 seconds then settle to a subtle ambient pulse */
.shop-cart-toggle.shop-cart-toggle-attn {
    animation: shopCartAppear 0.45s ease-out, shopCartPulse 1.6s ease-in-out 0.45s 3;
}

@keyframes shopCartAppear {
    0%   { transform: translate(60%, -50%) scale(0.6); opacity: 0; box-shadow: 0 0 0 rgba(255, 191, 0, 0); }
    60%  { transform: translateY(-50%) scale(1.1); opacity: 1; box-shadow: 0 0 24px rgba(255, 191, 0, 0.85); }
    100% { transform: translateY(-50%) scale(1); opacity: 1; box-shadow: 0 0 12px rgba(255, 191, 0, 0.55); }
}

@keyframes shopCartPulse {
    0%, 100% { box-shadow: 0 0 0 rgba(255, 191, 0, 0.0), 0 0 6px rgba(255, 191, 0, 0.25); }
    50%      { box-shadow: 0 0 14px rgba(255, 191, 0, 0.6), 0 0 24px rgba(255, 191, 0, 0.35); }
}

.shop-cart-badge {
    background: #0e0e0e;
    color: #ffbf00;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* ── Cart drawer ───────────────────────────────────────── */

.shop-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.shop-cart-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.shop-cart-drawer {
    position: fixed;
    top: 140px; /* below header (70px) + action-bar (70px) */
    right: 0;
    height: calc(100% - 140px);
    width: 380px;
    max-width: 100vw;
    background: #161616;
    border-left: 1px solid rgba(255, 191, 0, 0.22);
    z-index: 101;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.shop-cart-drawer.open { transform: translateX(0); }

.shop-cart-head {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 191, 0, 0.16);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.shop-cart-head h3 {
    margin: 0;
    font-family: 'Dragon Slayer', sans-serif;
    color: #ffbf00;
    font-size: 1.2rem;
    letter-spacing: 0.05em;
}

.shop-cart-close {
    background: none;
    border: none;
    color: rgba(240, 236, 230, 0.6);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.shop-cart-close:hover { color: #ffbf00; }

.shop-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.shop-cart-empty {
    text-align: center;
    padding: 2rem 0;
    color: rgba(240, 236, 230, 0.4);
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.9rem;
}

.shop-cart-row {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.shop-cart-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.shop-cart-thumb-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 191, 0, 0.25);
    font-size: 1.2rem;
}

.shop-cart-info {
    flex: 1;
    min-width: 0;
}

.shop-cart-name {
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.88rem;
    color: rgba(240, 236, 230, 0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shop-cart-line-price {
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.8rem;
    color: #ffbf00;
    margin-top: 2px;
}

.shop-cart-qty {
    margin-top: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.shop-qty-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(240, 236, 230, 0.85);
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-qty-btn:hover {
    background: rgba(255, 191, 0, 0.25);
    color: #ffbf00;
}

.shop-cart-qty span {
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.88rem;
    color: rgba(240, 236, 230, 0.92);
    min-width: 18px;
    text-align: center;
}

.shop-cart-remove {
    background: none;
    border: none;
    color: rgba(240, 236, 230, 0.32);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.shop-cart-remove:hover { color: #ff4444; }

.shop-cart-foot {
    padding: 1.2rem 1.5rem;
    border-top: 1px solid rgba(255, 191, 0, 0.16);
}

.shop-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
    font-family: 'HwyGothic', sans-serif;
    color: rgba(240, 236, 230, 0.7);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.shop-cart-total span:last-child {
    font-family: 'Dragon Slayer', sans-serif;
    color: #ffbf00;
    font-size: 1.3rem;
    letter-spacing: 0.04em;
}

.shop-cart-tax-note {
    margin: 0 0 0.85rem;
    color: rgba(240, 236, 230, 0.45);
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}

.shop-checkout-btn {
    width: 100%;
    background: #ffbf00;
    color: #0e0e0e;
    border: none;
    border-radius: 6px;
    padding: 0.75rem;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.95rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.shop-checkout-btn:hover:not(:disabled) { background: #ffd040; }
.shop-checkout-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(240, 236, 230, 0.3);
    cursor: not-allowed;
}

.shop-cart-error {
    margin-bottom: 0.5rem;
    color: #ff6b6b;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.78rem;
    min-height: 0;
}

.shop-cart-error:empty {
    display: none;
}

.shop-cart-note {
    margin: 0.6rem 0 0;
    text-align: center;
    color: rgba(240, 236, 230, 0.45);
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}

/* ── Mobile cart adjustments ───────────────────────────── */

@media only screen and ((max-width: 767px) or (hover: none)) {
    body.cart-open .action-bar { display: none; }

    .shop-cart-overlay { z-index: 1003; }

    .shop-cart-drawer {
        top: 0;
        right: 0;
        bottom: 0;
        height: auto;
        width: 100%;
        max-width: 100vw;
        z-index: 1004;
    }

    .shop-modal {
        top: 0;
        bottom: 70px; /* above mobile action-bar */
    }

    .shop-modal-box {
        max-height: calc(100vh - 70px - 2rem);
    }
}

/* ── Checkout modal ────────────────────────────────────── */

.shop-modal {
    position: fixed;
    top: 140px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.78);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.shop-modal.open {
    opacity: 1;
    pointer-events: all;
}

.shop-modal-box {
    box-sizing: border-box;
    width: 100%;
    max-width: 720px;
    background: #1c1c1c;
    border: 1px solid rgba(255, 191, 0, 0.26);
    border-radius: 10px;
    padding: 1.5rem 2rem;
    max-height: calc(100vh - 140px - 2rem);
    overflow-y: auto;
}

.shop-modal-box h2 {
    margin: 0 0 0.75rem;
    font-family: 'Dragon Slayer', sans-serif;
    color: #ffbf00;
    font-size: 1.4rem;
    letter-spacing: 0.05em;
}

.shop-modal-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 0.5rem 0 0.75rem;
}

.shop-modal-section {
    margin: 0 0 0.65rem;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.78rem;
    color: rgba(240, 236, 230, 0.5);
    letter-spacing: 0.06em;
}

.shop-form-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.shop-form-field {
    flex: 1 1 200px;
    min-width: 0;
    margin-bottom: 0.65rem;
}

.shop-form-field label {
    display: block;
    margin-bottom: 0.3rem;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.78rem;
    color: rgba(240, 236, 230, 0.6);
    letter-spacing: 0.05em;
}

.shop-form-field input {
    box-sizing: border-box;
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    padding: 0.55rem 0.75rem;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.9rem;
    color: rgba(240, 236, 230, 0.92);
    transition: border-color 0.15s ease;
}

.shop-form-field input:focus {
    outline: none;
    border-color: rgba(255, 191, 0, 0.5);
}

.shop-summary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.6rem 1rem;
}

.shop-summary-title {
    margin-bottom: 0.5rem;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.72rem;
    color: rgba(240, 236, 230, 0.5);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.shop-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.85rem;
    color: rgba(240, 236, 230, 0.82);
}

.shop-summary-total {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.95rem;
    color: #ffbf00;
    font-weight: bold;
}

.shop-error {
    margin: 0.75rem 0;
    color: #ff6b6b;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.82rem;
    min-height: 1.2em;
}

.shop-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.shop-modal-btn {
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 5px;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.15s ease;
}

.shop-modal-btn.cancel {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(240, 236, 230, 0.7);
}

.shop-modal-btn.cancel:hover { background: rgba(255, 255, 255, 0.14); }

.shop-modal-btn.submit {
    background: #ffbf00;
    color: #0e0e0e;
}

.shop-modal-btn.submit:hover:not(:disabled) { background: #ffd040; }

.shop-modal-btn.submit:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(240, 236, 230, 0.3);
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════
   store-success.html (route: /test/success) — preserved
   These classes are referenced by the success template.
   ═══════════════════════════════════════════════════════════ */

.phys-success-page {
    max-width: 560px;
    margin: 3rem auto;
    padding: 3rem 2.5rem;
    text-align: center;
    background: #151515;
    border: 1px solid rgba(255, 191, 0, 0.12);
    border-radius: 12px;
}

.phys-success-icon {
    font-size: 3.5rem;
    color: #ffbf00;
    margin-bottom: 1.2rem;
}

.phys-success-page h2 {
    font-family: 'Dragon Slayer', sans-serif;
    color: #ffbf00;
    font-size: 2rem;
    margin: 0 0 1rem;
}

.phys-success-page p {
    font-family: 'HwyGothic', sans-serif;
    color: rgba(240, 236, 230, 0.7);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 0.75rem;
}

.phys-back-link {
    display: inline-block;
    margin-top: 2rem;
    background: #ffbf00;
    color: #0e0e0e;
    font-family: 'HwyGothic', sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    padding: 0.7rem 1.8rem;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.phys-back-link:hover { background: #ffd040; }
