/* Shared, theme-agnostic components (loaded before every theme.css).
   Cross-cutting widgets that should look/behave the same in every theme:
   accessibility helpers, the contact form, lightbox and WhatsApp button.
   Everything consumes design tokens, so colours still vary per tenant.
   Visual identity (typography, layout, sections) lives in each theme.css. */

*, *::before, *::after { box-sizing: border-box; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--color-primary); color: var(--color-primary-contrast);
  padding: 0.6rem 1rem;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Contact form --------------------------------------------------------- */

.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.contact-form { max-width: 34rem; }
.form-field { margin: 0 0 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.form-field label { font-weight: 600; font-size: 0.95rem; }
.form-field input, .form-field textarea {
  font: inherit; color: inherit; padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  background: var(--color-surface); width: 100%;
}
.form-field textarea { resize: vertical; }
.form-hint { color: var(--color-muted); font-size: 0.9rem; }
.field-error { color: #b91c1c; font-size: 0.85rem; }
.form-error { color: #b91c1c; font-weight: 600; }
.contact-success { background: #dcfce7; color: #166534; padding: 1.25rem 1.5rem; border-radius: var(--radius); }
.contact-success h3 { margin: 0 0 0.25rem; }

/* --- WhatsApp floating button --------------------------------------------- */

.wa-float {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 30;
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: #25d366; color: #fff; text-decoration: none; font-weight: 600;
  padding: 0.7rem 1rem; border-radius: 999px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.wa-float:hover { filter: brightness(0.96); }
@media (max-width: 30rem) { .wa-float span { display: none; } .wa-float { padding: 0.8rem; } }

/* --- Lightbox (enhanced by site.js; thumbnails are plain links without JS) -- */

.lightbox {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(15, 15, 15, 0.9); padding: 1.5rem; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox__img { max-width: 100%; max-height: 90vh; border-radius: var(--radius); }
.lightbox__close {
  position: absolute; top: 1rem; right: 1rem; font-size: 2rem; line-height: 1;
  background: none; border: none; color: #fff; cursor: pointer;
}

/* --- Stock catalogue (theme-agnostic; themes may override) ----------------- */

.shop-filter ul { list-style: none; margin: 0 0 1.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.shop-filter a {
  display: inline-block; padding: 0.4rem 0.9rem; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--color-border); color: inherit; font-size: 0.95rem;
}
.shop-filter a[aria-current="true"] { background: var(--color-primary); color: var(--color-primary-contrast); border-color: var(--color-primary); }
.shop-group { margin: 0 0 2rem; }
.shop-group__heading { margin: 0 0 1rem; }
.product-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}
.product-card {
  border: 1px solid var(--color-border); border-radius: var(--radius);
  background: var(--color-surface); overflow: hidden; display: flex; flex-direction: column;
}
.product-card__img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.product-card__body { padding: 1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.product-card__name { margin: 0; font-size: 1.05rem; }
.product-card__price { margin: 0; font-weight: 700; }
.product-card__desc { margin: 0; color: var(--color-muted); font-size: 0.95rem; }
.avail {
  align-self: flex-start; margin-top: 0.25rem; padding: 0.2rem 0.6rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600;
}
.avail--in_stock { background: #dcfce7; color: #166534; }
.avail--low { background: #fef3c7; color: #92400e; }
.avail--out { background: #f1f5f9; color: #475569; }
.shop-empty { color: var(--color-muted); }
.product-card__buy { margin-top: 0.6rem; }
.product-card__buy-btn { width: 100%; }

/* Mobile nav toggle is hidden until site.js reveals it (themes style it). */
.nav-toggle { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
