/* ================================
   SHOP — Modern UI (clean)
   ================================ */

/* ---- CSS variables ---- */
:root{
  --bg0:#070A12;
  --bg1:#0B1020;
  --card: rgba(255,255,255,.06);
  --card2: rgba(255,255,255,.04);
  --stroke: rgba(255,255,255,.10);
  --stroke2: rgba(255,255,255,.08);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);

  --accent:#7C5CFF;
  --accent2:#41D1FF;

  --shadow: 0 18px 60px rgba(0,0,0,.55);
  --shadow2: 0 10px 30px rgba(0,0,0,.35);

  --radius: 18px;
  --radius2: 14px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }

body{
  margin:0;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(124,92,255,.20), transparent 60%),
    radial-gradient(900px 500px at 85% 0%, rgba(65,209,255,.16), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a{ color: inherit; }
img{ max-width: 100%; display:block; }

/* ---- layout ---- */
.container{
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.small{ font-size: 12px; }
.muted{ color: var(--muted); }

/* ---- header ---- */
.header{
  position: sticky;
  top: 0;
  z-index: 50;

  background: rgba(7,10,18,.55);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--stroke2);
}

.header__row{
  min-height: 66px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 18px;
}

.logo{
  text-decoration: none;
  font-weight: 900;
  letter-spacing: .18em;
}

.nav{
  display:flex;
  gap: 14px;
  align-items:center;
  flex-wrap: wrap;
}

.nav a{
  text-decoration: none;
  color: rgba(255,255,255,.82);
}
.nav a:hover{
  color: #fff;
}

.badge{
  display:inline-flex;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,.10);
  border: 1px solid var(--stroke2);
  font-size: 12px;
}

/* ---- hero ---- */
.hero{
  padding: 26px 0 10px;
}
.hero h1{
  margin: 0 0 10px;
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---- inputs & buttons ---- */
.input, .select{
  width:100%;
  padding: 12px 12px;
  border-radius: var(--radius2);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.05);
  color: var(--text);
  transition: transform .15s ease, border-color .2s ease, background .2s ease;
}
.input:focus, .select:focus{
  outline:none;
  border-color: rgba(124,92,255,.55);
  background: rgba(255,255,255,.07);
  transform: translateY(-1px);
}

.btn{
  border-radius: var(--radius2);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 10px 12px;
  cursor:pointer;
  transition: transform .15s ease, filter .2s ease, background .2s ease;
}
.btn:hover{ transform: translateY(-1px); filter: brightness(1.05); }
.btn:active{ transform: translateY(0); }

.btn--primary{
  border:none;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #0b1020;
  font-weight: 800;
  box-shadow: 0 14px 40px rgba(124,92,255,.25);
}
.btn:disabled{
  opacity: .55;
  cursor:not-allowed;
}

/* ---- toolbar / filters ---- */
.toolbar{
  position: sticky;
  top: 66px; /* под шапку */
  z-index: 20;
  padding: 12px 0;
  background: linear-gradient(180deg, rgba(7,10,18,.75), rgba(7,10,18,0));
  backdrop-filter: blur(10px);

  transition: transform .22s ease, opacity .22s ease;
  transform: translateY(0);
  opacity: 1;
}
.toolbar.is-hidden{
  transform: translateY(-14px);
  opacity: 0;
  pointer-events:none;
}

.filters{
  display:grid;
  grid-template-columns: 1.3fr .9fr .9fr .9fr;
  gap: 12px;
}
@media (max-width: 980px){
  .filters{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px){
  .filters{ grid-template-columns: 1fr; }
}

/* ---- grid ---- */
.grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 30px;
}
@media (max-width: 980px){ .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px){ .grid{ grid-template-columns: 1fr; } }

/* ---- cards / products ---- */
.card{
  background: var(--card);
  border: 1px solid var(--stroke2);
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
}

.card.product{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: var(--shadow);
  overflow:hidden;
  transform: translateZ(0);
  transition: transform .18s ease;
}
.card.product:hover{
  transform: translateY(-4px);
}

.product{
  padding: 14px;
}

.product__img{
  height: 180px;
  border-radius: 16px;
  display:flex;
  align-items:center;
  justify-content:center;
  color: rgba(255,255,255,.65);

  background:
    radial-gradient(260px 120px at 30% 20%, rgba(124,92,255,.25), transparent 70%),
    radial-gradient(220px 120px at 80% 30%, rgba(65,209,255,.18), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.06);
}

