/* Catalogue luxury layout — scoped to this page */

body[data-page="catalogue"] {
  background: var(--bg);
}

body[data-page="catalogue"] .overlay.open {
  background: rgba(0, 0, 0, 0.72);
}

html[lang="ar"] body[data-page="catalogue"] {
  font-family: "Tajawal", "Cairo", sans-serif;
}

/* —— Hero —— */
.cat-hero {
  position: relative;
  min-height: min(72vh, 680px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 0;
  isolation: isolate;
  overflow: hidden;
  background: #080706;
}

.cat-hero-media,
.cat-hero-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cat-hero-media { z-index: 0; }
.cat-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  transform: scale(1.04);
}

.cat-hero-veil {
  z-index: 1;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(212, 175, 55, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(8, 7, 6, 0.35) 0%, rgba(8, 7, 6, 0.55) 42%, rgba(8, 7, 6, 0.94) 100%);
}

.cat-hero-copy {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 820px;
  margin-inline: auto;
  padding: 24px 0;
}

.cat-hero-copy h1 {
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  color: #f8f5ec;
  letter-spacing: 0.04em;
  margin: 0 0 12px;
  text-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.cat-hero-copy .lead {
  color: #efe6cc;
  font-size: 1.08rem;
  max-width: 560px;
  margin: 0 auto;
  font-weight: 400;
}

.cat-kicker {
  display: inline-block;
  color: #e8c76a;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.cat-kicker-sm {
  letter-spacing: 0.22em;
  font-size: 0.68rem;
  margin-bottom: 6px;
}

.cat-hero-copy .gold-line {
  width: 88px;
  margin: 10px auto 18px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #f3d58a, var(--gold), #f3d58a, transparent);
  animation: catShimmer 3.6s ease-in-out infinite;
}

@keyframes catShimmer {
  0%, 100% { opacity: 0.55; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(1.35); }
}

/* —— Shop —— */
.cat-shop {
  padding: 88px 0 96px;
  scroll-margin-top: 96px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.07), transparent 42%),
    var(--bg);
}

.cat-shop-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.cat-shop-head h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

.cat-count {
  margin: 0;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.cat-controls {
  display: grid;
  gap: 18px;
  margin-bottom: 32px;
}

.cat-nav,
.cat-subnav {
  display: grid;
  gap: 14px;
  margin: 0;
}

.cat-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cat-subnav { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.cat-nav-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 148px;
  padding: 18px 12px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.06), transparent 42%),
    var(--card);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.32s ease, border-color 0.28s ease, box-shadow 0.32s ease;
}

.cat-nav-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 14px;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border-color 0.28s ease;
}

.cat-nav-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 42%;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, #e8c76a, transparent);
  opacity: 0.55;
}

.cat-nav-media {
  position: relative;
  z-index: 1;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(145deg, #f8e7b0, #d4af37 42%, #8a6910);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.cat-nav-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #0d0b08;
  display: block;
  transition: transform 0.5s ease;
}

.cat-nav-glyph {
  display: grid;
  place-items: center;
  color: #1a1208;
}

.cat-nav-glyph svg {
  width: 34px;
  height: 34px;
}

.cat-nav-label {
  position: relative;
  z-index: 1;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.cat-nav-card:hover {
  transform: translateY(-5px);
  border-color: rgba(232, 199, 106, 0.7);
  box-shadow: 0 18px 36px rgba(212, 175, 55, 0.14);
}

.cat-nav-card:hover::before { border-color: rgba(232, 199, 106, 0.35); }
.cat-nav-card:hover .cat-nav-media img { transform: scale(1.08); }

.cat-nav-card.active {
  border-color: #e8c76a;
  box-shadow:
    0 18px 40px rgba(212, 175, 55, 0.18),
    inset 0 0 0 1px rgba(232, 199, 106, 0.35);
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.16), rgba(18, 14, 8, 0.2) 50%),
    var(--card);
}

.cat-nav-card.active::before { border-color: rgba(232, 199, 106, 0.55); }

.cat-nav-card.active .cat-nav-label { color: #e8c76a; }

.cat-nav-card.active .cat-nav-media {
  box-shadow: 0 0 0 4px rgba(232, 199, 106, 0.22), 0 10px 22px rgba(0, 0, 0, 0.3);
}

.cat-subnav .cat-nav-card { min-height: 136px; padding: 14px 10px 12px; }
.cat-subnav .cat-nav-media { width: 64px; height: 64px; }

html[data-theme="light"] .cat-nav-card {
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.1), transparent 46%),
    var(--card);
}

