/* =============================================================================
   agg.css — the Gifts-page "Off-chain ⇄ On-chain" source toggle + the
   listings grid. OFF-CHAIN (default) = every gift for sale across the
   marketplaces we index (universe=all); ON-CHAIN = the chain-verified in-house
   book (gifts_only=1). Buyable on-site through the escrow bridge. Scoped .agg-*.
   ========================================================================== */

/* STRIP TO A CLEAN GRID — at launch there are no in-house listings, so the
   curated marketing reels (and the on-page auctions window, now its own tab)
   would just repackage aggregated data. Hide them; the Gifts page is the
   toggle + the buyable grid. They come back when there's real in-house stock. */
#view-gifts #maWrap,
#view-gifts #hotnow,
#view-gifts #hotdeals,
#view-gifts #topgifts,
#view-gifts #recentsales{ display:none !important; }

.agg-bar{ display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin:6px auto 4px; padding:0 clamp(14px,2.5vw,40px); }
.agg-seg{ display:inline-flex; border:1px solid var(--hairline-2); border-radius:12px; overflow:hidden; background:var(--well); }
.agg-seg-btn{ display:inline-flex; align-items:center; gap:8px; padding:9px 16px; font-weight:800; font-size:13.5px; color:var(--ink-mid); }
.agg-seg-btn + .agg-seg-btn{ border-left:1px solid var(--hairline-2); }
.agg-seg-btn[aria-pressed="true"]{ background:var(--p400); color:var(--on-accent); }
.agg-seg-btn:hover{ color:var(--ink-hi); }
.agg-seg-btn[aria-pressed="true"]:hover{ color:var(--on-accent); }
.agg-seg-btn .cnt{ font-size:11px; font-weight:700; opacity:.7; font-variant-numeric:tabular-nums; }
/* live count for the active on/off-chain universe — sits beside the segment */
.agg-count{ font-size:12.5px; font-weight:800; color:var(--p400); font-variant-numeric:tabular-nums; white-space:nowrap; }
.agg-sub{ color:var(--ink-lo); font-size:12.5px; }
.agg-sub b{ color:var(--ink-mid); }

/* the aggregated pane — full desktop width */
.agg-wrap{ margin:0 auto; padding:8px clamp(14px,2.5vw,40px) 60px; }
.agg-whd{ display:flex; align-items:baseline; gap:10px; margin:14px 0 2px; flex-wrap:wrap; }
.agg-wlabel{ font-size:18px; font-weight:900; color:var(--ink-hi); letter-spacing:-.01em; }
.agg-wlabel::before{ content:"◆"; color:var(--p400); font-size:12px; margin-right:7px; vertical-align:middle; }
.agg-wsub{ color:var(--ink-lo); font-size:12px; }

/* the (bigger) stats box */
.agg-stats{ display:flex; flex-wrap:wrap; gap:12px; margin:12px 0 14px; }
.agg-stat{ display:flex; flex-direction:column; gap:3px; background:var(--panel); border:1px solid var(--hairline); border-radius:14px; padding:14px 20px; min-width:118px; }
.agg-stat-v{ font-size:24px; font-weight:900; color:var(--ink-hi); font-variant-numeric:tabular-nums; line-height:1; }
.agg-stat-k{ font-size:11px; color:var(--ink-lo); text-transform:uppercase; letter-spacing:.05em; }

/* filter controls */
.agg-sel{ background:var(--well); border:1px solid var(--hairline-2); border-radius:10px; padding:9px 12px; color:var(--ink-hi); font-size:13px; max-width:240px; }
.agg-num{ width:104px; background:var(--well); border:1px solid var(--hairline-2); border-radius:10px; padding:9px 12px; color:var(--ink-hi); font-size:13px; }
.agg-num:focus,.agg-sel:focus{ border-color:var(--p400); }
.agg-tools{ display:flex; align-items:flex-end; gap:10px; row-gap:12px; flex-wrap:wrap; margin:6px 0 14px; }
.agg-search{ flex:1 1 220px; min-width:160px; background:var(--well); border:1px solid var(--hairline-2); border-radius:10px; padding:9px 12px; color:var(--ink-hi); font-size:13px; }
.agg-search:focus{ border-color:var(--p400); }
.agg-sort{ background:var(--well); border:1px solid var(--hairline-2); border-radius:10px; padding:9px 12px; color:var(--ink-hi); font-size:13px; }

