html {
  scroll-padding-block-end: calc(var(--cookie-panel-space, 0px) + 76px);
}

.legal-footer {
  padding: 9px var(--site-gutter, 20px) calc(9px + var(--cookie-panel-space, 0px));
  border-top: 1px solid #71735d;
  background: #4b4d39;
  color: #f6f3eb;
}

body:has(.basket-dock:not([hidden])) .legal-footer {
  padding-block-end: calc(77px + var(--cookie-panel-space, 0px));
}

.legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
  align-items: center;
  font-size: 13px;
  font-weight: 550;
}

.legal-footer :is(a, button) {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: start;
}

.legal-footer :is(a, button):hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-footer :is(a, button):focus-visible {
  outline: 2px solid #f6f3eb;
  outline-offset: 3px;
}

.legal-page {
  max-width: 728px;
  margin-inline: auto;
  padding: 24px clamp(20px, 5vw, 48px) 42px;
  overflow-wrap: anywhere;
}

.legal-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-block-end: 24px;
}

.legal-page a,
.legal-contacts a,
.cookie-panel a,
.checkout-legal-intro a,
.checkout-legal a,
.success-legal a {
  color: #631520;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-breadcrumb a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: 14px;
}

.legal-page h1 {
  max-width: 20ch;
  font-size: clamp(27px, 4.5vw, 42px);
  letter-spacing: -.025em;
}

.legal-page article,
.return-rules {
  line-height: 1.6;
}

.legal-page article h2,
.legal-contacts h2 {
  margin-block-start: 28px;
  font-size: 21px;
  line-height: 1.25;
}

.legal-page .legal-revision {
  margin-block: 9px 22px;
  color: #5b5d47;
  font-size: 14px;
}

.legal-page article p,
.return-rules p {
  margin-block-start: 10px;
}

.legal-index,
.legal-related {
  list-style: none;
  padding: 0;
  margin-block: 22px 0;
  border-block-start: 1px solid #c0bcad;
}

.legal-index a,
.legal-related a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-block: 8px;
  border-block-end: 1px solid #c0bcad;
  font-weight: 600;
}

.legal-contacts {
  margin-block: 32px 0;
  overflow-wrap: anywhere;
}

.legal-contacts dl {
  display: grid;
  gap: 9px;
  margin: 13px 0 0;
}

.legal-contacts dl > div {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
  gap: 4px 16px;
}

.legal-contacts dt {
  font-weight: 650;
}

.legal-contacts dd {
  margin: 0;
}

.return-rules {
  margin-block: 28px 0;
  border-block: 1px solid #c0bcad;
}

.return-rules > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding-block: 16px;
  cursor: pointer;
  list-style: none;
}
.return-rules > summary::-webkit-details-marker { display: none; }
.return-rules > summary h2 { margin: 0; }
.return-rules > summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-inline-end: 4px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.return-rules[open] { padding-bottom: 16px; }
.return-rules[open] > summary::after { transform: rotate(225deg); }
.return-rules > summary:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}
.return-rules #returns {
  scroll-margin-block-start: 12rem;
}

.return-rules h3 {
  margin-block: 22px 0;
}

.checkout-legal {
  margin: 22px 0;
  padding: 0;
  border: 0;
  min-width: 0;
  font-size: 14px;
}

.checkout-legal legend {
  padding: 0;
  font-size: 16px;
  font-weight: 700;
}

.checkout-legal .consent {
  align-items: flex-start;
  margin: 10px 0 2px;
  padding-block: 6px;
  font-size: inherit;
  font-weight: 600;
}

.checkout-legal .consent input {
  margin: 2px 0 0;
}

.checkout-legal .consent ~ p {
  margin: 3px 0 12px 30px;
}

.checkout-legal p,
.success-legal {
  font-size: 14px;
}

.cookie-panel {
  position: fixed;
  display: flex;
  flex-direction: column;
  z-index: 90;
  inset-inline-end: max(12px, env(safe-area-inset-right));
  inset-block-end: max(10px, env(safe-area-inset-bottom));
  width: min(calc(100% - 24px), 428px);
  max-height: 46vh;
  max-height: 46dvh;
  padding: 16px;
  background: #faf7ee;
  color: #393c2c;
  border: 1px solid #77745e;
  border-radius: 15px;
  box-shadow: 0 6px 24px #302b1e24;
  font-size: 14px;
  line-height: 1.45;
}

.cookie-panel[hidden] {
  display: none;
}

.cookie-panel-copy {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 3px 3px;
}

.cookie-panel h2 {
  font-size: 19px;
  letter-spacing: -.2px;
}

.cookie-panel p {
  margin: 7px 0 0;
}

.cookie-panel :is(a, button, input):focus-visible,
.checkout-legal-intro a:focus-visible,
.checkout-legal :is(a, input):focus-visible,
.legal-page a:focus-visible {
  outline: 2px solid #631520;
  outline-offset: 3px;
}

.cookie-actions {
  display: grid;
  flex-shrink: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-block-start: 12px;
}

.cookie-actions-settings {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cookie-actions button {
  min-height: 42px;
  padding: 5px;
  border: 1px solid #74735e;
  border-radius: 9px;
  background: #f2eee3;
  color: #393c2c;
  font-weight: 650;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.cookie-actions button:hover {
  background: #e6e2d4;
}

.cookie-options {
  display: grid;
  gap: 7px;
  margin-block-start: 9px;
  padding-block-start: 7px;
  border-block-start: 1px solid #c0bcad;
}

.cookie-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
}

.cookie-option input {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: #4b4d39;
}

body .basket-dock {
  bottom: calc(12px + var(--cookie-panel-space, 0px));
}

body .toast {
  bottom: calc(84px + var(--cookie-panel-space, 0px));
}

@media (max-width: 375px) {
  .legal-contacts dl > div {
    grid-template-columns: 1fr;
  }

  .cookie-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cookie-actions button:nth-child(3) {
    grid-column: 1 / -1;
  }
}

@media (max-height: 380px) {
  .cookie-panel {
    max-height: 54dvh;
    padding: 10px;
  }

  .cookie-actions:not(.cookie-actions-settings) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cookie-actions button:nth-child(3) {
    grid-column: auto;
  }
}
