/* The home page (16.11.2026, Angela): many products, tidy, a technical look.
   Loaded only by home.html; colours come from the tokens in shop.css (light and dark). */

.hx {
  --hx-glow: color-mix(in srgb, var(--blue) 22%, transparent);
  --hx-grid: color-mix(in srgb, var(--blue) 9%, transparent);
  display: grid;
  gap: 1.6rem;
  min-width: 0;
}

.hx > * {
  min-width: 0;
  margin: 0;
}

.hx .carousel {
  margin-top: 1rem;
}

/* Banners on a computer (17.11.2026, Angela): one big slider and two smaller banners on the
   right. Phones and tablets keep one slider with every banner (the side ones included). */
.hx-banners {
  min-width: 0;
}

.hx-side {
  display: none;
}

@media (min-width: 1000px) {
  .hx-banners.has-side {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1rem;
    margin-top: 1rem;
  }

  .hx-banners.has-side .carousel {
    margin: 0;
  }

  .hx-banners.has-side .slide[data-side],
  .hx-banners.has-side .dots [data-side] {
    display: none;
  }

  /* The dots sit on the banner, so the slider is exactly as tall as its picture. */
  .hx-banners.has-side .dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.75rem;
    margin: 0;
    pointer-events: none;
  }

  .hx-banners.has-side .dots button {
    pointer-events: auto;
    background: rgb(255 255 255 / 55%);
    box-shadow: 0 1px 4px rgb(0 0 0 / 30%);
  }

  .hx-banners.has-side .dots button[aria-current="true"] {
    background: #fff;
  }

  .hx-banners.has-side.single .carousel-btn,
  .hx-banners.has-side.single .dots {
    display: none;
  }

  .hx-side {
    display: grid;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    min-height: 0;
    contain: size; /* the slider sets the height; the side column follows it */
  }

  .hx-side-banner {
    position: relative;
    display: block;
    min-height: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  }

  .hx-side-banner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease);
  }

  a.hx-side-banner:hover,
  a.hx-side-banner:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgb(0 0 0 / 18%);
  }

  a.hx-side-banner:hover img {
    transform: scale(1.03);
  }

  a.hx-side-banner:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
  }
}

@media (min-width: 1000px) and (prefers-reduced-motion: reduce) {
  .hx-side-banner,
  .hx-side-banner img {
    transition: none;
  }

  a.hx-side-banner:hover,
  a.hx-side-banner:hover img {
    transform: none;
  }
}

/* Icons in a soft square ------------------------------------------------------------------- */
.hx-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--blue-soft), color-mix(in srgb, var(--blue) 18%, var(--surface)));
  color: var(--blue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 22%, transparent);
}

.hx-icon svg,
.hx-store-facts svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* "Сите категории" at the top of the home page (17.11.2026): one tidy button into the full list.
   Sits outside the cached .hx block, right under the phone group grid. */
.hx-allcats-bar {
  display: flex;
  margin: 1rem 0 0;
}

.hx-allcats {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 1rem 0.4rem 0.4rem;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
  border-radius: 14px;
  background: linear-gradient(135deg, var(--surface), var(--blue-soft));
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.hx-allcats:hover,
.hx-allcats:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 22%, transparent);
  outline: none;
}

.hx-allcats-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
}

.hx-allcats-icon svg,
.hx-allcats-arrow {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hx-allcats-arrow {
  margin-left: 0.15rem;
  color: var(--blue);
  transition: transform 0.2s;
}

.hx-allcats:hover .hx-allcats-arrow {
  transform: translateX(3px);
}

/* On phones and tablets it is a full-width bar under the group tiles. */
@media (max-width: 999px) {
  .hx-allcats-bar {
    margin: 0 0 0.25rem;
  }

  .hx-allcats {
    flex: 1;
    min-height: 48px;
  }

  .hx-allcats-arrow {
    margin-left: auto;
  }
}

/* On desktop the big bar gives way to a compact chip at the start of the header's group row. */
.group-allcats-item {
  display: none;
}

@media (min-width: 1000px) {
  .hx-allcats-bar {
    display: none;
  }

  .page-home .group-allcats-item {
    display: flex;
    align-items: center;
    flex: none;
    margin-right: 0.35rem;
    padding-right: 0.55rem;
    border-right: 1px solid var(--line);
  }

  .group-allcats {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 34px;
    padding: 0.3rem 0.8rem 0.3rem 0.6rem;
    border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent);
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 0.9rem;
    font-weight: 650;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  }

  .group-allcats .chip-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
  }

  /* On the home page the groups sit a little closer, so the chip and the icons fit on one line. */
  .page-home .group-chip {
    gap: 0.28rem;
    padding-inline: 0.34rem;
    font-size: 0.87rem;
  }

  .page-home .group-chip::after {
    left: 0.34rem;
    right: 0.34rem;
  }

  .page-home .group-chip .chip-icon {
    width: 16px;
    height: 16px;
  }

  .group-allcats:hover {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
  }

  .group-allcats:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }
}

