/* Shared reading, navigation and panel layout. Product content stays intact. */
html { scrollbar-gutter: stable; scroll-padding-top: 88px; }
html:has(body[data-color="dark"]) { --scroll-thumb: #686875; --scroll-track: #141419; }
html:has(body:not([data-color="dark"])) { --scroll-thumb: #9797a2; --scroll-track: #f0f0f4; }
html, body, body * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb, #9797a2) var(--scroll-track, #f0f0f4); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scroll-track, #f0f0f4); border-radius: 8px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb, #9797a2); border: 2px solid var(--scroll-track, #f0f0f4); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #80808d; }
::-webkit-scrollbar-button { display: none; }
@supports selector(::-webkit-scrollbar) {
  :root, :root * { scrollbar-width: auto; scrollbar-color: auto; }
}
[hidden] { display: none !important; }

/* Only the body scrolls inside a dialog, keeping its close button reachable. */
:is(.drawer, .buy-dialog, .info-dialog, .cookie-dialog)[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
}
:is(.drawer, .buy-dialog, .info-dialog, .cookie-dialog) > .drawer-header {
  position: relative;
  flex: 0 0 auto;
  padding: 20px 24px;
  gap: 16px;
  background: var(--surface);
}
:is(.drawer, .buy-dialog, .info-dialog, .cookie-dialog) > .drawer-body,
.theme-flow :is(.drawer, .buy-dialog, .info-dialog, .cookie-dialog) > .drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y pinch-zoom;
}
.theme-flow :is(.drawer, .buy-dialog, .info-dialog, .cookie-dialog) .drawer-header h2 {
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -.35px;
  overflow-wrap: anywhere;
}
.theme-flow dialog .drawer-header .icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
}
.info-dialog { width: min(640px, calc(100vw - 40px)); }
.info-dialog [data-info-content] > .button { margin-top: 24px; }
.theme-flow :is(.buy-dialog, .info-dialog, .cookie-dialog) { max-height: min(820px, calc(100dvh - 48px)); }

/* Consistent rich-text rhythm, including text pasted from the product editor. */
body .prose, .theme-flow .prose {
  max-width: 68ch;
  font-size: 15px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-break: normal;
}
body .prose :where(p, h2, h3, h4, ul, ol, blockquote) { margin: 0; }
body .prose > * + * { margin-top: 16px; }
body .prose :is(h2, h3, h4) {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -.2px;
  color: var(--ink);
}
body .prose > :is(h2, h3, h4):not(:first-child) { margin-top: 24px; }
body .prose :is(p, li, blockquote) { color: var(--muted); }
body .prose :is(ul, ol) { padding-left: 22px; }
body .prose li + li { margin-top: 8px; }
body .prose li > p + p { margin-top: 8px; }
body .prose strong { color: var(--ink); font-weight: 600; }
body .prose a { text-underline-offset: 3px; }
body .prose blockquote { padding-left: 16px; border-left: 2px solid var(--line); }
body .prose > :is(p, div, h2, h3, h4):empty,
body .prose br + br { display: none; }
body .prose > :first-child { margin-top: 0; }
body .prose > :last-child { margin-bottom: 0; }

/* The excerpt can be read directly, independently of the video feed. */
.theme-flow .flow-description-preview { grid-template-rows: minmax(0, 1fr); gap: 0; }
.theme-flow .flow-description-excerpt {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 12px;
  scrollbar-gutter: stable;
  overscroll-behavior-y: contain;
  touch-action: pan-y pinch-zoom;
  mask-image: none;
  font-size: 14px;
  line-height: 1.7;
}
.theme-flow .flow-description-excerpt :is(h2, h3, h4) {
  display: block;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  overflow: visible;
}
.theme-flow .flow-description-excerpt > * + * { margin-top: 12px; }
.theme-flow .flow-rail { padding-right: 8px; scrollbar-gutter: stable; overscroll-behavior-y: contain; }
.theme-flow .flow-rail > .flow-categories:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.theme-flow .flow-rail-footer { font-size: 11px; gap: 10px; }
.theme-flow .flow-discovery > a, .theme-flow .flow-categories > a { font-size: 14px; }
@media (min-width: 761px) {
  .theme-flow .flow-detail {
    grid-template-rows: auto 40px 49px minmax(0, 1fr);
    height: min(460px, calc(100dvh - var(--flow-head) - 102px));
    gap: 20px;
  }
  .theme-flow .flow-detail > h2 { font-size: 28px; line-height: 1.25; max-height: 70px; text-wrap: pretty; }
  .theme-flow .flow-detail .flow-price strong { font-size: 28px; font-variant-numeric: tabular-nums; }
}
@media (min-width: 761px) and (max-height: 650px) {
  .theme-flow .flow-detail { grid-template-rows: auto 32px 45px minmax(0, 1fr); gap: 12px; }
  .theme-flow .flow-detail > h2 { font-size: 22px; max-height: 55px; }
  .theme-flow .flow-detail .flow-price strong { font-size: 25px; }
  .theme-flow .flow-description-preview { padding-top: 10px; }
}

