/* Category text follows the products and never changes the initial video area. */
.category-description {
  width: 100%;
  min-width: 0;
  margin-top: 32px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.category-description > h2 { font-size: 21px; line-height: 1.3; margin: 0 0 16px; }
.category-description .prose { max-width: 68ch; font-size: 14px; line-height: 1.8; }
body.theme-flow.store-page .flow-main > [data-flow-feed] > .category-description {
  flex: 0 0 auto;
  grid-column: 1 / -1;
  align-self: stretch;
  height: auto;
  min-height: 100%;
  margin: 0;
  padding: 32px 24px;
  background: var(--bg);
  overflow: visible;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}
body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .category-description {
  min-height: 0;
  margin-top: 12px;
  padding: 28px 0;
}
.flow-layout:has([data-flow-feed][data-category-reading]) .flow-detail { visibility: hidden; }
@media (max-width: 760px) {
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed]:has(> .category-description) { grid-auto-rows: auto; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .category-description {
    min-height: calc(var(--feed-height) - 16px);
    padding: 28px 16px;
    margin-top: 0;
  }
}

/* Single video / catalogue views. The same choice adapts to desktop and mobile. */
body .site-header .mobile-layout-trigger { display: none; }
.theme-flow .flow-view-control.flow-layout-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: auto;
  max-width: none;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 1px 2px #00000008;
}
.theme-flow .flow-layout-switch > [data-flow-layout] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 54px;
  min-height: 40px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.theme-flow .flow-layout-switch > [data-flow-layout] .reel-icon { width: 18px; height: 18px; }
.theme-flow .flow-layout-switch > [data-flow-layout][aria-pressed="true"] { background: var(--control-soft, var(--bg)); color: var(--ink); border-color: var(--line); }
.theme-flow .flow-layout-switch > [data-flow-layout]:focus-visible { outline: 2px solid var(--control-focus, var(--action, var(--ink))); outline-offset: 1px; }
.theme-flow .flow-layout-switch > [data-flow-layout]:disabled { opacity: .45; cursor: not-allowed; }
@media (hover: hover) { .theme-flow .flow-layout-switch > [data-flow-layout]:not(:disabled):hover { background: var(--control-soft, var(--bg)); color: var(--ink); } }
@media (pointer: coarse) { .theme-flow .flow-layout-switch > [data-flow-layout] { min-width: 44px; min-height: 44px; } }