html[data-theme="light"] .cat-nav-media img { border-color: #fffdf7; }

html[data-theme="light"] .cat-nav-card.active {
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.22), #fffdf7 58%);
}

.cat-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  margin: 4px 0 0;
  align-items: center;
}

body[data-page="catalogue"] .search,
body[data-page="catalogue"] .select {
  min-height: 48px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding-inline: 18px;
}

body[data-page="catalogue"] .search:focus,
body[data-page="catalogue"] .select:focus {
  outline: 2px solid rgba(212, 175, 55, 0.45);
  outline-offset: 2px;
}

/* —— Product cards —— */
.cat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
}

body[data-page="catalogue"] .cat-product {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s ease, border-color 0.3s ease, box-shadow 0.35s ease;
  animation: catReveal 0.55s ease both;
}

.cat-product:nth-child(2) { animation-delay: 0.05s; }
.cat-product:nth-child(3) { animation-delay: 0.1s; }
.cat-product:nth-child(4) { animation-delay: 0.12s; }
.cat-product:nth-child(5) { animation-delay: 0.16s; }
.cat-product:nth-child(6) { animation-delay: 0.2s; }

@keyframes catReveal {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

body[data-page="catalogue"] .cat-product:hover {
  transform: translateY(-8px);
  border-color: rgba(232, 199, 106, 0.7);
  box-shadow: 0 26px 50px rgba(212, 175, 55, 0.14);
}

.cat-card-media {
  position: relative;
  aspect-ratio: 4 / 3.2;
  overflow: hidden;
  background: #120e09;
}

.cat-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
}

.cat-product:hover .cat-card-media img { transform: scale(1.06); }

