/* pages.css */

/* ─── Shared page heading ───────────────────────────────────── */

.page-header {
  margin-bottom: var(--space-8);
}

.page-header__title {
  font-size:      var(--font-size-2xl);
  font-weight:    var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-tight);
}

/* Keep ticker/slider transforms inside main so they cannot
   widen the page. Header sits outside main and stays sticky. */
.page-home {
  --home-marquee-height: 40px;
}

/* Home used the warm paper token while hero/placeholders were
   a different beige. Catalog already maps --color-bg to white;
   home now shares that so header, hero, collection, and footer
   sit on one page ground. */
body.page-home {
  --color-bg: var(--color-bg-alt);
}

.page-home main {
  overflow-x: clip;
  min-width:  0;
}

/* ─── Home hero slider ──────────────────────────────────────── */

.home-hero {
  position:         relative;
  width:            100%;
  max-width:        100%;
  min-width:        0;
  height:           calc(100svh - var(--header-height) - var(--home-marquee-height));
  min-height:       480px;
  max-height:       820px;
  overflow:         hidden;
  background-color: var(--color-bg);
}

.hero-slider {
  position: relative;
  width:    100%;
  height:   100%;
}

.hero-slider__viewport {
  height:        100%;
  overflow:      hidden;
  touch-action:  pan-y;
  cursor:        grab;
}

.hero-slider__viewport.is-dragging {
  cursor: grabbing;
}

.hero-slider__track {
  display: flex;
  height:  100%;
  will-change: transform;
}

.hero-slider__slide {
  position:  relative;
  flex:      0 0 100%;
  width:     100%;
  min-width: 0;
  height:    100%;
  overflow:  hidden;
}

.hero-slider__image {
  display:         block;
  width:           100%;
  height:          100%;
  max-width:       none;
  object-fit:      cover;
  object-position: var(--hero-position, center);
  pointer-events:  none;
  user-select:     none;
}

.hero-slider__placeholder {
  width:            100%;
  height:           100%;
  background-color: var(--hero-tone, var(--color-bg-alt));
}

@media (min-width: 769px) {
  .hero-slider__image {
    object-position: var(--hero-position-wide, var(--hero-position, center));
  }
}

.hero-slider__nav {
  position:        absolute;
  top:             0;
  z-index:         2;
  display:         flex;
  align-items:     center;
  width:           18%;
  max-width:       8.5rem;
  height:          100%;
  padding:         0 var(--space-5);
  color:           var(--color-text);
  background:      none;
  border:          none;
}

.hero-slider__nav--prev {
  left:            0;
  justify-content: flex-start;
  cursor:          w-resize;
}

.hero-slider__nav--next {
  right:           0;
  justify-content: flex-end;
  cursor:          e-resize;
}

.hero-slider__nav-icon {
  display:    block;
  width:      1.125rem;
  height:     2.25rem;
  opacity:    0;
  transition: opacity var(--transition-fast);
}

.hero-slider__nav:hover .hero-slider__nav-icon,
.hero-slider__nav:focus-visible .hero-slider__nav-icon {
  opacity: 1;
}

.hero-slider__nav:focus-visible {
  outline:        var(--border-width-thick) solid var(--color-text);
  outline-offset: -10px;
}

.hero-slider__dots {
  position:        absolute;
  right:           0;
  bottom:          var(--space-5);
  left:            0;
  z-index:         2;
  display:         flex;
  justify-content: center;
  gap:             var(--space-2);
  pointer-events:  none;
}

.hero-slider__dot {
  width:            6px;
  height:           6px;
  padding:          0;
  background-color: var(--color-text);
  border:           none;
  border-radius:    0;
  opacity:          0.28;
  pointer-events:   auto;
  cursor:           pointer;
}

.hero-slider__dot.is-active {
  opacity: 1;
}

.hero-slider__dot:focus-visible {
  outline:        var(--border-width-thick) solid var(--color-text);
  outline-offset: 3px;
}

@media (max-width: 1024px) {
  .home-hero {
    min-height: 420px;
    max-height: 720px;
  }
}

@media (max-width: 768px) {
  .page-home {
    --home-marquee-height: 36px;
  }

  .home-hero {
    height:     clamp(420px, 74svh, 580px);
    min-height: 0;
    max-height: calc(100svh - var(--header-height));
  }

  .hero-slider__nav {
    width:     22%;
    max-width: none;
    padding:   0 var(--space-3);
  }

  .hero-slider__nav-icon {
    display: none;
  }

  .hero-slider__dots {
    bottom: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-slider__nav-icon {
    transition: none;
  }
}

/* ─── Home marquee ──────────────────────────────────────────── */

.home-marquee {
  width:            100%;
  max-width:        100%;
  min-width:        0;
  overflow:         hidden;
  background-color: var(--color-bg);
  border-top:       var(--border-width) solid var(--color-border);
  border-bottom:    var(--border-width) solid var(--color-border);
}

.home-marquee__viewport {
  overflow: hidden;
  width:    100%;
}

.home-marquee__track {
  display:   flex;
  width:     max-content;
  animation: home-marquee-scroll var(--marquee-duration, 36s) linear infinite;
}

.home-marquee__group {
  display:     flex;
  align-items: center;
  flex-shrink: 0;
}

.home-marquee__msg,
.home-marquee__sep {
  flex-shrink:    0;
  font-size:      0.75rem;
  font-weight:    var(--font-weight-regular);
  letter-spacing: 0.08em;
  line-height:    1;
  text-transform: uppercase;
  color:          var(--color-text);
  white-space:    nowrap;
  user-select:    none;
}

.home-marquee__msg {
  padding-inline: 1.25rem;
}

.home-marquee__viewport,
.home-marquee__track,
.home-marquee__group {
  height: var(--home-marquee-height);
}

@keyframes home-marquee-scroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

@media (max-width: 768px) {
  .home-marquee__msg,
  .home-marquee__sep {
    font-size:      0.6875rem;
    letter-spacing: 0.07em;
  }

  .home-marquee__msg {
    padding-inline: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-marquee__track {
    animation: none;
    transform: none;
  }
}

/* ─── Home: new arrivals ────────────────────────────────────── */

.home-new-arrivals {
  padding-top:    var(--space-12);
  padding-bottom: var(--space-16);
}

.home-new-arrivals__header {
  grid-column:     1 / -1;
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             var(--space-6);
  margin-bottom:   var(--space-6);
}

.home-new-arrivals__heading {
  font-size:      var(--font-size-xs);
  font-weight:    var(--font-weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color:          var(--color-text);
}

/* Home-scoped four-up editorial grid. */
.home-new-arrivals__grid {
  grid-column:           1 / -1;
  display:               grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap:            clamp(var(--space-3), 1.5vw, var(--space-6));
  row-gap:               var(--space-16);
}

.home-new-arrivals__grid > .empty-state {
  grid-column: 1 / -1;
}

.home-new-arrivals__grid .catalog-status {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .home-new-arrivals__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .home-new-arrivals {
    padding-top:    var(--space-8);
    padding-bottom: var(--space-16);
  }

  .home-new-arrivals > .site-frame {
    grid-template-columns: minmax(0, 1fr);
    column-gap:            0;
    padding-inline:        var(--space-4);
  }

  .home-new-arrivals__header,
  .home-new-arrivals__grid {
    grid-column: 1;
  }

  .home-new-arrivals__header {
    gap: var(--space-4);
  }

  .home-new-arrivals__grid {
    column-gap: var(--space-3);
    row-gap:    var(--space-10);
  }
}

/* Home: same header hide/show as desktop PDP. The injected #site-header
   slot is the sticky ancestor (the inner .site-header cannot stick on
   its own because the slot is only as tall as the bar). Hide/show is
   done by moving that slot with `top`, not transform — transform on
   the slot would break the position:fixed nav drawer. Layout height is
   unchanged, so the hero and collection grid do not jump. */
.page-home #site-header {
  position:   sticky;
  top:        0;
  z-index:    var(--z-header);
  transition: top var(--transition-base);
}

.page-home .site-header {
  position: relative;
}

.page-home #site-header.is-header-unpinned {
  top: calc(-1 * var(--header-height));
}

@media (prefers-reduced-motion: reduce) {
  .page-home #site-header {
    transition: none;
  }
}

/* ─── Index / catalog ───────────────────────────────────────── */

/* Match the white header. Catalog and PDP have enough empty canvas
   that the warm page tone reads as a seam under the bar. */
body.page-catalog,
body.page-product {
  --color-bg: var(--color-bg-alt);
}

body.page-catalog .site-header,
body.page-product .site-header {
  border-bottom: none;
}

