/* Zuwika Rose CARDS: one file for the desktop sub-menu AND the subcategory tiles of category pages (variant 03 "Karta z miekkim cieniem", chosen by Pawel 2026-10-24).
   Each second-level item is a white card (picture or pink initial-letter square, name). Its children are NOT shown at rest;
   on hover or keyboard focus the card opens (panel grows, links fade in one after another), lifts a little and tilts after the pointer.
   Loaded from the ps_mainmenu.tpl override and from the subcategory tiles (catalog/_partials/subcategories.tpl). Spec: themes/zuwika-rose/DESIGN.md "Menu card". Desktop only (the phone menu is untouched). */

/* New tokens (DESIGN.md + design-system-rose/tokens.json): soft card shadow and its hover state */
:root {
  --zr-shadow-card: 0 8px 24px rgba(35, 27, 31, .10);
  --zr-shadow-card-hover: 0 14px 36px rgba(35, 27, 31, .20);
}

/* Animated custom properties: the transform is built from them, so the browser eases every one of them */
@property --zw-rx { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@property --zw-ry { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@property --zw-lift { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --zw-scale { syntax: '<number>'; inherits: false; initial-value: 1; }

/* This replaces the two trial blocks at the end of custom.css (picture above the name, centred columns) */
.main-menu__tree .menu-container ul.zw-cards[data-depth="1"] {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: var(--zr-space-32) var(--zr-space-32);
  margin: 0;
  padding: var(--zr-space-8) 0 var(--zr-space-16);
  list-style: none;
}

.main-menu__tree .menu-container ul.zw-cards[data-depth="1"] > li.zw-card {
  position: relative;
  flex: 0 0 208px;
  width: 208px;
  max-width: 208px;
  margin: 0;
  padding: 0;
  text-align: center;
}

/* the card itself floats over its slot; the ghost keeps the slot's height */
.zw-card__box {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  overflow: hidden;
  background: var(--zr-ivory-light);
  border-radius: var(--zr-radius-12, 12px);
  box-shadow: var(--zr-shadow-card);
  transform-origin: 50% 40%;
  transform: perspective(900px) translateY(var(--zw-lift)) rotateX(var(--zw-rx)) rotateY(var(--zw-ry)) scale(var(--zw-scale));
  transition:
    box-shadow .35s ease,
    left .35s ease,
    right .35s ease,
    --zw-lift .35s ease,
    --zw-scale .35s ease,
    --zw-rx .22s ease-out,
    --zw-ry .22s ease-out;
  will-change: transform;
}

.zw-card:hover .zw-card__box,
.zw-card:focus-within .zw-card__box {
  z-index: 3;
  left: -24px; /* the open card is a little wider, room for the pills */
  right: -24px;
  --zw-lift: -4px;
  --zw-scale: 1.03;
  box-shadow: var(--zr-shadow-card-hover);
}

.zw-card__ghost { display: block; visibility: hidden; pointer-events: none; padding-bottom: var(--zr-space-16); }

/* link: picture on top, name below */
.main-menu__tree .menu-container .zw-card__box > a.main-menu__tree__link[data-depth="1"],
.main-menu__tree .menu-container .zw-card__box > a.main-menu__tree__link[data-depth="1"]:hover {
  display: block;
  padding: 0 0 var(--zr-space-16);
  white-space: normal;
  background: transparent;
  text-align: center;
  border-bottom: 0;
}

.zw-card__pic {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 208 / 172;
  overflow: hidden;
}
.zw-card__pic img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }

/* missing picture: the pink square with the initial letter */
.zw-card__ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--zr-pink-soft);
  font-family: var(--zr-font-display);
  font-size: 40px;
  line-height: 1;
  color: var(--zr-magenta-muted);
}

.zw-card__name {
  display: block;
  margin: var(--zr-space-16) var(--zr-space-16) 0;
  min-height: 0;
  font-family: var(--zr-font-sans);
  font-size: 12px;
  line-height: 18px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--zr-ink);
  transition: color .2s ease;
}
.zw-card:hover .zw-card__name,
.zw-card:focus-within .zw-card__name { color: var(--zr-magenta-deep); }

.main-menu__tree .menu-container .zw-card__box > a.main-menu__tree__link[data-depth="1"]:focus-visible {
  outline-offset: -2px;
  border-radius: var(--zr-radius-12, 12px);
}

