/* ============================================================
   Paviaco — mobile enhancement layer
   Loaded after styles.css. Everything here is scoped to small
   screens or touch input, so desktop is untouched.
   ============================================================ */

/* ---------- base mobile polish ---------- */

@media (max-width: 860px) {

  html { -webkit-tap-highlight-color: transparent; }

  body { font-size: 15px; }

  .wrap { padding: 0 18px; }

  /* header becomes a slim app bar; navigation moves to the tab bar */
  .header-inner { height: 56px; gap: 12px; }
  .site-header { border-bottom: 1px solid var(--line); }
  .brand { font-size: 1.15rem; letter-spacing: 0.12em; }
  .nav { display: none !important; }
  .nav-toggle { display: none !important; }
  .tools { margin-left: auto; gap: 10px; }
  .currency { padding: 6px 7px; font-size: 0.72rem; }
  .cart-link { font-size: 0.78rem; border-bottom: 0; padding: 8px 10px; }
  .cart-count { line-height: 16px; min-width: 16px; font-size: 0.66rem; }

  .announce { font-size: 0.68rem; padding: 7px 12px; letter-spacing: 0.03em; }

  /* hero: full-bleed image, tighter copy */
  .hero { grid-template-columns: 1fr; }
  .hero-media { min-height: 0; aspect-ratio: 4 / 3; }
  .hero-copy { padding: 28px 18px 34px; }
  .hero-copy h1 { font-size: clamp(1.9rem, 8vw, 2.5rem); }
  .hero-copy p { font-size: 0.92rem; max-width: none; }

  .section { padding: 40px 0; }
  .section--tight { padding: 28px 0; }
  .section-head { margin-bottom: 20px; align-items: baseline; }
  .section-head h2 { font-size: 1.35rem; }

  /* categories stack tighter */
  .categories { grid-template-columns: 1fr; gap: 12px; }
  .cat-card__media { aspect-ratio: 16 / 9; }
  .cat-card__media svg { width: 44%; height: 76%; }
  .cat-card__body { padding: 14px 16px; }
  .cat-card__body h3 { font-size: 1.1rem; }

  /* product cards: taller image, roomier text */
  .grid { grid-template-columns: repeat(2, 1fr); gap: 18px 12px; }
  .card__media { aspect-ratio: 3 / 4; margin-bottom: 9px; }
  .card__name { font-size: 0.86rem; }
  .card__meta { font-size: 0.74rem; }
  .card__price { font-size: 0.86rem; }
  .badge { font-size: 0.58rem; padding: 4px 7px; top: 8px; left: 8px; }

  /* filters: chips scroll horizontally, sort sits below */
  .filters {
    position: sticky;
    top: 56px;
    z-index: 30;
    background: var(--bg);
    flex-wrap: nowrap;
    overflow: visible;
    padding: 12px 0 12px;
    margin-bottom: 18px;
    gap: 8px;
  }
  .chips-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    flex: 1 1 auto;
  }
  .chips-scroll::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; font-size: 0.78rem; padding: 8px 14px; min-height: 36px; }
  .filters__sort { margin-left: 0; flex: 0 0 auto; }
  .filters select { font-size: 0.76rem; padding: 8px 6px; max-width: 96px; }

  /* product page */
  .pdp { gap: 20px; }
  .pdp__media { aspect-ratio: 1 / 1; margin: 0 -18px; }
  .pdp h1 { font-size: 1.5rem; }
  .pdp__price { font-size: 1.2rem; margin: 2px 0 14px; }

  .option-row { margin-bottom: 18px; }
  .option-row__label { font-size: 0.7rem; margin-bottom: 8px; }
  .sizes { gap: 7px; }
  .size-btn {
    min-width: 54px;
    min-height: 46px;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .swatch { width: 34px; height: 34px; }

  .spec-list li { font-size: 0.82rem; padding: 10px 0; }
  .accordion summary { padding: 15px 0; font-size: 0.84rem; }

  /* cart */
  .cart-layout { gap: 18px; }
  .cart-line { grid-template-columns: 68px 1fr; gap: 12px; }
  .cart-line > div:last-child { grid-column: 2; text-align: left; margin-top: 6px; }
  .qty button { width: 38px; height: 38px; }
  .qty input { width: 40px; height: 38px; }
  .summary { position: static; padding: 20px; }

  /* prose pages */
  .prose h1 { font-size: 1.7rem; }
  .prose { font-size: 0.94rem; }

  /* newsletter stacks */
  .newsletter form { flex-direction: column; gap: 8px; max-width: none; }
  .newsletter .btn { width: 100%; }

  .values { padding: 28px 0; gap: 18px; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 22px; }
  .footer-bottom { flex-direction: column; gap: 6px; margin-top: 28px; }

  /* touch-friendly buttons */
  .btn { min-height: 46px; padding: 13px 20px; }

  /* toast sits above the tab bar */
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* ---------- app-style tab bar ---------- */

.tabbar {
  display: none;
}

@media (max-width: 860px) {
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 75;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .tabbar__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 9px 0 8px;
    min-height: 56px;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.15s ease;
  }

  .tabbar__item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.5; }

  .tabbar__item[aria-current="page"] { color: var(--ink); }
  .tabbar__item[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 2px;
    background: var(--ink);
  }

  .tabbar__badge {
    position: absolute;
    top: 4px;
    left: 50%;
    margin-left: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.6rem;
    line-height: 16px;
    text-align: center;
    letter-spacing: 0;
  }
  .tabbar__badge[hidden] { display: none; }

  body.has-tabbar { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
}

/* ---------- sticky add-to-cart (product page, mobile only) ---------- */

.atc-bar { display: none; }

@media (max-width: 860px) {
  .atc-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom));
    z-index: 74;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: rgba(250, 248, 245, 0.97);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }

  .atc-bar__price {
    font-size: 1rem;
    flex: 0 0 auto;
    line-height: 1.2;
  }
  .atc-bar__price small {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .atc-bar .btn { flex: 1 1 auto; min-height: 44px; }

  body.has-atc { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
  body.has-atc .toast { bottom: calc(140px + env(safe-area-inset-bottom)); }
}

/* ---------- standalone / installed app mode ---------- */

@media (display-mode: standalone) {
  .announce { display: none; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card__media svg, .card__media img { transition: none; }
}
