:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --panel: #ffffff;
  --ink: #20231f;
  --muted: #697066;
  --line: #e1e5dc;
  --brand: #2f6f4e;
  --brand-ink: #ffffff;
  --accent: #c85c3c;
  --shadow: 0 16px 44px rgba(40, 50, 38, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--brand);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 18px 14px 132px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 2px 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.08;
}

h2 {
  font-size: 20px;
}

.icon-button {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.icon-button::before {
  content: "";
  position: absolute;
  inset: 12px 10px 9px;
  border: 2px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 5px 5px;
}

.icon-button::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 9px;
  width: 12px;
  height: 8px;
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

#cartBadge {
  position: absolute;
  right: -5px;
  top: -6px;
  z-index: 1;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  line-height: 22px;
}

.search-row {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 4px 0 10px;
  background: var(--bg);
}

.search-row input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  caret-color: var(--ink);
  outline: none;
}

.search-row input:focus {
  border-color: var(--brand);
}

.categories {
  display: flex;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  margin: 0 -14px;
  padding: 3px 14px 24px;
  scroll-padding: 14px;
  scrollbar-width: none;
}

.categories::-webkit-scrollbar {
  display: none;
}

.category-button {
  flex: 0 0 auto;
  display: grid;
  width: 98px;
  min-width: 98px;
  grid-template-rows: 76px minmax(64px, auto);
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  color: var(--ink);
  text-align: left;
}

.category-button.active {
  color: var(--brand);
  font-weight: 750;
}

.category-thumb {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  justify-self: center;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)),
    #dfe7dc;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.12;
  padding: 8px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.category-thumb.has-image {
  background-color: #fff;
  background-size: contain;
}

.category-thumb-all {
  background:
    linear-gradient(135deg, #f8efe5 0 50%, #dfebdd 50%),
    #fff;
}

.category-button.active .category-thumb {
  border-color: var(--brand);
  box-shadow: 0 8px 20px rgba(47, 111, 78, 0.14);
}

.category-title {
  display: block;
  width: 84px;
  justify-self: center;
  min-height: 48px;
  overflow-wrap: anywhere;
  color: var(--brand);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.22;
  text-align: center;
}

.products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 2px;
}

.product {
  display: flex;
  flex-direction: column;
  min-height: 286px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.product-visual {
  flex: 0 0 136px;
  height: 136px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0)),
    var(--swatch, #9aa7a0);
  position: relative;
  overflow: hidden;
}

.product-visual.has-photo {
  background: #fff;
  transition: opacity 160ms ease;
}

.product-visual.has-photo:not(.loaded) {
  background:
    linear-gradient(90deg, rgba(245, 242, 234, 0.85), rgba(255, 255, 255, 0.72), rgba(245, 242, 234, 0.85)),
    var(--swatch, #f5f2ea);
  background-size: 180% 100%;
  animation: image-loading 1.1s ease-in-out infinite;
}

.product-visual::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: 34px;
  height: 38px;
  border-radius: 19px 7px 7px 19px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(32, 35, 31, 0.08);
}

.product-visual.has-photo::after {
  display: none;
}

.product-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 220ms ease;
}

.product-slide {
  display: grid;
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 0;
  background: #fff;
  padding: 12px;
  touch-action: pan-y;
}

.product-slide img {
  display: block;
  position: absolute;
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  object-fit: contain;
  object-position: center center;
  opacity: 0;
  transition: opacity 160ms ease;
}

.product-visual.category-watercolor .product-slide {
  place-items: end center;
  padding: 0;
}

.product-visual.category-watercolor .product-slide img {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.product-visual.category-oil-tubes-45 .product-slide {
  padding: 0;
}

.product-visual.category-oil-tubes-45 .product-slide img {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.product-visual.category-oil-doypack-200 .product-slide:first-child {
  padding: 0;
}

.product-visual.category-oil-doypack-200 .product-slide:first-child img {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.product-slide img.loaded {
  opacity: 1;
}

/* Larger, top-aligned product photos only in the “В подарок” section. */
.product.category-gift-sets .product-visual {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
}

.product.category-gift-sets .product-slide {
  padding: 0;
}

.product.category-gift-sets .product-slide img {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
}

.gallery-dots,
.image-viewer-dots {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.gallery-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7px;
  pointer-events: none;
}

.gallery-dots span,
.image-viewer-dots span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(32, 35, 31, 0.24);
}

.gallery-dots span.active,
.image-viewer-dots span.active {
  width: 14px;
  background: var(--brand);
}

@keyframes image-loading {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 10px;
}

.product h3 {
  min-height: 42px;
  margin: 0;
  font-size: 15px;
  line-height: 1.22;
}

.product p {
  min-height: 34px;
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.product-specs {
  display: grid;
  gap: 2px;
}

.product-specs span {
  display: block;
}

.product-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.price {
  font-weight: 750;
  white-space: nowrap;
}

.add-button,
.bottom-bar button,
.checkout-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
}

.add-button {
  width: 48px;
  min-height: 48px;
  font-size: 24px;
  line-height: 1;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: stretch;
  background: var(--panel);
  overscroll-behavior: contain;
  touch-action: none;
}

.sheet.open {
  display: flex;
}

.sheet-panel {
  width: min(720px, 100%);
  min-height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0 auto;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border-radius: 0;
  background: var(--panel);
  box-shadow: none;
  padding: 14px 14px 116px;
}

.sheet-handle {
  display: none;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.close-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px 10px;
  color: var(--ink);
}

.cart-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cart-row h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.cart-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.qty {
  display: grid;
  grid-template-columns: 46px 34px 46px;
  align-items: center;
  gap: 6px;
}

.qty button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf6;
  color: var(--ink);
  font-weight: 800;
}

.qty span {
  text-align: center;
}

.empty {
  margin: 24px 0;
  color: var(--muted);
  text-align: center;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 18px 0 0;
  font-size: 13px;
}

.legal-links a,
.consent-row a,
.cookie-banner a {
  color: var(--brand);
}

.checkout {
  display: grid;
  gap: 10px;
}

.form-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 4px;
  background: var(--panel);
}