@media (min-width: 1000px) and (max-width: 1279px) {
  .group-allcats {
    padding: 0.3rem 0.65rem 0.3rem 0.5rem;
    font-size: 0.86rem;
  }

  .page-home .group-allcats-item {
    margin-right: 0.15rem;
    padding-right: 0.35rem;
  }

  .page-home .group-chip {
    gap: 0.22rem;
    padding-inline: 0.24rem;
    font-size: 0.84rem;
  }

  .page-home .group-chip::after {
    left: 0.24rem;
    right: 0.24rem;
  }
}

/* Small laptops: a little less room around the group names so the row still fits with the chip. */
@media (min-width: 1000px) and (max-width: 1179px) {
  .page-home .group-chip {
    padding-inline: 0.28rem;
  }

  .page-home .group-chip::after {
    left: 0.28rem;
    right: 0.28rem;
  }

  .page-home .group-allcats-item {
    margin-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hx-allcats-arrow {
    transition: none;
  }
}

/* Section titles are links too, to the same place as the button beside them. */
.hx-title-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.hx-title-link:hover,
.hx-title-link:focus-visible {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* Section heads: a small label, the title, and a link to the whole list ------------------- */
.hx-sec {
  display: grid;
  gap: 0.9rem;
}

.hx-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
}

.hx-head-icon {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

main .hx section h2 {
  margin: 0;
  padding: 0;
  font-size: clamp(1.25rem, 1rem + 1.1vw, 1.7rem);
  letter-spacing: -0.01em;
}

main .hx section h2::after {
  content: none;
}

.hx-kicker {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.hx-kicker::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--blue), var(--accent));
}

.hx-more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.hx-more:hover,
.hx-more:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 0 4px var(--hx-glow);
}

/* Rows of products that slide sideways ---------------------------------------------------- */
.hx-rail {
  position: relative;
}

.hx-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(168px, 44%);
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 4px 2px 10px;
  margin: -4px -2px 0;
}

.hx-track::-webkit-scrollbar {
  display: none;
}

.hx-track > .card {
  scroll-snap-align: start;
}

@media (min-width: 600px) {
  .hx-track {
    grid-auto-columns: minmax(190px, 30%);
  }
}

@media (min-width: 1000px) {
  .hx-track {
    grid-auto-columns: calc((100% - 4 * 14px) / 5);
    gap: 14px;
  }
}

.hx-arrow {
  position: absolute;
  top: 38%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}

.hx-arrow[hidden] {
  display: none;
}

.hx-arrow:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: scale(1.06);
}

.hx-arrow.prev {
  left: -14px;
}

.hx-arrow.next {
  right: -14px;
}

.hx-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

/* Product cards on the home page: brand and category above the name, the discount ------- */
.hx .card-media {
  position: relative;
}

.card-off {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--sale);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.2;
  min-width: 0;
}

.card-brand {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
}

.card-cat {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.hx .card {
  transition: box-shadow 0.25s var(--ease), border-color 0.25s;
}

.hx .card:hover,
.hx .card:focus-within {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 35%, transparent), 0 10px 28px var(--hx-glow);
}

/* The sale row sits on a dark technical panel ------------------------------------------- */
.hx-deals {
  padding: 1.1rem;
  border-radius: calc(var(--radius-lg) + 4px);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  background:
    linear-gradient(var(--hx-grid) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--hx-grid) 1px, transparent 1px) 0 0 / 28px 28px,
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--surface);
}

.hx-deals .hx-kicker {
  color: var(--accent-dark);
}

@media (prefers-reduced-motion: reduce) {
  .hx-track {
    scroll-behavior: auto;
  }

  .hx-tiles a,
  .hx-shot img,
  .hx-hero img,
  .hx-arrow {
    transition: none;
  }
}

/* One slim line about delivery and payment -------------------------------------------- */
.hx-perks {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.hx-perks li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hx-perks svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Photo tiles: a product photo on white, the name and price on a glass strip ------------ */
.hx-shot,
.hx-hero {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-lg) + 2px);
  background: #fff; /* product photos have white backgrounds */
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  isolation: isolate;
  transition: box-shadow 0.3s var(--ease), border-color 0.3s;
}

.hx-shot-img,
.hx-hero-img {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 0.9rem 0.9rem 4.6rem;
}

.hx-shot img,
.hx-hero img,
.hx-shot .noimg,
.hx-hero .noimg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.6s var(--ease);
}

.hx-shot:hover img,
.hx-hero:hover img,
.hx-shot:focus-visible img,
.hx-hero:focus-visible img {
  transform: scale(1.06);
}