/* the panel with the subcategories: grows from 0 to its height */
.zw-card__panel {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows .38s cubic-bezier(.2, .7, .2, 1), visibility 0s linear .38s;
}
.zw-card:hover .zw-card__panel,
.zw-card:focus-within .zw-card__panel {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows .38s cubic-bezier(.2, .7, .2, 1), visibility 0s;
}
.zw-card__panel-in { min-height: 0; overflow: hidden; }

.main-menu__tree .zw-card__panel ul.submenu {
  margin: 0 var(--zr-space-16);
  padding: var(--zr-space-8) 0 var(--zr-space-16);
  list-style: none;
  border-top: 1px solid var(--zr-pink-line);
}
.main-menu__tree .zw-card__panel ul.submenu > li {
  margin: 0;
  padding: 0;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
}
.main-menu__tree .zw-card__panel ul.submenu a.dropdown-item {
  display: block;
  padding: 4px 0;
  white-space: normal;
  background: transparent;
  text-align: center;
  font-family: var(--zr-font-serif);
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--zr-ink);
}
.main-menu__tree .zw-card__panel ul.submenu a.dropdown-item:hover,
.main-menu__tree .zw-card__panel ul.submenu a.dropdown-item:focus-visible { color: var(--zr-magenta-deep); }

.main-menu__tree .zw-card:hover .zw-card__panel ul.submenu > li,
.main-menu__tree .zw-card:focus-within .zw-card__panel ul.submenu > li {
  opacity: 1;
  transform: none;
  transition: opacity .28s ease calc(120ms + var(--i, 1) * 40ms), transform .28s ease calc(120ms + var(--i, 1) * 40ms);
}

/* reduced motion: no tilt, no lift, no scale, instant open */
@media (prefers-reduced-motion: reduce) {
  .zw-card__box,
  .zw-card__panel,
  .zw-card__name,
  .main-menu__tree .zw-card__panel ul.submenu > li { transition: none !important; }
  .zw-card__box { transform: none !important; will-change: auto; }
  .main-menu__tree .zw-card__panel ul.submenu > li { transform: none !important; }
}

/* keyboard: submenu.js sets .zw-kb on the top item whose link has keyboard focus (the theme itself opens the sub-menu on :hover only) */
#top-menu > li.zw-kb > .menu-container { display: block; }

/* ---- Third level, variant "pills" (default): the subcategories are small rounded chips, centred, two to three per row ---- */
.main-menu__tree .zw-card__panel ul.submenu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--zr-space-8);
  padding: var(--zr-space-16) 0;
}
.main-menu__tree .zw-card__panel ul.submenu a.dropdown-item {
  padding: 4px 12px;
  border-radius: var(--zr-radius-12, 12px);
  background: var(--zr-pink-soft);
  font-family: var(--zr-font-serif);
  font-size: 14px;
  line-height: 20px;
  transition: background-color .2s ease, color .2s ease;
}
.main-menu__tree .zw-card__panel ul.submenu a.dropdown-item:hover,
.main-menu__tree .zw-card__panel ul.submenu a.dropdown-item:focus-visible { background: var(--zr-pink); color: var(--zr-magenta-deep); }

/* ---- Variant "skip": no third level in the menu; the card only links to its category, a small hint says it has subcategories ---- */
.zw-card__hint { display: none; }
.zw-sm-skip .zw-card--sub .zw-card__hint {
  display: block;
  margin: -8px 16px 0;
  font-family: var(--zr-font-serif);
  font-size: 13px;
  line-height: 20px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--zr-magenta-muted);
}
.zw-sm-skip .zw-card:hover .zw-card__hint,
.zw-sm-skip .zw-card:focus-within .zw-card__hint { color: var(--zr-magenta-deep); }
.zw-sm-skip .zw-card__panel { display: none; }
.zw-sm-skip .zw-card--sub .zw-card__ghost { padding-bottom: calc(var(--zr-space-16) + 12px); }