/* COMPOSABLE FILTER GROUPS — a labelled control per facet; each AND-composes on
   the unified endpoint. The row reads Collection · Model · Backdrop · Price ·
   Monochrome · Sort, so the filters visibly go together instead of a loose bar. */
.agg-fgroup{ display:flex; flex-direction:column; gap:4px; min-width:0; }
.agg-flabel{ font-size:10px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-lo); padding-left:2px; }
.agg-prow{ display:flex; gap:8px; }
/* MONOCHROME 🌈 — a TOGGLE chip (not a sort). Pressed = the hue-ordered rainbow
   is on, still composing with the other filters. */
.agg-toggle{ display:inline-flex; align-items:center; gap:6px; background:var(--well); border:1px solid var(--hairline-2); border-radius:10px; padding:9px 14px; color:var(--ink-mid); font-size:13px; font-weight:800; white-space:nowrap; transition:background .15s, color .15s, border-color .15s; }
.agg-toggle:hover{ color:var(--ink-hi); border-color:var(--p300); }
.agg-toggle[aria-pressed="true"]{ background:var(--p400); color:var(--on-accent); border-color:var(--p400); }
.agg-toggle[aria-pressed="true"]:hover{ background:var(--p500); color:var(--on-accent); }
/* dimmed while Monochrome owns the order / until a collection scopes the models */
.agg-sel:disabled,.agg-toggle:disabled{ opacity:.5; cursor:not-allowed; }

.agg-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(248px,1fr)); gap:18px; }
@media (max-width:640px){ .agg-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; } }

/* MOBILE — 16px inputs so iOS Safari never zooms the page on focus. The filter
   bar + buy-modal inputs otherwise inherit 13–14px and trigger auto-zoom. */
@media (max-width:640px){
  .agg-sel,.agg-num,.agg-search,.agg-sort,.agg-input{ font-size:16px; }
}

