/* =========================================================
   ZSCAPE — Store page
   Builds on styles.css (shared tokens, buttons, nav, footer).
   Ported from the Figma "Store page design" bundle.
   ========================================================= */

:root {
    /* donor rank tiers */
    --tier-donor:   #7ec8f5;
    --tier-super:   #c084fc;
    --tier-extreme: #ffd680;
    /* item rarities */
    --rare:   #7ec8f5;
    --epic:   #c084fc;
    --legend: #ffd680;
    --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ambient ember glow beneath the nav */
.store-ambient {
    position: fixed; inset: var(--nav-h) 0 0 0; z-index: 0; pointer-events: none;
    background: radial-gradient(80% 40% at 50% 0%, rgba(255,106,31,.12), transparent 55%);
}

.store-main { position: relative; z-index: 1; padding-bottom: 80px; }

/* diamond ornament (matches the Figma section divider) */
.orn { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; }
.orn::before, .orn::after { content: ""; height: 1px; flex: 1; max-width: 80px; }
.orn::before { background: linear-gradient(90deg, transparent, var(--line-2)); }
.orn::after  { background: linear-gradient(270deg, transparent, var(--line-2)); }
.orn svg { display: block; }

/* =========================================================
   Page header
   ========================================================= */
.store-hero { padding: calc(var(--nav-h) + 72px) 0 72px; text-align: center; }
.store-hero h1 {
    font-family: 'Cinzel Decorative', serif; font-weight: 900;
    font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.1; margin-bottom: 16px;
    background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 4px 12px rgba(255,100,30,.3));
}
.store-hero p { color: var(--muted); max-width: 540px; margin: 0 auto; font-size: 1.02rem; line-height: 1.7; }
.store-badges {
    display: flex; gap: 24px; justify-content: center; flex-wrap: wrap;
    margin-top: 20px; color: var(--muted-2); font-size: .88rem;
}
.store-badges span { display: inline-flex; align-items: center; gap: 6px; }
.check { color: #57d07a; }

.store-section { margin-bottom: 88px; }
.store-section-head { text-align: center; margin-bottom: 46px; }
.store-section-head h2 {
    font-family: 'Cinzel', serif; font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 10px;
    background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.store-section-head p { color: var(--muted); font-size: .95rem; }

/* =========================================================
   Store credit / spend progress
   ========================================================= */
.credit {
    border-radius: 6px; border: 1px solid var(--line);
    background: linear-gradient(180deg, #1a0f07, var(--bg-3));
    padding: 24px 28px; box-shadow: inset 0 1px 0 rgba(255,214,128,.06);
    margin-bottom: 48px;
}
.credit-top {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 24px; flex-wrap: wrap; margin-bottom: 20px;
}
.credit-id { display: flex; align-items: center; gap: 12px; }
.credit-icon {
    width: 36px; height: 36px; border-radius: 4px; display: grid; place-items: center; color: var(--gold);
    background: radial-gradient(circle at 50% 35%, rgba(242,166,58,.18), rgba(0,0,0,.15));
    border: 1px solid var(--line-2);
}
.credit-label {
    font-family: var(--mono); font-size: .7rem; text-transform: uppercase;
    letter-spacing: .15em; color: var(--muted-2); margin-bottom: 2px;
}
.credit-amount {
    font-family: 'Cinzel', serif; font-weight: 900; font-size: 1.6rem; line-height: 1;
    background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.credit-status { text-align: right; }
.credit-status .credit-label { letter-spacing: .12em; margin-bottom: 3px; }
.credit-rank { font-family: 'Cinzel', serif; font-weight: 700; font-size: .9rem; }
.credit-next { margin-top: 4px; font-family: var(--mono); font-size: .7rem; color: var(--muted-2); }

.credit-bar { position: relative; }
.credit-track {
    height: 10px; border-radius: 5px; background: #0d0905;
    border: 1px solid #2a1e0a; position: relative;
}
.credit-fill {
    position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px;
    transition: width .6s ease;
}
.credit-tick {
    position: absolute; top: 50%; transform: translate(-50%, -50%);
    width: 14px; height: 14px; border-radius: 50%;
    background: #1a0f07; border: 2px solid var(--line-2);
    transition: all .4s ease; z-index: 2;
}
.credit-tick.reached { }
.credit-labels { position: relative; height: 36px; margin-top: 4px; }
.credit-tick-label {
    position: absolute; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 1px; white-space: nowrap;
}
.credit-tick-label .amt { font-family: var(--mono); font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--line-2); }
.credit-tick-label .nm  { font-family: 'Cinzel', serif; font-size: .6rem; letter-spacing: .04em; color: #3a2913; }

/* =========================================================
   Donor rank cards
   ========================================================= */
.rank-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 32px; }
.rank-card {
    position: relative; padding: 32px 24px; border-radius: 6px;
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255,214,128,.05);
    display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.rank-card::before { /* corner brackets, tinted per tier via --tier */
    content: ""; position: absolute; inset: 8px; border-radius: 3px; pointer-events: none;
    background:
        linear-gradient(var(--tier), var(--tier)) left top / 14px 1px no-repeat,
        linear-gradient(var(--tier), var(--tier)) left top / 1px 14px no-repeat,
        linear-gradient(var(--tier), var(--tier)) right bottom / 14px 1px no-repeat,
        linear-gradient(var(--tier), var(--tier)) right bottom / 1px 14px no-repeat;
    opacity: .15; transition: opacity .25s;
}
.rank-card:hover { transform: translateY(-5px); border-color: var(--line-2); box-shadow: 0 0 20px -8px var(--tier-glow); }
.rank-card:hover::before { opacity: .5; }
.rank-card.popular { border-color: var(--line-2); box-shadow: 0 0 30px -8px var(--tier-glow), inset 0 1px 0 rgba(255,214,128,.1); }
.rank-card.popular::before { opacity: .5; }

.rank-popular-tag {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 5px;
    font-family: 'Cinzel', serif; font-weight: 700; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
    padding: 3px 12px; border-radius: 12px; white-space: nowrap;
    background: linear-gradient(180deg, #fff0cf 0%, var(--gold) 45%, var(--gold-deep) 100%);
    color: #35210a; box-shadow: 0 0 18px -4px rgba(242,166,58,.7);
}
.rank-badge {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: 'Cinzel', serif; font-weight: 700; font-size: .78rem; letter-spacing: .08em;
    padding: 5px 14px; border-radius: 20px;
    background: var(--tier-badge); border: 1px solid var(--tier-border); color: var(--tier);
}
.rank-price {
    font-family: 'Cinzel', serif; font-weight: 900; font-size: 2.4rem;
    background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rank-price small { color: var(--muted-2); font-size: .85rem; font-weight: 400; -webkit-text-fill-color: var(--muted-2); }
.rank-note { color: var(--muted-2); font-size: .82rem; }
.rank-card .rs-btn { margin-top: 8px; width: 100%; }

/* tier palettes */
.tier-donor   { --tier: var(--tier-donor);   --tier-glow: rgba(126,200,245,.25); --tier-badge: rgba(30,74,122,.35);  --tier-border: rgba(30,74,122,.6); }
.tier-super   { --tier: var(--tier-super);   --tier-glow: rgba(192,132,252,.3);  --tier-badge: rgba(74,32,112,.35);  --tier-border: rgba(74,32,112,.7); }
.tier-extreme { --tier: var(--tier-extreme); --tier-glow: rgba(242,166,58,.35);  --tier-badge: rgba(122,74,0,.35);   --tier-border: rgba(122,74,0,.7); }

/* =========================================================
   Feature comparison table
   ========================================================= */
.feature-table-wrap {
    border-radius: 6px; border: 1px solid var(--line); overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,214,128,.04);
}
.feature-scroll { overflow-x: auto; }
.feature-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.feature-table thead tr, .feature-table tfoot tr { background: linear-gradient(180deg, #1a0f07, var(--bg-3)); }
.feature-table thead tr { border-bottom: 1px solid var(--line); }
.feature-table tfoot tr { border-top: 1px solid var(--line-2); }
.feature-table th.feat-col, .feature-table td.feat-lead {
    font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .15em;
    color: var(--muted-2); font-weight: 500; text-align: left;
}
.feature-table th.feat-col { padding: 14px 20px; width: 48%; }
.feature-table th.feat-tier { padding: 14px 16px; text-align: center; }
.feature-table th.feat-tier span { font-family: 'Cinzel', serif; font-weight: 700; font-size: .85rem; }
.feature-table tbody tr { border-bottom: 1px solid rgba(58,41,19,.5); transition: background .15s; }
.feature-table tbody tr:nth-child(even) { background: rgba(10,8,6,.4); }
.feature-table tbody tr:hover { background: rgba(242,166,58,.04); }
.feature-table td { padding: 11px 16px; text-align: center; }
.feature-table td.feat-name { padding: 11px 20px; text-align: left; color: var(--text); }
.feature-table tfoot td.feat-lead { padding: 13px 20px; }
.feature-table tfoot td.feat-price { padding: 13px 16px; text-align: center; }
.feat-price-num {
    font-family: 'Cinzel', serif; font-weight: 900; font-size: 1.1rem;
    background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.feat-val-str { font-family: var(--mono); font-size: .8rem; color: var(--gold); }
.feat-yes { color: #57d07a; }
.feat-no  { color: var(--muted-2); opacity: .6; }

/* =========================================================
   Item shop
   ========================================================= */
.shop-tabs {
    display: flex; gap: 6px; flex-wrap: wrap; margin: 0 auto 32px; padding: 6px;
    border-radius: 6px; background: linear-gradient(180deg, #1a0f07, var(--bg-3));
    border: 1px solid var(--line); width: fit-content;
}
.tab-btn {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: 'Cinzel', serif; font-weight: 700; letter-spacing: .05em; font-size: .8rem;
    padding: 9px 18px; border-radius: 4px; cursor: pointer; border: none;
    background: transparent; color: var(--muted); transition: all .15s ease;
}
.tab-btn:hover { color: var(--gold-2); }
.tab-btn.active {
    background: linear-gradient(180deg, #ffe6ab 0%, var(--gold) 45%, var(--gold-deep) 100%);
    color: #35210a;
    box-shadow: 0 0 18px -4px rgba(242,166,58,.6), inset 0 1px 0 rgba(255,255,255,.4);
}

.item-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.item-panel { display: none; }
.item-panel.active { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

.item-card {
    position: relative; padding: 20px; border-radius: 6px;
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255,214,128,.05);
    display: flex; flex-direction: column; gap: 12px;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.item-card::before { /* corner brackets, tinted per rarity via --ra-text */
    content: ""; position: absolute; inset: 6px; border-radius: 3px; pointer-events: none;
    background:
        linear-gradient(var(--ra-text), var(--ra-text)) left top / 10px 1px no-repeat,
        linear-gradient(var(--ra-text), var(--ra-text)) left top / 1px 10px no-repeat,
        linear-gradient(var(--ra-text), var(--ra-text)) right bottom / 10px 1px no-repeat,
        linear-gradient(var(--ra-text), var(--ra-text)) right bottom / 1px 10px no-repeat;
    opacity: 0; transition: opacity .25s;
}
.item-card:hover { transform: translateY(-3px); border-color: var(--ra-border); box-shadow: 0 0 24px -6px var(--ra-glow), inset 0 1px 0 rgba(255,214,128,.08); }
.item-card:hover::before { opacity: .4; }

.item-tag {
    position: absolute; top: -11px; left: 12px;
    font-family: var(--mono); font-size: .65rem; letter-spacing: .15em; text-transform: uppercase;
    padding: 2px 8px; border-radius: 2px; font-weight: 700; color: #35210a;
    background: linear-gradient(180deg, #ffe6ab 0%, var(--gold) 45%, var(--gold-deep) 100%);
}
.item-top { display: flex; align-items: flex-start; gap: 12px; }
.item-glyph {
    width: 44px; height: 44px; border-radius: 4px; flex-shrink: 0; display: grid; place-items: center;
    font-family: var(--mono); font-weight: 700; letter-spacing: .02em;
    background: var(--ra-bg); border: 1px solid var(--ra-border); color: var(--ra-text);
    font-size: .8rem;
}
.item-glyph.long { font-size: .65rem; }
.item-body { flex: 1; min-width: 0; }
.item-name-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.item-name { font-family: 'Cinzel', serif; font-weight: 700; color: var(--gold-2); font-size: .9rem; line-height: 1.3; }
.item-rarity {
    font-size: .65rem; font-family: var(--mono); letter-spacing: .1em; white-space: nowrap;
    padding: 2px 6px; border-radius: 2px; border: 1px solid var(--ra-border);
    background: var(--ra-bg); color: var(--ra-text);
}
.item-desc { color: var(--muted); font-size: .83rem; margin-top: 4px; line-height: 1.5; }
.item-foot {
    display: flex; align-items: center; justify-content: space-between;
    border-top: 1px solid var(--line); padding-top: 12px; margin-top: auto;
}
.item-price {
    font-family: 'Cinzel', serif; font-weight: 900; font-size: 1.1rem;
    background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.item-coins { color: var(--muted-2); font-size: .75rem; margin-left: 4px; }
.item-foot .rs-btn { gap: 6px; }

/* rarity palettes */
.rarity-common    { --ra-border: var(--line);       --ra-bg: rgba(58,41,19,.4);  --ra-text: var(--muted); --ra-glow: transparent; }
.rarity-rare      { --ra-border: #1e4a7a;           --ra-bg: rgba(30,74,122,.25); --ra-text: var(--rare);  --ra-glow: rgba(56,189,248,.12); }
.rarity-epic      { --ra-border: #4a2070;           --ra-bg: rgba(74,32,112,.25); --ra-text: var(--epic);  --ra-glow: rgba(192,132,252,.12); }
.rarity-legendary { --ra-border: #7a4a00;           --ra-bg: rgba(122,74,0,.25);  --ra-text: var(--legend);--ra-glow: rgba(242,166,58,.18); }

/* =========================================================
   Toast + cart badge
   ========================================================= */
.cart-btn {
    position: relative; display: inline-flex; align-items: center; gap: 6px;
    font-family: 'Cinzel', serif; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    font-size: .75rem; padding: 8px 16px; border-radius: 3px; cursor: pointer;
    background: linear-gradient(180deg, #241708, #140d06); border: 1px solid var(--line-2); color: var(--gold-2);
    box-shadow: 0 0 0 1px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,214,128,.12);
    transition: border-color .2s, color .2s;
}
.cart-btn:hover { border-color: var(--gold); color: var(--gold-3); }
.cart-count {
    position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
    background: linear-gradient(180deg, #ffe6ab, var(--gold)); color: #35210a;
    font-size: .65rem; font-weight: 900; font-family: var(--mono);
    display: none; align-items: center; justify-content: center;
}
.cart-count.show { display: flex; }

.toast {
    position: fixed; top: 80px; right: 22px; z-index: 300;
    display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 4px;
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line-2);
    box-shadow: 0 0 24px -4px rgba(242,166,58,.35), 0 12px 40px rgba(0,0,0,.8);
    font-family: 'Cinzel', serif; font-weight: 700; font-size: .82rem; letter-spacing: .04em; color: var(--gold-2);
    opacity: 0; transform: translateX(12px); pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: none; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
    .rank-grid { grid-template-columns: 1fr; }
    .item-grid, .item-panel.active { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
    .item-grid, .item-panel.active { grid-template-columns: 1fr; }
    .credit-status { text-align: left; }
}