/* Catalog: same hide/show as Home. Sticky ancestor is the injected
   #site-header slot; moving it with `top` (not transform) keeps the
   position:fixed nav drawer intact and does not jump the grid. */
.page-catalog #site-header {
  position:   sticky;
  top:        0;
  z-index:    var(--z-header);
  transition: top var(--transition-base);
}

.page-catalog .site-header {
  position: relative;
}

.page-catalog #site-header.is-header-unpinned {
  top: calc(-1 * var(--header-height));
}

@media (prefers-reduced-motion: reduce) {
  .page-catalog #site-header {
    transition: none;
  }
}

/* Short catalogs consume the page-wrapper 100vh leftover, so the
   footer sat on the last row. Floor the section to the remaining
   viewport; extra height sits after the grid. Long catalogs ignore
   the floor. The cap keeps a tall window from opening a large void. */
.page-catalog .page-wrapper main {
  display:        flex;
  flex-direction: column;
}

.catalog-page {
  flex:           1 0 auto;
  padding-top:    var(--space-16);
  padding-bottom: var(--space-20);
  min-height:     calc(100vh - var(--header-height));
  min-height:     min(calc(100svh - var(--header-height)), 56rem);
}

.catalog-page__header {
  margin-bottom: var(--space-10);
}

.catalog-page__back {
  margin-bottom: var(--space-4);
  font-size:     var(--font-size-sm);
  line-height:   var(--line-height-snug);
}

.catalog-page__back-link {
  color: var(--color-text-secondary);
}

.catalog-page__back-link:hover {
  color: var(--color-text);
}

.catalog-page__title {
  font-size:      var(--font-size-2xl);
  font-weight:    var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-normal);
  line-height:    var(--line-height-tight);
  color:          var(--color-text);
}

.catalog-categories {
  margin-bottom: var(--space-12);
}

.catalog-categories__list {
  display:   flex;
  flex-wrap: wrap;
  gap:       var(--space-3) var(--space-8);
}

.catalog-categories__link {
  position:       relative;
  display:        inline-flex;
  align-items:    baseline;
  gap:            var(--space-2);
  font-size:      var(--font-size-sm);
  font-weight:    var(--font-weight-regular);
  color:          var(--color-text-secondary);
  line-height:    var(--line-height-snug);
  transition:     color 220ms ease-out;
}

.catalog-categories__link:hover {
  color: var(--color-text);
}

.catalog-categories__link.is-active,
.catalog-categories__link[aria-current="page"] {
  color: var(--color-text);
}

.catalog-categories__name {
  position:       relative;
  padding-bottom: 5px;
  color:          inherit;
}

.catalog-categories__name::after {
  content:          '';
  position:         absolute;
  left:             0;
  right:            0;
  bottom:           0;
  height:           1px;
  background-color: currentColor;
  transform:        scaleX(0);
  transform-origin: left;
  transition:       transform 220ms ease-out;
}

.catalog-categories__link.is-active .catalog-categories__name::after,
.catalog-categories__link[aria-current="page"] .catalog-categories__name::after {
  transform: scaleX(1);
}

.catalog-categories__link:focus-visible {
  outline:        var(--border-width-thick) solid var(--color-text);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .catalog-categories__link,
  .catalog-categories__name::after {
    transition: none;
  }
}

.catalog-status {
  margin-bottom: var(--space-8);
  font-size:     var(--font-size-sm);
  color:         var(--color-text-secondary);
}

.catalog-status--error {
  color: var(--color-error);
}

.catalog-page--search .catalog-page__back,
.catalog-page--search .catalog-categories,
.catalog-page--search .catalog-status {
  display: none;
}

.catalog-page--search .catalog-page__header {
  margin-bottom: var(--space-12);
}

.catalog-page--search .catalog-page__title {
  font-size:      var(--font-size-xs);
  font-weight:    var(--font-weight-regular);
  letter-spacing: 0;
  line-height:    var(--line-height-snug);
  color:          var(--color-text-secondary);
  text-align:     center;
}

.catalog-page--search-empty .catalog-page__header,
.catalog-page--search-empty .catalog-categories,
.catalog-page--search-empty .catalog-status {
  display: none;
}

.product-grid > .empty-state {
  grid-column: 1 / -1;
}

.catalog-page .product-grid {
  transition: opacity 160ms ease;
}

.catalog-page .product-grid.is-switching {
  opacity:        0.55;
  pointer-events: none;
}

/* Catalog loading placeholders: same product-card geometry, no shimmer. */
.catalog-page .catalog-skeleton__block {
  background-color: var(--color-surface);
}

.catalog-page .catalog-skeleton__name,
.catalog-page .catalog-skeleton__price {
  flex:             0 0 auto;
  align-self:       flex-start;
  max-width:        100%;
  overflow:         hidden;
  border-radius:    0;
  color:            transparent;
  background-color: var(--color-surface);
}

.catalog-page .catalog-skeleton__name {
  width: 68%;
}

.catalog-page .catalog-skeleton__price {
  width: 36%;
}

.catalog-page .product-card-skeleton {
  animation: catalog-skeleton-pulse 2.2s ease-in-out infinite;
}

@keyframes catalog-skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.72;
  }
}

/* Keep complete grid rows: 3-col default, 4-col wide, 2-col compact. */
.catalog-page .product-card-skeleton:nth-child(n + 7) {
  display: none;
}

@media (min-width: 1100px) {
  .catalog-page .product-card-skeleton:nth-child(n + 7) {
    display: flex;
  }
}

@media (max-width: 1024px) {
  .catalog-page .product-card-skeleton:nth-child(n + 5) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-page .product-grid {
    transition: none;
  }

  .catalog-page .product-grid.is-switching {
    opacity: 1;
  }

  .catalog-page .product-card-skeleton {
    animation: none;
  }
}

/* ─── Product page ──────────────────────────────────────────── */

/* Loading PDP has #product-content hidden, so main is shorter than
   the viewport and page-wrapper leftover docks the footer on the
   first screen. Floor this section to the remaining viewport; the
   footer sits below the fold until the product unhides. Loaded
   galleries exceed the floor. Uncapped so 768px and 900px windows
   stay covered. */
.page-product main > .section {
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100svh - var(--header-height));
}

/* Quiet wait mark. Shown only after a long getProduct; no canvas
   of its own. [hidden] stays display:none via reset !important. */
.product-loader {
  position:        fixed;
  inset:           0;
  z-index:         var(--z-raised);
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             0.4em;
  margin:          0;
  pointer-events:  none;
}

.product-loader__dots {
  display:     inline-flex;
  align-items: center;
  gap:         0.12em;
  line-height: 1;
}

.product-loader__dot {
  font-family: var(--font-family);
  font-size:   0.7em;
  font-weight: var(--wordmark-font-weight);
  line-height: 1;
  color:       var(--color-text);
  opacity:     0.22;
  animation:   product-loader-dot 1.6s ease-in-out infinite;
}

.product-loader__dot:nth-child(2) {
  animation-delay: 0.22s;
}

.product-loader__dot:nth-child(3) {
  animation-delay: 0.44s;
}

@keyframes product-loader-dot {
  0%,
  100% {
    opacity: 0.22;
  }

  50% {
    opacity: 0.75;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-loader__dot {
    opacity:   0.45;
    animation: none;
  }
}

/* Desktop PDP only: the injected #site-header slot is the sticky
   ancestor (the inner .site-header cannot stick on its own because
   the slot is only as tall as the bar). Hide/show is done by moving
   that slot with `top`, not transform — transform on the slot would
   break the position:fixed nav drawer. Layout height is unchanged,
   so the gallery and sticky purchase column do not jump. */
@media (min-width: 769px) {
  .page-product #site-header {
    position:   sticky;
    top:        0;
    z-index:    var(--z-header);
    transition: top var(--transition-base);
  }

  .page-product .site-header {
    position: relative;
  }

  .page-product #site-header.is-header-unpinned {
    top: calc(-1 * var(--header-height));
  }
}

@media (min-width: 769px) and (prefers-reduced-motion: reduce) {
  .page-product #site-header {
    transition: none;
  }
}

/* Desktop PDP stage: media and purchase share one top edge under the
   header, instead of a 3fr column being pulled out of a padded container.
   Details keep the same track width/position as the original 2fr column;
   gallery is the remaining left span, not a stretched card. */
