body {
  --brand-color: #ff8522;
  --accent-color: #7fff00;
  --surface-color: #2f2f2f;
  --background-image: url("/static/mall-bg.webp");
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--brand-color);
  background-color: var(--surface-color);
  background-image:
    linear-gradient(rgba(47, 47, 47, 0.5), rgba(47, 47, 47, 0.5)),
    var(--background-image);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
}

body.retailer-novus {
  --brand-color: #e8f6d8;
  --accent-color: #b8e62e;
  --surface-color: #123725;
  --background-image: url("/static/novus-bg.jpg");
}

pre {
  font-family: Consolas, "Courier New", monospace;
}

/* Помаранчевий, повністю непрозорий шрифт у контенті */
main,
main * {
  color: var(--brand-color) !important;
}

/* Графітові поверхні з прозорістю 50% — крізь них видно фото */
main .bg-white,
main .bg-slate-50,
main .bg-emerald-600,
main .bg-emerald-700,
main .bg-rose-600,
main .bg-slate-400,
main .bg-amber-50 {
  background-color: color-mix(in srgb, var(--surface-color) 72%, transparent) !important;
}

main input,
main select {
  background-color: color-mix(in srgb, var(--surface-color) 72%, transparent) !important;
}

/* Графітове випадаюче меню категорій із прозорістю 50% */
main select {
  color-scheme: dark;
}

main select option {
  background-color: rgba(47, 47, 47, 0.5) !important;
  color: var(--brand-color) !important;
}

main select option:checked {
  background-color: rgba(47, 47, 47, 0.75) !important;
  color: var(--accent-color) !important;
}

.category-select {
  position: relative;
}

.category-select__button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--brand-color) 40%, transparent);
  border-radius: 0.25rem;
  background-color: color-mix(in srgb, var(--surface-color) 72%, transparent) !important;
  color: var(--brand-color) !important;
  text-align: left;
  cursor: pointer;
}

.category-select__button:hover,
.category-select__button:focus-visible {
  border-color: color-mix(in srgb, var(--brand-color) 80%, transparent);
  outline: none;
}

.category-select__chevron {
  color: var(--brand-color) !important;
  transition: transform 0.15s ease;
}

.category-select.is-open .category-select__chevron {
  transform: rotate(180deg);
}

.category-select__menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  max-height: 20rem;
  overflow-y: auto;
  padding: 0.25rem 0;
  border: 1px solid color-mix(in srgb, var(--brand-color) 40%, transparent);
  border-radius: 0.375rem;
  background-color: color-mix(in srgb, var(--surface-color) 72%, transparent) !important;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 133, 34, 0.55) rgba(47, 47, 47, 0.35);
}

.category-select__menu[hidden] {
  display: none;
}

.category-select__menu li {
  padding: 0.4rem 0.75rem;
  color: var(--brand-color) !important;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.category-select__menu li:hover,
.category-select__menu li.is-active {
  background-color: rgba(255, 133, 34, 0.16) !important;
  color: #ffffff !important;
}

.category-select__menu li.is-selected {
  background-color: rgba(127, 255, 0, 0.08) !important;
  color: var(--accent-color) !important;
}

.category-select__menu::-webkit-scrollbar {
  width: 10px;
}

.category-select__menu::-webkit-scrollbar-track {
  background: rgba(47, 47, 47, 0.35);
}

.category-select__menu::-webkit-scrollbar-thumb {
  background: rgba(255, 133, 34, 0.55);
  border-radius: 5px;
}

main .border-slate-100 {
  border-color: rgba(255, 255, 255, 0.12) !important;
}

main .border-slate-300,
main .border-amber-200 {
  border-color: color-mix(in srgb, var(--brand-color) 40%, transparent) !important;
}

/* Білі заголовки та комірки колонок у таблиці товарів */
main th.text-white,
main td.text-white {
  color: #ffffff !important;
}

/* Лаймовий акцент для акційної ціни та деталей акції */
main .text-lime,
main .text-lime * {
  color: var(--accent-color) !important;
}

/* Дрібний другорядний текст під назвою товару */
main .product-meta,
main .product-meta * {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Керування сортуванням у заголовках таблиці */
main .sort-hint {
  color: rgba(255, 255, 255, 0.55) !important;
  font-size: 0.7em;
  font-weight: 600;
}

main .sort-arrows {
  display: inline-flex;
  flex-direction: column;
  line-height: 0.7;
  vertical-align: middle;
}

main .sort-arrows a.sort-arrow {
  color: rgba(255, 255, 255, 0.5) !important;
  font-size: 10px;
  line-height: 1;
  padding: 1px 2px;
  text-decoration: none;
}

main .sort-arrows a.sort-arrow:hover,
main .sort-arrows a.sort-arrow.sort-arrow-active {
  color: var(--accent-color) !important;
}

/* Фото товарів лишаються повністю непрозорими */
main img {
  opacity: 1 !important;
  filter: none !important;
}

/* Product detail: the gallery and price history each use half of the desktop
   canvas. The line chart replaces the former per-run history table. */
.product-detail__back {
  margin-bottom: 1rem;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}

.product-gallery,
.product-detail__content {
  min-width: 0;
}

.product-gallery {
  padding: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--brand-color) 30%, transparent);
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--surface-color) 78%, transparent);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.22);
}

