/* MERARY categories — stable fr-grid + per-card media vars on the CARD */
:root {
  /* same soft pink as .hero-merary__card */
  --category-hero-bg: linear-gradient(128deg, #fffdfb 0%, #fdf3f5 24%, #f8e4ea 52%, #faeef2 78%, #fff9fa 100%);
  --category-bg: #fdf3f5;
  --category-bg-secondary: #f8e4ea;
  --category-border: rgba(232, 165, 176, 0.35);
  --category-text: #262221;
  --category-muted: #746d6b;
  --category-accent: #c85f73;
  --category-gold: #c79852;
  --category-gold-border: #d4a84b;
  --category-radius: 12px;
  --category-top-gap: 8px;
  --category-middle-gap: 7px;
}

/* Hide until layout applied — prevents FOUC of old positions/images */
.home-categories {
  padding: clamp(12px, 1.5vw, 24px) 0 clamp(40px, 4vw, 64px);
  background: transparent;
  visibility: hidden;
  opacity: 0;
}

html.cat-layout-ready .home-categories {
  visibility: visible;
  opacity: 1;
}

.home-categories .container {
  /* same width + gutters as hero / search / rest of site */
  max-width: var(--container-max);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  box-sizing: border-box;
}

.category-section {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.category-grid {
  display: flex;
  flex-direction: column;
  gap: var(--category-top-gap);
}

.category-grid__row {
  display: grid;
  align-items: stretch;
  min-width: 0;
}

.category-grid__row--top {
  grid-template-columns: minmax(0, 800fr) minmax(0, 326fr) minmax(0, 334fr);
  gap: 8px;
}

.category-grid__row--mid {
  grid-template-columns:
    minmax(0, 239fr) minmax(0, 238fr) minmax(0, 239fr)
    minmax(0, 240fr) minmax(0, 240fr) minmax(0, 243fr);
  gap: var(--category-middle-gap);
}

.category-grid__row--bottom {
  grid-template-columns: minmax(0, 1fr);
}

.category-card {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--category-text);
  text-decoration: none;
  background: var(--category-hero-bg);
  border: 1px solid var(--category-border);
  border-radius: var(--category-radius);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  --cat-w: 70%;
  --cat-h: 70%;
  --cat-right: 0%;
  --cat-bottom: 0%;
  --cat-scale: 1;
  --cat-title-font: "Playfair Display", Georgia, "Times New Roman", serif;
  --cat-body-font: Montserrat, Arial, Helvetica, sans-serif;
  --cat-text-x: 0%;
  --cat-text-y: 0%;
  --cat-content-mw: 48%;
}

.category-card:hover {
  transform: translateY(-2px);
  border-color: rgba(200, 95, 115, 0.4);
  box-shadow: 0 12px 30px rgba(200, 95, 115, 0.12);
}

.category-card:focus-visible {
  outline: 3px solid rgba(200, 95, 115, 0.4);
  outline-offset: 3px;
}

.category-card__content {
  position: relative;
  z-index: 2;
  min-width: 0;
  max-width: var(--cat-content-mw);
  box-sizing: border-box;
}

.category-card__media {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  width: var(--cat-w);
  height: var(--cat-h);
  right: var(--cat-right);
  bottom: var(--cat-bottom);
  transform: scale(var(--cat-scale));
  transform-origin: right bottom;
}

/* Beat styles.css cover/hover — cutouts must use contain */
.home-categories .category-card__image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain !important;
  object-position: right bottom;
  user-select: none;
  transform: none !important;
}

.home-categories .category-card:hover .category-card__image {
  transform: none !important;
}

.category-card__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--category-gold);
  font-family: var(--cat-body-font);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.category-card__eyebrow::before {
  content: "♕";
  font-size: 15px;
  line-height: 1;
}

