/* Shared layout corrections: logical spacing, readable type and mobile reflow. */
:root {
  --purchase-bar-height: 82px;
  --page-gutter: 20px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; }
img, svg, video { max-inline-size: 100%; }
.wrap { inline-size: min(1180px, calc(100% - var(--page-gutter) * 2)); }
.home-intro, .routine-hero, .split, .cart-layout, .component-grid,
.pack-grid, .category-grid, .ritual-grid, .footer-grid, .staff-content-grid {
  min-inline-size: 0;
}
.home-intro > *, .routine-hero > *, .split > *, .cart-layout > *,
.component-grid > *, .pack-grid > *, .category-grid > *, .footer-grid > *,
.staff-content-grid > *, .field, .cart-copy, .component-head > * {
  min-inline-size: 0;
}
h1, h2, h3, p, li, label, summary, a, th, td, .message {
  overflow-wrap: anywhere;
  word-break: normal;
}
h1, h2 { text-wrap: balance; }
p { text-wrap: pretty; }
html[lang=fr] .storefront h1, html[lang=fr] .storefront h2 { hyphens: auto; }
html[lang=ar] h1, html[lang=ar] h2 { line-height: 1.5; }
html[lang=ar] h3, html[lang=ar] label, html[lang=ar] summary { line-height: 1.7; }
html[lang=ar] .eyebrow, html[lang=ar] .badge { letter-spacing: normal; }
html[lang=ar] p { line-height: 1.95; }
/* Keep product names readable without oversized editorial heading scales. */
.storefront .routine-heading h1,
html[lang=ar] .storefront .routine-heading h1 {
  font-size: clamp(1.625rem, calc(1.25rem + 1vw), 2rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: normal;
  margin-block: 10px 12px;
}
html[lang=ar] .storefront .routine-heading h1 { line-height: 1.5; }
.money { display: inline-block; white-space: nowrap; unicode-bidi: isolate; }
.field input, .field select, .field textarea, .form-input, .filter-input {
  min-inline-size: 0;
  max-inline-size: 100%;
  line-height: 1.5;
}
.field textarea { resize: vertical; }
.field input[type=checkbox], .field input[type=radio] {
  inline-size: 22px;
  min-block-size: 22px;
}
.btn, .action, .btn-secondary {
  text-align: center;
  white-space: normal;
  line-height: 1.5;
  max-inline-size: 100%;
}
.badge { display: inline-block; line-height: 1.6; }
.pack-card { display: flex; flex-direction: column; }
/* The image itself fills the square; the card clips its upper corners. */
.pack-visual {
  position: relative;
  aspect-ratio: 1 / 1;
  max-block-size: none;
  background: #fff;
}
.pack-visual > img {
  position: absolute;
  inset: 0;
  display: block;
  inline-size: 100%;
  block-size: 100%;
  padding: 0;
  object-fit: cover;
  object-position: center;
}
.pack-visual .brand-placeholder { min-block-size: 0; }
.pack-card-copy { display: flex; flex-direction: column; flex: 1; }
.pack-actions { margin-block-start: auto; padding-block-start: 20px; }
.pack-card .price { white-space: nowrap; }
.pack-card h3 { margin-block: 12px; }
.component-head { flex-wrap: wrap; align-items: start; }
.component-head h3 { flex: 1 1 150px; }
.catalog-tools { align-items: end; gap: 16px; }
.catalog-field { display: grid; gap: 8px; flex: 1 1 220px; max-inline-size: 320px; }
.catalog-field label { font-size: .875rem; }
.catalog-field select { min-inline-size: 0; }
.catalog-bottom-space { block-size: 56px; }
.language-links { display: flex; align-items: center; gap: 8px; }
.language-links a, .header-cart { min-block-size: 44px; display: inline-flex; align-items: center; }
.language-links a { justify-content: center; min-inline-size: 44px; }
.mobile-nav summary { display: flex; align-items: center; gap: 8px; list-style: none; min-block-size: 44px; }
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-links { max-block-size: calc(100dvh - 170px); overflow-y: auto; box-shadow: 0 12px 24px #2c382712; }
.mobile-links a { min-block-size: 44px; display: flex; align-items: center; padding-inline: 8px; }
.staff-navigation > summary { display: none; }
.staff-filter-form { min-inline-size: 0; flex-wrap: wrap; }
.staff-toolbar { gap: 16px; flex-wrap: wrap; }
.staff-toolbar > * { min-inline-size: 0; max-inline-size: 100%; }
.staff-main .admin-card, .staff-main .panel { min-inline-size: 0; }
.staff-shell .overflow-x-auto { overscroll-behavior-inline: contain; }
.staff-shell th, .staff-shell td { line-height: 1.65; text-align: start; }
.staff-shell th.text-center, .staff-shell td.text-center { text-align: center; }
.staff-shell th.text-right, .staff-shell td.text-right { text-align: end; }
.staff-shell [dir=ltr] { unicode-bidi: isolate; }

/* Reflow before desktop navigation and checkout columns become cramped. */
@media (max-width: 1023px) {
  .desktop-nav { display: none; }
  .mobile-nav { display: block; }
  .cart-layout { grid-template-columns: minmax(0, 1fr); }
  .routine-hero { gap: 32px; }
}
@media (max-width: 767px) {
  :root { --page-gutter: 16px; }
  html { scroll-padding-top: 140px; }
  h1 { font-size: clamp(2rem, 7.5vw, 2.75rem); line-height: 1.15; }
  h2 { font-size: clamp(1.7rem, 6vw, 2.2rem); line-height: 1.2; }
  h3 { line-height: 1.5; }
  html[lang=ar] .storefront h1 { font-size: clamp(1.75rem, 6.5vw, 2.3rem); }
  html[lang=ar] .storefront h2 { font-size: clamp(1.5rem, 5.7vw, 2rem); }
  .notice { font-size: .75rem; line-height: 1.6; padding-block: 7px; }
  .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-block-size: 0;
    gap: 0 12px;
    padding-block: 8px;
  }
  .header-brand { grid-column: 1; grid-row: 1; display: inline-flex; align-items: center; min-block-size: 44px; }
  .brand-logo { inline-size: 120px; block-size: 40px; }
  .header-brand .wordmark { font-size: 1.35rem; }
  .header-actions { display: contents; }
  .language-links { grid-column: 1; grid-row: 2; justify-self: start; gap: 4px; }
  .header-cart { grid-column: 2; grid-row: 2; justify-self: end; }
  .mobile-nav { grid-column: 2; grid-row: 1; justify-self: end; }
  .mobile-nav summary { padding: 8px; font-size: .875rem; }
  .mobile-links { gap: 4px; padding: 12px 16px; }
  .section { padding-block: 36px; }
  .page-intro { padding-block: 32px 24px; }
  .page-intro p { margin-block-start: 16px; font-size: .95rem; }
  .home-intro, .routine-hero, .split, .ritual-grid, .component-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .home-intro { padding-block: 28px 36px; }
  .home-intro p { margin-block: 16px 20px; }
  .home-intro .arch-image { inline-size: min(100%, 340px); max-block-size: 300px; justify-self: center; }
  .home-intro .brand-placeholder { min-block-size: 200px; }
  .trust-strip { display: grid; gap: 10px; text-align: center; padding-block: 16px; }
  .section-heading { gap: 16px; margin-block-end: 24px; align-items: start; flex-direction: column; }
  .category-tile { padding: 18px 12px; font-size: .9rem; line-height: 1.6; }
  .category-number { font-size: 1.5rem; margin-block-end: 8px; }
  .catalog-tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-block-end: 24px; }
  .catalog-field { max-inline-size: none; }
  .catalog-tools .btn { inline-size: 100%; }
  .catalog-bottom-space { block-size: 36px; }
  .pack-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .pack-card-copy { padding: 18px; }
  .pack-card p { font-size: .9rem; line-height: 1.7; }
  .pack-card .badge { font-size: .75rem; }
  .pack-card .btn { inline-size: 100%; }
  .pack-actions { gap: 12px; }
  .panel, .component { padding: 20px; }
  .component p, .component li, .faq p { font-size: .95rem; }
  .component-head { gap: 10px; }
  .faq summary { padding: 4px 0; line-height: 1.65; }
  .routine-hero { padding-block: 20px 36px; }
  .routine-image .brand-placeholder { min-block-size: 0; }
  .routine-heading .subtitle { font-size: 1.05rem; }
  .routine-heading .intro { font-size: .95rem; margin-block-end: 16px; }
  .routine-heading .price { font-size: 1.6rem; margin-block: 16px; }
  .routine-heading .purchase-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .qty-field { inline-size: 100%; max-inline-size: 180px; }
  .qty-field input { inline-size: 100%; }
  .gallery-thumbs { padding-block: 12px 4px; scroll-snap-type: inline proximity; }
  .gallery-thumbs button { scroll-snap-align: start; }
  .routine-page { padding-block-end: 0; }
  body.has-purchase-bar { padding-block-end: calc(var(--purchase-bar-height) + env(safe-area-inset-bottom, 0px)); }
  .purchase-bar { display: flex; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); min-block-size: 76px; }
  .purchase-bar > div { min-inline-size: 0; line-height: 1.5; }
  .purchase-bar .btn { flex: 0 1 auto; min-inline-size: 130px; }
  .purchase-bar-hidden .purchase-bar { display: none; }
  .cart-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .cart-row img { inline-size: 72px; block-size: 80px; grid-column: 1 / -1; }
  .cart-copy { grid-column: 1 / -1; }
  .cart-price { grid-column: 1 / -1; font-size: 1.05rem; }
  .cart-row form { flex-wrap: wrap; max-inline-size: 100%; gap: 10px; }
  .cart-row button, .cart-row input { min-block-size: 44px; }
  .cart-row .underline { padding: 8px; }
  .totals div { align-items: start; line-height: 1.65; }
  .totals .grand-total { font-size: 1.1rem; }
  .footer-grid { gap: 28px; }
  .brand-footer { padding-block: 36px 24px; }
  .brand-footer ul { gap: 4px; }
  .brand-footer li a { display: inline-flex; align-items: center; min-block-size: 44px; }
  .brand-footer p { font-size: .9rem; }
  .footer-bottom { line-height: 1.7; margin-block-start: 24px; }
  .field input, .field textarea, .field select, .form-input, .filter-input { font-size: 16px !important; }
  .staff-layout { grid-template-columns: minmax(0, 1fr); }
  .staff-sidebar { padding: 8px 16px; }
  .staff-brand { display: none; }
  .staff-navigation > summary { display: flex; justify-content: space-between; align-items: center; min-block-size: 44px; cursor: pointer; list-style: none; }
  .staff-navigation > summary::-webkit-details-marker { display: none; }
  .staff-navigation > summary::after { content: '+'; font-size: 1.4rem; }
  .staff-navigation[open] > summary::after { content: '−'; }
  .staff-navigation:not([open]) > nav { display: none; }
  .staff-sidebar nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; max-block-size: 65dvh; overflow-y: auto; padding-block: 8px 16px; }
  .staff-sidebar .group-label { display: block; grid-column: 1 / -1; margin: 16px 10px 4px; }
  .staff-sidebar .sidebar-link { white-space: normal; min-block-size: 44px; line-height: 1.65; }
  .staff-main { padding: 16px; }
  .staff-topbar { gap: 8px; margin-block-end: 20px; padding-block-end: 12px; font-size: .85rem; }
  .staff-topbar > div { gap: 8px 12px; }
  .staff-topbar a { display: inline-flex; align-items: center; min-block-size: 44px; }
  .staff-shell h1 { font-size: 1.3rem; }
  .staff-shell h2 { font-size: 1.2rem; }
  .staff-shell .staff-content-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .staff-shell .row-editor { padding: 16px; }
  .staff-shell .content-tabs { gap: 10px; }
  .staff-toolbar { align-items: stretch; flex-direction: column; }
  .staff-toolbar > .flex { flex-wrap: wrap; }
  .staff-filter-form { inline-size: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
  .staff-filter-form > * { min-inline-size: 0; max-inline-size: 100%; }
  .staff-filter-form > .flex { flex-wrap: wrap; }
  .staff-filter-form > .flex > div { min-inline-size: 0; flex: 1 1 140px; }
  .staff-filter-form input, .staff-filter-form select { inline-size: 100%; }
  .staff-filter-form input[type=search], .staff-filter-form input[name=q], .staff-filter-form > .relative { grid-column: 1 / -1; }
  .staff-shell button, .staff-shell .btn-secondary, .staff-shell a[title] { min-block-size: 44px; }
  .staff-shell a[title] { min-inline-size: 44px; }
  .staff-shell input[type=file] { inline-size: 100%; }
}
@media (max-width: 479px) {
  .pack-grid { grid-template-columns: minmax(0, 1fr); }
  .pack-visual .brand-placeholder { min-block-size: 0; }
  .pack-actions { display: flex; flex-wrap: wrap; }
  .pack-actions .btn { inline-size: auto; flex: 1 1 140px; }
  .section .flex > .btn { flex: 1 1 180px; }
  .staff-filter-form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 359px) {
  :root { --page-gutter: 12px; }
  .panel, .component, .pack-card-copy { padding: 16px; }
  .category-grid { gap: 10px; }
  .purchase-bar { padding-inline: 12px; }
  .purchase-bar .btn { min-inline-size: 112px; padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}


/* One complete routine per row on every phone, including larger phones. */
@media (max-width: 767px) {
  .pack-card { padding: 0; overflow: hidden; border-radius: 14px; box-shadow: 0 3px 12px #2c382705; }
  .pack-visual .brand-placeholder { min-block-size: 0; }
  .pack-card-copy { padding: 20px; gap: 0; }
  .pack-card .badge { align-self: start; font-size: .75rem; letter-spacing: 0; text-transform: none; padding: 6px 10px; }
  .pack-card h3 { font-size: 1.4rem; font-weight: 600; letter-spacing: .02em; line-height: 1.35; margin-block: 14px 8px; }
  .pack-card p { font-size: .9375rem; line-height: 1.65; }
  html[lang=ar] .pack-card p { line-height: 1.85; }
  .pack-card .pack-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-block-start: 20px; padding-block-start: 0; }
  .pack-card .price { font-size: 1.25rem; font-weight: 600; }
  .pack-card .pack-actions .btn { inline-size: auto; flex: 0 1 auto; min-inline-size: 124px; font-size: .875rem; border-radius: 8px; padding: 11px 18px; }
  .routine-image {
    position: relative;
    inline-size: 100%;
    max-block-size: none;
    aspect-ratio: 1 / 1;
    padding: 0;
    margin-inline: auto;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
  }
  .routine-image > img {
    position: absolute;
    inset: 0;
    display: block;
    inline-size: 100%;
    block-size: 100%;
    padding: 0;
    object-fit: cover;
    object-position: center;
  }
  .routine-heading .subtitle { font-size: 1rem; line-height: 1.65; }
  html[lang=ar] .routine-heading .subtitle { line-height: 1.85; }
  .routine-heading .price { margin-inline: 0; }
  .gallery-thumbs { gap: 8px; padding-block: 12px 4px; }
  .gallery-thumbs button { inline-size: 64px; block-size: 64px; padding: 0; overflow: hidden; background: #fff; border-radius: 8px; }
  .gallery-thumbs img { display: block; inline-size: 100%; block-size: 100%; padding: 0; object-fit: cover; object-position: center; }
  .purchase-bar { position: fixed; inset-block-end: 0; inset-inline: 0; z-index: 45; background: var(--cream); border-block-start: 1px solid var(--line); align-items: center; justify-content: space-between; box-shadow: 0 -4px 16px #2c382708; }
  .purchase-bar strong { display: block; font-size: .9375rem; line-height: 1.4; }
  .purchase-bar .btn { font-size: .875rem; border-radius: 8px; }
  .mobile-nav summary::marker { content: ''; }
  .mobile-nav summary { flex-direction: row; }
}
.gallery-thumbs button[aria-pressed=true] { border-color: var(--forest); box-shadow: inset 0 0 0 1px var(--forest); }

@media (max-width: 767px) {
  .catalog-page .page-intro { padding-block: 24px; }
  .catalog-page .page-intro h1 { font-size: 1.875rem; line-height: 1.2; }
  html[lang=ar] .catalog-page .page-intro h1 { font-size: 1.625rem; line-height: 1.5; }
  .catalog-page .page-intro .eyebrow { margin-block: 0 12px; font-size: .6875rem; }
  .catalog-page .page-intro p.muted { font-size: .9375rem; margin-block-start: 12px; }
}
@media (min-width: 360px) and (max-width: 767px) {
  .catalog-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .catalog-tools .btn { grid-column: 1 / -1; }
  .catalog-tools select { padding-inline: 8px; }
}

/* The narrative product editor and published content share readable line lengths. */
.routine-editor .field-wide { grid-column: 1 / -1; }
.product-copy h2 { margin-block-end: 24px; }
.product-prose { max-inline-size: 75ch; line-height: 1.85; }
.product-prose p + p { margin-block-start: 20px; }

/* Product information: segmented navigation, with all sections readable without JS. */
.routine-tabs { scroll-margin-block-start: 112px; margin-block: 8px 24px; border: 1px solid var(--line); border-radius: 18px; background: #fff; overflow: clip; }
.routine-tabs.wrap { padding: 0; }
.routine-tabs [hidden] { display: none !important; }
.routine-tabs-list { display: flex; gap: 6px; padding: 8px; background: #efebe2; border-block-end: 1px solid var(--line); }
.routine-tabs-list button { flex: 1 1 0; min-inline-size: 0; min-block-size: 52px; padding: 12px 16px; border: 1px solid transparent; border-radius: 10px; color: var(--forest); background: transparent; font-size: .9375rem; font-weight: 600; line-height: 1.5; text-align: center; overflow-wrap: normal; cursor: pointer; }
.routine-tabs-list button:hover { background: #fff9; }
.routine-tabs-list button[aria-selected=true] { background: var(--forest); color: #fff; border-color: var(--forest); box-shadow: 0 2px 5px #2c38271a; }
.routine-tabs-list button:focus-visible, .routine-tabpanel:focus-visible { outline: 2px solid #9b792e; outline-offset: -3px; }
.routine-tabpanel { padding: clamp(24px, 4vw, 48px); }
.routine-tabs.is-enhanced .routine-tabpanel { min-block-size: 240px; }
.routine-tabpanel + .routine-tabpanel { border-block-start: 1px solid var(--line); }
.routine-tabs.is-enhanced .routine-tabpanel { border-block-start: 0; }
.routine-tabpanel h2 { font-size: 1.625rem; line-height: 1.4; margin-block-end: 24px; }
.routine-tabpanel .product-prose { font-size: 1rem; color: var(--muted); }
.routine-tab-faq details { padding-block: 16px; }
.routine-tab-faq details:first-child { padding-block-start: 0; }
.routine-tab-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; list-style: none; min-block-size: 44px; }
.routine-tab-faq summary::-webkit-details-marker { display: none; }
.routine-tab-faq summary::after { content: '+'; color: #80672f; font-size: 1.5rem; font-weight: 400; flex-shrink: 0; }
.routine-tab-faq details[open] summary::after { content: '−'; }
.routine-tab-faq .product-prose { margin-block-start: 12px; }
.routine-help-link { display: inline-flex; align-items: center; gap: 10px; min-block-size: 44px; margin-block-start: 20px; text-decoration: underline; text-underline-offset: 4px; font-size: .9rem; }
.routine-checkout-section { max-inline-size: 720px; padding-block-start: 32px; }
@media (max-width: 767px) {
  .routine-tabs { scroll-margin-block-start: 0; border-radius: 14px; margin-block: 0 16px; }
  .routine-tabs-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 6px; }
  .routine-tabs-list button { min-block-size: 52px; padding: 10px 8px; font-size: .875rem; border-radius: 8px; }
  .routine-tabs-list button:last-child:nth-child(odd) { grid-column: 1 / -1; }
  html[lang=ar] .routine-tabs-list button { font-size: .875rem; line-height: 1.75; }
  .routine-tabpanel { padding: 24px 20px; }
  .routine-tabpanel h2 { font-size: 1.375rem; margin-block-end: 18px; }
  .routine-tabpanel .product-prose { font-size: .9375rem; }
}