@media (min-width: 769px) {
  .page-product main > .section {
    padding-top: 0;
  }

  .page-product main > .section > .container {
    max-width:     none;
    padding-left:  0;
    padding-right: max(
      var(--container-gutter),
      calc((100vw - var(--container-max)) / 2 + var(--container-gutter))
    );
  }

  .page-product .product-layout {
    --pdp-gap: var(--space-16);
    --pdp-gallery-inset: var(--space-6); /* 24px: C inset, not A gutter */
    --pdp-details-span: calc(
      (
        min(100vw, var(--container-max))
        - 2 * var(--container-gutter)
        - var(--pdp-gap)
      ) * 2 / 5
    );
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--pdp-details-span));
    gap:                   var(--pdp-gap);
  }

  .page-product .catalog-status {
    padding-left: var(--container-gutter);
  }

  /* Match the gallery's top edge under the header. The previous
     header + space-8 offset assumed .section padding-top.
     `--pdp-sticky-top` stays at the header while the column fits
     the viewport; if accordion content makes it taller, JS lowers
     the inset on page scroll so the extra content stays in the
     document flow instead of being trapped below a pinned top. */
  .page-product .product-details {
    --pdp-sticky-top: var(--header-height);
    top: var(--pdp-sticky-top);
  }

  /* Variant C: small left inset from the viewport. Gallery width
     absorbs the inset so the details track and grid gap stay put. */
  .page-product .product-layout__gallery {
    justify-self: start;
    margin-left:  var(--pdp-gallery-inset);
    width:        calc(
      100%
      - var(--space-10)
      - var(--space-4)
      - var(--pdp-gallery-inset)
    );
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .page-product .product-layout {
    --pdp-gap: var(--space-10);
  }
}

.product-layout__gallery {
  position:  relative;
  min-width: 0;
}

.product-gallery__track {
  display:          flex;
  flex-direction:   column;
  gap:              1px;
  background-color: var(--color-border);
}

.product-gallery__item {
  width:            100%;
  min-width:        0;
  background-color: var(--color-surface);
}

.product-gallery__image {
  display:          block;
  width:            100%;
  aspect-ratio:     3 / 4;
  object-fit:       cover;
  background-color: var(--color-surface);
}

.product-gallery__progress {
  display: none;
}

.product-gallery__progress[hidden] {
  display: none;
}

.product-details {
  display:        flex;
  flex-direction: column;
  gap:            0;
}

.product-details__name {
  font-size:      var(--font-size-2xl);
  font-weight:    var(--font-weight-regular);
  letter-spacing: var(--letter-spacing-tight);
}

.product-details__price {
  margin-top:  var(--space-2);
  font-size:   var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  color:       var(--color-text);
}

.product-details__description {
  margin-top:  var(--space-8);
  font-size:   var(--font-size-sm);
  line-height: var(--line-height-base);
  color:       var(--color-text-secondary);
}

.product-details__section {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-3);
  margin-top:     var(--space-8);
}

.product-size-heading {
  display:         flex;
  align-items:     baseline;
  justify-content: space-between;
  gap:             var(--space-3);
}

.product-size-heading__start {
  display:     flex;
  align-items: baseline;
  min-width:   0;
}

.product-size-guide-trigger {
  flex-shrink:     0;
  margin:          0 0 0 auto;
  padding:         0;
  border:          0;
  background:      transparent;
  font-family:     var(--font-family);
  font-size:       var(--font-size-xs);
  font-weight:     var(--font-weight-regular);
  letter-spacing:  var(--letter-spacing-normal);
  text-transform:  none;
  color:           var(--color-text-secondary);
  cursor:          pointer;
}

@media (hover: hover) and (pointer: fine) {
  .product-size-guide-trigger:hover {
    color: var(--color-text);
  }
}

.product-size-guide-trigger:focus-visible {
  outline:        var(--border-width-thick) solid var(--color-text);
  outline-offset: var(--space-1);
}

.product-size-hint {
  font-size:      var(--font-size-xs);
  font-weight:    var(--font-weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color:          var(--color-text-secondary);
  white-space:    nowrap;
}

.product-size-hint::before {
  content:     "·";
  margin:      0 var(--space-2);
  font-weight: var(--font-weight-regular);
}

.page-product .size-btn {
  font-weight:      var(--font-weight-regular);
  background-color: transparent;
  border-color:     color-mix(in srgb, var(--color-text) 16%, var(--color-bg));
}

.page-product .size-btn--selected {
  font-weight:      var(--font-weight-medium);
  background-color: var(--color-surface);
  color:            var(--color-text);
  border-color:     var(--color-text);
}

.page-product .size-btn--disabled,
.page-product .size-btn:disabled {
  color:            var(--color-text-disabled);
  border-color:     color-mix(in srgb, var(--color-text) 12%, var(--color-bg));
  background-color: transparent;
}

.product-details__section.is-size-prompt .size-btn:not(:disabled) {
  border-color: var(--color-border-strong);
}

.product-details__label {
  font-size:      var(--font-size-xs);
  font-weight:    var(--font-weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color:          var(--color-text-secondary);
}

.product-details__dock {
  display:        flex;
  flex-direction: column;
  min-width:      0;
  margin-top:     var(--space-5);
}

.product-details__end-dock {
  display: none;
}

.product-details__actions {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-4);
}

#product-add-btn {
  display:       grid;
  align-items:   center;
  justify-items: center;
  min-height:    48px;
  transition:    background-color 400ms ease-in-out,
                 border-color 400ms ease-in-out,
                 color 400ms ease-in-out;
}

#product-add-btn .product-add-btn__label {
  grid-area:  1 / 1;
  transition: opacity 400ms ease-in-out;
}

#product-add-btn .product-add-btn__label--idle {
  color:   var(--color-text-inverse);
  opacity: 1;
}

#product-add-btn .product-add-btn__label--added {
  color:   var(--color-text);
  opacity: 0;
}

#product-add-btn.is-added .product-add-btn__label--idle {
  opacity: 0;
}

#product-add-btn.is-added .product-add-btn__label--added {
  opacity: 1;
}

#product-add-btn.is-added,
#product-add-btn.is-added:hover:not(:disabled) {
  background-color: var(--color-bg-alt);
  border-color:     var(--color-text);
}

.color-list {
  display:   flex;
  gap:       var(--space-2);
  flex-wrap: wrap;
}

.color-swatch {
  display:          inline-flex;
  align-items:      center;
  justify-content:  center;
  width:            var(--space-10);
  height:           var(--space-10);
  padding:          0;
  border:           var(--border-width) solid transparent;
  border-radius:    0;
  background-color: transparent;
  cursor:           pointer;
}

.color-swatch__sample {
  width:            var(--space-6);
  height:           var(--space-6);
  border:           var(--border-width) solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-radius:    0;
  background-color: var(--swatch-color);
}

.color-swatch:hover,
.color-swatch--selected {
  border-color: transparent;
}

.color-swatch:hover:not(.color-swatch--selected) .color-swatch__sample {
  border-color: var(--color-text);
}

.color-swatch--selected .color-swatch__sample {
  outline:        var(--border-width) solid var(--color-text);
  outline-offset: 3px;
}

.color-swatch--selected {
  transition: none;
}

.color-swatch:focus-visible {
  outline:        var(--border-width-thick) solid var(--color-text);
  outline-offset: var(--space-1);
}

.product-option-status {
  font-size: var(--font-size-sm);
  color:     var(--color-text-secondary);
}

.product-feedback {
  font-size: var(--font-size-sm);
  color:     var(--color-error);
  min-height: var(--space-5);
}

/* ─── PDP information layer ─────────────────────────────────── */

.product-info {
  margin-top:    var(--space-16);
  min-width:     0;
  overflow-wrap: break-word;
}

.product-info__item {
  border-top: var(--border-width) solid color-mix(in srgb, var(--color-text) 8%, var(--color-bg));
}

.product-info__item:last-child {
  border-bottom: var(--border-width) solid color-mix(in srgb, var(--color-text) 8%, var(--color-bg));
}

.product-info__trigger {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             var(--space-4);
  width:           100%;
  min-height:      48px;
  padding:         var(--space-4) 0;
  border:          0;
  background:      transparent;
  font-family:     var(--font-family);
  font-size:       var(--font-size-sm);
  font-weight:     var(--font-weight-regular);
  line-height:     var(--line-height-snug);
  text-align:      left;
  color:           var(--color-text);
  cursor:          pointer;
}

.product-info__trigger span:first-child {
  min-width: 0;
}

.product-info__icon {
  display:     inline-block;
  flex-shrink: 0;
  font-size:   var(--font-size-lg);
  font-weight: var(--font-weight-light);
  line-height: 1;
  color:       var(--color-text-secondary);
  transition:  transform var(--transition-base);
}

.product-info__trigger[aria-expanded="true"] .product-info__icon {
  transform: rotate(45deg);
}