/* pills: plain inline links, compact, no divider; nothing below this level exists in the desktop menu */
.main-menu__tree .zw-card__panel ul.submenu { border-top: 0; margin: 0 var(--zr-space-16); padding: var(--zr-space-8) 0 var(--zr-space-16); gap: 6px; }
.main-menu__tree .zw-card__panel ul.submenu a.dropdown-item { padding: 2px 10px; font-size: 13px; line-height: 20px; white-space: nowrap; }
/* text-only card: a shorter pink square */
.zw-card--noimg .zw-card__pic { aspect-ratio: 208 / 88; }
.zw-card--noimg .zw-card__ph { font-size: 32px; }
/* the dropdown grows with the open card (submenu.js sets the extra height) */
.main-menu__tree .menu-container ul.zw-cards[data-depth="1"] { transition: padding-bottom .38s cubic-bezier(.2, .7, .2, 1); }
@media (prefers-reduced-motion: reduce) { .main-menu__tree .menu-container ul.zw-cards[data-depth="1"] { transition: none !important; } }

/* ---- generic parts for the subcategory tiles of category pages (same card, same panel, same pills) ---- */
.zw-card { position: relative; text-align: center; }
.zw-card__box > a.zw-card__link { display: block; padding: 0 0 var(--zr-space-16); text-align: center; text-decoration: none; color: inherit; background: transparent; }
.zw-card__box > a.zw-card__link:focus-visible { outline-offset: -2px; border-radius: var(--zr-radius-12, 12px); }
.zw-card__panel ul.zw-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 var(--zr-space-16); padding: var(--zr-space-8) 0 var(--zr-space-16); list-style: none; }
.zw-card__panel ul.zw-pills > li { margin: 0; padding: 0; opacity: 0; transform: translateY(4px); transition: opacity .12s ease, transform .12s ease; }
.zw-card:hover .zw-card__panel ul.zw-pills > li,
.zw-card:focus-within .zw-card__panel ul.zw-pills > li {
  opacity: 1;
  transform: none;
  transition: opacity .28s ease calc(120ms + var(--i, 1) * 40ms), transform .28s ease calc(120ms + var(--i, 1) * 40ms);
}
.zw-card__panel ul.zw-pills a {
  display: block;
  padding: 2px 10px;
  border-radius: var(--zr-radius-12, 12px);
  background: var(--zr-pink-soft);
  font-family: var(--zr-font-serif);
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--zr-ink);
  transition: background-color .2s ease, color .2s ease;
}
.zw-card__panel ul.zw-pills a:hover,
.zw-card__panel ul.zw-pills a:focus-visible { background: var(--zr-pink); color: var(--zr-magenta-deep); }
/* shortcut tile: the filter value, small, in the top right corner of the card (Paweł, 2026-10-24), on a soft chip so it reads over a picture */
.zw-card .zw-sc-tile__filter { position: absolute; z-index: 2; top: var(--zr-space-8); right: var(--zr-space-8); padding: 0 8px; border-radius: var(--zr-radius-12, 12px); background: rgba(255, 255, 255, .9); font-family: var(--zr-font-sans); font-size: 11px; line-height: 20px; letter-spacing: .12em; text-transform: uppercase; color: var(--zr-magenta-deep); }
.zw-tiles { row-gap: var(--zr-space-32); margin-bottom: var(--zr-space-32); }
.zw-tiles > .zw-tile { padding-inline: var(--zr-space-16); }
/* phone and touch: plain cards, no hover effects, no pills (the category page itself lists them) */
@media (max-width: 767.98px), (hover: none) {
  .zw-card--tile .zw-card__panel { display: none; }
  .zw-card--tile .zw-card__box { transform: none !important; left: 0 !important; right: 0 !important; box-shadow: var(--zr-shadow-card) !important; }
}
@media (max-width: 767.98px) { .zw-card__name { letter-spacing: .18em; font-size: 11px; } .zw-tiles > .zw-tile { padding-inline: var(--zr-space-8); } }
/* tiles sit close together: the open card grows only a little sideways */
.zw-card--tile:hover .zw-card__box,
.zw-card--tile:focus-within .zw-card__box { left: -8px; right: -8px; }
/* the tile row floats above the product list under it (wishlist hearts, badges, sticky filter column), below the sticky header (1020) and the menu */
.zw-tiles { position: relative; z-index: 30; }
.zw-tiles > .zw-tile { position: relative; }
.zw-tiles > .zw-tile:hover,
.zw-tiles > .zw-tile:focus-within { z-index: 31; }
