/* ==========================================================================
   richter2026 — utilities.css
   Small reusable helpers + restyle of breadcrumb, pagination, alert
   boxes, pill badges. Targets existing class names (.breadcrumb,
   .pagination, .success/.warning/.attention) — no markup changes.
   Milestone: 0.1 Foundation
   ========================================================================== */

/* ---- Alerts -------------------------------------------------------------- */

.success,
.warning,
.attention,
.information {
  padding: var(--space-4) var(--space-5);
  margin: 0 0 var(--space-5) 0;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  background-image: none !important; /* drop legacy icon sprites */
}

.success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success);
}

.warning {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning);
}

.attention {
  background: var(--color-attention-bg);
  border: 1px solid var(--color-attention-border);
  color: var(--color-attention);
}

.success .close,
.warning .close,
.attention .close,
.information .close {
  float: right;
  cursor: pointer;
  opacity: .6;
}

.success .close:hover,
.warning .close:hover,
.attention .close:hover,
.information .close:hover {
  opacity: 1;
}

/* ---- Breadcrumb ------------------------------------------------------- */

.breadcrumb {
  background: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  margin: 0 0 var(--space-6) 0;
  padding: 0;
}

.breadcrumb a {
  color: var(--color-text-muted);
}

.breadcrumb a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ---- Pagination --------------------------------------------------------- */

.pagination {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.pagination .links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-right: var(--space-1);
  text-decoration: none;
  color: var(--color-text-muted);
}

.pagination .links a:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.pagination .links b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-semibold);
  color: #fff;
  background: var(--color-primary);
  margin-right: var(--space-1);
}

.pagination .results {
  color: var(--color-text-faint);
  font-size: var(--font-size-sm);
}

/* ---- Stock status dots (legacy used red/green .png icons) -------------- */

.richter-stock {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.richter-stock::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-stock-out);
}

.richter-stock--in::before {
  background: var(--color-stock-in);
}

/* ---- Generic spacing / layout helpers ----------------------------------- */

.richter-mt-0 { margin-top: 0 !important; }
.richter-mb-0 { margin-bottom: 0 !important; }
.richter-text-center { text-align: center; }
.richter-text-muted { color: var(--color-text-muted); }

.richter-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.richter-badge--accent {
  background: var(--color-accent);
  color: #fff;
}

.richter-badge--primary {
  background: var(--color-primary);
  color: #fff;
}

/* ---- Responsive --------------------------------------------------------- */

@media (max-width: 599px) {
  .pagination {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .pagination .links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .pagination .results {
    width: 100%;
    text-align: left;
  }
}

/* ---- v0.9 Polish: alert box refinements -------------------------------- */

/* Add a left border accent stripe to alerts for stronger visual hierarchy */
.success  { border-left: 4px solid var(--color-success);  }
.warning  { border-left: 4px solid var(--color-warning);  }
.attention { border-left: 4px solid var(--color-attention); }

/* ---- Suppress RDFa microdata breadcrumb duplicate (category.tpl) ------
   category.tpl renders an RDFa <span xmlns:v> block with <a> tags
   that have no visible text content — they're semantic microdata only.
   Without this rule they create a blank "ghost" breadcrumb line. */
span[xmlns\:v] {
  display: none;
}

/* ---- Lightbox (javascript/lightbox.js) ---------------------------------
   Vanilla replacement for the jQuery "colorbox" plugin, which was
   referenced across product/news/register templates but never
   actually shipped with any CSS or a working init. Used for the
   product image zoom, news article image, and the "terms and
   conditions" popups on the register forms / shipping quote result
   on the cart page. */

.richter-lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: rgba(15, 17, 21, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base);
}

.richter-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.richter-lightbox__box {
  position: relative;
  max-width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
}

.richter-lightbox__close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-bg-subtle);
  color: var(--color-text);
  font-size: var(--font-size-lg);
  line-height: 1;
  cursor: pointer;
}

.richter-lightbox__close:hover {
  background: var(--color-bg-muted);
}

.richter-lightbox__content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.richter-lightbox__content h1 {
  margin: 0 var(--space-8) var(--space-4) 0;
  font-size: var(--font-size-xl);
  line-height: 1.25;
}

.richter-lightbox__caption {
  margin-top: var(--space-3);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

body.richter-lightbox-locked {
  overflow: hidden;
}

/* ---- Sitemap page (.sitemap-info in information/sitemap.tpl) -----------
   Two-column layout: full category tree on the left, site links
   (account/checkout/information) on the right. Mirrors the two-column
   card language already used by .login-content in account.css. */

.sitemap-info {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.sitemap-info .left,
.sitemap-info .right {
  flex: 1 1 320px;
  min-width: 260px;
}

.sitemap-info ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sitemap-info ul ul {
  padding-left: var(--space-5);
  margin-top: var(--space-2);
}

.sitemap-info li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.sitemap-info li > a {
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
}

.sitemap-info ul ul li {
  border-bottom: none;
  padding: var(--space-1) 0;
  font-weight: var(--font-weight-regular);
}

.sitemap-info ul ul li > a {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-regular);
}

.sitemap-info li > a:hover,
.sitemap-info ul ul li > a:hover {
  color: var(--color-primary);
}

@media (max-width: 767px) {
  .sitemap-info {
    flex-direction: column;
  }
}

/* ---- Lightbox image viewer (single picture + galleries, lightbox.js) ------
   Dark, picture-first: no white card around images. Galleries get prev/next
   buttons (mouse), a counter, and swipe/drag on the stage (touch + mouse). */

.richter-lightbox.is-viewer {
  background: rgba(15, 17, 21, 0.88);
  padding: var(--space-3);
}

.richter-lightbox.is-viewer .richter-lightbox__box {
  max-width: 100%;
  max-height: none;
  padding: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.richter-lightbox.is-viewer .richter-lightbox__close {
  position: fixed;
  top: var(--space-3);
  right: var(--space-3);
  z-index: 3;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.richter-lightbox.is-viewer .richter-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.richter-lightbox__stage {
  display: flex;
  justify-content: center;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.richter-lightbox__stage img {
  display: block;
  max-width: min(96vw, 1100px);
  max-height: calc(100vh - 150px);
  max-height: calc(100dvh - 150px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: #fff;
  transition: opacity 0.2s ease, transform 0.25s ease;
  -webkit-user-drag: none;
}

.richter-lightbox.is-viewer .richter-lightbox__caption {
  color: rgba(255, 255, 255, 0.85);
}

.richter-lightbox__counter {
  position: fixed;
  bottom: var(--space-4);
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  padding: 2px var(--space-3);
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: var(--font-size-sm);
  line-height: 1.6;
}

.richter-lightbox__nav {
  position: fixed;
  top: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
}

.richter-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.richter-lightbox__nav--prev {
  left: var(--space-3);
}

.richter-lightbox__nav--next {
  right: var(--space-3);
}

.richter-lightbox__nav::before {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.richter-lightbox__nav--prev::before {
  transform: rotate(135deg);
  margin-left: 4px;
}

.richter-lightbox__nav--next::before {
  transform: rotate(-45deg);
  margin-right: 4px;
}

/* touch devices swipe; keep the picture free of buttons */
@media (hover: none) {
  .richter-lightbox__nav {
    display: none;
  }
}

