/* Shared outer gutters. Typography, card composition and image crops stay theme-owned. */
body[data-cosy-wide-layout] {
  --cosy-page-gutter: clamp(10px, 1vw, 20px);
  --cosy-page-width: calc(100% - var(--cosy-page-gutter) * 2);
  --gutter: var(--cosy-page-gutter);
  --moyo-gutter: var(--cosy-page-gutter);
  --moyo-max: 100%;
  --max: 100%;
  --ah-width: 100%;
  --ah-gutter: var(--cosy-page-gutter);
  --content: var(--cosy-page-width);
}
body[data-cosy-wide-layout] main { min-width: 0; max-width: none; }

/* Only page-level frames expand; form cards and text columns retain their measures. */
body[data-cosy-wide-layout] main > :is(
  .minimal-intro, .editorial-intro, .cosy-flex-hero, .catalog-section, .catalog-page, .catalog-index,
  .catalog-vault, .commerce-page, .ledger-page, .account-shell, .orders-shell,
  .content-shell, .editorial-page, .error-shell, .product-detail, .product-sheet,
  .product-layout, .page-shell:not(.narrow), .category-section, .featured-section,
  .fresh-section, .recommendations, .collection, .care-note, .routine-section,
  .routine-result, .home-support-story, .working-collection, .object-shelf,
  .jewel-cabinet, .bakery-case, .makeup-counter, .ritual-intro, .event-rail-section
) {
  box-sizing: border-box;
  width: var(--cosy-page-width);
  max-width: none;
  margin-inline: auto;
  padding-inline: 0;
}
body[data-cosy-wide-layout] :is(.cosy-recommendation-rail, .cosy-save-product, .cosy-saved-products) {
  box-sizing: border-box;
  width: var(--cosy-page-width);
  max-width: none;
  margin-inline: auto;
  padding-inline: var(--cosy-page-gutter);
}
body[data-cosy-wide-layout] :is(.site-footer, .ah-footer) {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding-inline: var(--cosy-page-gutter);
}
body[data-cosy-wide-layout]:not([data-cosy-wide-layout="veyra-perfumes"]):not([data-cosy-wide-layout="rift"]) :is(
  .site-header, .plan-header, .bakery-header, .colour-header, .atelier-header, .ah-header
) {
  box-sizing: border-box;
  max-width: none;
  margin-inline: 0;
  padding-inline: var(--cosy-page-gutter);
}
body[data-cosy-wide-layout="jishopie-shop"] :is(.j-container, .j-header-inner, .j-top > div, .j-hero-grid, .j-footer-grid, .j-footer-bottom) {
  width: var(--cosy-page-width);
  max-width: none;
  margin-inline: auto;
  padding-inline: 0;
}
body[data-cosy-wide-layout="novacircuit-tech"] .hero-copy { margin-left: var(--cosy-page-gutter); }
body[data-cosy-wide-layout="verdant-blooms"] :is(.site-header, .home-hero__copy, .promise-section, .personalisation-callout__copy, .site-footer) { padding-inline: var(--cosy-page-gutter); }
body[data-cosy-wide-layout] section[data-cosy-newsletter] { box-sizing: border-box; max-width: none; padding-inline: var(--cosy-page-gutter) !important; }

/* The concepts retain their side rail, floating navigation and editorial hero geometry. */
body[data-cosy-wide-layout="folio"] .site-header { margin-inline: var(--cosy-page-gutter); padding-inline: 0; }
body[data-cosy-wide-layout="orbit"] .design-hero,
body[data-cosy-wide-layout="mingle"] .design-hero,
body[data-cosy-wide-layout="folio"] .design-hero { padding-inline: var(--cosy-page-gutter); }

/* Decorative edge marks must not run through the widened hero copy. */
body[data-cosy-wide-layout="mingle"] .design-hero .hero-copy,
body[data-cosy-wide-layout="folio"] .design-hero .hero-copy { padding-inline-start: 22px; }

/* Avoid form controls forcing wider grid tracks after the surrounding page expands. */
body[data-cosy-wide-layout] :is(.catalog-tools, .checkout-form, .account-form, .product-detail, .product-sheet, .product-layout) > * { min-width: 0; }
body[data-cosy-wide-layout] :is(.content-shell, .editorial-page, .content-page) > p { max-width: 75ch; }
@media (max-width: 760px) {
  body[data-cosy-wide-layout] { --cosy-page-gutter: 10px; }
  body[data-cosy-wide-layout] :is(.site-header, .plan-header, .colour-header, .atelier-header, .bakery-header, .studio-rail) .menu-toggle { min-width: 44px; min-height: 44px; }
  body[data-cosy-wide-layout="serein-bath-body"] .site-header .brand { max-width: clamp(90px, calc(100vw - 260px), 140px); }
  body[data-cosy-wide-layout="serein-bath-body"] .site-header .cosy-destination select { max-width: 136px; }
  body[data-cosy-wide-layout="after-hours"] .ah-header { grid-template-columns: minmax(0, 1fr); }
  body[data-cosy-wide-layout="after-hours"] .ah-header > * { min-width: 0; max-width: 100%; }
  body[data-cosy-wide-layout="after-hours"] .ah-header-actions { flex-wrap: wrap; }
  body[data-cosy-wide-layout="rift"] .site-header,
  body[data-cosy-wide-layout="veyra-perfumes"] .site-header { padding-inline: var(--cosy-page-gutter); }
}
[data-cart-feedback] { grid-column: 1 / -1; margin: .65rem 0; font-size: .9rem; line-height: 1.5; }
[data-cart-feedback] a { color: inherit; text-decoration: underline; text-underline-offset: .2em; }
header [data-cosy-account-navigation] { display: flex; align-items: center; min-height: 44px; white-space: nowrap; }
header [data-cosy-account-fallback][hidden] { display: none !important; }
