/* ==========================================================================
   SOVANIKA — Responsive overrides (desktop-first)
   Breakpoints (sovanika_design.md §30): 1199 / 991 / 767 / 479
   ========================================================================== */

/* Tablet / small laptop (≤1199) */
@media (max-width: 1199px) {
  :root {
    --gutter: 32px;
    --section-gap: 60px;
    --hero-gap: 48px;
    --title-gap: 20px;
    --footer-gap: 72px;
  }

  .logo {
    width: 160px;
  }

  .search {
    max-width: 300px;
  }

  .main-nav__list {
    gap: 22px;
  }

  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Best Seller / You May Also Like stay in rows of four (otherwise 3 + 3 + 2, or 3 + 1) */
  .product-grid--quad {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pdp__grid {
    gap: 24px;
  }

  .gallery {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 12px;
  }

  /* Narrower column: a square image keeps it as tall as the details beside it */
  .gallery__main {
    aspect-ratio: 1;
  }

  .marketplaces {
    gap: 8px;
  }

  .benefit {
    font-size: 12px;
  }

  .site-footer__main {
    padding: 56px 32px 120px;
  }

}

/* Tablet (≤991): compact header + drawer, stacked hero copy */
@media (max-width: 991px) {
  /* 4-product rows (Best Seller, You May Also Like): 2 + 2, never 3 + 1 */
  .product-grid--quad {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Page banners: the text is wider than the shade, so the shade reaches further */
  .page-hero::before {
    background: linear-gradient(90deg, rgba(22, 14, 8, 0.86) 0%, rgba(22, 14, 8, 0.7) 60%, rgba(22, 14, 8, 0.4) 100%);
  }

  /* Product gallery on tablets (touch): taller up / down arrows, easier to tap */
  .gallery__rail.has-arrows {
    grid-template-rows: 34px minmax(0, 1fr) 34px;
  }

  .site-header__top {
    grid-template-columns: 1fr auto 1fr;
    padding-block: 10px;
  }

  .site-header .site-header__menu-btn,
  .site-header .site-header__search-toggle {
    display: inline-flex;
  }

  .site-header__menu-btn {
    justify-self: start;
    margin-left: -8px;
  }

  .site-header__top > .search,
  .main-nav {
    display: none;
  }

  .site-header__actions {
    display: flex;
    gap: 6px;
  }

  .logo {
    width: 170px;
  }

  .categories__grid {
    gap: 22px 14px;
  }

  /* Shop: the sidebar becomes a slide-in drawer behind a "Filters" button */
  .shop {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Bottom sheet: slides up over a backdrop; only here does the panel scroll on its own */
  .filters {
    position: fixed;
    inset: auto 0 0;
    z-index: var(--z-overlay);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    margin-inline: auto;
    padding: 0 20px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 14px 14px 0 0;
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 300ms ease, visibility 0s linear 300ms;
  }

  .filters::-webkit-scrollbar {
    width: 6px;
  }

  .filters::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: #D9D9D9;
  }

  .filters__head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding-top: 22px;
    background: var(--color-white);
  }

  /* Grab handle */
  .filters__head::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #DDDDDD;
    transform: translateX(-50%);
  }

  .filters.is-open {
    transform: none;
    visibility: visible;
    transition: transform 300ms ease;
  }

  .filters .filters__close {
    display: inline-flex;
    margin-left: auto;
  }

  .filters__head {
    align-items: center;
    gap: 16px;
  }

  .shop .shop__filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid #DDDDDD;
    border-radius: var(--radius-control);
    background: var(--color-white);
    font-size: 14px;
  }

  .shop__filter-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-pill);
    background: var(--color-black);
    color: var(--color-white);
    font-size: 11px;
    line-height: 20px;
  }

  .product-slider__track {
    grid-auto-columns: calc((100% - 2 * 18px) / 3);
    gap: 18px;
  }

  .featured__item {
    height: 400px;
  }

  .featured__content {
    padding: 0 28px 30px;
  }

  /* Footer stacks: links, then the photo */
  .site-footer__split {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .site-footer__main {
    min-height: 560px;
    padding-bottom: 150px;
  }

  .site-footer__watermark {
    left: 32px;
    width: calc(100% - 64px);
  }

  .site-footer__media {
    aspect-ratio: 16 / 9;
  }
}

/* Product page stacks below 1024 (≤1023): gallery, then information */
@media (max-width: 1023px) {
  .pdp__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  /* Square photos: keep the gallery a sensible size once it is full width */
  .gallery {
    width: 100%;
    max-width: 640px;
    margin-inline: auto;
  }
}

/* Size guide */
@media (max-width: 1199px) {
  .sg-row {
    gap: 36px;
  }

  .sg-how {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 20px;
  }

  .sg-tips__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991px) {
  .sg-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
}

