:root {
  --rh-forest: #245c58;
  --rh-forest-dark: #194743;
  --rh-honey: #d5a447;
  --rh-terracotta: #c9775d;
  --rh-ivory: #fbf8f0;
  --rh-sage: #e8f1eb;
  --rh-ink: #203a39;
  --rh-muted: #617471;
  --rh-white: #ffffff;
  --rh-border: #dedcd2;
  --rh-color-primary: var(--rh-forest);
  --rh-color-primary-hover: var(--rh-forest-dark);
  --rh-color-accent: var(--rh-honey);
  --rh-color-highlight: var(--rh-terracotta);
  --rh-color-background: var(--rh-ivory);
  --rh-color-surface: var(--rh-white);
  --rh-color-surface-soft: var(--rh-sage);
  --rh-color-text: var(--rh-ink);
  --rh-color-text-muted: var(--rh-muted);
  --rh-font-heading: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --rh-font-body: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  --ink: var(--rh-color-text);
  --muted: var(--rh-color-text-muted);
  --paper: var(--rh-color-background);
  --surface: var(--rh-color-surface-soft);
  --accent: var(--rh-color-primary);
  --accent-dark: var(--rh-color-primary-hover);
  --line: var(--rh-border);
  --radius: 14px;
  --radius-lg: 24px;
  --shadow: 0 12px 36px rgb(32 58 57 / 10%);
  --content-width: 1180px;
  --transition: 180ms ease;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.65 var(--rh-font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-dark); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button {
  border: 0;
  border-radius: 999px;
  padding: .7rem 1rem;
  background: var(--accent);
  color: white;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--rh-honey); outline-offset: 3px; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 10; background: white; padding: .5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.site-header, .site-footer, main, .breadcrumbs {
  width: min(var(--content-width), calc(100% - 2rem));
  margin-inline: auto;
}
.site-header-shell {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgb(36 92 88 / 10%);
  background: rgb(251 248 240 / 94%);
  backdrop-filter: blur(12px);
}
.site-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-block: .7rem;
}
.logo {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .7rem;
  color: var(--rh-forest-dark);
  text-decoration: none;
}
.logo img { width: 48px; height: 48px; border-radius: var(--radius); }
.logo span { display: grid; gap: .12rem; }
.logo strong { font: 700 1.32rem/1 var(--rh-font-heading); }
.logo small { color: var(--muted); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; }
.search { display: flex; flex: 0 1 auto; min-width: 0; gap: .5rem; margin-left: auto; }
.search input {
  flex: 1 1 320px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .68rem 1rem;
  background: var(--rh-white);
  color: var(--ink);
}
.search input:focus { border-color: var(--accent); }
.utility-nav { display: flex; align-items: center; gap: 1rem; }
.cart-link { white-space: nowrap; font-weight: 700; text-decoration: none; }
.account-link { white-space: nowrap; text-decoration: none; }
#cart-count {
  display: inline-grid;
  min-width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  border-radius: 999px;
  background: var(--rh-honey);
  color: var(--ink);
  font-size: .78rem;
}
main { min-height: 68vh; padding-block: 2.5rem 4rem; }
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding-block: 1.5rem;
  font-size: .9rem;
}
.site-footer p { margin: 0; }
.footer-brand { color: var(--rh-forest-dark); font: 700 1.2rem/1 var(--rh-font-heading); text-decoration: none; }
h1, h2 { font-family: var(--rh-font-heading); line-height: 1.12; letter-spacing: -.02em; }
h1 { margin: .2rem 0 1rem; font-size: clamp(2.2rem, 6vw, 4.8rem); font-weight: 700; }
h2 { color: var(--rh-forest-dark); font-size: clamp(1.8rem, 4vw, 2.6rem); }
.eyebrow { margin: 0; color: var(--accent); font-size: .78rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.hero {
  min-height: min(700px, 76svh);
  display: grid;
  max-width: none;
  place-items: center;
  padding: 3rem 1.5rem;
  border-radius: var(--radius-lg);
  background-color: var(--paper);
  background-image: url("/static/brand/hero-background.webp");
  background-position: center;
  background-size: cover;
}
.hero__content {
  width: min(650px, 100%);
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid rgb(36 92 88 / 10%);
  border-radius: var(--radius-lg);
  background: rgb(251 248 240 / 84%);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(4px);
}
/* Ширина у vw не враховує відступи предків і розпирає блок — рахуємо від доступного місця. */
.hero__logo { display: block; width: min(340px, 100%); margin: -.8rem auto -1rem; }
.hero .lead { max-width: 52ch; margin: 1rem auto 1.5rem; color: var(--muted); font-size: 1.12rem; }
.primary-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .8rem 1.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--rh-white);
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}
.primary-button:hover { background: var(--accent-dark); box-shadow: 0 2px 8px rgb(32 58 57 / 10%); transform: translateY(-1px); }
.page-heading > p:last-child, .lead { max-width: 720px; color: var(--muted); font-size: 1.12rem; }
.categories { padding-top: 4.5rem; scroll-margin-top: 6rem; }
.section-heading { margin-bottom: 1.5rem; text-align: center; }
.section-heading h2 { margin: .25rem 0; }
.categories ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; list-style: none; padding: 0; }
.category-card {
  overflow: hidden;
  border: 1px solid rgb(36 92 88 / 11%);
  border-radius: var(--radius-lg);
  background: white;
  box-shadow: 0 2px 8px rgb(32 58 57 / 6%);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.category-card:hover { border-color: rgb(36 92 88 / 28%); box-shadow: var(--shadow); transform: translateY(-3px); }
.category-card__media, .category-card__placeholder { display: grid; width: 100%; height: auto; aspect-ratio: 4 / 3; place-items: center; object-fit: cover; background: var(--surface); color: var(--rh-forest); font-size: 3rem; }
.category-card__body { padding: 1.2rem 1.35rem 1.35rem; }
.category-card h3 { margin: 0; font: 700 1.45rem/1.2 var(--rh-font-heading); }
.category-card h3 a { color: var(--rh-forest-dark); text-decoration: none; }
.category-card h3 a::after { content: " →"; color: var(--rh-honey); }
.category-card p { margin: .5rem 0 0; color: var(--muted); font-size: .92rem; }
.inspiration { margin-top: 4.5rem; padding: clamp(2rem, 7vw, 4.5rem); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.inspiration h2 { margin: .3rem 0 1rem; }
.inspiration .lead { margin: 0 auto 1.5rem; }
.inspiration__button { min-height: 48px; display: inline-flex; align-items: center; padding: .8rem 1.4rem; border-radius: 999px; background: var(--rh-honey); color: var(--ink); font-weight: 700; text-decoration: none; transition: transform var(--transition), filter var(--transition); }
.inspiration__button:hover { filter: brightness(.94); transform: translateY(-1px); }
.breadcrumbs { padding-top: 1rem; color: var(--muted); font-size: .9rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; margin: 0; padding: 0; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: .45rem; color: var(--rh-muted); }
.page-heading { margin-bottom: 2rem; }
.page-heading h1 { font-size: clamp(2rem, 5vw, 3.8rem); }
.category-heading { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(280px, 1.2fr); gap: 2rem; align-items: center; }
.category-heading__media { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: var(--radius-lg); background: var(--surface); object-fit: cover; }
.catalog-layout { display: grid; grid-template-columns: 230px 1fr; gap: 2rem; align-items: start; }
/* Блок фільтрів рендериться лише за наявності фасетів — без нього товари не мають падати у вузьку колонку. */
.catalog-layout:not(:has(.facets)) { grid-template-columns: 1fr; }
.facets { position: sticky; top: 1rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--surface); }
.facets h2 { margin-top: 0; }
.facets fieldset { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; padding: 1rem 0 0; }
.facets legend { font-weight: 700; }
.facets label { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center; margin-top: .55rem; }
.facets small { color: var(--muted); }
.facet-actions { display: flex; gap: .8rem; align-items: center; }
.result-count { color: var(--muted); margin-top: 0; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; list-style: none; margin: 0; padding: 0; }
.product-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.product-card__link { color: var(--ink); text-decoration: none; }
/* height: auto обов'язковий — інакше атрибут height у розмітці фіксує висоту
   й перебиває aspect-ratio, через що квадратне фото ставало прямокутним.
   contain замість cover: фото має вміщатися повністю, а не обрізатися. */
.product-card img, .product-card__placeholder { display: grid; width: 100%; height: auto; aspect-ratio: 1; place-items: center; object-fit: contain; background: var(--surface); color: var(--rh-muted); font-size: 4rem; }
.product-card h2 { min-height: 2.4em; margin: 1rem 1rem .5rem; font: 600 1.08rem/1.2 system-ui, sans-serif; }
.product-card .price, .product-card .out-of-stock { margin: .5rem 1rem 1.1rem; }
.product-card__buy { display: grid; gap: .5rem; margin: 0 1rem 1.1rem; }
.product-card__buy select { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: .55rem; background: var(--rh-white); color: var(--ink); }
.product-card__buy button { min-height: 44px; }
.product-card [id^="cart-feedback-"]:not(:empty) { margin: 0 1rem 1.1rem; font-size: .85rem; }
.product-card .notice { color: var(--rh-forest); }
.product-card .form-error { color: var(--rh-terracotta); }
.product-card__panel { display: none; }
.price { font-weight: 750; }
.old-price { margin-left: .5rem; color: var(--muted); font-weight: 400; text-decoration: line-through; }
.in-stock { color: var(--rh-forest); }
.out-of-stock, .sku, .order-terms { color: var(--muted); }
.pagination { display: flex; gap: .5rem; margin-top: 2rem; }
.pagination a, .pagination span { min-width: 2.3rem; border: 1px solid var(--line); border-radius: 7px; padding: .45rem; text-align: center; text-decoration: none; }
.pagination [aria-current="page"] { background: var(--ink); color: white; }
.empty-state { border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; color: var(--muted); }

.product { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr); gap: 2.5rem; }
.gallery { display: grid; gap: 1rem; }
.gallery img, .gallery video, .gallery__placeholder { display: grid; width: 100%; height: auto; aspect-ratio: 1; place-items: center; object-fit: contain; border-radius: var(--radius); background: var(--surface); color: var(--rh-muted); font-size: 8rem; }
.gallery video { aspect-ratio: 16 / 9; background: var(--ink); }
.product h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.variants { margin: 1.5rem 0; }
.variants [role="group"] { display: flex; flex-wrap: wrap; gap: .5rem; }
.variants button { border: 1px solid var(--line); background: white; color: var(--ink); }
.variants button:hover { border-color: var(--accent); color: var(--accent-dark); }
.add-to-cart { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-top: 1rem; }
.add-to-cart label, .cart-quantity label { display: grid; gap: .3rem; color: var(--muted); font-size: .85rem; }
.add-to-cart input, .cart-quantity input { width: 8rem; border: 1px solid var(--line); border-radius: 8px; padding: .65rem; }
.description, .attributes { grid-column: 1 / -1; max-width: 800px; }
.attributes dl > div { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr; gap: 1rem; border-top: 1px solid var(--line); padding: .8rem 0; }
.attributes dt { color: var(--muted); }
.attributes dd { margin: 0; }