.category-card__title {
  margin: 0;
  font-family: var(--cat-title-font);
  font-size: 27px;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.category-card__description {
  margin: 14px 0 0;
  color: var(--category-muted);
  font-family: var(--cat-body-font);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
}

.category-card__arrow {
  /* reset legacy circle button from styles.css */
  position: static;
  bottom: auto;
  right: auto;
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
  display: block;
  margin-top: 12px;
  padding: 0;
  color: var(--category-muted);
  font-family: var(--cat-body-font);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0.02em;
}

.category-card__button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding: 11px 19px;
  color: var(--category-accent);
  font-family: var(--cat-body-font);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(200, 95, 115, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

/* —— Card geometry + default media vars on CARD (not media) —— */
.category-card--premium {
  aspect-ratio: 800 / 356;
  --cat-w: 71.25%;
  --cat-h: 100%;
  --cat-right: -0.25%;
  --cat-bottom: 0%;
  --cat-content-mw: 42%;
  border: 1.5px solid var(--category-gold-border);
  box-shadow:
    0 0 0 1px rgba(255, 236, 190, 0.55) inset,
    0 8px 28px rgba(199, 152, 82, 0.12);
  /* soft light-pink → slightly deeper pink */
  background: linear-gradient(
    135deg,
    #fff8fa 0%,
    #fdf0f4 28%,
    #f8e4ea 58%,
    #f3d5df 100%
  );
}

.category-card--premium::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 70% 40%, rgba(255, 255, 255, 0.45), transparent 55%),
    linear-gradient(
      105deg,
      transparent 0%,
      transparent 40%,
      rgba(255, 255, 255, 0.35) 50%,
      transparent 60%,
      transparent 100%
    );
  background-size: 100% 100%, 200% 100%;
  animation: premiumCardSheen 8s ease-in-out infinite;
}

.category-card--premium .category-card__content,
.category-card--premium .category-card__media {
  z-index: 1;
}

.category-card--premium:hover {
  border-color: #c9a04a;
  box-shadow:
    0 0 0 1px rgba(255, 236, 190, 0.7) inset,
    0 14px 34px rgba(199, 152, 82, 0.18);
}