@media (max-width: 767px) {
  .page-bar {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .sg-panel__head {
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

  .sg-steps--cards {
    gap: 8px;
  }

  .sg-step__text {
    font-size: 12.5px;
  }

  .sg-how {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 16px;
  }

  .sg-chart-head {
    flex-direction: column;
    gap: 0;
  }

  .sg-tabs {
    margin: 0 0 14px;
  }

  .sg-tips__list {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .sg-table th,
  .sg-table td {
    padding: 11px 12px;
  }

  .sg-table {
    font-size: 13px;
  }
}

/* Jewellery care */
@media (max-width: 1199px) {
  .care-avoid__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .care-split,
  .care-split--even {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767px) {
  .care-promises {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .care-promise {
    padding: 20px 12px;
  }

  .care-rule {
    grid-template-columns: minmax(0, 1fr);
  }

  .care-rule__image {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .care-rule__text {
    padding: 20px 0 0;
  }

  .care-avoid__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 12px;
  }

  .care-card__title {
    font-size: 16px;
  }

  .care-card__text {
    font-size: 12.5px;
  }

  .care-store,
  .care-dos {
    grid-template-columns: minmax(0, 1fr);
  }

  .care-note--blush {
    padding: 22px 18px;
  }
}

/* Contact page */
@media (max-width: 991px) {
  .contact__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .contact__image {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 767px) {
  .contact-form__row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* FAQs */
@media (max-width: 991px) {
  .faqs__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  /* Help box moves below the questions */
  .faqs__aside {
    position: static;
    order: 2;
    padding: 28px 0 0;
    border-top: 1px solid var(--color-line);
  }
}

@media (max-width: 767px) {
  .faq__question {
    gap: 16px;
    padding-block: 18px;
    font-size: 17px;
  }

  .faq__toggle {
    width: 28px;
    height: 28px;
  }

  .faq__answer {
    padding-right: 0;
    font-size: 14.5px;
  }
}

/* Categories page */
@media (max-width: 991px) {
  .categories-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px 14px;
  }
}

@media (max-width: 767px) {
  .categories-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 10px;
  }
}

/* Mobile (≤767) */
@media (max-width: 767px) {
  :root {
    --gutter: 16px;
    --section-gap: 44px;
    --hero-gap: 36px;
    --title-gap: 16px;
    --footer-gap: 56px;
  }

  .logo {
    width: 136px;
  }

  .site-footer__logo {
    width: 160px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .icon-btn .icon {
    width: 23px;
    height: 23px;
  }

  .section-title {
    font-size: 26px;
  }

  /* Categories: 3 + 3 on phones, then "View All Categories" */
  .categories__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 10px;
  }

  .categories__grid > li:nth-child(n + 7) {
    display: none;
  }

  /* Phones: the banner grows with its text, and the shade covers the whole width */
  .page-hero {
    height: auto;
    min-height: 160px;
    padding-block: 28px;
  }

  .page-hero::before {
    background: rgba(22, 14, 8, 0.66);
  }

  .page-hero__kicker {
    font-size: 10.5px;
    letter-spacing: 0.26em;
  }

  .page-hero__text {
    font-size: 14px;
  }

  .shop {
    padding-top: 24px;
  }

  .shop__toolbar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .shop__count {
    flex-basis: 100%;
    font-size: 14px;
  }

  .category-page__count {
    font-size: 19px;
  }

  .sort {
    flex: 1;
    justify-content: flex-end;
  }

  .sort__label {
    display: none;
  }

  .sort__select {
    width: 100%;
    min-width: 0;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 12px;
  }

  /* Thumbnails move under the main image */
  .gallery {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Phones: thumbnails in one row under the photo, swipe for more (no arrows) */
  .gallery__rail,
  .gallery__rail.has-arrows {
    grid-row: 2;
    grid-template-rows: auto;
    contain: none;
  }

  .gallery__rail.has-arrows .gallery__arrow {
    display: none;
  }

  .gallery__thumbs {
    grid-template-rows: none;
    grid-auto-rows: auto;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 24px) / 4);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    gap: 8px;
  }

  .lightbox__nav {
    width: 44px;
    height: 44px;
  }

  .lightbox__nav--prev {
    left: 8px;
  }

  .lightbox__nav--next {
    right: 8px;
  }

  .gallery__thumb {
    height: auto;
    aspect-ratio: 1;
  }

  .gallery__main {
    aspect-ratio: 1;
  }

  .pdp__title {
    font-size: 26px;
  }

  .pdp__current-price {
    font-size: 22px;
  }

  .marketplaces {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Phones: highlights two by two, dividers only between the two columns */
  .pdp__benefits {
    flex-wrap: wrap;
    row-gap: 20px;
  }

  .pdp__benefits .benefit {
    flex: 0 0 50%;
    flex-direction: column;
  }

  .pdp__benefits .benefit + .benefit {
    border-left: 0;
  }

  .pdp__benefits .benefit:nth-child(2n) {
    border-left: 1px solid var(--color-line);
  }

  .benefit {
    flex-direction: row;
    align-items: center;
  }

  .pdp-desc__benefits {
    flex-direction: column;
    gap: 16px;
  }

  .category-tile__name {
    margin-top: 8px;
    font-size: 13.5px;
  }

  /* Text panel moves under the image instead of overlapping it */

  /* Campaigns stack on phones (§30) */
  .featured__grid {
    grid-template-columns: 1fr;
  }

  .featured__item {
    height: 340px;
  }

  /* Two cards per view on phones */
  .product-slider__track {
    grid-auto-columns: calc((100% - 12px) / 2);
    gap: 12px;
  }

  .product-slider__arrow {
    top: 38%;
  }

  .product-card__media {
    aspect-ratio: 1;
  }

  .product-card__rating {
    gap: 4px;
    margin-top: 10px;
    font-size: 11px;
  }

  .stars {
    font-size: 11px;
  }

  /* Phones: up to two lines, so names aren't cut short ("Diamond Studded Ring - 18...") */
  .product-card__name {
    display: -webkit-box;
    min-height: calc(2 * 1.4em);
    font-size: 12.5px;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .product-card__price {
    flex-wrap: wrap;
    gap: 2px 8px;
  }

  .product-card__current-price {
    font-size: 15px;
  }

  .product-card__old-price {
    font-size: 12px;
  }

  .product-card__tag {
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    font-size: 10px;
  }

  /* Phones: the whole card is the link, so no separate "View Product" */
  .product-card__cta {
    display: none;
  }

  .site-footer__main {
    min-height: 0;
    padding: 48px 20px 120px;
  }

  .site-footer__columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 40px 16px;
    margin-top: 44px;
  }

  .site-footer__links {
    font-size: 14px;
  }

  .site-footer__watermark {
    left: 16px;
    width: calc(100% - 32px);
  }

  .site-footer__media {
    aspect-ratio: 4 / 3;
  }
}

/* Small phones (≤479) */
@media (max-width: 479px) {

}

/* Our Story: photo above text on tablets and phones */
@media (max-width: 991px) {
  .story__chapter {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .story__chapter--reverse .story__image {
    order: 0;
  }
}

@media (max-width: 767px) {
  .story__cta {
    padding: 40px 18px;
  }
}

/* Header search suggestions on small screens */
@media (max-width: 767px) {
  .search-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-panel__section {
    padding-inline: 16px;
  }

  .search-item {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 12px;
    padding-inline: 16px;
  }

  .search-item__img {
    width: 48px;
    height: 48px;
  }

  .search-panel__section--flush .search-panel__title {
    padding-inline: 16px;
  }

  .search-link {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .search-panel__all {
    margin-inline: 16px;
  }
}

/* Jewellery Care "How To Clean" on phones: one step per row (photo left, words right)
   instead of three narrow columns */
@media (max-width: 575px) {
  .care-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .care-steps .sg-step {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 14px;
    align-items: start;
  }

  .care-steps .sg-step__media {
    grid-row: 1 / span 2;
  }

  .care-steps .care-step__image {
    aspect-ratio: 1;
  }

  .care-steps .care-step__title {
    margin-top: 0;
  }

  .care-steps .sg-step__text {
    font-size: 13.5px;
  }
}

@media (max-width: 575px) {
  .not-found {
    padding-top: 56px;
  }

  .not-found__actions .btn {
    flex: 1 1 140px;
  }
}

/* Home hero: tablets and phones - photo on top, text below on the same night black
   ========================================================================== */
@media (max-width: 991px) {
  .hero {
    height: auto;
  }

  .hero__slide {
    display: flex;
    flex-direction: column;
  }

  .hero__image {
    position: static;
    flex-shrink: 0;
    height: 380px;
    object-position: 74% 20% !important;
  }

  .hero__slide::before {
    display: none;
  }

  /* Dots under the text */
  .hero__dots {
    bottom: 18px;
  }

  .hero__inner {
    padding-bottom: 56px !important;
  }

  .hero__inner {
    padding-block: 32px 44px;
  }
}

@media (max-width: 767px) {
  .hero__image {
    height: 340px;
    object-position: 78% 20% !important;
  }

  .hero__inner {
    padding-block: 28px 36px;
  }

  .hero__title {
    font-size: 36px;
  }

  .hero__lead {
    margin-top: 10px;
    font-size: 16px;
  }

  .hero__link {
    margin-top: 24px;
    font-size: 11.5px;
    letter-spacing: 0.22em;
  }
}

/* Essentials: tablets and phones
   ========================================================================== */
@media (max-width: 991px) {
  .essentials__grid {
    gap: 18px;
  }

  .essential__title {
    font-size: 21px;
  }
}

@media (max-width: 767px) {
  .essentials__grid {
    gap: 12px;
  }

  .essential__media {
    aspect-ratio: 4 / 5;
  }

  .essential__title {
    margin-top: 10px;
    font-size: 17px;
  }

  .essential__cta {
    margin-top: 6px;
    font-size: 11px;
    letter-spacing: 0.05em;
  }
}

/* Product details: two columns on tablets, one on phones */
@media (max-width: 991px) {
  .pdp-specs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 32px;
  }
}

@media (max-width: 575px) {
  .pdp-specs {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Product information sections on phones */
@media (max-width: 767px) {
  .pdp-acc__head {
    padding-block: 16px;
    font-size: 18px;
  }

  .pdp-prose {
    font-size: 14px;
  }
}

/* Marketplace rows on small phones: logo above "Shop now" */
@media (max-width: 479px) {
  .marketplace {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    height: 70px;
    padding: 0 14px;
  }
}
