/*
  NextStep storefront layer
  Loaded last from snippets/_config.liquid. Everything lives in the theme's own
  `overrides` cascade layer, so it wins over main.css and section CSS without
  raising specificity. Remove the <link> in _config.liquid to revert to stock Bella.
*/
@layer reset, base, components, utilities, sections, snippets, overrides;

@layer overrides {
  :root {
    --ns-ink: #161616;
    --ns-paper: #faf8f4;
    --ns-stone: #f1ede6;
    --ns-line: #e4dfd5;
    --ns-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --ns-shadow-1: 0 1px 2px rgba(22, 22, 22, 0.06), 0 4px 12px rgba(22, 22, 22, 0.06);
    --ns-shadow-2: 0 2px 4px rgba(22, 22, 22, 0.06), 0 14px 32px rgba(22, 22, 22, 0.14);
  }

  /* Warm neutral canvas instead of the brand-tinted background */
  body {
    --color-background: var(--ns-paper);
    --color-surface: var(--ns-paper);
    background-color: var(--ns-paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  /* ---------- Accessibility helpers ---------- */
  .ns-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ns-skip-link {
    position: absolute;
    z-index: 1000;
    inset-block-start: 8px;
    inset-inline-start: 8px;
    padding: 12px 20px;
    transform: translateY(-200%);
    border-radius: 8px;
    background: var(--ns-ink);
    color: #fff;
    font-weight: 600;
  }

  .ns-skip-link:focus-visible {
    transform: translateY(0);
  }

  /* Two-tone ring (ink outline over a white halo) stays visible on light and dark backgrounds.
     tabindex="-1" elements (e.g. <main>, the skip-link target) are programmatic focus targets
     and must not get a ring or halo. */
  :where(a, button, input, select, textarea, summary, label[ui-slot="accordion-trigger"], [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 2px solid var(--ns-ink);
    outline-offset: 3px;
    box-shadow: 0 0 0 5px #fff;
  }

  [tabindex="-1"]:focus,
  [tabindex="-1"]:focus-visible {
    outline: none;
    box-shadow: none;
  }

  /* ---------- Typography ---------- */
  [ui-slot="head"] .heading {
    font-weight: 600;
    letter-spacing: -0.02em;
    text-wrap: balance;
  }

  /* Eyebrow labels only (the <p>/<span> above a heading). Direct children keep this off the
     reviews title, which reuses the .subheading class on an <h2>. Case is left to the theme's
     "text_transform_subheadings" setting (--text-subheading-transform). */
  [ui-slot="head"] > :is(p, span).subheading {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.08em;
  }

  [ui-slot="head"] .description {
    line-height: 1.6;
  }

  /* ---------- Announcement bar ---------- */
  [ui-section="announcement-bar"] .item {
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.04em;
  }

  /* ---------- Header ---------- */
  /* Border visibility stays under the theme's own border setting (data-bottom-border). */
  #youcan-section--navbar [ui-layout="navbar"][data-shadow="true"] {
    box-shadow: var(--ns-shadow-1);
  }

  /* ---------- Buttons ---------- */
  /* No transition/transform here: the theme animates buttons with `transition: all` and some
     buttons (card add-to-cart, gallery arrows) are positioned with their own transforms. */
  [ui-slot="button"] {
    font-weight: 600;
    letter-spacing: 0.01em;
  }

  [ui-slot="button"][data-mode="filled"] {
    box-shadow: 0 1px 2px rgba(22, 22, 22, 0.12);
  }

  /* ---------- Hero ---------- */
  [ui-section="slideshow"] [ui-slot="carousel"] [ui-slot="carousel-item"] .media {
    box-shadow: var(--ns-shadow-2);
  }

  /* Text block: bounded width and size so a slide's copy stays in its own area of the banner
     (about the left half on desktop) instead of running across the whole image. */
  [ui-section="slideshow"] [ui-slot="carousel"] [ui-slot="carousel-item"] .content {
    padding: clamp(20px, 4.5vw, 64px);
  }

  [ui-section="slideshow"] [ui-slot="carousel"] [ui-slot="carousel-item"] .content [ui-slot="head"] {
    max-width: min(100%, 30rem);
    row-gap: var(--spacing-8);
  }

  /* Tablets and up: copy stays in the left part of the banner (about half), phones keep the full width. */
  @media (min-width: 600px) {
    [ui-section="slideshow"] [ui-slot="carousel"] [ui-slot="carousel-item"] .content [ui-slot="head"] {
      max-width: min(52%, 30rem);
    }
  }

  @media (min-width: 1024px) {
    [ui-section="slideshow"] [ui-slot="carousel"] [ui-slot="carousel-item"] .content [ui-slot="head"] {
      max-width: min(46%, 30rem);
    }
  }

  [ui-section="slideshow"] [ui-slot="carousel"] [ui-slot="carousel-item"] .content [ui-slot="head"] .heading {
    /* Scales with the merchant's heading-scale setting like every other heading.
       Floor of 28px, ceiling of 52px; line-height leaves room for French accents. */
    font-size: calc(clamp(28px, 3.6vw, 52px) * var(--font-heading-scale));
    line-height: 1.25; /* the heading box clips overflow: keeps room for accents on capitals (É, À) */
    overflow-wrap: break-word;
    hyphens: auto;
  }

  [ui-section="slideshow"] [ui-slot="carousel"] [ui-slot="carousel-item"] .content [ui-slot="head"] .description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    max-width: 34ch;
    font-size: clamp(14px, 1.25vw, 17px);
    line-height: 1.5;
  }

  /* Compact call to action */
  [ui-section="slideshow"] [ui-slot="carousel"] [ui-slot="carousel-item"] .content .cta {
    margin-block-start: var(--spacing-16);
  }

  [ui-section="slideshow"] [ui-slot="carousel"] [ui-slot="carousel-item"] .content .cta[ui-slot="button"] {
    min-width: 0;
    padding-inline: var(--spacing-24);
  }

  @media (max-width: 769px) {
    [ui-section="slideshow"] [ui-slot="carousel"] {
      padding-inline: 16px;
    }
  }

  /* ---------- Product cards ---------- */
  [ui-block="product"] .media {
    background-color: var(--ns-stone);
    box-shadow: var(--ns-shadow-1);
    transition:
      transform 0.35s var(--ns-ease),
      box-shadow 0.35s var(--ns-ease);
  }

  [ui-block="product"] .content .title {
    font-weight: 500;
  }

  [ui-block="product"] .content .price {
    font-weight: 600;
  }

  [ui-block="product"] .content .price .compare-at-price {
    font-weight: 400;
    text-decoration: line-through;
  }

  @media (hover: hover) {
    [ui-block="product"]:hover .media {
      transform: translateY(-4px);
      box-shadow: var(--ns-shadow-2);
    }

    /* Replace the heavy dimming on hover with a gentle zoom */
    [ui-block="product"]:hover .media > a img {
      transform: scale(1.04);
      filter: brightness(0.97);
    }
  }

  /* ---------- Collection cards ---------- */
  [ui-block="collection"] .media,
  .items [ui-block="collection"] a.media {
    background-color: var(--ns-stone);
  }

  /* ---------- Product page ---------- */
  /* Carousel (mobile/tablet) and grid (desktop) galleries share the same backdrop. No drop
     shadow: .core is overflow:hidden and the carousel scrolls, so it would be clipped. */
  [ui-section="single-product"] .core .media[data-layout="carousel"] [ui-slot="carousel"].main-media,
  [ui-section="single-product"] .core .media[data-layout="grid"] .image {
    background-color: var(--ns-stone);
  }

  [ui-section="single-product"] [ui-block="title"] {
    letter-spacing: -0.01em;
  }

  [ui-section="single-product"] [ui-block="price"] .original-price {
    font-weight: 600;
  }

  [ui-section="single-product"] [ui-block="price"] .compare-at-price {
    text-decoration: line-through;
  }

  /* ---------- RTL (Arabic) ---------- */
  /* Letter-spacing breaks the connected shapes of Arabic script. Only affects dir="rtl";
     French (LTR) typography is untouched. */
  [dir="rtl"] :is(
      [ui-slot="head"] .heading,
      [ui-slot="head"] > :is(p, span).subheading,
      [ui-section="announcement-bar"] .item,
      [ui-section="announcement-bar"] .item .brand,
      [ui-section="page"] .social-title,
      [ui-slot="button"],
      [ui-section="single-product"] [ui-block="title"]
    ) {
    letter-spacing: normal;
  }

  /* ---------- Motion preferences ---------- */
  /* Essential loading feedback is intentionally left alone: the button spinner
     ([ui-slot="button"][data-loading]::before, `spin`) and the skeleton shimmer
     ([ui-slot="skeleton"]::before, `pulse`), both defined in main.css. Do NOT add a universal
     `animation-*` override here; only list specific decorative animations (see sub-links below).
     Note: carousel JS passes behavior:"smooth" explicitly, which CSS scroll-behavior cannot override. */
  @media (prefers-reduced-motion: reduce) {
    html,
    ui-carousel,
    [ui-slot="carousel"] {
      scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
      transition-duration: 0.01ms !important;
    }

    /* Sub-menu open/close keyframes end in their final state, so they can be near-instant. */
    [ui-layout="navbar"] .links .link .sub-links {
      animation-duration: 0.01ms !important;
    }

    [ui-block="product"]:hover .media {
      transform: none;
    }

    [ui-block="product"]:hover .media > a img {
      transform: none;
    }
  }
}
