/* =========================================================
   THUMBNAILER — Asset Store (mockup)
   Builds on the site's branding tokens from ../styles.css
   ========================================================= */

/* ---------- Nav: cart button ---------- */
.cart-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-2); color: var(--text);
  cursor: pointer; transition: background .2s ease, transform .15s ease;
}
.cart-btn:hover { background: rgba(255,255,255,0.1); }
.cart-btn:active { transform: scale(0.95); }
.cart-btn__count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #04282b;
  font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.cart-btn__count.is-empty { display: none; }

/* ---------- Hero / filters ---------- */
.store-hero { padding-top: clamp(140px, 16vw, 190px); padding-bottom: clamp(20px, 4vw, 36px); }
/* overflow visible so the filter dropdown menus aren't clipped */
.store-products { overflow: visible; padding-top: clamp(16px, 3vw, 26px); }

.store-filters {
  position: relative; z-index: 4; display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center; margin: 0 0 20px;
}
.dropdown { position: relative; }
.dropdown__btn {
  display: inline-flex; align-items: center; gap: 10px; min-width: 190px;
  font-size: 0.92rem; font-weight: 500; color: var(--text);
  padding: 11px 16px; border-radius: 12px; border: 1px solid var(--border-2);
  background: rgba(255,255,255,0.04); cursor: pointer; transition: border-color .18s ease, background .18s ease;
}
.dropdown__btn:hover { background: rgba(255,255,255,0.07); }
.dropdown.is-open .dropdown__btn { border-color: rgba(var(--accent-rgb), 0.55); background: rgba(255,255,255,0.07); }
.dropdown__label { font-size: 0.7rem; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted-2); }
.dropdown__value { margin-left: 2px; }
.dropdown__chev { margin-left: auto; color: var(--muted); transition: transform .2s ease; }
.dropdown.is-open .dropdown__chev { transform: rotate(180deg); }
.dropdown__menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 100%; z-index: 30;
  max-height: 300px; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  background: rgba(12,16,24,0.98); border: 1px solid var(--border-2); border-radius: 14px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.9);
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.dropdown.is-open .dropdown__menu { opacity: 1; visibility: visible; transform: none; }
.dropdown__opt {
  text-align: left; font-size: 0.9rem; color: var(--muted); white-space: nowrap;
  padding: 9px 14px; border-radius: 9px; background: none; border: none; cursor: pointer; transition: .12s ease;
}
.dropdown__opt:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.dropdown__opt.is-active { color: #04282b; font-weight: 600; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

/* ---------- Search ---------- */
.store-search {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-width: 240px;
  padding: 0 12px; border-radius: 12px; border: 1px solid var(--border-2); background: rgba(255,255,255,0.04);
  transition: border-color .18s ease, background .18s ease;
}
.store-search:focus-within { border-color: rgba(var(--accent-rgb), 0.55); background: rgba(255,255,255,0.07); }
.store-search__icon { color: var(--muted); flex: 0 0 auto; }
.store-search__input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  font-family: inherit; font-size: 0.92rem; color: var(--text); padding: 11px 0;
}
.store-search__input::placeholder { color: var(--muted-2); }
.store-search__input::-webkit-search-decoration,
.store-search__input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.store-search__clear { flex: 0 0 auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.25rem; line-height: 1; padding: 2px 4px; }
.store-search__clear:hover { color: var(--text); }

/* anchor the glow around the filters / start of the grid (not up in the hero) */
.store-products .glow--hero { top: 96px; width: 1200px; height: 720px; }

/* ---------- Product grid ---------- */
.store-grid {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
@media (max-width: 900px) { .store-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .store-grid { grid-template-columns: 1fr; } }
.store-empty { text-align: center; color: var(--muted); margin-top: 30px; }
.store-count { color: var(--muted); font-size: 0.85rem; margin: 0 0 16px; padding-left: 2px; }

.product-card {
  display: flex; flex-direction: column; text-align: left; cursor: pointer;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--card-shadow);
  transition: transform .2s ease, border-color .2s ease;
}
.product-card:hover { transform: translateY(-5px); border-color: var(--border-2); }
.product-card:hover .product-card__preview img,
.product-card:hover .ph-preview__icon { transform: scale(1.05); }