.cart-layout, .checkout-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 2rem; align-items: start; }
.cart-items { display: grid; gap: 1rem; }
.cart-item { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto auto auto; gap: 1rem; align-items: center; border-bottom: 1px solid var(--line); padding: 0 0 1rem; }
.cart-item h2 { margin: 0; font: 650 1.1rem/1.3 system-ui, sans-serif; }
.cart-item p { margin: .25rem 0; color: var(--muted); }
.cart-item__media, .cart-item__placeholder { display: grid; width: 120px; aspect-ratio: 1; place-items: center; overflow: hidden; border-radius: var(--radius); background: var(--surface); color: var(--rh-muted); font-size: 2.5rem; }
.cart-item__media img, .cart-item__media video { width: 100%; height: 100%; object-fit: cover; }
.link-button { padding: 0; background: transparent; color: var(--accent-dark); text-decoration: underline; }
.order-summary { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; background: var(--surface); }
.order-summary h2 { margin-top: 0; }
.order-summary ul { display: grid; gap: .75rem; padding: 0; list-style: none; }
.order-summary li { display: flex; justify-content: space-between; gap: 1rem; }
.summary-total { font-size: 1.35rem; font-weight: 750; }
.min-order-warning { border-left: 4px solid var(--rh-terracotta); border-radius: 6px; padding: .7rem .9rem; background: rgb(201 119 93 / 12%); color: var(--ink); font-size: .92rem; }
.checkout-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.checkout-form label { display: grid; gap: .35rem; font-weight: 650; }
.checkout-form input, .checkout-form select, .checkout-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .7rem; background: white; }
.checkout-form label:has(textarea), .checkout-form button { grid-column: 1 / -1; }
.success-card { max-width: 720px; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.5rem, 5vw, 3rem); background: var(--surface); }
.auth-shell { display: grid; place-items: center; }
.auth-card { width: min(480px, 100%); border: 1px solid var(--line); border-radius: 16px; padding: clamp(1.4rem, 5vw, 2.5rem); background: white; box-shadow: var(--shadow); }
.auth-card h1 { font-size: clamp(2.3rem, 6vw, 3.7rem); }
.account-form { display: grid; gap: 1rem; margin-block: 1.5rem; }
.account-form label { display: grid; gap: .35rem; font-weight: 650; }
.account-form input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .7rem; background: white; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.account-heading, .order-heading, .panel-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.account-grid { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; }
.account-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; background: white; box-shadow: var(--shadow); }
.account-panel h2 { margin-top: 0; }
.order-list { display: grid; gap: .5rem; padding: 0; list-style: none; }
.order-list li a { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: .75rem; align-items: center; border-bottom: 1px solid var(--line); padding: .75rem 0; color: var(--ink); text-decoration: none; }
.order-list-full { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.5rem; background: white; }
.badge { display: inline-block; width: fit-content; border-radius: 99px; padding: .2rem .55rem; background: var(--rh-sage); color: var(--rh-forest); font-size: .78rem; }
.status-cancelled { background: rgb(201 119 93 / 16%); color: var(--rh-terracotta); }
.account-order-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1.5rem; align-items: start; }
.order-items-list { display: grid; gap: 0; padding: 0; list-style: none; }
.order-items-list li { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; gap: 1rem; border-bottom: 1px solid var(--line); padding: .85rem 0; }
.order-items-list div { display: grid; }
.order-items-list div span, .muted { color: var(--muted); }

