.fm-visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html.fm-shop-open { overflow: hidden; }

.fm-shop {
  --fm-rule: #ccc6bc;
  --fm-focus: #00757d;
  box-sizing: border-box;
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(100%, 545px);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: none;
  background: var(--gallery-paper);
  color: var(--gallery-ink);
  font: inherit;
}

.fm-shop::backdrop { background: rgb(20 20 20 / .5); }

.fm-shop * { box-sizing: border-box; }

.fm-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.fm-header,
.fm-footer {
  padding: 20px 28px;
  background: var(--gallery-paper);
}

.fm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
  border-bottom: 1px solid var(--fm-rule);
}

.fm-header h2 {
  margin: 0;
  font: 400 clamp(1.75rem, 4.5vw, 2.25rem)/1.1 var(--editorial-serif);
  letter-spacing: -.035em;
}

.fm-close,
.fm-quantity button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  color: inherit;
  border: 0;
  cursor: pointer;
}

.fm-close { flex: none; }

.fm-close:hover,
.fm-quantity button:not(:disabled):hover { background: #eae4db; }

.fm-shop :focus-visible {
  outline: 2px solid var(--fm-focus);
  outline-offset: 2px;
}

.fm-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 18px;
  padding: 24px 28px;
}

.fm-cart-list,
.fm-order-summary ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.fm-line {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  padding: 15px 0 20px;
  border-bottom: 1px solid var(--fm-rule);
}

.fm-line:first-child { padding-top: 0; }

.fm-product-image {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  background: #eae4db;
}

.fm-line-head,
.fm-line-actions,
.fm-cost,
.fm-total,
.fm-order-summary li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.fm-line-head h3,
.fm-order-summary h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.fm-line-head { align-items: baseline; }

.fm-order-summary strong,
.fm-line-head strong,
.fm-cost > :last-child,
.fm-total strong {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.fm-options,
.fm-caption {
  margin: 5px 0 10px;
  color: #51514e;
  font-size: .82rem;
  line-height: 1.45;
}

.fm-options { overflow-wrap: anywhere; }

.fm-photo {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: #51514e;
  font-size: .75rem;
}

.fm-photo img {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: cover;
}

.fm-line-actions { align-items: center; }

.fm-quantity {
  display: inline-grid;
  grid-template-columns: 44px 20px 44px;
  align-items: center;
  text-align: center;
  border: 1px solid var(--fm-rule);
  font-size: .9rem;
}

.fm-quantity button {
  font: inherit;
  font-size: 1.05rem;
}

.fm-quantity button:disabled { opacity: .35; cursor: default; }

.fm-button,
.fm-text-button {
  font: inherit;
  cursor: pointer;
}

.fm-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 15px;
  background: var(--gallery-ink);
  color: #fff;
  border: 1px solid var(--gallery-ink);
  border-radius: 0;
  font-size: .92rem;
  font-weight: 600;
  text-align: center;
}

