/*
 * SiteSpin shop runtime, v1 styles: the cart bar, the cart sheet, the product
 * page's button states and the customer's order page. Built only from the
 * variables the site declares (the base surface on :root), so the cart wears
 * the site's colours, faces and corners. Nothing here is a Tailwind class: a
 * generated site purges what its baked markup does not name, and most of this
 * is drawn at runtime. Logical properties throughout, so a right-to-left site
 * reads it mirrored.
 */

.sh-bar, .sh-scrim, [data-shop-order], [data-shop-product] {
  --sh-tint: color-mix(in srgb, var(--sf-btn-bg, #222) 10%, var(--sf-bg, #fff));
  --sh-line: var(--sf-border, rgba(0, 0, 0, 0.15));
  --sh-tile: min(var(--radius-btn, 0.5rem), 0.625rem);
  --sh-card: min(calc(var(--radius-btn, 0.5rem) * 1.2), 1rem);
  overflow-wrap: anywhere;
}

/* --- Product page --------------------------------------------------------- */

[data-shop-product] [data-shop-size][aria-checked="true"] {
  border-color: var(--sf-btn-bg);
  background: var(--sh-tint);
  color: var(--sf-heading);
  font-weight: 600;
}
[data-shop-product] [data-shop-size].sh-struck,
[data-shop-product] [data-shop-size]:disabled {
  text-decoration: line-through;
  opacity: 0.55;
  cursor: not-allowed;
}
[data-shop-product] [aria-invalid="true"] { border-color: var(--sf-btn-bg); outline: 2px solid var(--sf-btn-bg); }
[data-shop-product] [data-shop-line] .sh-under-line { display: block; }
[data-shop-product] .sh-returns { margin: 0; font-size: 0.875rem; color: var(--sf-muted, inherit); }
[data-shop-product] .sh-consent { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9rem; }

/* --- The cart bar ---------------------------------------------------------- */

.sh-bar {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 60;
  padding: 0.625rem 1rem calc(0.625rem + env(safe-area-inset-bottom, 0px));
  background: var(--sf-bg, #fff);
  border-block-start: 1px solid var(--sh-line);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08);
  font-family: var(--font-body, inherit);
}
.sh-bar[hidden] { display: none; }
.sh-bar-go {
  display: flex;
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.1rem;
  border: 0;
  border-radius: var(--radius-btn, 0.5rem);
  background: var(--sf-btn-bg, #222);
  color: var(--sf-btn-fg, #fff);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
html.sh-has-bar body { padding-block-end: 4.5rem; }

/* --- The cart sheet ---------------------------------------------------------- */

html.sh-open { overflow: hidden; }
.sh-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.42);
  font-family: var(--font-body, inherit);
  color: var(--sf-body, inherit);
  font-size: 16px;
  line-height: 1.45;
}
.sh-scrim[hidden] { display: none; }
.sh-sheet {
  width: 100%;
  max-width: 34rem;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--sf-bg, #fff);
  border-start-start-radius: var(--sh-card);
  border-start-end-radius: var(--sh-card);
  padding: 0.5rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 640px) {
  .sh-scrim { align-items: center; }
  .sh-sheet { border-radius: var(--sh-card); }
}
.sh-grab {
  width: 2.5rem;
  height: 0.25rem;
  margin: 0.25rem auto 0.5rem;
  border-radius: 1rem;
  background: var(--sh-line);
}
.sh-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 3rem;
  border-block-end: 1px solid var(--sh-line);
}
.sh-title {
  margin: 0;
  font-family: var(--font-heading, inherit);
  color: var(--sf-heading, inherit);
  font-size: 1.375rem;
  font-weight: 600;
}
.sh-close {
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin-inline-end: -0.5rem;
  border: 0;
  background: none;
  color: var(--sf-heading, inherit);
  font-size: 1.375rem;
  line-height: 1;
  cursor: pointer;
}
.sh-scrim[aria-busy="true"] .sh-sums dd,
.sh-scrim[aria-busy="true"] .sh-amount { opacity: 0.55; }

.sh-lines { list-style: none; margin: 0; padding: 0; }
.sh-line { border-block-end: 1px solid var(--sh-line); }
.sh-line-go {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0;
  border: 0;
  background: none;
  color: var(--sf-heading, inherit);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.sh-line-name { min-width: 0; }
.sh-line-detail { display: block; color: var(--sf-muted, inherit); font-size: 0.875rem; }
.sh-amount { flex: none; font-variant-numeric: tabular-nums; }
.sh-gone { padding: 0.75rem 0; color: var(--sf-muted, inherit); }
.sh-gone .sh-gone-said { color: var(--sf-btn-bg, inherit); font-weight: 600; }
.sh-stepper { display: flex; align-items: center; gap: 0.5rem; padding: 0 0 0.85rem; }
.sh-step {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-tile);
  background: none;
  color: var(--sf-heading, inherit);
  font: inherit;
  font-size: 1.25rem;
  cursor: pointer;
}
.sh-step:disabled { opacity: 0.4; cursor: default; }
.sh-step-n { min-width: 2rem; text-align: center; font-weight: 700; color: var(--sf-heading, inherit); }
.sh-remove { margin-inline-start: auto; }

.sh-row { padding: 0.75rem 0 0; }
.sh-label { margin: 0 0 0.4rem; color: var(--sf-muted, inherit); font-size: 0.875rem; }
.sh-plain { margin: 0; color: var(--sf-heading, inherit); }
.sh-chips { display: flex; gap: 0.5rem; }
.sh-chip {
  flex: 1 1 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-tile);
  background: none;
  color: var(--sf-heading, inherit);
  font: inherit;
  cursor: pointer;
  text-align: center;
}
.sh-chip[aria-checked="true"] {
  border-color: var(--sf-btn-bg, currentColor);
  background: var(--sh-tint);
  box-shadow: inset 0 0 0 1px var(--sf-btn-bg, currentColor);
}
.sh-chip-label { font-weight: 500; }
.sh-chip-sub { font-size: 0.85rem; color: var(--sf-muted, inherit); }
.sh-note {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--sh-card);
  background: var(--sh-tint);
}