/* Сайдбар фільтрів забирає 230px, і ширшим карткам не лишається місця:
   на планшеті це давало один товар у ряд. Краще віддати сітці всю ширину. */
@media (max-width: 900px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .facets { position: static; }
}

/* Повний рядок кошика вимагає ~611px і не влазить у колонку 2fr, доки вікно вужче за 1000px. */
@media (max-width: 1000px) {
  .cart-item { grid-template-columns: 1fr auto; }
  .cart-item__media { grid-column: 1 / -1; width: 96px; }
}

@media (max-width: 760px) {
  .site-header { min-height: 68px; flex-wrap: wrap; gap: .75rem; }
  .logo { width: auto; }
  .logo strong { font-size: 1.12rem; }
  .logo small { display: none; }
  .search { order: 3; width: 100%; margin-left: 0; }
  .search input { min-width: 0; flex: 1; }
  .utility-nav { margin-left: auto; gap: .75rem; }
  main { width: min(100% - 1rem, var(--content-width)); padding-top: 1rem; }
  .hero { min-height: 560px; padding: 1rem; background-position: center; }
  .hero__content { padding: 1.25rem; background: rgb(251 248 240 / 88%); }
  .hero__logo { width: min(300px, 100%); }
  .categories { padding-inline: .5rem; padding-top: 3rem; }
  .catalog-layout, .product, .cart-layout, .checkout-layout, .category-heading { grid-template-columns: 1fr; }
  .checkout-form { grid-template-columns: 1fr; }
  .checkout-form label, .checkout-form button { grid-column: auto; }
  .account-grid, .account-order-grid { grid-template-columns: 1fr; }
  /* Заголовок і посилання поруч не стискаються нижче min-content і розпирають панель. */
  .account-heading, .order-heading, .panel-heading { flex-wrap: wrap; }
  .order-list li a { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  /* 180px під назву не лишають місця для кількості й суми у вузькій панелі. */
  .order-items-list li { grid-template-columns: minmax(0, 1fr) auto auto; }
  .order-items-list div { min-width: 0; }
  .facets { position: static; }
}

@media (hover: hover) and (min-width: 1000px) {
  .product-card {
    transform-origin: 50% 0;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  }
  .product-card:hover, .product-card:focus-within {
    z-index: 5;
    overflow: visible;
    border-color: rgb(36 92 88 / 28%);
    border-bottom: 0;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
    transform: scale(1.09);
  }
  .product-card__link img, .product-card__link .product-card__placeholder {
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .product-card__panel {
    position: absolute;
    display: grid;
    top: 100%;
    right: -1px;
    left: -1px;
    gap: .55rem;
    overflow: hidden;
    max-height: 0;
    border: 1px solid rgb(36 92 88 / 28%);
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    padding-inline: 1rem;
    background: white;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: max-height var(--transition), padding var(--transition), opacity var(--transition);
  }
  .product-card:hover .product-card__panel, .product-card:focus-within .product-card__panel {
    max-height: 22rem;
    padding-block: .85rem 1rem;
    opacity: 1;
  }
  .product-card__excerpt { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.5; }
  .product-card__specs { display: grid; gap: .3rem; margin: 0; font-size: .82rem; }
  .product-card__specs > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: .5rem; }
  .product-card__specs dt { color: var(--muted); }
  .product-card__specs dd { margin: 0; }
  .product-card__more { margin: 0; color: var(--accent-dark); font-size: .84rem; font-weight: 650; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