.product-gallery__main {
  display: grid;
  place-items: center;
  min-height: clamp(20rem, 44vw, 39rem);
  margin: 0;
  overflow: hidden;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.96);
}

.product-gallery__main img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: clamp(20rem, 44vw, 39rem);
  object-fit: contain;
}

.product-gallery__empty {
  display: grid;
  min-height: clamp(20rem, 44vw, 39rem);
  place-items: center;
  padding: 1.5rem;
  border: 1px dashed color-mix(in srgb, var(--brand-color) 42%, transparent);
  border-radius: 0.55rem;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.product-gallery__toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.product-gallery__count {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.82rem;
  white-space: nowrap;
}

.product-gallery__thumbnails {
  display: flex;
  min-width: 0;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.1rem;
}

.product-gallery__thumbnail {
  flex: 0 0 auto;
  width: 4.25rem;
  height: 4.25rem;
  padding: 0.15rem;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.95) !important;
  cursor: pointer;
}

.product-gallery__thumbnail:hover,
.product-gallery__thumbnail:focus-visible,
.product-gallery__thumbnail.is-active {
  border-color: var(--accent-color);
  outline: none;
}

.product-gallery__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-detail__content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.product-detail__header,
.product-price-chart {
  padding: 1.25rem;
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--surface-color) 78%, transparent);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.22);
}

.product-price-chart {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 26rem;
}

.product-price-chart__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.product-price-chart__canvas {
  position: relative;
  flex: 1 1 auto;
  min-height: 20rem;
  margin-top: 1rem;
}

@media (max-width: 767px) {
  .product-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-gallery__main,
  .product-gallery__empty {
    min-height: min(78vw, 32rem);
  }

  .product-gallery__main img {
    max-height: min(78vw, 32rem);
  }

  .product-price-chart {
    min-height: 22rem;
  }

  .product-price-chart__canvas {
    min-height: 17rem;
  }
}

.retailer-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(9.5rem, 1fr));
  align-items: stretch;
  gap: 0.5rem;
  min-width: 0;
}

.retailer-switch__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 5.25rem;
  padding: 0.35rem 0.5rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.5rem;
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.1;
  text-align: center;
}

.retailer-switch__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 9.25rem;
  height: 3.55rem;
}

.retailer-switch__logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.retailer-switch__campaign {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.93rem;
}

.retailer-switch__campaign--silpo {
  color: #ff8522;
}

.retailer-switch__campaign--novus {
  color: #b8e62e;
}

.retailer-switch__item:hover,
.retailer-switch__item.is-active {
  border-color: var(--accent-color);
  background: color-mix(in srgb, var(--accent-color) 17%, transparent);
  color: var(--accent-color);
}

.retailer-switch__item.is-active {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-color) 45%, transparent);
}

#nav-links {
  display: none;
}

#nav-links.open {
  display: flex;
}

@media (min-width: 640px) {
  #nav-links {
    display: flex;
  }
}

@media (max-width: 639px) {
  body {
    background-attachment: scroll, scroll;
  }

  .retailer-switch {
    flex: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.3rem;
    max-width: calc(100vw - 5.5rem);
  }

  .retailer-switch__item {
    min-height: 4.8rem;
    padding-inline: 0.25rem;
  }

  .retailer-switch__campaign {
    font-size: 0.83rem;
  }

  .retailer-switch__logo {
    width: min(100%, 8.2rem);
    height: 3.15rem;
  }

  .offers-shell {
    overflow: visible !important;
  }

  .offers-table,
  .offers-table tbody,
  .offers-table tr,
  .offers-table td {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }

  .offers-table colgroup,
  .offers-table thead {
    display: none;
  }

  .offers-table tr {
    margin: 0.75rem;
    padding: 0.25rem 0;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--surface-color) 78%, transparent);
  }

  .offers-table td {
    display: grid;
    grid-template-columns: minmax(6.8rem, 42%) 1fr;
    align-items: start;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem !important;
    text-align: right !important;
    white-space: normal !important;
  }

  .offers-table td::before {
    content: attr(data-label);
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: left;
  }

  .offers-table td:first-child {
    display: block;
    padding-top: 0.75rem !important;
    text-align: left !important;
  }

  .offers-table td:first-child::before {
    display: none;
  }

  .offers-table td:first-child .flex {
    align-items: flex-start;
  }
}