.sh-details { padding: 0.75rem 0 0; }
.sh-field { margin: 0 0 0.75rem; }
.sh-field label { display: block; margin: 0 0 0.3rem; color: var(--sf-muted, inherit); font-size: 0.875rem; }
.sh-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-tile);
  background: var(--sf-bg, #fff);
  color: var(--sf-body, inherit);
  font: inherit;
}
.sh-input[aria-invalid="true"] { border-color: var(--sf-btn-bg, red); box-shadow: 0 0 0 1px var(--sf-btn-bg, red); }
.sh-fault { margin: 0.3rem 0 0; color: var(--sf-heading, inherit); font-weight: 600; font-size: 0.9rem; }
.sh-consent { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9rem; margin: 0 0 0.75rem; }
.sh-textbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--sf-link, inherit);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  text-align: start;
}
.sh-add-note { min-height: 2.75rem; }

.sh-sums { margin: 0.5rem 0 0; padding: 0; }
.sh-sum {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-block-start: 1px solid var(--sh-line);
}
.sh-sums > .sh-sum:first-child { border-block-start: 0; }
.sh-sum dt { margin: 0; min-width: 0; }
.sh-sum dd { margin: 0; flex: none; font-variant-numeric: tabular-nums; }
.sh-total { font-weight: 700; color: var(--sf-heading, inherit); font-size: 1.05rem; }
.sh-changed, .sh-notice {
  margin: 0.5rem 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--sh-card);
  background: var(--sh-tint);
  color: var(--sf-heading, inherit);
  font-weight: 600;
}
.sh-go {
  display: block;
  width: 100%;
  margin: 1rem 0 0;
  padding: 0.9rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-btn, 0.5rem);
  background: var(--sf-btn-bg, #222);
  color: var(--sf-btn-fg, #fff);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}
.sh-go:disabled { opacity: 0.7; cursor: wait; }
.sh-go.sh-ghost { background: transparent; color: var(--sf-heading, inherit); border-color: var(--sh-line); }
.sh-under, .sh-paused { margin: 0.6rem 0 0; color: var(--sf-muted, inherit); font-size: 0.92rem; text-align: center; }
.sh-paused { margin-block-start: 1rem; padding: 0.9rem; border: 1px solid var(--sh-line); border-radius: var(--sh-card); color: var(--sf-heading, inherit); }
.sh-failed p { margin: 1rem 0 0; color: var(--sf-heading, inherit); font-weight: 600; }

/* --- The customer's order page ------------------------------------------------ */

[data-shop-order] { font-family: var(--font-body, inherit); color: var(--sf-body, inherit); }
.sh-order-title {
  margin: 0;
  font-family: var(--font-heading, inherit);
  color: var(--sf-heading, inherit);
  font-size: var(--text-h2, 1.75rem);
  line-height: 1.15;
}
.sh-lead { margin: 0.35rem 0 1.5rem; color: var(--sf-muted, inherit); }
.sh-muted { color: var(--sf-muted, inherit); }
.sh-steps { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.sh-stepline {
  position: relative;
  padding-inline-start: 1.75rem;
  padding-block-end: 0.9rem;
  color: var(--sf-muted, inherit);
}
.sh-dot {
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.3rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  border: 2px solid var(--sh-line);
  background: var(--sf-bg, #fff);
  box-sizing: border-box;
}
/* The line joining one step's dot to the next; filled once the step is done.
   Logical insets, so a right-to-left page draws it on the right. */
.sh-stepline:not(:last-child)::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(0.475rem - 1px);
  inset-block-start: 1.25rem;
  inset-block-end: -0.3rem;
  width: 2px;
  background: var(--sh-line);
}
.sh-done:not(:last-child)::before { background: var(--sf-btn-bg, currentColor); }
.sh-done .sh-dot, .sh-current .sh-dot { border-color: var(--sf-btn-bg, currentColor); background: var(--sf-btn-bg, currentColor); }
.sh-done, .sh-current { color: var(--sf-heading, inherit); }
.sh-step-label { margin: 0; }
.sh-current .sh-step-label { font-weight: 600; }
.sh-step-sub { margin: 0.15rem 0 0; color: var(--sf-muted, inherit); font-size: 0.875rem; }
.sh-rows {
  margin: 0.6rem 0 0;
  padding: 0 0.9rem;
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-card);
  color: var(--sf-body, inherit);
}
.sh-row-said {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.25rem 0.75rem;
  padding: 0.65rem 0;
  border-block-start: 1px solid var(--sh-line);
}
.sh-row-said:first-child { border-block-start: 0; }
/* A long value (an email to pay to) takes its own line on a phone rather than
   breaking a letter at a time beside its label. */
.sh-row-said dt { margin: 0; color: var(--sf-muted, inherit); flex: 1 0 5.5rem; font-size: 0.9rem; }
.sh-row-said dd { margin: 0; flex: 999 1 12rem; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; min-width: 0; }
.sh-value { font-weight: 600; color: var(--sf-heading, inherit); min-width: 0; overflow-wrap: break-word; word-break: normal; }
.sh-copy {
  flex: none;
  min-height: 2.25rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-tile);
  background: none;
  color: var(--sf-link, inherit);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.sh-copy[data-copied] { color: var(--sf-heading, inherit); }
.sh-link-button { margin: 0 0 1rem; }
.sh-receipt { border-block-start: 1px solid var(--sh-line); }
.sh-receipt > .sh-sum:first-child { border-block-start: 0; }
.sh-cancelbox { margin: 1.25rem 0 0; text-align: center; }
.sh-cancel { display: inline-block; min-height: 2.75rem; color: var(--sf-heading, inherit); text-align: center; }
.sh-cancel-note { margin: 0.25rem 0 0; font-size: 0.875rem; }
.sh-questions { margin: 1.5rem 0 0; font-size: 0.92rem; }

@media (prefers-reduced-motion: no-preference) {
  .sh-bar-go[data-shop-pulse] { animation: sh-pulse 0.4s ease-out; }
  @keyframes sh-pulse { from { transform: scale(0.97); } to { transform: none; } }
}