.product-info__panel {
  display:            grid;
  grid-template-rows: 0fr;
  transition:         grid-template-rows 280ms ease;
}

.product-info__panel.is-open {
  grid-template-rows: 1fr;
}

.product-info__content {
  overflow:    hidden;
  min-height:  0;
  min-width:   0;
  font-size:   var(--font-size-sm);
  line-height: var(--line-height-base);
  color:       var(--color-text-secondary);
}

.product-info__content > :last-child {
  padding-bottom: var(--space-5);
}

.product-info__block + .product-info__block {
  margin-top: var(--space-4);
}

.product-info__subhead {
  margin:          0 0 var(--space-2);
  font-size:       var(--font-size-xs);
  font-weight:     var(--font-weight-medium);
  letter-spacing:  var(--tracking-label);
  text-transform:  uppercase;
  color:           var(--color-text-secondary);
}

.product-info__list {
  margin:      0;
  padding:     0;
  list-style:  none;
  line-height: var(--line-height-snug);
}

.product-info__list li + li {
  margin-top: var(--space-1);
}

/* ─── Size guide overlay ────────────────────────────────────── */

.size-guide {
  position:        fixed;
  inset:           0;
  z-index:         var(--z-modal);
  display:         flex;
  align-items:     center;
  justify-content: center;
  padding:         var(--space-6);
  opacity:         0;
  visibility:      hidden;
  pointer-events:  none;
  transition:      opacity var(--transition-base),
                   visibility var(--transition-base);
}

.size-guide.is-open {
  opacity:        1;
  visibility:     visible;
  pointer-events: auto;
}

.size-guide__backdrop {
  position:         absolute;
  inset:            0;
  background-color: var(--color-overlay);
}

.size-guide__panel {
  position:         relative;
  display:          flex;
  flex-direction:   column;
  width:            min(580px, 100%);
  max-height:       min(80vh, 720px);
  background-color: var(--color-bg);
  min-width:        0;
}

.size-guide__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             var(--space-4);
  flex-shrink:     0;
  padding:         var(--space-5) var(--space-6);
  border-bottom:   var(--border-width) solid color-mix(in srgb, var(--color-text) 8%, var(--color-bg));
}

.size-guide__title {
  margin:          0;
  font-size:       var(--font-size-xs);
  font-weight:     var(--font-weight-regular);
  letter-spacing:  0;
  text-transform:  none;
  color:           var(--color-text-secondary);
}

.size-guide__close {
  display:          inline-flex;
  align-items:      center;
  justify-content:  center;
  flex-shrink:      0;
  width:            44px;
  height:           44px;
  margin:           calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) 0;
  padding:          0;
  border:           0;
  background:       transparent;
  font-size:        var(--font-size-xl);
  font-weight:      var(--font-weight-light);
  line-height:      1;
  color:            var(--color-text);
  cursor:           pointer;
}

.size-guide__close:focus-visible {
  outline:        var(--border-width-thick) solid var(--color-text);
  outline-offset: var(--space-1);
}

.size-guide__body {
  overflow-x: hidden;
  overflow-y: auto;
  padding:    var(--space-6);
  min-height: 0;
}

.size-guide__table-wrap {
  width:      100%;
  overflow-x: auto;
}

.size-guide__table {
  width:           100%;
  border-collapse: collapse;
  font-size:       var(--font-size-sm);
}

.size-guide__table th,
.size-guide__table td {
  padding:        var(--space-3) var(--space-2);
  text-align:     left;
  vertical-align: top;
  border-bottom:  var(--border-width) solid color-mix(in srgb, var(--color-text) 8%, var(--color-bg));
}

.size-guide__table th {
  font-size:      var(--font-size-xs);
  font-weight:    var(--font-weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color:          var(--color-text-secondary);
}

.size-guide__table td:first-child,
.size-guide__table th:first-child {
  padding-left: 0;
}

.size-guide__table td:last-child,
.size-guide__table th:last-child {
  padding-right: 0;
}

.size-guide__note {
  margin:      var(--space-5) 0 0;
  font-size:   var(--font-size-sm);
  line-height: var(--line-height-base);
  color:       var(--color-text-secondary);
}

body.size-guide-open {
  overflow: hidden;
}

/* ─── Cart page: viewport shell owns height and scroll ───────── */

html.page-cart,
body.page-cart {
  height:     100%;
  min-height: 0;
  overflow:   hidden;
}

.cart-app {
  display:        flex;
  flex-direction: column;
  height:         100vh;
  height:         100dvh;
  overflow:       hidden;
}

.cart-app #site-header {
  flex: 0 0 auto;
}

.cart-app .site-header {
  position: relative;
}

.cart-app #site-footer {
  display: none;
}

.cart-shell {
  display:    flex;
  flex:       1 1 auto;
  min-height: 0;
  overflow:   hidden;
}

.cart-shell--empty .cart-page__header,
html.cart-is-empty .cart-page__header {
  display: none;
}

/* Empty cart must not paint the checkout CTA or form before JS,
   and must keep them hidden if the hidden attribute is cleared. */
html.cart-is-empty #cart-actions,
.cart-shell--empty #cart-actions,
html.cart-is-empty .cart-shell__form,
.cart-shell--empty .cart-shell__form {
  display: none !important;
}

html.cart-is-empty #cart-empty {
  display: flex !important;
}

.cart-shell--empty .cart-shell__main {
  display:         flex;
  flex-direction:  column;
  flex:            1 1 auto;
  align-items:     stretch;
  justify-content: stretch;
}

.cart-shell--empty .cart-shell__main-inner {
  flex:            1 1 auto;
  min-height:      0;
  display:         flex;
  flex-direction:  column;
  align-items:     stretch;
  justify-content: center;
}

.cart-empty {
  flex:            0 0 auto;
  justify-content: center;
  gap:             var(--space-5);
  padding:         var(--space-8) var(--space-6);
}

.cart-empty[hidden] {
  display: none;
}

.cart-empty__icon {
  display:       block;
  width:         3.5rem;
  height:        3.5rem;
  margin-bottom: var(--space-1);
  color:         var(--color-text-secondary);
}

.cart-empty .empty-state__title {
  font-size:   var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  color:       var(--color-text-secondary);
}

.cart-empty__cta {
  min-width:  11rem;
  min-height: 2.75rem;
  margin-top: var(--space-1);
}

.cart-shell__main {
  min-width:                  0;
  min-height:                 0;
  overflow-x:                 hidden;
  overflow-y:                 auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior:        contain;
}

.cart-shell__summary {
  position:         static;
  flex-shrink:      0;
  min-width:        0;
  border:           0;
  background-color: transparent;
  box-shadow:       none;
}

.cart-page__title--checkout {
  display: none;
}

.cart-page__checkout-summary {
  display: none;
}

.cart-shell .cart-shell__form {
  display: none;
}

.cart-items .cart-item {
  border-bottom: 1px solid var(--color-border);
}

.cart-items .cart-item:last-child {
  border-bottom: none;
}

.cart-summary {
  display:        flex;
  flex-direction: column;
  min-width:      0;
}

.cart-summary__lines {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-3);
}

.cart-summary__line,
.cart-summary__total {
  display:         flex;
  justify-content: space-between;
  align-items:     baseline;
  gap:             var(--space-4);
}

.cart-summary__key,
.cart-summary__val {
  font-size:   var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  color:       var(--color-text);
  line-height: var(--line-height-snug);
}

.cart-summary__val {
  text-align: right;
}

.cart-summary__val--secondary {
  color:       var(--color-text-secondary);
  font-weight: var(--font-weight-regular);
}

.cart-summary__total .cart-summary__key,
.cart-summary__total .cart-summary__val {
  font-weight: var(--font-weight-semibold);
}

.cart-summary__hint {
  display: none;
}

.cart-summary__cta {
  width:       100%;
  min-height:  2.5rem;
  padding:     var(--space-2) var(--space-4);
  font-size:   var(--font-size-xs);
}

.cart-summary__cta[aria-disabled="true"] {
  opacity: 0.4;
  cursor:  not-allowed;
}

a.cart-summary__cta[aria-disabled="true"]:hover {
  background-color: var(--color-accent);
  border-color:     var(--color-accent);
  color:            var(--color-text-inverse);
}

/* Mobile-only pre-checkout gate. Desktop already gated this in the
   header cart drawer, so this block stays hidden at 769px+ (below). */
.cart-consent {
  margin-top: var(--space-2);
}

.cart-rail {
  display:        flex;
  flex-direction: column;
  min-height:     0;
  height:         100%;
}

.cart-rail__items {
  display: none;
}

.cart-rail-item {
  display:               grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap:                   0.875rem;
  align-items:           center;
  padding:               0;
}