.product-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.product-card__name { font-weight: 500; font-size: 1.04rem; line-height: 1.3; }
.product-card__foot { margin-top: auto; padding-top: 4px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.product-card__price { font-weight: 600; font-size: 1.05rem; }
.product-card__price .cur { color: var(--muted); font-weight: 500; font-size: 0.8rem; margin-right: 1px; }

/* tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-sm {
  font-size: 0.68rem; font-weight: 500; color: var(--muted);
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border-2);
  background: rgba(255,255,255,0.03);
}
.tag-sm.tag-type {
  color: var(--accent); font-weight: 600;
  border-color: rgba(var(--accent-rgb), 0.4); background: rgba(var(--accent-rgb), 0.08);
}

/* add-to-cart button */
.btn-add {
  font-size: 0.82rem; font-weight: 600; white-space: nowrap;
  padding: 8px 15px; border-radius: 999px; cursor: pointer;
  color: var(--accent); border: 1px solid rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--accent-rgb), 0.08); transition: .18s ease;
}
.btn-add:hover { background: rgba(var(--accent-rgb), 0.18); }
.btn-add.in-cart { color: #04282b; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

/* ---------- Preview placeholder ---------- */
.product-card__preview, .modal__media { position: relative; overflow: hidden; }
.product-card__preview { aspect-ratio: 16 / 10; }
.ph-preview { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ph-preview::after {            /* subtle dot grid texture */
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 16px 16px;
}
.ph-preview__icon { position: relative; z-index: 1; width: 38%; max-width: 120px; color: rgba(255,255,255,0.85); transition: transform .35s ease; filter: drop-shadow(0 6px 18px rgba(0,0,0,0.4)); }
.ph-preview__cat {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  font-size: 0.68rem; font-weight: 600; letter-spacing: .2px; color: #fff;
  padding: 4px 11px; border-radius: 999px; background: rgba(5,7,10,0.5);
  border: 1px solid rgba(255,255,255,0.16); backdrop-filter: blur(6px);
}
.product-card__preview img, .modal__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.ph-preview__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.ph-preview--img::after { opacity: .25; }   /* lighter dot texture over real photos */

/* type gradients (drive the preview tile per asset type) */
.cat-characters   { background: linear-gradient(135deg, #402617, #1c1410); }
.cat-templates    { background: linear-gradient(135deg, #3a1633, #190d16); }
.cat-particles    { background: linear-gradient(135deg, #0e3a44, #0a1822); }
.cat-backgrounds  { background: linear-gradient(135deg, #241a46, #0e0a1e); }
.cat-text         { background: linear-gradient(135deg, #103a26, #0a1a12); }
.cat-layer-styles { background: linear-gradient(135deg, #13284a, #0b1426); }
.cat-misc         { background: linear-gradient(135deg, #262a38, #12151d); }
.cat-overlays     { background: linear-gradient(135deg, #103a3a, #0a1a1a); }
.cat-banners      { background: linear-gradient(135deg, #3a2a10, #1a1208); }
.cat-characters   .ph-preview__icon { color: #ffb074; }
.cat-templates    .ph-preview__icon { color: #ff86d3; }
.cat-particles    .ph-preview__icon { color: #6ff3ff; }
.cat-backgrounds  .ph-preview__icon { color: #b48bff; }
.cat-text         .ph-preview__icon { color: #6ff0a8; }
.cat-layer-styles .ph-preview__icon { color: #7ab0ff; }
.cat-misc         .ph-preview__icon { color: #a9b8d4; }
.cat-overlays     .ph-preview__icon { color: #5fe0d0; }
.cat-banners      .ph-preview__icon { color: #ffcf6b; }

/* ---------- Modal slideshow / gallery ---------- */
.gallery { position: absolute; inset: 0; }
.gallery__viewport { position: absolute; inset: 0; }
.gallery__slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .35s ease; }
.gallery__slide.is-active { opacity: 1; visibility: visible; }
.gallery__slide .ph-preview { position: absolute; }

.gallery__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(5,7,10,0.55); border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(6px); cursor: pointer; transition: background .18s ease, transform .15s ease;
}
.gallery__nav:hover { background: rgba(5,7,10,0.85); }
.gallery__nav:active { transform: translateY(-50%) scale(.92); }
.gallery__nav--prev { left: 12px; }
.gallery__nav--next { right: 12px; }

.gallery__dots {
  position: absolute; left: 0; right: 0; bottom: 12px; z-index: 3;
  display: flex; justify-content: center; gap: 7px;
}
.gallery__dot {
  width: 8px; height: 8px; border-radius: 50%; padding: 0; cursor: pointer;
  background: rgba(255,255,255,0.4); border: none; transition: background .18s ease, transform .18s ease;
}
.gallery__dot:hover { background: rgba(255,255,255,0.75); }
.gallery__dot.is-active { background: var(--accent); transform: scale(1.25); }

@media (max-width: 860px) {
  .gallery__nav { backdrop-filter: none; -webkit-backdrop-filter: none; width: 36px; height: 36px; }
}

/* ---------- Product modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 160; display: flex; align-items: center; justify-content: center;
  padding: 22px; background: rgba(2,5,9,0.62); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
}
.modal.is-open { opacity: 1; visibility: visible; }
.modal__panel {
  width: min(900px, 100%); max-height: 88vh; overflow: auto;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border-2); border-radius: var(--radius-lg);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,0.9);
  transform: translateY(18px) scale(.985); transition: transform .25s cubic-bezier(.2,.7,.2,1);
}
.modal.is-open .modal__panel { transform: none; }
.modal__close {
  position: absolute; top: 14px; right: 14px; z-index: 3; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem; line-height: 1;
  color: #fff; background: rgba(5,7,10,0.55); border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(6px); cursor: pointer;
}
.modal__close:hover { background: rgba(5,7,10,0.8); }
.modal__grid { display: grid; grid-template-columns: 1.05fr 1fr; }
.modal__media { aspect-ratio: 16 / 10; border-right: 1px solid var(--border); }
.modal__info { padding: clamp(22px, 3vw, 32px); display: flex; flex-direction: column; gap: 12px; }
.modal__name { font-weight: 500; font-size: clamp(1.4rem, 3vw, 1.9rem); line-height: 1.15; }
.modal__desc { color: var(--muted); font-size: 0.95rem; }
.modal__includes { display: flex; flex-direction: column; gap: 9px; margin: 4px 0 2px; }
.modal__includes li { position: relative; padding-left: 26px; font-size: 0.9rem; color: #d6dce6; }
.modal__includes li::before {
  content: ""; position: absolute; left: 0; top: 1px; width: 17px; height: 17px; border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb),0.3); background: rgba(var(--accent-rgb),0.14)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2330f8f8' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.modal__buy { margin-top: auto; padding-top: 8px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.modal__price { font-weight: 700; font-size: 1.8rem; margin-right: auto; }
.modal__price .cur { color: var(--muted); font-weight: 500; font-size: 1rem; }
.modal .btn-add { font-size: 0.92rem; padding: 12px 22px; }

@media (max-width: 680px) {
  .modal__grid { grid-template-columns: 1fr; }
  .modal__media { border-right: none; border-bottom: 1px solid var(--border); }
  .modal__buy { flex-direction: column; align-items: stretch; }
  .modal__price { margin: 0 0 4px; }
  .modal .btn-add, .modal__buy .btn { width: 100%; justify-content: center; }
}

/* ---------- Cart drawer ---------- */
.cart {
  position: fixed; top: 0; right: 0; height: 100%; width: min(410px, 100%); z-index: 150;
  display: flex; flex-direction: column; background: var(--bg-2); border-left: 1px solid var(--border-2);
  box-shadow: -30px 0 80px -30px rgba(0,0,0,0.9);
  transform: translateX(105%); transition: transform .32s cubic-bezier(.2,.7,.2,1);
}
.cart.is-open { transform: none; }
.cart__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.cart__title { font-weight: 500; font-size: 1.2rem; }
.cart__close { width: 36px; height: 36px; border-radius: 10px; font-size: 1.5rem; color: var(--muted); background: rgba(255,255,255,0.04); border: 1px solid var(--border-2); cursor: pointer; }
.cart__close:hover { color: var(--text); }
.cart__items { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.cart__empty { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 0.92rem; }

.cart-item { display: flex; gap: 12px; align-items: center; }
.cart-item__preview { width: 74px; height: 46px; border-radius: 9px; overflow: hidden; flex: 0 0 auto; position: relative; }
.cart-item__preview .ph-preview__icon { width: 40%; }
.cart-item__preview .ph-preview::after { display: none; }
.cart-item__body { flex: 1; min-width: 0; }
.cart-item__name { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item__cat { font-size: 0.74rem; color: var(--muted); }
.cart-item__price { font-weight: 600; font-size: 0.92rem; }
.cart-item__remove { background: none; border: none; color: var(--muted-2); cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 4px; }
.cart-item__remove:hover { color: var(--red); }

.cart__foot { border-top: 1px solid var(--border); padding: 18px 20px 22px; }
.cart__row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; font-size: 0.95rem; }
.cart__row #cartSubtotal { font-weight: 700; font-size: 1.3rem; }
.cart__note { text-align: center; color: var(--muted-2); font-size: 0.74rem; margin-top: 12px; }

/* ---------- Scrim (behind cart) ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 140; background: rgba(2,5,9,0.6); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
}
.scrim.is-open { opacity: 1; visibility: visible; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; z-index: 300; max-width: 90vw;
  transform: translateX(-50%) translateY(22px); opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--border-2);
  color: var(--text); font-size: 0.9rem; padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.9); transition: opacity .3s ease, transform .3s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Lock scroll when an overlay is open ---------- */
body.no-scroll { overflow: hidden; }

/* mobile: full-width stacked dropdowns */
@media (max-width: 560px) {
  .store-filters { gap: 10px; }
  .dropdown { flex: 1 1 100%; }
  .dropdown__btn { width: 100%; min-width: 0; }
  .dropdown__menu { min-width: 100%; }
  .store-search { flex: 1 1 100%; min-width: 0; }
}

/* nav layout tweaks for the cart button on mobile */
@media (max-width: 860px) {
  .store-page .cart-btn { margin-left: auto; }
  .store-page .nav__burger { margin-left: 8px; }
  /* perf: drop backdrop blur on the many preview chips */
  .ph-preview__cat { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