.hidden,
.checkout.hidden {
  display: none;
}

.checkout input,
.checkout select,
.checkout textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
  color: var(--ink);
  caret-color: var(--ink);
  outline: none;
}

.checkout input:focus,
.checkout select:focus,
.checkout textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(47, 111, 78, 0.12);
}

.consent-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 9px;
  align-items: start;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.consent-row input {
  width: 20px;
  min-height: 20px;
  margin: 1px 0 0;
  padding: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.segmented label {
  display: grid;
  min-height: 48px;
  min-width: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  font-size: 13px;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented label:has(input:checked) {
  border-color: var(--brand);
  background: #e8f0e7;
  color: var(--brand);
  font-weight: 700;
}

.full-width {
  width: 100%;
  margin-top: 14px;
}

.text-button {
  width: max-content;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
  padding: 0;
}

.keyboard-hide-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf6;
  color: var(--ink);
  font-weight: 700;
  padding: 0 10px;
  white-space: nowrap;
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.bottom-bar div {
  min-width: 0;
}

.bottom-bar strong {
  display: block;
  font-size: 17px;
}

.bottom-bar span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.bottom-bar button {
  min-width: 158px;
  padding: 0 14px;
}

.bottom-bar button:disabled {
  background: #b8c0b3;
}

.cookie-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 40;
  display: none;
  width: min(696px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.cookie-banner.show {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.cookie-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.cookie-banner button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
  padding: 0 12px;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(15, 18, 14, 0.72);
}

.image-viewer.open {
  display: flex;
}

.image-viewer-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(680px, 100%);
  min-width: 0;
  height: auto;
  max-height: calc(100dvh - 28px);
  gap: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.image-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.image-viewer-head h2 {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-viewer-stage {
  position: relative;
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: min(66dvh, 620px);
  max-height: calc(100dvh - 130px);
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-viewer-stage img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  padding: 10px;
}

.image-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-50%);
}

.image-nav::before {
  content: "";
  position: absolute;
  top: 13px;
  width: 13px;
  height: 13px;
  border: solid var(--ink);
  border-width: 0 2px 2px 0;
}

.image-nav.prev {
  left: 8px;
}

.image-nav.prev::before {
  left: 16px;
  transform: rotate(135deg);
}

.image-nav.next {
  right: 8px;
}

.image-nav.next::before {
  right: 16px;
  transform: rotate(-45deg);
}

.image-nav:disabled {
  display: none;
}

.image-viewer-dots {
  min-height: 8px;
}

.legal-page {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.legal-back {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  color: var(--brand);
  font-weight: 700;
}

.legal-hero {
  padding: 12px 0 8px;
}

.legal-hero p {
  color: var(--muted);
  line-height: 1.45;
}

.legal-toc,
.legal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.legal-toc {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
}

.legal-toc a,
.legal-card a {
  color: var(--brand);
}

.legal-card {
  margin: 12px 0;
  padding: 14px;
}

.legal-card h2 {
  margin-bottom: 10px;
  font-size: 19px;
}

.legal-card h3 {
  margin: 14px 0 6px;
  font-size: 15px;
}

.legal-card p {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.48;
}

.seller-details {
  display: grid;
  gap: 10px;
  margin: 0;
}

.seller-details div {
  display: grid;
  gap: 2px;
}

.seller-details dt {
  color: var(--muted);
  font-size: 12px;
}

.seller-details dd {
  margin: 0;
  line-height: 1.35;
}

@media (min-width: 680px) {
  .app {
    padding-top: 24px;
  }

  .products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