.cart-rail-item__image-wrap {
  position: relative;
  display:  block;
  width:    64px;
  height:   64px;
  overflow: visible;
}

.cart-rail-item__image-clip {
  display:          block;
  width:            100%;
  height:           100%;
  overflow:         hidden;
  border-radius:    8px;
  background-color: var(--color-bg-alt);
  box-shadow:       0 0 0 1px color-mix(in srgb, var(--color-text) 10%, transparent);
}

.cart-rail-item__image {
  width:      100%;
  height:     100%;
  object-fit: cover;
}

.cart-rail-item__qty {
  position:         absolute;
  top:              -0.45rem;
  right:            -0.45rem;
  z-index:          1;
  min-width:        1.25rem;
  height:           1.25rem;
  padding:          0 0.3rem;
  border-radius:    999px;
  background-color: var(--color-text);
  color:            var(--color-text-inverse);
  font-size:        0.6875rem;
  font-weight:      var(--font-weight-medium);
  line-height:      1.25rem;
  text-align:       center;
  box-shadow:       0 0 0 2px var(--cart-rail-bg, var(--color-surface));
}

.cart-rail-item__body {
  min-width: 0;
}

.cart-rail-item__name {
  display:     block;
  font-size:   var(--font-size-sm);
  line-height: var(--line-height-snug);
}

.cart-rail-item__meta {
  margin-top:  0.15rem;
  font-size:   var(--font-size-xs);
  color:       var(--color-text-secondary);
}

.cart-rail-item__price {
  margin:      0;
  font-size:   var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

@media (min-width: 769px) {
  html.page-cart,
  body.page-cart,
  .cart-app,
  .cart-app #site-header,
  .cart-app .site-header {
    background-color: var(--color-bg-alt);
  }

  .cart-shell {
    flex-direction: row;
    align-items:    stretch;
    width:          100%;
    max-width:      none;
    margin-inline:  0;
    padding-inline: 0;
    column-gap:     0;
  }

  .cart-shell__main {
    display:          flex;
    justify-content:  flex-end;
    align-items:      flex-start;
    flex:             1.5 1 0;
    background-color: var(--color-bg-alt);
  }

  .cart-shell__main-inner {
    width:          min(100%, 42.5rem);
    max-width:      42.5rem;
    padding-top:    2.75rem;
    padding-bottom: 5.5rem;
    padding-left:   clamp(1.5rem, 4vw, 3.5rem);
    padding-right:  clamp(1.5rem, 3vw, 2.75rem);
  }

  .cart-page__title--cart {
    display: none;
  }

  .cart-page__title--checkout {
    display:     block;
    font-size:   var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
  }

  .cart-items {
    display: none;
  }

  .cart-shell .cart-shell__form {
    display:        flex;
    flex-direction: column;
  }

  .cart-summary__cta[href] {
    display: none;
  }

  .cart-shell__summary {
    --cart-rail-bg:   #f5f5f5;
    display:          flex;
    justify-content:  flex-start;
    flex-direction:   row;
    flex:             1 1 0;
    min-height:       0;
    overflow-x:       hidden;
    overflow-y:       auto;
    background-color: var(--cart-rail-bg);
    border-left:      1px solid #e6e6e6;
  }

  .cart-rail {
    flex:           0 1 auto;
    width:          min(100%, 26.5rem);
    height:         auto;
    padding-top:    2.75rem;
    padding-bottom: 2.75rem;
    padding-left:   clamp(1.5rem, 3vw, 2.75rem);
    padding-right:  clamp(1.5rem, 4vw, 3.5rem);
  }

  .cart-rail__items {
    display:                    flex;
    flex-direction:             column;
    gap:                        1rem;
    flex:                       none;
    max-height:                 22rem;
    overflow-x:                 hidden;
    overflow-y:                 auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior:        contain;
    padding-top:                0.5rem;
    padding-right:              0.25rem;
    scrollbar-width:            thin;
  }

  .cart-summary {
    flex:        0 0 auto;
    margin-top:  1.5rem;
    padding-top: 1.5rem;
    border-top:  1px solid var(--color-border);
  }

  .cart-summary__val--secondary {
    max-width: 13rem;
  }

  .cart-summary__total {
    margin-top:  1rem;
    padding-top: 1rem;
    border-top:  1px solid var(--color-border);
  }

  .cart-summary__total .cart-summary__val {
    font-size:   var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
  }

  .cart-summary__cta {
    margin-top: var(--space-5);
  }

  /* Desktop consent already happened in the header cart drawer before
     this rail is ever reached; do not show it a second time here. */
  .cart-consent {
    display: none;
  }

  .cart-shell--empty .cart-shell__main {
    flex:            1 1 auto;
    flex-direction:  column;
    align-items:     stretch;
    justify-content: stretch;
  }

  .cart-shell--empty .cart-shell__main-inner {
    width:     100%;
    max-width: none;
  }

  .cart-shell--empty .cart-shell__form {
    display: none;
  }
}

@media (max-width: 768px) {
  /* Cart and checkout are one document. Desktop already paints this
     shell white; on mobile the warm page token stayed on screen, and
     checkout only replaced it after JS added .page-cart-checkout.
     page-cart is in the initial HTML, so the first paint is white. */
  html.page-cart,
  body.page-cart,
  .cart-app {
    --color-bg:       var(--color-bg-alt);
    background-color: #ffffff;
  }

  .cart-shell {
    flex-direction: column;
  }

  .cart-shell__main {
    flex: 1 1 auto;
  }

  .cart-shell__main-inner {
    padding: var(--space-5) var(--container-gutter) var(--space-6);
  }

  .cart-shell--empty .cart-shell__main {
    display: flex;
  }

  .cart-shell .cart-shell__form {
    display: none;
  }

  .cart-shell--checkout:not(.cart-shell--empty) .cart-page__title--cart {
    display: none;
  }

  .cart-shell--checkout:not(.cart-shell--empty) .cart-page__title--checkout {
    display:     block;
    font-size:   var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
  }

  .cart-shell--checkout:not(.cart-shell--empty) .cart-items {
    display: none;
  }

  .cart-shell--checkout:not(.cart-shell--empty) .cart-page__checkout-summary {
    display:     block;
    margin-top:  var(--space-8);
    margin-bottom: var(--space-4);
  }

  .cart-shell--checkout:not(.cart-shell--empty) .cart-shell__form {
    display:        flex;
    flex-direction: column;
    margin-top:     0;
    padding-top:    0;
    border-top:     0;
  }

  .cart-shell--checkout .checkout-summary__toggle {
    position:      static;
    top:           auto;
    margin-left:   0;
    margin-right:  0;
    padding-left:  0;
    padding-right: 2px;
  }

  .cart-shell--checkout:not(.cart-shell--empty) .cart-shell__summary {
    display: none;
  }

  html.page-cart.page-cart-checkout,
  body.page-cart.page-cart-checkout {
    --color-bg:        #ffffff;
    background-color:  #ffffff;
    height:            auto;
    min-height:        0;
    overflow:          visible;
    scroll-behavior:   auto;
  }

  html.page-cart-checkout .cart-app,
  html.page-cart-checkout .cart-shell,
  html.page-cart-checkout .cart-shell__main,
  html.page-cart-checkout .checkout-form__footer,
  html.page-cart-checkout .checkout-form__actions {
    background-color: #ffffff;
  }

  html.page-cart-checkout .cart-app {
    height:     auto;
    min-height: auto;
    overflow:   visible;
  }

  html.page-cart-checkout .cart-shell {
    flex:       none;
    min-height: auto;
    overflow:   visible;
  }

  html.page-cart-checkout .cart-shell__main {
    flex:                       none;
    min-height:                 auto;
    overflow:                   visible;
    -webkit-overflow-scrolling: auto;
    overscroll-behavior:        auto;
  }

  html.page-cart-checkout .checkout-form__actions {
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  }

  .cart-shell__summary {
    border-top:       1px solid var(--color-border);
    background-color: var(--color-bg);
  }

  .cart-summary {
    padding: var(--space-5) var(--container-gutter)
      calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  }

  .cart-summary__lines {
    display: none;
  }

  .cart-summary__cta {
    margin-top: var(--space-5);
  }

  .cart-consent {
    margin-top: var(--space-3);
  }
}

/* ─── Checkout page ─────────────────────────────────────────── */

.visually-hidden {
  position: absolute;
  width:    1px;
  height:   1px;
  padding:  0;
  margin:   -1px;
  overflow: hidden;
  clip:     rect(0, 0, 0, 0);
  white-space: nowrap;
  border:   0;
}

.form-row {
  display:               grid;
  grid-template-columns: 1fr 1fr;
  gap:                   0.75rem;
}

.form-row--3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-row--3 .form-label {
  white-space: nowrap;
}

.form-hint {
  margin:      0;
  font-size:   var(--font-size-xs);
  line-height: var(--line-height-snug);
  color:       var(--color-text-secondary);
}

.checkout-form {
  min-width: 0;
}

.checkout-form__section {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-3);
}

