/* SAJNAARA JEWELLERY: responsive rules
   Desktop (1024px and wider) is the default styling in the other CSS files.
   This file adapts it for iPad (portrait), large phones and small phones. */

/* =========================================================
   Tablet and below (up to 1023px): iPad portrait, small laptops
   ========================================================= */

@media (max-width: 1023px) {

  /* Navigation becomes a slide-in panel */
  .nav-toggle { display: inline-grid; }
  .header-wa { display: none; }
  .nav-tier { border-top: 0; }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgba(42, 32, 24, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t);
  }
  .nav-overlay.is-open { opacity: 1; pointer-events: auto; }

  .main-nav {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    width: min(86vw, 360px);
    padding: 5rem 1.75rem 2rem;
    overflow-y: auto;
    background: var(--ivory);
    box-shadow: 18px 0 50px -24px rgba(60, 40, 15, 0.5);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform var(--t) var(--ease), visibility 0s linear var(--t);
  }
  .main-nav.is-open { transform: none; visibility: visible; transition: transform var(--t) var(--ease), visibility 0s; }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .main-nav a { padding: 1rem 0; border-bottom: 1px solid var(--line); font-size: 1.125rem; }
  .main-nav a::after { display: none; }
  .main-nav a[aria-current="page"] { color: var(--gold-deep); }
  .nav-close { display: inline-grid; position: absolute; top: 0.9rem; right: 0.9rem; }

  /* Homepage */
  .hero-inner { gap: 2rem; min-height: 0; }
  .hero-copy h1 { font-size: clamp(2.5rem, 6.2vw, 3.6rem); }
  .hero-lead { font-size: 1.0625rem; }
  .category-tile-name { font-size: 1.3rem; }
  .trust-item { flex-direction: column; gap: 0.75rem; }

  /* Homepage grids use 3 columns; Shop uses 2 readable columns on iPad portrait. */
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shop-results .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-grid--featured .product-card:nth-child(n+7) { display: none; }

  /* Shop: filters collapse behind a button */
  .shop-layout { grid-template-columns: 1fr; margin-top: 1.5rem; }
  .filter-toggle { display: inline-flex; }
  .filter-panel { display: none; position: static; }
  .filter-panel.is-open { display: block; }

  /* Footer */
  .footer-main { grid-template-columns: 1fr 1fr; gap: 2.5rem; padding-block: 3.5rem 2.5rem; }

  .cart-summary { position: static; }
}

/* =========================================================
   Narrow tablet (up to 900px): stack two-column layouts
   ========================================================= */

