/* ============================================================
   PAGES.CSS — Catalog, Product, Shared Components
   ============================================================ */

/* Focus-visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Disabled button */
.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

/* Cart badge animation */
@keyframes cartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.cart-badge.is-pop { animation: cartPop .3s var(--ease); }
.cart-badge.is-hidden { display: none; }

/* Toast */
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  z-index: 200;
  padding: 14px 28px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.toast.is-active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Active nav link override */
.nav__link.is-active {
  font-weight: 700;
  color: var(--ink);
}
.nav__link.is-active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 12px;
  right: 12px;
  height: 2px;
  background-color: var(--accent);
  border-radius: 2px;
  width: auto;
}

/* ==================== CATALOG ==================== */

.page-title-block {
  padding-top: 140px;
  margin-bottom: 32px;
}

.page-title-block .section-title {
  margin-bottom: 8px;
}

.catalog-count {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 15px;
  color: var(--muted);
}

/* Sticky filter bar */
.filter-bar {
  --nav-offset: 80px;
  view-transition-name: filter-bar;
  position: sticky;
  top: 16px;
  will-change: transform;
  transform: translateY(var(--nav-offset));
  transition: transform .45s cubic-bezier(.2, .8, .2, 1);
  z-index: 40;
  padding: 10px 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

/* Segmented control */
.seg-control {
  display: flex;
  position: relative;
  background: rgba(0,0,0,.04);
  border-radius: 999px;
  padding: 4px;
  flex-shrink: 0;
}

.seg-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-radius: 999px;
  background: #111;
  transition: transform .35s var(--ease), width .35s var(--ease), opacity .2s var(--ease);
  z-index: 0;
  pointer-events: none;
}
.seg-control.is-init .seg-thumb { transition: none; }

.seg-btn {
  position: relative;
  z-index: 1;
  padding: 0 17px;
  min-height: 40px;
  border: none;
  background: transparent;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  border-radius: 999px;
  transition: color .25s var(--ease);
  white-space: nowrap;
}

.seg-btn.is-active {
  color: #fff;
}

/* Filter selects */
.filter-select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 48px;
  padding: 0 40px 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23111' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.filter-select:focus { border-color: var(--ink); }

/* Catalog grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  transition: opacity .25s var(--ease);
}
.catalog-grid.is-fading { opacity: 0; }

@media (max-width: 1200px) {
  .catalog-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
  .catalog-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Empty state */
.catalog-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 80px 0;
  text-align: center;
}
.catalog-empty__title {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--ink);
  line-height: 1.2;
}

/* ==================== PRODUCT ==================== */

/* Breadcrumbs */
.breadcrumbs {
  padding-top: 120px;
  padding-bottom: 24px;
  list-style: none;
  display: flex;
  gap: 8px;
  align-items: center;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
}
.breadcrumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s var(--ease);
}
@media (hover: hover) {
  .breadcrumbs a:hover { color: var(--ink); }
}
.breadcrumbs__sep { opacity: .4; }
.breadcrumbs__current { color: var(--ink); }

/* Product layout */
.product-layout {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 56px;
  align-items: start;
  padding-bottom: 48px;
}

/* Gallery */
.gallery__main {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 36px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  transition: opacity .25s var(--ease);
}
.gallery__main.is-fading { opacity: 0; }

.gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.gallery__thumb {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s var(--ease), opacity .2s var(--ease);
  opacity: .7;
}
@media (hover: hover) {
  .gallery__thumb:hover { opacity: 1; }
}
.gallery__thumb.is-active {
  border-color: #111;
  opacity: 1;
}

.filter-bar:not(.is-stuck), .product-info:not(.is-stuck), html.nav-hidden .filter-bar, html.nav-hidden .product-info { --nav-offset: 0px; }

/* Product info */
.product-info {
  --nav-offset: 88px;
  position: sticky;
  top: 24px;
  transform: translateY(var(--nav-offset));
  transition: transform .45s cubic-bezier(.2, .8, .2, 1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.product-info__cat {
  align-self: flex-start;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
}

.product-info__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 3.4vw, 52px);
  line-height: 1.1;
  color: var(--ink);
  margin: 0;
}

.product-info__price {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 32px;
  color: var(--ink);
}

/* Product detail rows */
.product-details {
  display: flex;
  flex-direction: column;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.detail-row:first-child { border-top: 1px solid var(--line); }

.detail-label {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
}
.detail-value {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
}

/* Size selection */
.sizes-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sizes-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.sizes-label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.sizes-hint {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sizes-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.size-chip {
  min-width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
@media (hover: hover) {
  .size-chip:hover { border-color: var(--ink); }
}
.size-chip.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.sizes-error {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--accent);
  display: none;
}
.sizes-error.is-visible { display: block; }

/* Shake */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  15%,45%,75% { transform: translateX(-6px); }
  30%,60%,90% { transform: translateX(6px); }
}
.is-shaking { animation: shake .5s ease-in-out; }

/* Qty stepper */
.qty-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  align-self: flex-start;
}

.qty-btn {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s var(--ease);
}
@media (hover: hover) {
  .qty-btn:hover { background: var(--surface); }
}

.qty-val {
  width: 48px;
  text-align: center;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}

/* Add to cart row */
.add-cart-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn--full {
  width: 100%;
  min-height: 56px;
  font-size: 1rem;
}

/* Marketplace buttons row */
.market-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.market-label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
}

.market-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.market-btns .btn { min-height: 48px; font-size: 14px; padding: 0 20px; }

.product-note {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* Related section */
.related-section {
  padding-block: var(--section-pad);
}

/* Product not found */
.product-not-found {
  padding-top: 180px;
  padding-bottom: 120px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.product-not-found__title {
  font-family: var(--font-display);
  font-size: 38px;
  color: var(--ink);
  line-height: 1.2;
}

/* Mobile sticky bar */
.product-sticky-bar {
  display: none;
}

@media (max-width: 900px) {
  .product-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .product-info {
    position: static;
  }

  .product-sticky-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 16px;
    transform: translateY(100%);
    transition: transform .3s var(--ease);
  }
  .product-sticky-bar.is-visible {
    transform: translateY(0);
  }

  .sticky-price {
    font-family: var(--font-ui);
    font-weight: 800;
    font-size: 22px;
    color: var(--ink);
    white-space: nowrap;
  }

  .product-sticky-bar .btn { flex: 1; min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .is-shaking { animation: none !important; }
  .cart-badge.is-pop { animation: none !important; }
  .toast { transition: none !important; }
}