.checkout-form__section-title {
  font-size:      var(--font-size-md);
  font-weight:    var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-normal);
  text-transform: none;
  color:          var(--color-text);
  padding-bottom: 0;
  border-bottom:  0;
}

.checkout-form .form-label {
  text-transform: none;
  letter-spacing: var(--letter-spacing-normal);
  color:          var(--color-text);
}

.checkout-form .form-input,
.checkout-form .form-select,
.checkout-form .form-textarea {
  border-radius: 8px;
  min-height:    2.75rem;
}

.checkout-form .form-textarea {
  min-height: 4.5rem;
}

.checkout-form .form-select {
  padding-right:        2.5rem;
  background-image:     url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b6965' d='M1.2 1.5 6 6.3 10.8 1.5'/></svg>");
  background-repeat:    no-repeat;
  background-position:  right 0.9rem center;
  background-size:      12px 8px;
}

.checkout-methods {
  display:        flex;
  flex-direction: column;
  gap:            0.5rem;
  margin:         0;
  padding:        0;
  border:         0;
  min-width:      0;
}

.checkout-method {
  display:     flex;
  align-items: center;
  gap:         0.75rem;
  padding:     0.9rem 1rem;
  border:      1px solid var(--color-border);
  border-radius: 8px;
  background:  var(--color-bg-alt);
  cursor:      pointer;
}

.checkout-method:has(input:checked) {
  border-color: var(--color-text);
}

.checkout-methods.is-invalid .checkout-method {
  border-color: #c8bdb6;
}

.checkout-form .form-error,
.checkout-form .checkout-field-error {
  margin:     0;
  font-size:  var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color:      var(--color-text-secondary);
}

.checkout-form .form-input.checkout-field-invalid,
.checkout-form .form-select.checkout-field-invalid,
.checkout-form .form-textarea.checkout-field-invalid {
  border-color: #c8bdb6;
}

.checkout-form .form-input.checkout-field-invalid:focus,
.checkout-form .form-select.checkout-field-invalid:focus,
.checkout-form .form-textarea.checkout-field-invalid:focus {
  border-color: var(--color-text);
}

.checkout-method input {
  width:         1rem;
  height:        1rem;
  flex-shrink:   0;
  accent-color:  var(--color-text);
}

.checkout-method-placeholder {
  margin:      0;
  padding:     1rem 1.1rem;
  border-radius: 8px;
  background:  #f5f5f5;
  color:       var(--color-text-secondary);
  font-size:   var(--font-size-sm);
  text-align:  center;
}

.checkout-branch {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-3);
  margin-top:     var(--space-4);
}

.checkout-branch[hidden] {
  display: none;
}

.checkout-branch.is-open {
  animation: checkout-branch-in 180ms ease;
}

.checkout-followup {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-3);
}

.checkout-followup[hidden] {
  display: none;
}

.checkout-followup.is-open {
  animation: checkout-branch-in 180ms ease;
}

.checkout-form__footer {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-4);
  margin-top:     var(--space-6);
}

@keyframes checkout-branch-in {
  from {
    opacity:   0;
    transform: translateY(-6px);
  }
  to {
    opacity:   1;
    transform: none;
  }
}

.checkout-form__actions {
  margin-top:     0;
  padding-bottom: var(--space-6);
  width:          100%;
  min-width:      0;
}

.checkout-form__actions .cart-summary__cta {
  margin-top: 0;
}

.checkout-form__error {
  font-size: var(--font-size-sm);
  color:     var(--color-text-secondary);
}

.checkout-form__error[hidden] {
  display: none;
}

.checkout-summary {
  --cart-rail-bg: var(--color-bg);
  width:          100%;
  min-width:      0;
}

.checkout-summary__bar {
  position: relative;
  width:    100%;
  min-width: 0;
}

.checkout-summary__toggle {
  display:             none;
  width:               100%;
  margin:              0;
  padding:             0 2px 0 0;
  border:              0;
  background:          transparent;
  font-family:         var(--font-family);
  font-size:           inherit;
  color:               inherit;
  text-align:          left;
  cursor:              pointer;
  -webkit-appearance:  none;
  appearance:          none;
}

.checkout-summary__toggle:focus-visible {
  outline:        var(--border-width-thick) solid var(--color-text);
  outline-offset: var(--space-2);
}

.checkout-summary__thumbs {
  position:   relative;
  display:    block;
  flex-shrink: 0;
  width:      3rem;
  height:     3rem;
}

.checkout-summary__thumbs img,
.checkout-summary__thumbs-fallback {
  display:          block;
  width:            3rem;
  height:           3rem;
  object-fit:       cover;
  border-radius:    8px;
  background-color: var(--color-surface);
  box-shadow:       0 0 0 1px color-mix(in srgb, var(--color-text) 10%, transparent);
}

.checkout-summary__thumbs--stack {
  width:  3rem;
  height: 3rem;
}

.checkout-summary__thumbs--stack::before {
  content:          "";
  position:         absolute;
  top:              0.2rem;
  left:             0.2rem;
  z-index:          0;
  width:            3rem;
  height:           3rem;
  border-radius:    8px;
  background-color: var(--color-surface);
  box-shadow:       0 0 0 1px color-mix(in srgb, var(--color-text) 8%, transparent);
}

.checkout-summary__thumbs--stack img,
.checkout-summary__thumbs--stack .checkout-summary__thumbs-fallback {
  position: relative;
  z-index:  1;
}

.checkout-summary__toggle-copy {
  display:        flex;
  flex-direction: column;
  gap:            0.1rem;
  min-width:      0;
  flex:           1 1 auto;
}

.checkout-summary__toggle-label {
  font-size:   var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  color:       var(--color-text);
}

.checkout-summary__toggle-count {
  font-size:   var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-snug);
  color:       var(--color-text-secondary);
}

.checkout-summary__toggle-price {
  flex-shrink: 0;
  font-size:   var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  color:       var(--color-text);
  white-space: nowrap;
}

.checkout-summary__info-slot {
  flex-shrink: 0;
  width:       1.25rem;
  height:      1px;
}

.checkout-summary__info-slot[hidden] {
  display: none;
}

.checkout-summary__info {
  position:         absolute;
  top:              50%;
  right:            calc(2px + 0.5rem + 0.35rem);
  z-index:          2;
  display:          none;
  align-items:      center;
  justify-content:  center;
  width:            1.25rem;
  height:           1.25rem;
  margin:           0;
  padding:          0;
  border:           0;
  background:       transparent;
  color:            var(--color-text-secondary);
  cursor:           pointer;
  -webkit-appearance: none;
  appearance:       none;
  transform:        translateY(-50%);
}

.checkout-summary__info[hidden] {
  display: none;
}

.checkout-summary__info svg {
  display: block;
}

.checkout-summary__info:focus-visible {
  outline:        var(--border-width-thick) solid var(--color-text);
  outline-offset: 2px;
}

.checkout-summary__tip {
  position:         absolute;
  right:            0;
  bottom:           calc(100% + 0.4rem);
  z-index:          var(--z-overlay);
  width:            max-content;
  max-width:        min(17.5rem, calc(100vw - 2.5rem));
  margin:           0;
  padding:          0.6rem 0.75rem;
  border:           0;
  background-color: var(--color-bg-alt);
  box-shadow:       var(--shadow-md);
  color:            var(--color-text-secondary);
  font-size:        var(--font-size-xs);
  font-weight:      var(--font-weight-regular);
  line-height:      var(--line-height-snug);
  text-align:       left;
}

.checkout-summary__tip[hidden] {
  display: none;
}

.checkout-summary__chevron {
  display:      inline-block;
  flex-shrink:  0;
  width:        0.5rem;
  height:       0.5rem;
  margin:       0 0.05rem 0.15rem 0.35rem;
  border-right:  1.5px solid var(--color-text-secondary);
  border-bottom: 1.5px solid var(--color-text-secondary);
  transform:     rotate(45deg);
  transition:    transform 280ms ease-out;
}

.checkout-summary.is-open .checkout-summary__chevron {
  margin-bottom: 0;
  margin-top:    0.15rem;
  transform:     rotate(225deg);
}

.checkout-summary__panel {
  display:            grid;
  grid-template-rows: 1fr;
}