/* Compact controls remain usable with touch, long names and narrow screens. */
.theme-flow .cart-options:empty { display: none; }
.theme-flow .cart-options { display: block; margin: 4px 0; line-height: 1.5; }
.theme-flow .cart-options, .theme-flow .order-line > div { min-width: 0; overflow-wrap: anywhere; }
.theme-flow .order-line > strong { flex-shrink: 0; white-space: nowrap; }
.theme-flow .cart-item-price { display: flex; align-items: flex-end; flex-direction: column; gap: 8px; }
.theme-flow .cart-item-price strong, .theme-flow .totals strong { font-variant-numeric: tabular-nums; }
.theme-flow .cart-remove { min-height: 40px; padding: 6px 0 6px 8px; }
.theme-flow .quantity-stepper { margin-top: 12px; height: auto; min-height: 40px; }
.theme-flow .quantity-stepper button { width: 40px; min-height: 40px; }
.theme-flow .quantity-stepper input { min-height: 40px; }
.theme-flow .coupon-form { gap: 10px; }
.theme-flow .coupon-form input { min-width: 0; width: 100%; }
.theme-flow .coupon-form .button { flex-shrink: 0; }
.theme-flow .checkout-fields, .theme-flow .checkout-summary, .theme-flow .summary-card { min-width: 0; }
.theme-flow .form-section h2 { padding-right: 32px; line-height: 1.35; }
.theme-flow .terms { align-items: flex-start; font-size: 13px; line-height: 1.65; }
.theme-flow .terms input { margin-top: 2px; }
.theme-flow :is(.summary-row, .summary-line) { gap: 16px; }
.theme-flow .breadcrumbs { line-height: 1.6; }
.theme-flow .breadcrumbs a { padding: 6px 0; }
.theme-flow .page-heading p { max-width: 54ch; line-height: 1.7; }

@media (max-width: 760px) {
  html { scroll-padding-top: 76px; }
  .theme-flow :is(.drawer, .buy-dialog, .info-dialog, .cookie-dialog) { max-height: calc(100dvh - 24px); }
  .theme-flow .cookie-dialog[data-position] { max-height: calc(100dvh - 110px); }
  .theme-flow :is(.drawer, .buy-dialog, .info-dialog, .cookie-dialog) > .drawer-header { padding: 14px 18px; }
  .theme-flow :is(.drawer, .buy-dialog, .info-dialog, .cookie-dialog) > .drawer-body { padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); }
  body .prose, .theme-flow .prose { font-size: 14px; line-height: 1.75; }
  body .prose :is(h2, h3, h4) { font-size: 17px; }
  .theme-flow .flow-header .flow-mobile-search, .theme-flow .flow-header .flow-menu-trigger { width: 44px; height: 44px; }
  .theme-flow .flow-toolbar select { height: 40px; font-size: 12px; }
  .theme-flow .flow-toolbar .filter-button { width: 40px; height: 40px; }
  .theme-flow .cart-item { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; }
  .theme-flow .cart-item > .cart-item-price { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; }
  .theme-flow .cart-thumb { width: 52px; height: 70px; }
  .theme-flow .cart-item h3 { font-size: 14px; line-height: 1.45; }
  .theme-flow .quantity-stepper button { width: 44px; min-height: 44px; }
  .theme-flow .quantity-stepper { min-height: 44px; }
  .theme-flow .quantity-stepper input { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-flow [data-flow-feed] { scroll-behavior: auto !important; }
}
