/* Home catalogue. Shared pieces (tokens, header, buttons, footer) are in themes.css + base.css. */

/* ---------- Floating menu trigger (no sticky header) ---------- */
.menu-toggle {
  position: fixed; top: 22px; right: max(var(--gutter), calc((100vw - var(--page)) / 2 + var(--gutter)));
  z-index: 90; height: 40px; min-width: 40px; padding: 0 14px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
  transition: border-color .15s;
}
.menu-toggle:hover { border-color: var(--muted); }
.menu-icon { display: grid; gap: 4px; width: 16px; flex: none; }
.menu-icon i { display: block; height: 1.5px; border-radius: 2px; background: var(--ink); }
.menu-lang { font-size: 12px; font-weight: 600; letter-spacing: .05em; padding-left: 10px; border-left: 1px solid var(--line); line-height: 16px; }
.menu-active-label { font-size: 12px; font-weight: 600; color: var(--red); white-space: nowrap; }
.menu-filter-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
}

/* ---------- Menu drawer ---------- */
body.menu-open { overflow: hidden; }
.menu-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(15,17,18,.36); backdrop-filter: blur(2px); }
.site-menu {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 101; width: min(400px, 100%);
  display: flex; flex-direction: column; overflow-y: auto;
  padding: 22px 28px 28px; background: var(--paper); box-shadow: -24px 0 60px rgba(0,0,0,.12);
}
.menu-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; }
.menu-header h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.close-menu, .dialog-close {
  width: 40px; height: 40px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--paper);
  font-size: 22px; line-height: 1; transition: background-color .15s;
}
.close-menu:hover, .dialog-close:hover { background: var(--soft); }
.menu-links { display: grid; padding: 4px 0 18px; border-bottom: 1px solid var(--line); }
.menu-links a {
  display: flex; justify-content: space-between; gap: 16px; padding: 11px 0;
  font-size: 19px; font-weight: 550; letter-spacing: -.015em; transition: color .15s;
}
.menu-links a:hover { color: var(--accent); }
.menu-links a span:last-child { color: var(--muted); font-size: 15px; }
.menu-section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.menu-section:last-child { border-bottom: 0; }
.menu-section h3 { margin: 0 0 12px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.language-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.language-option, .palette-option {
  min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); font-size: 13px; font-weight: 550; transition: background-color .15s, border-color .15s;
}
.language-option:hover, .palette-option:hover { background: var(--soft); }
.language-option.selected { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.menu-filter-summary { margin-bottom: 12px; font-size: 13px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.palette-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.palette-option { display: flex; align-items: center; gap: 9px; padding: 0 12px 0 6px; text-align: left; }
.palette-option.selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.palette-name { flex: 1; min-width: 0; line-height: 1.25; }
.palette-check { font-size: 12px; font-weight: 700; opacity: 0; }
.palette-option.selected .palette-check { opacity: 1; }
.palette-swatch {
  width: 28px; height: 28px; flex: none; border-radius: 50%; border: 1px solid rgba(0,0,0,.1);
  background: linear-gradient(135deg, var(--sw-bg) 0 50%, var(--sw-accent) 50%);
}
.swatch-ivory { --sw-bg: #faf8f3; --sw-accent: #2f4a37; }
.swatch-mono { --sw-bg: #ffffff; --sw-accent: #161718; }
.swatch-graphite { --sw-bg: #1c1f22; --sw-accent: #c3d4c8; }
.swatch-rose { --sw-bg: #fbf6f5; --sw-accent: #6e4a5c; }

/* Clear-filters stays a real call to action. */
.reset-button, .inline-reset {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--red);
  background: var(--red); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: filter .15s;
}
.reset-button:hover:not(:disabled), .inline-reset:hover { filter: brightness(.92); }
.reset-button:disabled { background: var(--soft); border-color: var(--line); color: var(--muted); }
.reset-in-menu { width: 100%; }

/* ---------- Intro ---------- */
.intro { max-width: var(--page); margin: 0 auto; padding: clamp(28px, 6vw, 72px) var(--gutter) clamp(28px, 4vw, 48px); }
.section-switch { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 28px; border: 1px solid var(--line); border-radius: 999px; max-width: 100%; }
.section-switch-item {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 550; color: var(--muted); white-space: nowrap;
}
.section-switch-item.is-active { background: var(--ink); color: var(--paper); }
a.section-switch-item:hover { color: var(--ink); }
.eyebrow { margin-bottom: 14px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.intro h1 { max-width: 14ch; margin: 0 0 18px; font-size: clamp(40px, 6.2vw, 76px); line-height: 1.02; font-weight: 650; letter-spacing: -.04em; }
.intro-desc { max-width: 560px; margin: 0; font-size: 17px; line-height: 1.6; color: var(--muted); }
.intro-discount {
  display: inline-flex; align-items: center; gap: 10px; margin: 20px 0 0; padding: 7px 14px;
  border-radius: 999px; background: var(--red-soft); font-size: 13px; font-weight: 550;
}
.intro-discount strong { color: var(--red); font-weight: 700; }
.intro-price-note { display: flex; gap: 8px; align-items: baseline; max-width: 620px; margin: 18px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.intro-price-note span:first-child { flex: none; }

/* ---------- Catalogue controls ---------- */
.catalog { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter) clamp(64px, 8vw, 110px); }
.catalog-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; padding-top: 28px; margin-bottom: 20px; border-top: 1px solid var(--line); }
.catalog-heading h2 { margin: 0 0 4px; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.catalog-heading p { margin: 0; max-width: 620px; font-size: 13.5px; color: var(--muted); }
.catalog-total { font-size: 13px; color: var(--muted); white-space: nowrap; }
.filter-controls { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(180px, 240px) minmax(180px, 240px); gap: 10px; }
.search-wrap, .select-wrap {
  min-height: 48px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper); transition: border-color .15s, box-shadow .15s;
}
.search-wrap { gap: 12px; padding: 0 14px 0 16px; color: var(--muted); }
.search-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--ink); }
.search-wrap input::placeholder { color: var(--placeholder); opacity: 1; }
.search-wrap input:focus-visible { outline: none; }
.search-wrap kbd { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 6px; font: 500 11px var(--font); color: var(--muted); }
.search-wrap:focus-within, .select-wrap:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--soft); }
.select-wrap { justify-content: space-between; gap: 10px; padding: 0 12px 0 16px; }
.select-wrap > span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.select-wrap select { min-width: 0; max-width: 65%; border: 0; outline: 0; background: transparent; font-size: 13.5px; font-weight: 550; cursor: pointer; }
.select-wrap select option { background: var(--paper); color: var(--ink); }
.theme-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.theme-chip {
  min-height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  font-size: 13px; font-weight: 550; color: var(--ink); transition: background-color .15s, border-color .15s;
}
.theme-chip:hover { border-color: var(--muted); }
.theme-chip.selected { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.theme-count { margin-left: 4px; font-weight: 450; opacity: .55; }
.results-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 24px 0 16px; }
.results-text { margin: 0; font-size: 13px; color: var(--muted); }
.results-text strong { color: var(--ink); font-weight: 600; }
.availability-toggle { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); cursor: pointer; }
.availability-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch { position: relative; display: inline-block; flex: none; width: 32px; height: 18px; border-radius: 18px; background: var(--line); transition: background-color .2s; }
.switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.availability-toggle input:checked + .switch { background: var(--accent); }
.availability-toggle input:checked + .switch::before { transform: translateX(14px); }
.availability-toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 3px; }
.active-filters-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; padding: 10px 10px 10px 16px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--soft);
}
.active-label { font-size: 12.5px; font-weight: 600; }
.active-filter-pills { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.active-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 6px 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 12.5px; font-weight: 550;
}
.active-pill span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--soft); color: var(--red); font-size: 14px; line-height: 1; }
.active-pill:hover { border-color: var(--red); }