.checkout-summary__panel-inner {
  overflow:   hidden;
  min-height: 0;
  min-width:  0;
}

.checkout-summary__items {
  display:        flex;
  flex-direction: column;
  gap:            1rem;
  padding-top:    0.5rem;
}

@media (min-width: 769px) {
  .checkout-summary__items {
    max-height:                 22rem;
    overflow-x:                 hidden;
    overflow-y:                 auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior:        contain;
    padding-right:              0.25rem;
    scrollbar-width:            thin;
  }
}

.checkout-summary__totals {
  display:     flex;
  flex-direction: column;
  gap:         0.75rem;
  margin-top:  1.5rem;
  padding-top: 1.25rem;
  border-top:  1px solid var(--color-border);
}

.checkout-summary__line,
.checkout-summary__total {
  display:         flex;
  justify-content: space-between;
  align-items:     baseline;
  gap:             var(--space-4);
  font-size:       var(--font-size-sm);
  line-height:     var(--line-height-snug);
}

.checkout-summary__muted {
  color:      var(--color-text-secondary);
  text-align: right;
}

.checkout-summary__delivery-value {
  text-align: right;
}

.checkout-summary__total {
  margin-top:  0.5rem;
  padding-top: 1rem;
  border-top:  1px solid var(--color-border);
  font-size:   var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

@media (max-width: 768px) {
  .checkout-summary,
  .checkout-summary__toggle,
  .checkout-form__actions {
    width: 100%;
  }

  .checkout-summary__toggle {
    display:          flex;
    align-items:      center;
    gap:              0.75rem;
    z-index:          var(--z-raised);
    box-sizing:       border-box;
    background-color: var(--color-bg);
    padding-top:      0.65rem;
    padding-bottom:   0.65rem;
  }

  .checkout-summary__info:not([hidden]) {
    display: inline-flex;
  }

  .checkout-summary.is-open .checkout-summary__toggle {
    border-bottom: 1px solid var(--color-border);
  }

  .checkout-summary__panel {
    display:    block;
    width:      100%;
    height:     0;
    overflow:   hidden;
    transition: height 320ms ease-out;
  }

  .checkout-summary.is-open .checkout-summary__panel {
    height: var(--summary-panel-height, auto);
  }

  .checkout-summary__panel-inner {
    padding-top: 1rem;
    opacity:     0;
    transition:  opacity 180ms ease;
  }

  .checkout-summary.is-open .checkout-summary__panel-inner {
    opacity:    1;
    transition: opacity 260ms ease 40ms;
  }

  .checkout-summary__totals {
    display:        flex;
    flex-direction: column;
  }

  .checkout-summary .cart-rail-item {
    width:                   100%;
    grid-template-columns:   3rem minmax(0, 1fr) auto;
    column-gap:              0.75rem;
  }

  .checkout-summary .cart-rail-item__image-wrap {
    width:  3rem;
    height: 3rem;
  }

  .checkout-summary .cart-rail-item__qty {
    top:   -0.35rem;
    right: -0.35rem;
  }

  .checkout-summary .cart-rail-item__price {
    text-align: right;
  }
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .form-row--3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* ─── Information pages ─────────────────────────────────────── */

/* Keep the footer immediately after the article. Short pages should
   not stretch a large empty main region just to pin the footer. */
.page-info .page-wrapper {
  min-height: auto;
}

.page-info .page-wrapper main {
  flex: 0 0 auto;
}

/* Legal documents inherit the warm paper token from :root --color-bg
   (#f7f6f4). Catalog/home already remap that token to --color-bg-alt
   (white); scoped here so contacts/delivery/returns stay unchanged. */
body.page-info:has(.info-page--legal) {
  --color-bg: var(--color-bg-alt);
}

.info-page {
  padding-top:    var(--space-16);
  padding-bottom: var(--space-20);
}

.info-page__inner {
  max-width: 36rem;
}

.info-page--legal .info-page__inner {
  max-width: 40rem;
}

.info-page__title {
  font-size:      var(--font-size-2xl);
  font-weight:    var(--font-weight-regular);
  letter-spacing: var(--letter-spacing-tight);
  line-height:    var(--line-height-tight);
  color:          var(--color-text);
}

.info-page__lead,
.info-page__text {
  margin-top:  var(--space-5);
  font-size:   var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);
  color:       var(--color-text-secondary);
}

.info-page__text + .info-page__text {
  margin-top: var(--space-4);
}

.info-page__section {
  margin-top: var(--space-10);
}

.info-page__section + .info-page__section {
  margin-top: var(--space-10);
}

.info-page__heading {
  margin-bottom:  var(--space-3);
  font-size:      var(--font-size-sm);
  font-weight:    var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-normal);
  line-height:    var(--line-height-snug);
  color:          var(--color-text);
}

.info-page__subheading {
  margin-top:     var(--space-6);
  margin-bottom:  var(--space-2);
  font-size:      var(--font-size-sm);
  font-weight:    var(--font-weight-regular);
  color:          var(--color-text);
}

.info-page__note {
  margin-top:  var(--space-5);
  font-size:   var(--font-size-sm);
  line-height: var(--line-height-base);
  color:       var(--color-text-secondary);
}

.info-page__outline {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-4);
  margin-top:     var(--space-10);
  padding:        0;
  list-style:     none;
  counter-reset:  info-section;
}

.info-page__outline li {
  counter-increment: info-section;
  font-size:         var(--font-size-sm);
  line-height:       var(--line-height-snug);
  color:             var(--color-text);
}

.info-page__outline li::before {
  content:        counter(info-section) ". ";
  color:          var(--color-text-secondary);
}

.info-page__list {
  margin-top:    var(--space-4);
  padding-left:  0;
  list-style:    none;
}

.info-page__text + .info-page__list,
.info-page__heading + .info-page__list {
  margin-top: var(--space-4);
}

.info-page__list + .info-page__text {
  margin-top: var(--space-4);
}

.info-page__list li {
  position:      relative;
  padding-left:  1.1em;
  font-size:     var(--font-size-sm);
  line-height:   var(--line-height-base);
  color:         var(--color-text-secondary);
}

.info-page__list li + li {
  margin-top: var(--space-2);
}

.info-page__list li::before {
  content:  "–";
  position: absolute;
  left:     0;
  color:    var(--color-text-secondary);
}

.info-page__heading + .info-page__subheading {
  margin-top: var(--space-4);
}

.info-page__text a {
  text-decoration: underline;
}

.info-contact {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-1);
  margin-top:     var(--space-8);
}

.info-contact + .info-contact {
  margin-top: var(--space-6);
}

.info-contact__label {
  font-size:      var(--font-size-xs);
  font-weight:    var(--font-weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color:          var(--color-text-secondary);
}

.info-contact__value,
.info-page a {
  color:              var(--color-text);
  text-decoration:    none;
  text-underline-offset: 0.18em;
}

.info-page a:hover {
  color: var(--color-text-secondary);
}

.info-contact__value {
  font-size:   var(--font-size-sm);
  line-height: var(--line-height-snug);
}

.info-contact a:hover {
  text-decoration: underline;
}

/* ─── Success page ──────────────────────────────────────────── */

/* Page ground was the warm paper token; header and the rest of the
   shop sit on --color-bg-alt. */
body.page-success {
  background-color: var(--color-bg-alt);
}

.success {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  text-align:      center;
  padding-top:     var(--space-20);
  padding-bottom:  var(--space-20);
  gap:             var(--space-4);
}

.success__title {
  font-size:      var(--font-size-2xl);
  font-weight:    var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-tight);
}

.success__text {
  font-size:  var(--font-size-sm);
  color:      var(--color-text-secondary);
  max-width:  28rem;
}

.success__order-number {
  margin-top:     var(--space-2);
  font-size:      var(--font-size-lg);
  font-weight:    var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-wide);
  color:          var(--color-text);
}