@media (max-width: 760px) {
  .theme-flow .flow-view-control.flow-layout-switch { display: none; }
  body.theme-flow.store-page .site-header .mobile-layout-trigger:not([hidden]) {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    box-shadow: none;
    touch-action: manipulation;
  }
  body.theme-flow.store-page .site-header .mobile-layout-trigger .reel-icon { width: 23px; height: 23px; }
  body.theme-flow.store-page .site-header .mobile-layout-trigger[aria-pressed="true"] { background: var(--control-soft, var(--field, var(--surface))); }
  body.theme-flow.store-page .site-header .mobile-layout-trigger:focus-visible { outline: 2px solid var(--control-focus, var(--action, var(--ink))); outline-offset: 1px; }
  /* Leave room for search, sort and layout even with a long custom store name. */
  body.theme-flow.store-page .flow-header:has(.mobile-layout-trigger:not([hidden])) { gap: 10px; }
  body.theme-flow.store-page .flow-header:has(.mobile-layout-trigger:not([hidden])) .wordmark { display: block; flex: 1 1 auto; min-width: 0; max-width: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.25; }
  body.theme-flow.store-page .flow-header:has(.mobile-layout-trigger:not([hidden])) .wordmark .brand-mark { vertical-align: middle; }
  body.theme-flow.store-page .flow-header:has(.mobile-layout-trigger:not([hidden])) .wordmark img { width: auto; max-width: 100%; max-height: 32px; object-fit: contain; object-position: left center; vertical-align: middle; }
  body.theme-flow.store-page .flow-header:has(.mobile-layout-trigger:not([hidden])) .header-actions { flex: 0 0 auto; gap: 2px; }

  /* Two columns and two rows fit inside the viewport; further rows scroll normally. */
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] {
    --feed-height: calc(100dvh - var(--flow-head,58px) - var(--flow-nav,66px) - env(safe-area-inset-bottom));
    --compact-row-height: max(240px, calc((var(--feed-height) - 24px) / 2));
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: none;
    grid-auto-rows: var(--compact-row-height);
    align-content: start;
    align-items: stretch;
    justify-items: stretch;
    gap: 8px !important;
    width: 100%;
    max-width: none;
    height: var(--feed-height);
    min-height: 0;
    margin: 0;
    padding: 8px;
    border: 0;
    border-radius: 0;
    background: var(--bg);
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y proximity;
    scroll-padding-top: 8px;
    overscroll-behavior-y: contain;
    touch-action: pan-y pinch-zoom;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .product-card {
    display: block !important;
    align-self: stretch;
    width: 100%;
    max-width: none !important;
    height: var(--compact-row-height);
    min-height: 0;
    max-height: none;
    margin: 0 !important;
    padding: 0;
    flex: none;
    aspect-ratio: auto;
    border: 1px solid #ffffff12;
    border-radius: 11px;
    overflow: hidden;
    background: #101014;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
    scroll-margin-top: 0;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .product-card .video-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto !important;
    border-radius: 0;
    scroll-snap-align: none;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .product-video { object-fit: contain; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .video-shade { background: linear-gradient(180deg,#0003 0%,transparent 28%,transparent 40%,#0008 64%,#000e 83%,#000f 100%); }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .product-card .card-info {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-end;
    gap: 8px !important;
    position: absolute;
    top: auto;
    bottom: 9px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0 !important;
    color: white;
    z-index: 4;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .card-copy { display: flex; flex-direction: column; gap: 5px; width: 100%; min-width: 0; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .product-kicker,
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .flow-card-description,
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .quick-card-button { display: none !important; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .product-card h3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    font-size: 14px !important;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -.1px;
    color: white;
    overflow: hidden;
    overflow-wrap: anywhere;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .card-info .price-line {
    display: flex;
    align-items: baseline;
    align-self: auto;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin: 0;
    padding: 0;
    font-size: 14px !important;
    line-height: 1.3;
    color: white;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .price-line strong { font-size: inherit; font-weight: 600; line-height: inherit; letter-spacing: 0; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .price-line :is(.from-price, del) { font-size: 10px; line-height: 1.3; color: #dedee5; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .card-actions { display: flex; flex-direction: column; align-items: stretch; width: 100%; min-width: 0; max-width: none; gap: 0; margin: 0; padding: 0; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .buy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px !important;
    border-radius: 8px !important;
    font-size: 12px;
    line-height: 1.3;
    gap: 9px;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .buy-button .reel-icon { width: 16px; height: 16px; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .video-tools { display: flex; flex-direction: row; align-items: center; gap: 2px; top: 5px; right: 5px; bottom: auto; left: auto; z-index: 3; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .video-tools :is(button, a) { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 11px; background: #17171b80; border: 1px solid #ffffff26; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .video-tools :is(button, a) .reel-icon { width: 19px; height: 19px; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .video-tools :is([data-share], [data-view-product]),
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .tool-caption,
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .video-timeline { display: none !important; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .empty-state { grid-column: 1 / -1; grid-row: span 2; width: 100%; height: 100%; min-height: 0; padding: 30px 20px; }
  body.theme-flow.store-page.view-grid .flow-feed-controls { display: none; }
}
@media (max-width: 350px) {
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .product-card h3 { font-size: 13px !important; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .product-card .card-info { left: 8px; right: 8px; }
}
@media (prefers-reduced-motion: reduce) { .theme-flow .flow-layout-switch > [data-flow-layout] { transition: none; } }

/* Keep the price and purchase action together in every catalogue grid card. */
body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .product-card .card-info {
  display: grid !important;
  grid-template-columns: fit-content(45%) minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center !important;
  gap: 12px !important;
}
body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .card-copy,
body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .card-actions { display: contents; }
body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .product-kicker { display: none; }
body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .product-card h3 { grid-column: 1 / -1; grid-row: 1; margin: 0; }
body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .card-info .price-line {
  grid-column: 1;
  grid-row: 2;
  align-self: center;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 0;
  padding: 0;
  font-size: 16px !important;
  line-height: 1.3;
}
body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .buy-button {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  justify-self: start;
  justify-content: center;
  width: min(100%, 132px);
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 10px 14px !important;
  gap: 8px;
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
}
body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .buy-button .reel-icon { width: 18px; height: 18px; flex-shrink: 0; }
body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .quick-card-button { grid-column: 1 / -1; grid-row: 3; }
@media (max-width: 760px) {
  /* Reserve the complete order label; price details wrap inside the other cell. */
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .product-card .card-info {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 8px 6px !important;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .card-info .price-line {
    flex-direction: column;
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 2px;
    max-width: 100%;
    font-size: 14px !important;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .price-line :is(strong, del, .from-price) {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .price-line :is(.from-price, del) { font-size: 11px; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .buy-button {
    width: max-content;
    min-height: 32px;
    padding: 5px 6px !important;
    gap: 4px;
    font-size: 12px;
    letter-spacing: 0;
    white-space: nowrap;
  }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .buy-button .reel-icon { width: 14px; height: 14px; }
}
@media (max-width: 380px) {
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .buy-button { padding: 5px 4px !important; gap: 3px; font-size: 11px; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .buy-button .reel-icon { width: 12px; height: 12px; }
}
@media (max-width: 350px) {
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] > .product-card .card-info { left: 6px; right: 6px; column-gap: 4px !important; }
  body.theme-flow.store-page.view-grid .flow-main > [data-flow-feed] .card-info .price-line { font-size: 13px !important; }
}