/* ---------- Product cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 36px 20px; }
.item-card { position: relative; min-width: 0; }
.card-open { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; border: 0; background: none; text-align: left; color: inherit; }
.card-image {
  position: relative; width: 100%; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden;
  border-radius: var(--r); background: var(--image-surface);
}
.card-image img { width: 80%; height: 80%; object-fit: contain; mix-blend-mode: multiply; transition: transform .35s var(--ease); }
.item-card:hover .card-image img { transform: scale(1.04); }
.card-badge, .detail-badge {
  position: absolute; top: 12px; left: 12px; z-index: 2; padding: 4px 9px; border-radius: 999px;
  background: var(--paper); color: var(--ink); font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
}
:root[data-palette="graphite"] .card-badge, :root[data-palette="graphite"] .detail-badge { background: #fff; color: #23272a; }
.card-badge.badge-open, .detail-badge.badge-open {
  display: flex; flex-direction: column; gap: 1px; max-width: calc(100% - 24px); padding: 6px 10px; border-radius: 10px;
  background: var(--open-bg); color: var(--open-ink); line-height: 1.3;
}
.badge-open .badge-detail { font-size: 9.5px; font-weight: 550; letter-spacing: .03em; }
.image-fallback { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; height: 100%; color: var(--placeholder); }
.fallback-block { display: grid; place-items: center; width: 56px; height: 56px; border: 1.5px solid currentColor; border-radius: 12px; font-size: 26px; transform: rotate(-10deg); }
.image-fallback small { font-size: 13px; font-weight: 600; }
.card-content { display: flex; flex-direction: column; flex: 1; width: 100%; padding: 14px 2px 0; }
.card-meta { display: flex; gap: 6px; margin-bottom: 4px; font-size: 12.5px; color: var(--muted); }
.card-meta span + span::before { content: "·"; margin-right: 6px; }
.card-title { margin: 0 0 4px; font-size: 15.5px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.card-packaging { font-size: 13px; line-height: 1.45; color: var(--muted); }
.card-quantity { font-size: 12.5px; color: var(--muted); }
.card-bottom { margin-top: auto; padding-top: 10px; }
.card-bottom > span { display: none; }
.card-price-stack, .detail-pricing { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.card-price-row, .detail-price-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.card-bottom .card-price-current { font-size: 17px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.card-price-original, .detail-price-original { order: 2; font-size: 12.5px; color: var(--muted); text-decoration: line-through; }
.card-price-stack { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.card-price-stack .card-price-row { order: 1; }
.card-price-stack .bricklink-source { display: none; }
.price-pln { font-size: 12.5px; font-weight: 450; color: var(--muted); white-space: nowrap; }
.discount-tag {
  display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 999px;
  background: var(--red-soft); color: var(--red); font-size: 11px; font-weight: 650; white-space: nowrap; align-self: center;
}
.bricklink-source { font-size: 12px; color: var(--muted); }
.empty-state { padding: 64px 20px; border: 1px dashed var(--line); border-radius: var(--r); text-align: center; }
.empty-state h3 { margin-bottom: 6px; font-size: 20px; font-weight: 650; }
.empty-state p { color: var(--muted); font-size: 14px; }
.loading { grid-column: 1 / -1; padding: 32px 0; font-size: 14px; color: var(--muted); }

/* ---------- About ---------- */
.about-section {
  max-width: var(--page); margin: 0 auto; padding: clamp(48px, 6vw, 80px) var(--gutter);
  display: grid; grid-template-columns: minmax(240px, .8fr) 1fr; gap: 24px 64px; border-top: 1px solid var(--line);
}
.about-section h2 { max-width: 420px; margin: 0; font-size: clamp(28px, 3.4vw, 42px); font-weight: 650; line-height: 1.1; letter-spacing: -.03em; }
.about-copy { max-width: 600px; }
.about-copy p { margin-bottom: 24px; font-size: 16px; line-height: 1.7; color: var(--muted); }
.about-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Product dialog ---------- */
.product-dialog {
  width: min(960px, calc(100vw - 32px)); max-height: min(92dvh, 900px); padding: 0; border: 0;
  border-radius: var(--r-lg); background: var(--paper); color: var(--ink); box-shadow: 0 40px 100px rgba(0,0,0,.22);
}
.product-dialog::backdrop { background: rgba(15,17,18,.55); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; top: 14px; right: 14px; z-index: 5; }
.detail-layout { display: grid; grid-template-columns: 1fr 1fr; }
.detail-image { position: relative; display: grid; place-items: center; min-height: 480px; background: var(--image-surface); }
.detail-image > img { width: 84%; max-height: 420px; object-fit: contain; mix-blend-mode: multiply; }
.detail-info { display: flex; flex-direction: column; padding: 44px 40px 32px; }
.detail-code { margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.detail-info h2 { margin: 0 0 18px; padding-right: 36px; font-size: clamp(24px, 2.6vw, 32px); font-weight: 650; line-height: 1.15; letter-spacing: -.025em; }
.detail-price { font-size: 28px; font-weight: 650; letter-spacing: -.02em; }
.detail-price-row .price-pln { font-size: 15px; }
.detail-pricing .detail-price-row { order: 1; }
.detail-pricing .detail-price-original { order: 2; font-size: 14px; }
.detail-pricing .bricklink-source { order: 3; }
.detail-price-note { margin: 8px 0 20px; font-size: 13px; color: var(--muted); }
.detail-spec { display: grid; grid-template-columns: minmax(110px, .6fr) 1fr; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.5; }
.detail-spec > span { color: var(--muted); }
.detail-spec strong { font-weight: 500; }
.detail-disclaimer { margin: 0; padding: 14px 0 20px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.detail-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .filter-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-wrap { grid-column: 1 / -1; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 14px; }
  .about-section { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-image { min-height: 300px; }
  .detail-image > img { max-height: 260px; width: 72%; }
  .detail-info { padding: 28px 22px 24px; }
}
@media (max-width: 600px) {
  .menu-toggle { top: 22px; }
  .masthead { min-height: 84px; }
  .intro-desc { font-size: 15.5px; }
  .catalog-heading { flex-direction: column; gap: 4px; }
  .select-wrap { padding: 0 8px 0 12px; gap: 6px; }
  .select-wrap > span { display: none; }
  .select-wrap select { width: 100%; max-width: none; font-size: 13.5px; }
  .card-image { border-radius: 12px; }
  .card-badge { top: 8px; left: 8px; font-size: 9.5px; }
  .card-title { font-size: 14.5px; }
  .card-packaging { font-size: 12.5px; }
  .card-bottom .card-price-current { font-size: 16px; }
  .price-pln { display: none; }
  .detail-price-row .price-pln { display: inline; }
  .detail-buttons .btn { flex: 1 1 auto; }
  .palette-option { font-size: 12px; }
}
@media (max-width: 380px) {
  .filter-controls { grid-template-columns: minmax(0, 1fr); }
  .search-wrap { grid-column: auto; }
}