.fm-button:hover { background: #343432; }

.fm-text-button {
  background: transparent;
  border: 0;
  color: #333;
  min-height: 36px;
  padding: 6px 0;
  font-size: .83rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fm-text-button:hover { color: var(--fm-focus); }

.fm-line-actions .fm-text-button { min-height: 44px; }

.fm-secondary { display: block; margin: 10px auto 0; }

.fm-footer {
  flex-shrink: 0;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--fm-rule);
}

.fm-total { align-items: baseline; font-size: 1rem; font-weight: 600; }

.fm-total strong { font-size: 1.3rem; }

.fm-cost {
  margin-bottom: 6px;
  color: #51514e;
  font-size: .85rem;
}

.fm-footer .fm-total + .fm-button,
.fm-footer [data-fm-tax-row] + .fm-button { margin-top: 13px; }

.fm-empty {
  display: grid;
  align-content: center;
  gap: 12px;
  padding-block: 34px;
}

.fm-empty p {
  margin: 0;
  color: #51514e;
  line-height: 1.5;
}

.fm-empty .fm-empty-title {
  font: 400 1.65rem/1.2 var(--editorial-serif);
  color: var(--gallery-ink);
}

.fm-empty .fm-button { margin-top: 9px; }

.fm-note {
  margin: 0 0 17px;
  padding: 10px 0 10px 12px;
  border-left: 2px solid var(--aqua);
  color: #363633;
  font-size: .83rem;
  line-height: 1.5;
}

.fm-back { margin-bottom: 9px; }

.fm-checkout-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.fm-fields {
  display: grid;
  gap: 12px;
  min-inline-size: 0;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.fm-fields legend,
.fm-delivery h3 {
  margin-bottom: 9px;
  padding: 0;
  color: var(--gallery-ink);
  font: 400 1.25rem/1.25 var(--editorial-serif);
}

.fm-field-row,
.fm-coupon {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fm-coupon {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.fm-field {
  display: grid;
  gap: 5px;
  min-inline-size: 0;
  color: var(--gallery-ink);
  font-size: .85rem;
  font-weight: 600;
}

.fm-field input,
.fm-field select {
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 44px;
  padding: 8px 10px;
  border: 1px solid #887f74;
  border-radius: 0;
  background: #fff;
  color: var(--gallery-ink);
  line-height: 1.3;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
}

.fm-button.fm-outline {
  min-height: 44px;
  background: transparent;
  color: var(--gallery-ink);
}

.fm-button.fm-outline:hover { background: #eae4db; }

.fm-button:disabled,
.fm-text-button:disabled { opacity: .65; cursor: wait; }

.fm-consent {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  margin-top: 16px;
  font-size: .85rem;
  line-height: 1.45;
}

.fm-consent input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--fm-focus);
}

.fm-caption a { text-decoration: underline; text-underline-offset: 3px; }

.fm-reference,
.fm-error {
  margin: 10px 0;
  font-size: .84rem;
  line-height: 1.45;
}

.fm-reference { color: #005c63; }

.fm-error {
  padding: 9px 11px;
  border-left: 2px solid #9a2e25;
  color: #8d2a22;
  background: #f4e9e3;
}

.fm-delivery p,
.fm-result p {
  margin-bottom: 12px;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.fm-payment-options { gap: 8px; margin-top: 24px; }

.fm-payment-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 9px 12px;
  border: 1px solid var(--fm-rule);
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
}

.fm-payment-option:has(input:checked) {
  border-color: var(--fm-focus);
  background: #eaf1ef;
}

.fm-payment-option:has(input:disabled) { cursor: default; }

.fm-payment-option input {
  inline-size: 18px;
  block-size: 18px;
  margin: 0;
  accent-color: var(--fm-focus);
}

.fm-payment-option small {
  display: block;
  margin-top: 2px;
  color: #51514e;
  font-size: .8rem;
  font-weight: 400;
}

.fm-resume { display: block; margin: 0 0 7px; }

.fm-referral-notice {
  position: fixed;
  inset: auto max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) 16px;
  z-index: 12;
  width: min(440px, 100% - 32px);
  padding: 14px 16px;
  border: 1px solid #333;
  background: var(--gallery-ink);
  color: var(--gallery-paper);
  font-size: .84rem;
  line-height: 1.45;
  box-shadow: 0 6px 24px #0003;
}

.fm-referral-notice div { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 7px; }
.fm-referral-notice button { min-height: 40px; padding: 0; border: 0; background: transparent; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.fm-referral-notice .fm-referral-accept { color: #56d8dc; }

.fm-order-summary {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--fm-rule);
}

.fm-order-summary li {
  padding: 10px 0;
  font-size: .87rem;
}

.fm-order-summary li + li { border-top: 1px solid var(--fm-rule); }

.fm-order-summary small {
  display: block;
  margin-top: 3px;
  color: #51514e;
  overflow-wrap: anywhere;
}

@media (max-width: 440px) {
  .fm-header, .fm-footer, .fm-body { padding-inline: 18px; }
  .fm-line { grid-template-columns: 65px minmax(0, 1fr); gap: 12px; }
  .fm-line-head { flex-wrap: wrap; }
  .fm-header { padding-block: 10px; }
  .fm-footer { padding-block: 12px max(12px, env(safe-area-inset-bottom)); }
  .fm-text-button { min-height: 44px; }
}