.success__actions {
  display:         flex;
  flex-wrap:       wrap;
  gap:             var(--space-3);
  justify-content: center;
  margin-top:      var(--space-6);
}

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .catalog-page {
    padding-top:    var(--space-10);
    padding-bottom: var(--space-16);
    min-height:     min(calc(100svh - var(--header-height)), 40rem);
  }

  .catalog-page__title {
    font-size: var(--font-size-xl);
  }

  .catalog-page__header {
    margin-bottom: var(--space-4);
  }

  .catalog-categories {
    margin-bottom:              var(--space-8);
    overflow-x:                 auto;
    overflow-y:                 hidden;
    overscroll-behavior-x:      contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width:            none;
    scroll-behavior:            auto;
  }

  .catalog-categories::-webkit-scrollbar {
    display: none;
  }

  .catalog-categories__list {
    display:    flex;
    flex-wrap:  nowrap;
    width:      max-content;
    gap:        var(--space-4);
  }

  .catalog-categories__list::-webkit-scrollbar {
    display: none;
  }

  .catalog-categories__list > li {
    flex: 0 0 auto;
  }

  .catalog-categories__link {
    align-items:  center;
    min-height:   44px;
    white-space:  nowrap;
  }

  /* Flush gallery to the header; details stay in the container gutter.
     Generic mobile .section drops padding-bottom to space-10. Use
     space-20 so the docked purchase rail is not glued to the footer. */
  .page-product main > .section {
    padding-top: 0;
    padding-bottom: var(--space-20);
  }

  .page-product .product-layout {
    --pdp-rail: var(--pdp-rail-height, calc(3.5rem + env(safe-area-inset-bottom, 0px)));
    --pdp-photo: calc(100vw * 22 / 15);
    --pdp-room:  calc(
      100svh - var(--header-height) - var(--pdp-photo) - 2px - var(--space-4)
    );
    --pdp-text: calc(
      var(--font-size-xl) * var(--line-height-tight)
      + var(--space-2)
      + var(--font-size-lg) * var(--line-height-base)
      + var(--space-8)
      + 2 * var(--font-size-sm) * var(--line-height-base)
    );
    --pdp-need:  calc(var(--pdp-text) + var(--pdp-rail));
    --pdp-short: max(0px, var(--pdp-need) - var(--pdp-room));
    --pdp-over:  max(0px, var(--pdp-short) - var(--pdp-rail));
    --pdp-shave: calc(
      min(var(--pdp-rail), var(--pdp-short)) - min(var(--pdp-rail), var(--pdp-over))
    );
    gap: var(--space-4);
  }

  .page-product .product-layout__gallery {
    width:        calc(100% + 2 * var(--container-gutter));
    max-width:    none;
    margin-left:  calc(-1 * var(--container-gutter));
    margin-right: calc(-1 * var(--container-gutter));
  }

  .product-gallery__track {
    flex-direction:          row;
    gap:                     0;
    background-color:        transparent;
    overflow-x:              auto;
    overflow-y:              hidden;
    scroll-snap-type:        x mandatory;
    scrollbar-width:         none;
    -webkit-overflow-scrolling: touch;
  }

  .product-gallery__track::-webkit-scrollbar {
    display: none;
  }

  .product-gallery__item {
    flex:             0 0 100%;
    scroll-snap-align: start;
    scroll-snap-stop:  always;
  }

  /* Same stage as before the rail: 15/22, full width.
     A hair of max-height only when the text block already fits
     and would otherwise end inside the rail. */
  .product-gallery__image {
    aspect-ratio: 15 / 22;
    max-height:   calc(var(--pdp-photo) - var(--pdp-shave, 0px));
  }

  /* Full-width hairline on the photo/content cut. */
  .product-gallery__progress {
    position:        static;
    left:            auto;
    display:         flex;
    gap:             0;
    width:           100%;
    margin:          0;
    transform:       none;
    pointer-events:  none;
  }

  .product-gallery__segment {
    flex:             1;
    height:           2px;
    background-color: var(--color-text);
    opacity:          0.24;
    transition:       opacity var(--transition-fast);
  }

  .product-gallery__segment--active {
    opacity: 0.82;
  }

  .product-details__name {
    font-size: var(--font-size-xl);
  }

  .page-product .product-info {
    margin-top: var(--space-10);
  }

  .page-product #product-add-btn {
    font-weight:    var(--font-weight-regular);
    letter-spacing: 0.02em;
  }

  .page-product .product-feedback:empty {
    display: none;
  }

  /* One purchase rail. Fixed while the product is in view, then
     absolute in the end dock so it scrolls away with the section. */
  .page-product .product-details.is-rail-fixed,
  .page-product .product-details.is-rail-docked {
    position: relative;
    top:      auto;
  }

  .page-product .product-details.is-rail-fixed .product-details__dock,
  .page-product .product-details.is-rail-docked .product-details__dock {
    margin-top: 0;
  }

  .page-product .product-details.is-rail-fixed .product-details__end-dock,
  .page-product .product-details.is-rail-docked .product-details__end-dock {
    display:          block;
    flex:             0 0 auto;
    width:            calc(100% + 2 * var(--container-gutter));
    height:           var(--pdp-rail-height, calc(3.5rem + env(safe-area-inset-bottom, 0px)));
    margin-top:       var(--space-12);
    margin-left:      calc(-1 * var(--container-gutter));
    margin-right:     calc(-1 * var(--container-gutter));
    background-color: transparent;
    pointer-events:   none;
  }

  .page-product .product-details.is-rail-fixed .product-details__actions,
  .page-product .product-details.is-rail-docked .product-details__actions {
    z-index:          var(--z-raised);
    box-sizing:       border-box;
    width:            auto;
    margin:           0;
    padding:          0 var(--container-gutter)
                      calc(var(--space-1) + env(safe-area-inset-bottom, 0px));
    border:           0;
    border-top:       0;
    border-radius:    0;
    /* The gradient is only the top-edge blend. `background` shorthand
       clears background-color to transparent, and iOS Safari then
       paints its toolbar from the black button behind that plate. */
    background-color: var(--color-bg-alt);
    background-image: linear-gradient(
      to bottom,
      transparent 1px,
      var(--color-bg-alt) 1px
    );
    box-shadow:       none;
    transition:       none;
  }

  /* 14px * 1.6 lays out at 22.4px, so the border box becomes 48.39px.
     bottom: 0 then puts the fixed bar's top on a fractional pixel,
     and iOS paints that edge as a hairline. Lock a whole pixel. */
  .page-product .product-details.is-rail-fixed #product-add-btn,
  .page-product .product-details.is-rail-docked #product-add-btn {
    height:      48px;
    line-height: 22px;
  }

  .page-product .product-details.is-rail-fixed .product-details__actions {
    position: fixed;
    left:     0;
    right:    0;
    bottom:   0;
  }

  .page-product .product-details.is-rail-docked .product-details__actions {
    position:         absolute;
    left:             calc(-1 * var(--container-gutter));
    right:            calc(-1 * var(--container-gutter));
    bottom: 0;
  }

  body:is(.nav-drawer-open, .search-overlay-open, .cart-drawer-open, .size-guide-open)
    .product-details:is(.is-rail-fixed, .is-rail-docked)
    .product-details__actions {
    visibility:     hidden;
    pointer-events: none;
  }

  .page-product .product-details.is-rail-fixed #product-size-section,
  .page-product .product-details.is-rail-docked #product-size-section {
    scroll-margin-top:    calc(var(--header-height) + var(--space-2));
    scroll-margin-bottom: calc(var(--pdp-rail-height, 3.5rem) + var(--space-2));
  }

  html:has(.product-details.is-rail-fixed) {
    scroll-padding-bottom: var(--pdp-rail-height, 0px);
  }

  .product-info__trigger {
    min-height: 52px;
  }

  .product-size-heading__start {
    flex-wrap: wrap;
  }

  .product-size-hint {
    flex-basis:  100%;
    white-space: normal;
  }

  .product-size-hint::before {
    content: none;
    margin:  0;
  }

  .product-size-guide-trigger {
    display:     inline-flex;
    align-items: center;
    min-height:  44px;
  }

  .size-guide {
    align-items: flex-end;
    padding:     0;
  }

  .size-guide__panel {
    width:      100%;
    max-height: min(88dvh, 88vh);
  }

  .size-guide__header,
  .size-guide__body {
    padding-left:  var(--space-5);
    padding-right: var(--space-5);
  }

  .page-header__title {
    font-size: var(--font-size-xl);
  }

  .success {
    padding-top:    var(--space-12);
    padding-bottom: var(--space-12);
  }

  .success__title {
    font-size: var(--font-size-xl);
  }

  .info-page {
    padding-top:    var(--space-10);
    padding-bottom: var(--space-16);
  }

  .info-page__title {
    font-size: var(--font-size-xl);
  }

  .info-page__section + .info-page__section {
    margin-top: var(--space-8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-gallery__track {
    scroll-behavior: auto;
  }

  .product-gallery__segment {
    transition: none;
  }

  .product-info__icon,
  .product-info__panel,
  .size-guide,
  #product-add-btn,
  #product-add-btn .product-add-btn__label,
  .checkout-summary__chevron,
  .checkout-summary__panel,
  .checkout-summary__panel-inner,
  .checkout-branch.is-open,
  .checkout-followup.is-open {
    transition: none;
    animation:  none;
  }
}
