/* ==========================================================================
   Fashion S.House — motion layer (CSS)

   Interaction states layered on top of the static design. styles.css stays
   free of transitions and transforms, so the base layout can be reasoned
   about — and re-derived from Figma — without touching this file.

   Load order matters: this file comes after styles.css in index.html.

   How it is organised
   Each interactive pill declares its own highlight/press recipe as custom
   properties, and one shared pair of rules applies them. That keeps the
   colours next to the section they belong to while the behaviour is defined
   once — including on touch screens, where a tap gets the same halo a hover
   gives on a pointer device.

   Covered so far
   - Header / 118 /  — the two hero calls to action
   - Layout / 229 /  — the three category "Үзэх" buttons
   - Product / 6 /   — the "Худалдан авах" / "Add to cart" buttons in all
                       three product carousels
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. The pill set, and its shared timing
   -------------------------------------------------------------------------- */

.hero__actions .button,
.category__actions .button,
.product-card .button {
  transition:
    background-color 160ms ease-out,
    box-shadow 160ms ease-out,
    transform 100ms ease-out;
  /* Suppress the browser's own tap flash so only our own states show. */
  -webkit-tap-highlight-color: transparent;
}

/* --------------------------------------------------------------------------
   2. Per-variant recipes
   -------------------------------------------------------------------------- */

/* Header / 118 / — solid white pill.
   Settles onto the off-white tint and gains a white halo. */
.hero__actions .button--white {
  --pill-hover-bg: var(--scheme-6-background);
  --pill-hover-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.18),
    0 6px 20px rgba(255, 255, 255, 0.28),
    inset 0 -2px 1px 0 var(--opacity-neutral-darkest-5);
  --pill-active-bg: #e4e4e4;
  --pill-active-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.18),
    0 6px 20px rgba(255, 255, 255, 0.28),
    inset 0 2px 5px 0 rgba(2, 4, 4, 0.22);
}

/* Header / 118 / — amaranth pill.
   One shade lighter, with a red halo of the same hue. */
.hero__actions .button--primary {
  --pill-hover-bg: #ef505c;
  --pill-hover-shadow:
    0 0 0 4px rgba(230, 57, 70, 0.25),
    0 6px 20px rgba(230, 57, 70, 0.42),
    var(--shadow-button-primary-inset);
  --pill-active-bg: #cf2f3c;
  --pill-active-shadow:
    0 0 0 4px rgba(230, 57, 70, 0.25),
    0 6px 20px rgba(230, 57, 70, 0.42),
    inset 0 2px 5px 0 rgba(2, 4, 4, 0.35);
}

/* Light pills on a dark colour scheme
   (category row, Эмэгтэй + Эрэгтэй product cards). */
.category__actions .button,
.product-card .button--light {
  --pill-hover-bg: rgba(255, 255, 255, 0.22);
  --pill-hover-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.12),
    0 6px 20px rgba(255, 255, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4),
    inset 0 -2px 1px 0 var(--opacity-neutral-darkest-5);
  --pill-active-bg: rgba(255, 255, 255, 0.14);
  --pill-active-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.12),
    0 6px 20px rgba(255, 255, 255, 0.22),
    inset 0 2px 5px 0 rgba(2, 4, 4, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

/* Dark pills on the light colour scheme (Хүүхдийн product cards).
   A white halo would be invisible on #fcebec, so the pill deepens and casts
   a soft dark halo instead. */
.product-card .button--dark {
  --pill-hover-bg: rgba(2, 4, 4, 0.1);
  --pill-hover-shadow:
    0 0 0 4px rgba(2, 4, 4, 0.05),
    0 6px 20px rgba(2, 4, 4, 0.16),
    inset 0 0 0 1px rgba(2, 4, 4, 0.18),
    inset 0 -2px 1px 0 var(--opacity-neutral-darkest-5);
  --pill-active-bg: rgba(2, 4, 4, 0.13);
  --pill-active-shadow:
    0 0 0 4px rgba(2, 4, 4, 0.05),
    0 6px 20px rgba(2, 4, 4, 0.16),
    inset 0 2px 5px 0 rgba(2, 4, 4, 0.25),
    inset 0 0 0 1px rgba(2, 4, 4, 0.14);
}

/* --------------------------------------------------------------------------
   3. Applying the recipes

   `:hover` is confined to devices that actually have a pointer, otherwise a
   tap leaves the hover state stuck on until the visitor taps elsewhere.
   Touch screens get the same look through `:active` instead, which is why
   the press recipe carries the halo as well as the pressed inset.
   -------------------------------------------------------------------------- */

@media (hover: hover) {
  .hero__actions .button:hover,
  .category__actions .button:hover,
  .product-card .button:hover {
    background-color: var(--pill-hover-bg);
    box-shadow: var(--pill-hover-shadow);
  }
}

.hero__actions .button:focus-visible,
.category__actions .button:focus-visible,
.product-card .button:focus-visible {
  background-color: var(--pill-hover-bg);
  box-shadow: var(--pill-hover-shadow);
}

.hero__actions .button:active,
.category__actions .button:active,
.product-card .button:active {
  transform: translateY(1px);
  background-color: var(--pill-active-bg);
  box-shadow: var(--pill-active-shadow);
}

/* --------------------------------------------------------------------------
   4. Carousel dots

   Figma had a flat 7-dot image, which only ever matched the 24 static cards
   it was drawn against. Products now come from the database, so the dots are
   built by `app/carousel.js` and the styling lives here rather than in
   styles.css — that layer stays a faithful, script-free copy of the design.

   `currentColor` does the theme work: the dots inherit `--section-text`, so
   they turn white on the dark sections and near-black on the pink one
   without a second rule.
   -------------------------------------------------------------------------- */

.slider-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  width: auto;          /* styles.css pins 104px for the old <img> */
  height: 8px;
}

.slider-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: currentColor;
  opacity: 0.3;
  cursor: pointer;
  transition: opacity 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.slider-dot[aria-current="true"] {
  opacity: 1;
  cursor: default;
}

@media (hover: hover) {
  .slider-dot:hover {
    opacity: 0.65;
  }

  .slider-dot[aria-current="true"]:hover {
    opacity: 1;
  }
}

/* A dead end should look like one. */
.slider-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

/* --------------------------------------------------------------------------
   5. Reduced motion: keep the state changes (they carry meaning) but drop the
   animation and the movement.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .hero__actions .button,
  .category__actions .button,
  .product-card .button,
  .slider-dot {
    transition: none;
  }

  .hero__actions .button:active,
  .category__actions .button:active,
  .product-card .button:active {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   6. Hero / 118 / — төрлийн цэс

   Товчнуудын халаа энд тохирохгүй: эдгээр нь текст холбоос. Доогуур
   зураас нь аль нь идэвхтэйг хэлнэ.
   -------------------------------------------------------------------------- */

.hero__kinds a {
  transition: border-color 160ms ease-out;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .hero__kinds a:hover {
    border-bottom-color: currentColor;
  }
}

.hero__kinds a:focus-visible {
  border-bottom-color: currentColor;
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .hero__kinds a {
    transition: none;
  }
}