.cat-card-badge {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  z-index: 1;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(232, 199, 106, 0.55);
  background: rgba(8, 7, 6, 0.72);
  color: #f3d58a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

body[data-page="catalogue"] .cat-product .product-body {
  padding: 20px 20px 22px;
  gap: 10px;
}

body[data-page="catalogue"] .cat-product h3 {
  margin: 0;
  font-size: clamp(0.92rem, 2.8vw, 1.22rem);
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

body[data-page="catalogue"] .cat-product .muted {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3em;
}

body[data-page="catalogue"] .product-meta {
  align-items: baseline;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

body[data-page="catalogue"] .price {
  font-size: 1.18rem;
  color: var(--gold);
}

body[data-page="catalogue"] .product-actions {
  gap: 10px;
}

body[data-page="catalogue"] .product-actions .btn {
  flex: 1;
  min-height: 44px;
  font-size: 0.86rem;
}

.format-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 0;
}

.format-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.format-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.format-chip {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.2s ease;
}

.format-chip:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.format-chip.active {
  background: linear-gradient(180deg, #f3d58a, #d4af37 55%, #b8860b);
  color: #1a1208;
  border-color: #e8c994;
}

.format-chip.active:hover { color: #1a1208; }

.cat-empty {
  margin-top: 12px;
  background: var(--surface);
}

/* —— Detail modal —— */
#product-modal.product-detail-modal {
  width: min(920px, calc(100% - 24px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  z-index: 90;
  background: #120e09;
  color: #f8f5ec;
  border: 1px solid rgba(212, 175, 55, 0.42);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

#product-modal.product-detail-modal .modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.08), transparent);
}

#product-modal.product-detail-modal .modal-body {
  background: #120e09;
  padding: 20px;
}

html[data-theme="light"] #product-modal.product-detail-modal,
html[data-theme="light"] #product-modal.product-detail-modal .modal-body {
  background: #fffdf7;
  color: #1a1710;
}

.product-detail {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 26px;
  align-items: start;
}

.product-detail-visual {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #120e09;
}

.product-detail-visual img,
.product-detail img {
  width: 100%;
  height: min(460px, 56vh);
  object-fit: cover;
  margin: 0;
  border-radius: 16px;
}

.product-detail-visual .cat-card-badge { inset-inline-start: 14px; }

.product-detail-copy h3 {
  margin-bottom: 8px;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
}

.product-detail-copy .product-details-text {
  white-space: pre-line;
}

.product-detail-price {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 14px 0 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.qty-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.qty-select button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input);
  cursor: pointer;
  color: var(--text);
}

.qty-select button:hover { border-color: var(--gold); color: var(--gold); }

.qty-select input {
  width: 68px;
  height: 38px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input);
}

/* Light theme refinements */
html[data-theme="light"] .cat-hero-veil {
  background:
    radial-gradient(ellipse at 50% 18%, rgba(212, 175, 55, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(8, 7, 6, 0.42) 0%, rgba(8, 7, 6, 0.52) 52%, rgba(8, 7, 6, 0.28) 78%, #f8f5ec 100%);
}

html[data-theme="light"] .cat-hero-copy h1 {
  color: #f8f5ec;
  text-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
html[data-theme="light"] .cat-hero-copy .lead { color: #efe6cc; }
html[data-theme="light"] .cat-hero-copy .cat-kicker { color: #e8c76a; }

html[data-theme="light"] .cat-shop {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(184, 134, 11, 0.08), transparent 46%),
    var(--bg);
}

html[data-theme="light"] .cat-card-badge {
  background: rgba(255, 253, 247, 0.88);
  color: #8a6910;
  border-color: rgba(184, 134, 11, 0.4);
}

html[data-theme="light"] body[data-page="catalogue"] .cat-product {
  box-shadow: 0 16px 36px rgba(26, 23, 16, 0.08);
}

@media (max-width: 1100px) {
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cat-nav,
  .cat-subnav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .cat-hero { min-height: 58vh; padding-top: 28px; }
  .cat-shop { padding: 72px 0 64px; }
  .cat-shop-head { flex-direction: column; align-items: flex-start; }
  .product-detail { grid-template-columns: 1fr; }
  .product-detail-visual img,
  .product-detail img { height: 240px; }
}

@media (max-width: 640px) {
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body[data-page="catalogue"] .product-actions { flex-direction: column; }
  .cat-toolbar { grid-template-columns: 1fr; }
  .cat-nav,
  .cat-subnav { grid-template-columns: 1fr; }
  .cat-nav-card,
  .cat-subnav .cat-nav-card {
    min-height: 88px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    padding: 12px 14px;
    text-align: start;
  }
  .cat-nav-media,
  .cat-subnav .cat-nav-media { width: 56px; height: 56px; flex-shrink: 0; }
  .cat-nav-label { overflow-wrap: anywhere; }
}

.cat-card-media img[src*="-pack.jpg"],
.product-detail-visual img[src*="-pack.jpg"],
.product-detail img[src*="-pack.jpg"] {
  object-fit: contain;
  object-position: center;
  background: #ffffff;
}

.product-detail .product-detail-visual img[src*="-pack.jpg"] {
  height: min(560px, 72vh);
}

.cat-card-media img[src*="miel-adam-scene"],
.cat-card-media img[src*="miel-eve-scene"],
.cat-card-media img[src*="miel-quadruple-scene"],
.product-detail-visual img[src*="miel-adam-scene"],
.product-detail-visual img[src*="miel-eve-scene"],
.product-detail-visual img[src*="miel-quadruple-scene"],
.product-detail img[src*="miel-adam-scene"],
.product-detail img[src*="miel-eve-scene"],
.product-detail img[src*="miel-quadruple-scene"] {
  object-fit: cover;
  object-position: center 42%;
  background: #2a1c10;
}

.product-detail .product-detail-visual img[src*="miel-adam-scene"],
.product-detail .product-detail-visual img[src*="miel-eve-scene"],
.product-detail .product-detail-visual img[src*="miel-quadruple-scene"] {
  height: min(560px, 72vh);
}

.cat-card-media img[src*="amlou-graines-courge"],
.cat-card-media img[src*="amlou-amande-argan"],
.cat-card-media img[src*="amlou-cacahuete"],
.product-detail-visual img[src*="amlou-graines-courge"],
.product-detail-visual img[src*="amlou-amande-argan"],
.product-detail-visual img[src*="amlou-cacahuete"],
.product-detail img[src*="amlou-graines-courge"],
.product-detail img[src*="amlou-amande-argan"],
.product-detail img[src*="amlou-cacahuete"] {
  object-fit: cover;
  object-position: center 42%;
}

.product-detail .product-detail-visual img[src*="amlou-graines-courge"],
.product-detail .product-detail-visual img[src*="amlou-amande-argan"],
.product-detail .product-detail-visual img[src*="amlou-cacahuete"] {
  height: min(560px, 72vh);
}

.cat-card-media--oil {
  aspect-ratio: 3 / 4;
  background: #120e09;
}

.cat-card-media--oil img {
  object-fit: cover;
  object-position: center center;
  transform: none;
}

.cat-product:hover .cat-card-media--oil img {
  transform: scale(1.03);
}

.product-detail-visual--oil {
  aspect-ratio: 3 / 4;
  max-height: min(560px, 72vh);
  overflow: hidden;
  background: #120e09;
}

.product-detail .product-detail-visual--oil img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: center center;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .cat-product,
  .cat-hero-copy .gold-line,
  .cat-card-media img,
  .cat-nav-card,
  .cat-nav-media img { animation: none; transition: none; }
}