@media (max-width: 900px) {
  .product-detail { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .gallery-main { order: 1; }
  .gallery-thumbs { flex-direction: row; flex-wrap: wrap; order: 2; }
  .thumb { width: 72px; }

  .cart-layout,
  .two-col,
  .contact-grid,
  .policy-layout { grid-template-columns: 1fr; }
  .policy-nav { position: static; }
  .values-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   Mobile (up to 767px)
   ========================================================= */

@media (max-width: 767px) {
  :root { --section-y: 3.5rem; }

  .announce-bar { font-size: 0.8125rem; }

  .brand-name strong { font-size: 1.3rem; letter-spacing: 0.18em; }
  .brand-name small { letter-spacing: 0.4em; }
  .brand-logo { width: 46px; height: 46px; }

  /* Homepage */
  .hero-inner { grid-template-columns: 1fr; padding-block: 2.5rem 3.5rem; }
  .hero-copy h1 { max-width: none; font-size: clamp(2.4rem, 11vw, 3.2rem); }
  .hero-actions .btn { flex: 1 1 100%; }
  .hero-visual { width: min(80%, 340px); }

  .section-head { flex-direction: column; align-items: flex-start; }

  .category-grid {
    display: flex;
    gap: 1rem;
    margin-inline: calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }
  .category-tile { flex: 0 0 42vw; max-width: 200px; scroll-snap-align: start; }

  .trust-grid,
  .steps { grid-template-columns: 1fr; }
  .trust-item { flex-direction: row; }

  /* Products: 2 columns */
  .product-grid,
  .shop-results .product-grid { grid-template-columns: repeat(2, 1fr); gap: 1.75rem 0.85rem; }
  .product-card-title { font-size: 1.2rem; }
  .product-card-desc { font-size: 0.875rem; }
  .product-card .btn { padding-inline: 0.75rem; }

  /* Shop toolbar */
  .shop-toolbar { flex-direction: column; align-items: stretch; }
  .search-field { max-width: none; }
  .toolbar-controls { display: grid; grid-template-columns: 1fr auto; }
  .toolbar-controls select { min-width: 0; }
  .chip-row {
    flex-wrap: nowrap;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip { flex: none; }

  .form-grid { grid-template-columns: 1fr; }
  .spec-list { grid-template-columns: 1fr; gap: 0.15rem; }
  .spec-list dd { margin-bottom: 0.6rem; }

  /* Footer */
  .footer-main { grid-template-columns: 1fr; gap: 2rem; padding-block: 3rem 2rem; }
  .footer-bottom { flex-direction: column; align-items: center; gap: 0.4rem; text-align: center; }
}

/* =========================================================
   Small phones (up to 479px)
   ========================================================= */

@media (max-width: 479px) {
  .header-search { display: none; }
  .brand { gap: 0.6rem; }
  .brand-logo { width: 40px; height: 40px; font-size: 0.6875rem; }
  .brand-name strong { font-size: 1.15rem; letter-spacing: 0.14em; }
  .brand-name small { font-size: 0.625rem; letter-spacing: 0.34em; }

  .cart-line { grid-template-columns: 72px minmax(0, 1fr); }
  .cart-items .cart-line { grid-template-columns: 84px minmax(0, 1fr); }
  .cart-line-side { grid-column: 2; flex-direction: row; align-items: center; }

  .price-now { font-size: 1.05rem; }
  .buy-row .btn { flex-basis: 100%; }
}

/* =========================================================
   SHOP PAGE LAYOUT FIX
   Flexible filter/results layout and space-aware product cards.
   ========================================================= */

/* Filter box + products side by side (flexible, never a fixed 2-column grid) */
.shop-layout {
  display: flex;
  align-items: flex-start;
  gap: clamp(2rem, 4vw, 3.5rem);
  margin-top: 2rem;
}
.shop-layout > .filter-panel { flex: 0 0 260px; width: 260px; }
.shop-layout > .shop-results { flex: 1 1 0; min-width: 0; }

/* As many columns as fit, never narrower than about 190px */
.shop-results .product-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
}

/* Desktop filters use the panel's normal display. Do not override [hidden]:
   catalogue preview intentionally hides filters at every viewport width. */

/* iPad portrait and phones: filters open from the "Filters" button */
@media (max-width: 1023px) {
  .shop-layout { flex-direction: column; align-items: stretch; margin-top: 1.5rem; }
  .shop-layout > .filter-panel { flex: none; width: auto; }
}

/* Phones: two columns */
@media (max-width: 767px) {
  .shop-results .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Safety net: repeats the last rules of the earlier components.js addition,
   so nothing is missing if that paste was cut short. Safe to repeat. */
.section--tight { padding-block: clamp(2rem, 5vw, 3.5rem) var(--section-y); }
.product-info .btn-block + .btn-block { margin-top: 0.85rem; }
.product-ask { margin-top: 1rem; }
.cart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.cart-items + p { margin-top: 1.5rem; }
.cart-summary form h3 { margin-bottom: 1rem; }
.cart-summary .check { margin-top: 1rem; }
.cart-summary .notice { margin-top: 1rem; }
#cartNotice { margin-bottom: 1.5rem; }

/* "Saved items": heart icon in the header, and a menu item only on small phones */
.nav-saved { display: none; }
@media (max-width: 479px) {
  .header-saved { display: none; }
  .nav-saved { display: list-item; }
}