.product__title{
  display:inline-block;
  margin-top: 10px;
  margin-bottom: 8px;
  font-weight: 800;
  text-decoration:none;
  color: var(--text);
}
.product__title:hover{
  text-decoration: underline;
  color:#fff;
}

.price{
  font-weight: 800;
}

/* ---- footer ---- */
.footer{
  border-top: 1px solid var(--stroke2);
  padding: 20px 0;
  background: rgba(7,10,18,.35);
}

/* ================================
   Reveal animation (scroll)
   ================================ */
.reveal{
  opacity: 0;
  transform: translateY(16px) scale(.985);
  filter: blur(6px);
  transition: opacity .55s ease, transform .55s ease, filter .55s ease;
  will-change: opacity, transform;
}
.reveal--in{
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* ================================
   Skeleton loading
   ================================ */
.skeletonGrid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
}
@media (max-width: 980px){ .skeletonGrid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px){ .skeletonGrid{ grid-template-columns: 1fr; } }

.skel{
  border-radius: var(--radius);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.05);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.skel__img{
  height: 180px;
  margin: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.07);
}

.skel__line{
  height: 14px;
  margin: 10px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
}
.skel__line.w60{ width: 60%; }
.skel__line.w40{ width: 40%; }
.skel__line.w80{ width: 80%; }

.shimmer{
  position: relative;
  overflow:hidden;
}
.shimmer:before{
  content:"";
  position:absolute;
  inset:0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.10), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 100%{ transform: translateX(100%); } }

/* sentinel for infinite scroll */
#sentinel{ height: 1px; }

/* ================================
   Scroll-to-top button
   ================================ */
.toTop{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;

  border: 1px solid rgba(255,255,255,.10);
  background: rgba(12,18,36,.65);
  color: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);

  border-radius: 999px;
  padding: 12px 14px;
  display: inline-flex;
  gap: 10px;
  align-items: center;

  box-shadow: 0 18px 50px rgba(0,0,0,.45);

  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease, filter .2s ease;
}
.toTop:hover{ filter: brightness(1.05); }
.toTop:active{ transform: translateY(12px); }

.toTop.is-visible{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ================================
   Mobile responsiveness
   ================================ */

/* общие улучшения для тач-устройств */
@media (hover: none) and (pointer: coarse) {
  .card.product:hover { transform: none; }
  .btn:hover { transform: none; filter: none; }
}

/* планшеты и ниже */
@media (max-width: 980px){
  .container{ width: min(1120px, calc(100% - 24px)); }

  .header__row{
    gap: 12px;
  }

  .nav{
    gap: 10px;
  }
}

/* телефоны */
@media (max-width: 640px){
  .container{ width: calc(100% - 20px); }

  /* шапка: элементы в две строки, чтобы не сжимались */
  .header__row{
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 0;
  }

  .nav{
    width: 100%;
    justify-content: flex-start;
    gap: 10px 12px;
  }

  .nav a, .nav button{
    font-size: 14px;
  }

  /* hero */
  .hero{ padding: 18px 0 8px; }
  .hero h1{ font-size: 28px; }

  /* toolbar: липкость ниже, чтобы не закрывал шапку */
  .toolbar{
    top: 116px; /* примерно высота header в 2 строки */
    padding: 10px 0;
  }

  /* фильтры — в одну колонку, элементы крупнее */
  .filters{
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .input, .select{
    padding: 13px 12px;
    border-radius: 16px;
    font-size: 16px; /* важно для iOS: не будет зума при фокусе */
  }

  /* сетка карточек уже 1 колонка, делаем отступы и контент “пальцами” */
  .grid{
    gap: 14px;
    padding-bottom: 24px;
  }

  .product{
    padding: 12px;
  }

  .product__img{
    height: 170px;
    border-radius: 16px;
  }

  .product__title{
    font-size: 16px;
    line-height: 1.25;
  }

  .row{
    gap: 10px;
  }

  .btn{
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
  }

  /* кнопка наверх — чуть выше, чтобы не мешала */
  .toTop{
    right: 14px;
    bottom: 14px;
    padding: 12px 14px;
  }
}

/* очень маленькие экраны */
@media (max-width: 380px){
  .hero h1{ font-size: 24px; }
  .badge{ min-width: 20px; height: 20px; font-size: 11px; }
  .toolbar{ top: 122px; }
}