.hx-shot:hover,
.hx-hero:hover,
.hx-shot:focus-visible,
.hx-hero:focus-visible {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 35%, transparent), 0 14px 34px var(--hx-glow);
}

.hx-shot-info {
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: 0.6rem;
  display: grid;
  gap: 0.1rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  background: rgb(10 20 36 / 78%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  box-shadow: 0 6px 18px rgb(0 0 0 / 18%);
}

.hx-shot-cat {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8ec0ff;
}

.hx-shot-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
}

.hx-shot-price {
  font-weight: 700;
  color: #ffc06b;
}

/* The mosaic under the banners: one big photo and four smaller ones -------------------- */
.hx-mosaic {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hx-mosaic .hx-shot {
  aspect-ratio: 1 / 1.08;
}

.hx-mosaic .hx-shot-big {
  grid-column: 1 / -1;
  aspect-ratio: 1.25 / 1;
}

.hx-shot-big .hx-shot-name {
  font-size: 1.05rem;
}

.hx-shot-big .hx-shot-price {
  font-size: 1.1rem;
}

@media (min-width: 1000px) {
  .hx-mosaic {
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 14px;
    height: clamp(460px, 42vw, 600px);
  }

  .hx-mosaic .hx-shot,
  .hx-mosaic .hx-shot-big {
    aspect-ratio: auto;
  }

  .hx-mosaic .hx-shot-big {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .hx-shot-big .hx-shot-img {
    padding: 1.5rem 1.5rem 6rem;
  }

  .hx-shot-big .hx-shot-info {
    left: 1rem;
    right: auto;
    bottom: 1rem;
    max-width: 70%;
    padding: 0.8rem 1rem;
  }

  .hx-shot-big .hx-shot-name {
    font-size: 1.3rem;
  }

  .hx-shot-big .hx-shot-price {
    font-size: 1.3rem;
  }
}

/* Category tiles: four product photos and the name ------------------------------------ */
.hx-tiles {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hx-tiles a {
  display: grid;
  gap: 0.6rem;
  height: 100%;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}

.hx-tiles a:hover,
.hx-tiles a:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 12px 28px var(--hx-glow);
  transform: translateY(-2px);
}

.hx-collage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  overflow: hidden;
  border-radius: var(--radius);
}

.hx-collage img,
.hx-collage .noimg {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 6px;
  background: #fff;
  border-radius: 6px;
}

.hx-tile-text {
  display: grid;
  gap: 0.1rem;
  padding: 0 0.2rem 0.15rem;
}

.hx-tile-name {
  font-weight: 600;
  line-height: 1.25;
}

.hx-tile-count {
  color: var(--muted);
  font-size: 0.8rem;
}

@media (min-width: 700px) {
  .hx-tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }
}

/* Each big category: a large photo of its newest product next to the row --------------- */
.hx-show-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.hx-show-body > * {
  min-width: 0;
}

.hx-hero {
  aspect-ratio: 1.3 / 1;
}

@media (min-width: 1000px) {
  .hx-show-body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
    gap: 14px;
    align-items: stretch;
  }

  .hx-show-flip .hx-show-body {
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  }

  .hx-show-flip .hx-hero {
    order: 2;
  }

  .hx-hero {
    aspect-ratio: auto;
    min-height: 100%;
  }

  .hx-show-body .hx-track {
    grid-auto-columns: calc((100% - 3 * 14px) / 4);
  }
}

/* Phones and tablets: in the small mosaic tiles the name sits under the photo, not on it. */
@media (max-width: 999px) {
  .hx-mosaic .hx-shot:not(.hx-shot-big) {
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
  }

  .hx-mosaic .hx-shot:not(.hx-shot-big) .hx-shot-img {
    aspect-ratio: 1;
    height: auto;
    padding: 0.6rem;
  }

  .hx-mosaic .hx-shot:not(.hx-shot-big) .hx-shot-info {
    position: static;
    flex: 1;
    margin: 0 0.4rem 0.4rem;
    align-content: start;
  }

  .hx-mosaic .hx-shot:not(.hx-shot-big) .hx-shot-cat {
    display: none;
  }
}

/* Wider home page on big screens (17.11.2026, Angela: "too much blank space left and right").
   Other pages keep 1200px. The header, the category row, the page and the footer all use .wrap,
   so their edges stay lined up. */
@media (min-width: 1000px) {
  .page-home .wrap {
    max-width: 1520px;
    padding-inline: clamp(16px, 2.5vw, 32px);
  }
}

/* "Ново во понудата": three rows of 5, or of 6 on wide screens (18 come from the server). */
@media (max-width: 1399px) {
  .hx-grid > :nth-child(n + 16) {
    display: none;
  }
}

@media (min-width: 1400px) {
  .page-home .grid.grid-5.hx-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