.agg-card{ position:relative; background:var(--panel); border:1px solid var(--hairline); border-radius:14px; overflow:hidden; display:flex; flex-direction:column; transition:border-color .15s, transform .15s; }
.agg-card:hover{ border-color:var(--p300); transform:translateY(-2px); }
.agg-art{ position:relative; aspect-ratio:1/1; background:var(--well); display:flex; align-items:center; justify-content:center; overflow:hidden; }
.agg-art img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.agg-mono{ font-size:34px; font-weight:900; color:var(--p400); opacity:.85; }
.agg-src{ position:absolute; top:8px; left:8px; z-index:2; font-size:10px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; color:var(--ink-hi); background:rgba(4,8,14,.66); border:1px solid var(--hairline-2); padding:3px 7px; border-radius:7px; backdrop-filter:blur(3px); }
.agg-body{ padding:10px 11px 12px; display:flex; flex-direction:column; gap:8px; }
.agg-name{ font-weight:800; color:var(--ink-hi); font-size:13.5px; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.agg-price{ display:flex; align-items:baseline; gap:5px; }
.agg-price b{ color:var(--ink-hi); font-weight:900; font-size:16px; font-variant-numeric:tabular-nums; }
.agg-price span{ color:var(--ink-lo); font-size:11px; font-weight:700; }
.agg-buyrow{ display:flex; align-items:center; gap:8px; margin-top:2px; }
.agg-buy{ flex:1; display:block; background:var(--p400); color:var(--on-accent); font-weight:800; font-size:13px; border-radius:9px; padding:9px; text-align:center; text-decoration:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.agg-buy:hover{ background:var(--p500); }

/* TRUE RARITY chip — top-right of the art. Higher score = rarer; absent stays
   off the card entirely (no chip) rather than showing a fake 0. */
.agg-rare{ position:absolute; top:8px; right:8px; z-index:2; font-size:10px; font-weight:800; letter-spacing:.02em; color:var(--p400); background:rgba(4,8,14,.66); border:1px solid var(--hairline-2); padding:3px 7px; border-radius:7px; backdrop-filter:blur(3px); font-variant-numeric:tabular-nums; }
.agg-mkt{ font-size:9.5px; color:var(--ink-faint); text-transform:lowercase; letter-spacing:.02em; white-space:nowrap; }

/* OFF-CHAIN regular (non-NFT) gift cards — informational, no Buy. Subtle tag +
   a "sent via Telegram" affordance instead, in the same pastel/frosted theme. */
.agg-card--regular:hover{ border-color:var(--p200, var(--p300)); }
.agg-regtag{ position:absolute; top:8px; left:8px; z-index:2; font-size:9.5px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; color:var(--p400); background:rgba(4,8,14,.62); border:1px solid var(--hairline-2); padding:3px 7px; border-radius:7px; backdrop-filter:blur(3px); }
.agg-nofloor{ color:var(--ink-lo); font-size:12px; font-weight:700; }
.agg-regmeta{ font-size:11px; color:var(--ink-lo); font-weight:700; font-variant-numeric:tabular-nums; }
.agg-tgnote{ flex:1; display:inline-flex; align-items:center; justify-content:center; gap:6px; font-size:11.5px; font-weight:800; color:var(--ink-mid); background:var(--well); border:1px solid var(--hairline-2); border-radius:9px; padding:8px; white-space:nowrap; }
.agg-tgnote::before{ content:"✈"; color:var(--p400); font-size:12px; }

.agg-more{ display:block; margin:22px auto 0; background:var(--hover); color:var(--ink-mid); font-weight:800; font-size:13px; border-radius:11px; padding:11px 22px; }
.agg-more:hover{ color:var(--ink-hi); }
.agg-note{ grid-column:1/-1; text-align:center; color:var(--ink-lo); padding:48px 12px; font-size:14px; }
.agg-note h3{ color:var(--ink-hi); margin:0 0 6px; }

/* buy modal — reuses the auction modal look via its own .agg-* classes */
.agg-back{ position:fixed; inset:0; z-index:8200; background:rgba(4,8,14,.72); backdrop-filter:blur(4px); display:flex; align-items:flex-start; justify-content:center; overflow:auto; padding:6vh 14px 40px; }
.agg-modal{ width:100%; max-width:460px; background:var(--panel); border:1px solid var(--hairline-2); border-radius:18px; box-shadow:0 24px 60px rgba(0,0,0,.5); }
.agg-mhd{ display:flex; align-items:center; justify-content:space-between; padding:15px 18px; border-bottom:1px solid var(--hairline); }
.agg-mhd h3{ margin:0; font-size:16px; color:var(--ink-hi); font-weight:800; }
.agg-x{ font-size:22px; color:var(--ink-lo); line-height:1; padding:2px 6px; border-radius:8px; }
.agg-x:hover{ color:var(--ink-hi); background:var(--hover); }
.agg-form{ padding:16px 18px 20px; display:flex; flex-direction:column; gap:12px; }
.agg-line{ display:flex; justify-content:space-between; gap:10px; font-size:13px; }
.agg-line .k{ color:var(--ink-lo); }
.agg-line .v{ color:var(--ink-hi); font-weight:800; font-variant-numeric:tabular-nums; }
.agg-input{ background:var(--well); border:1px solid var(--hairline-2); border-radius:10px; padding:10px 12px; color:var(--ink-hi); font-size:14px; }
.agg-input:focus{ border-color:var(--p400); }
.agg-actions{ display:flex; gap:10px; }
.agg-btn{ flex:1; border-radius:11px; padding:12px; font-weight:800; font-size:14px; text-align:center; }
.agg-btn.primary{ background:var(--p400); color:var(--on-accent); }
.agg-btn.primary:hover{ background:var(--p500); }
.agg-btn.ghost{ background:var(--hover); color:var(--ink-mid); }
.agg-btn[disabled]{ opacity:.5; pointer-events:none; }
.agg-status{ font-size:12.5px; min-height:16px; }
.agg-status.err{ color:var(--loss); }
.agg-status.ok{ color:var(--gain); }
.agg-testnet{ display:inline-block; font-size:10px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; color:var(--sweep); border:1px solid var(--sweep); border-radius:6px; padding:2px 6px; }
.agg-esc{ background:var(--well); border:1px solid var(--hairline); border-radius:10px; padding:12px; display:flex; flex-direction:column; gap:8px; }
.agg-esc code{ font-family:var(--font-num); font-size:11.5px; color:var(--p500); word-break:break-all; }
.agg-mkt-link{ color:var(--p400); font-size:12px; text-decoration:none; }
.agg-mkt-link:hover{ color:var(--p500); text-decoration:underline; }