@keyframes premiumCardSheen {
  0%, 100% { background-position: 0 0, 120% 0; opacity: 0.7; }
  45%, 55% { background-position: 0 0, -20% 0; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .category-card--premium::before {
    animation: none;
  }
}

.category-card--premium .category-card__content {
  padding: 48px 12px 34px 38px;
}

.category-card--premium .category-card__title {
  font-size: clamp(31px, 2.2vw, 39px);
  line-height: 1.05;
}

.category-card--flowers,
.category-card--edible {
  aspect-ratio: 326 / 356;
  --cat-w: 92%;
  --cat-h: 86%;
  --cat-right: -5.2%;
  --cat-bottom: -1%;
  --cat-content-mw: 58%;
}

.category-card--edible {
  aspect-ratio: 334 / 356;
  --cat-w: 94.3%;
  --cat-right: -4.2%;
  --cat-content-mw: 70%;
}

.category-card--flowers .category-card__content,
.category-card--edible .category-card__content {
  padding: 31px 0 20px 30px;
}

.category-card--edible .category-card__content {
  width: max-content;
  max-width: 72%;
}

.category-card--edible .category-card__title {
  white-space: nowrap;
}

.category-card--edible .category-card__description {
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.45;
}

.category-card--small {
  aspect-ratio: 1 / 1;
  background: var(--category-hero-bg);
  --cat-content-mw: 58%;
}

.category-card--small .category-card__content {
  padding: 21px 0 16px 21px;
}

.category-card--small .category-card__title {
  font-size: 19px;
  line-height: 1.05;
}

.category-card--small .category-card__description {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.55;
}

.category-card--balloons {
  aspect-ratio: 239 / 240;
  --cat-w: 63.2%;
  --cat-h: 89.6%;
  --cat-right: -0.8%;
  --cat-bottom: -1.2%;
}

.category-card--plants {
  aspect-ratio: 238 / 240;
  --cat-w: 74%;
  --cat-h: 80.4%;
  --cat-right: -3.4%;
  --cat-bottom: -0.8%;
}

.category-card--strawberry {
  aspect-ratio: 239 / 240;
  --cat-w: 71.5%;
  --cat-h: 71.25%;
  --cat-right: -1.2%;
  --cat-bottom: -0.8%;
}

.category-card--sweets {
  --cat-w: 75.8%;
  --cat-h: 65.8%;
  --cat-right: -0.8%;
  --cat-bottom: -0.4%;
}

.category-card--bento {
  --cat-w: 81.7%;
  --cat-h: 74.2%;
  --cat-right: -1.7%;
  --cat-bottom: -0.8%;
}

.category-card--toys {
  aspect-ratio: 243 / 240;
  --cat-w: 73.3%;
  --cat-h: 79.2%;
  --cat-right: -0.4%;
  --cat-bottom: -0.8%;
}

.category-card--gifts {
  aspect-ratio: 1474 / 142;
  --cat-w: 46.1%;
  --cat-h: 100%;
  --cat-right: 9.7%;
  --cat-bottom: 0%;
  --cat-content-mw: 32%;
}

.category-card--gifts .category-card__content {
  padding: 17px 0 13px 27px;
}

.category-card--gifts .category-card__title {
  font-size: 20px;
  line-height: 1.05;
}

.category-card--gifts .category-card__description {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.category-card--gifts .category-card__arrow {
  margin-top: 8px;
  font-size: 12px;
}

.category-card--small .category-card__arrow {
  margin-top: 12px;
  font-size: 12px;
}

.category-card--gifts .category-card__media {
  transform-origin: center bottom;
}

.category-card--gifts .category-card__image {
  object-position: center bottom;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1024px) {
  .category-grid__row--top,
  .category-grid__row--mid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .category-card--premium {
    grid-column: 1 / -1;
    aspect-ratio: 2.15 / 1;
  }

  .category-card--flowers,
  .category-card--edible {
    aspect-ratio: 1 / 1.05;
  }

  .category-card--small {
    aspect-ratio: 1 / 1;
  }

  .category-card--gifts {
    min-height: 150px;
    aspect-ratio: auto;
  }

  .category-card--premium .category-card__content {
    padding: 38px 10px 30px 34px;
  }

  .category-card--premium {
    --cat-w: 66%;
  }

  .category-card--flowers,
  .category-card--edible {
    --cat-w: 88%;
  }

  .category-card--gifts {
    --cat-w: 58%;
    --cat-right: 3%;
  }
}

@media (max-width: 760px) {
  .category-grid__row--top,
  .category-grid__row--mid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .category-card--premium {
    grid-column: auto;
    min-height: 420px;
    aspect-ratio: auto;
    --cat-w: 96%;
    --cat-h: 62%;
    --cat-right: -8%;
    --cat-content-mw: 100%;
  }

  .category-card--premium .category-card__content {
    padding: 28px 24px 0;
  }

  .category-card--premium .category-card__title {
    font-size: 34px;
  }

  .category-card--flowers,
  .category-card--edible {
    min-height: 330px;
    aspect-ratio: auto;
    --cat-w: 80%;
    --cat-h: 72%;
    --cat-content-mw: 55%;
  }

  .category-card--flowers .category-card__content,
  .category-card--edible .category-card__content {
    padding: 27px 0 22px 24px;
  }

  .category-card--small {
    min-height: 250px;
    aspect-ratio: auto;
    --cat-w: 66%;
    --cat-h: 74%;
    --cat-content-mw: 55%;
  }

  .category-card--small .category-card__content {
    padding: 23px 0 18px 22px;
  }

  .category-card--gifts {
    min-height: 220px;
    --cat-w: 75%;
    --cat-h: 62%;
    --cat-right: -5%;
    --cat-content-mw: 42%;
  }

  .category-card--gifts .category-card__content {
    padding: 24px 0 20px 22px;
  }
}
