/* Shared primitives for migrated public surfaces. Keep legacy adapters route-scoped. */
:root {
  --ms-card-radius: 18px;
  --ms-card-body-padding: 12px;
  --ms-card-gap: 16px;
  --ms-panel-radius: 22px;
  --ms-panel-padding: clamp(16px, 2vw, 24px);
  --ms-section-gap: clamp(24px, 3vw, 40px);
  --ms-control-radius: 12px;
  --ms-control-height: 44px;
  --ms-public-border: #ead7ca;
  --ms-public-surface: #fffaf5;
  --ms-public-ink: #30231d;
  --ms-public-muted: #6e5b51;
}
.ms-surface { min-width: 0; padding: var(--ms-panel-padding); border: 1px solid var(--ms-public-border); border-radius: var(--ms-panel-radius); background: var(--ms-public-surface); }
.ms-stack { display: grid; gap: var(--ms-card-gap); min-width: 0; }
.ms-section-stack { display: grid; gap: var(--ms-section-gap); min-width: 0; }
.ms-responsive-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--ms-grid-min, 240px)), 1fr)); gap: var(--ms-card-gap); min-width: 0; }
.ms-copy { font-size: 16px; font-weight: 400; line-height: 1.55; word-break: normal; overflow-wrap: break-word; }
.ms-actions { display: flex; flex-wrap: wrap; gap: 10px; min-width: 0; }
.ms-actions > :is(a,button) { display: inline-flex; align-items: center; justify-content: center; min-height: var(--ms-control-height); border-radius: var(--ms-control-radius); }
.ms-surface :is(a,button,input,summary):focus-visible { outline: 2px solid #a80720; outline-offset: 3px; }

/* Directory filters share one control skin at every width; their existing
   toolbar rules continue to own placement, spacing and mobile drawer layout. */
body.page-public:is(.route-artists,.route-tutors,.route-products,.route-gallery) .directory-mobile-filter-toolbar .mobile-filter-toggle {
  appearance: none;
  border: 1px solid var(--ms-color-border, #ead7ca);
  background: var(--ms-color-surface, #fffaf5);
  color: var(--ms-color-brand, #a80720);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
body.page-public:is(.route-artists,.route-tutors,.route-products,.route-gallery) .directory-mobile-filter-toolbar .mobile-filter-toggle:focus-visible {
  outline: 2px solid var(--ms-color-brand, #a80720);
  outline-offset: 3px;
}
@media (max-width: 820px) {
  /* A reveal transform must not trap or clip the fixed filter drawer. */
  body.page-public:is(.route-artists,.route-tutors,.route-products,.route-gallery) :is(.artist-directory-workspace-section,.marketplace-directory-section):has(:is(.artist-filter-panel,.marketplace-filter-panel).is-mobile-open) {
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
    overflow: visible !important;
  }
}

/* Copy follows its available column width, including intermediate viewports. */
body.page-public .founder-b-directory-copy #directory-professional-title,
html body.page-home .home-app-coming-soon-copy > p {
  white-space: normal !important;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Privacy Choices is shared by every public route, outside the support page shell. */
/* These scoped priorities retire the legacy mobile dialog compression. */
body #privacy-settings.consent-dialog { width: min(560px, calc(100vw - 24px)) !important; max-width: none !important; max-height: calc(100dvh - 24px) !important; margin: auto; padding: 0; border: 1px solid var(--ms-public-border); border-radius: var(--ms-panel-radius) !important; overflow: auto !important; background: #fffaf5; color: var(--ms-public-ink); }
body #privacy-settings [data-consent-form] { display: grid; gap: 16px !important; padding: var(--ms-panel-padding) !important; max-height: none !important; overflow: visible !important; }
body #privacy-settings .consent-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
body #privacy-settings h2 { margin: 0; font-size: clamp(22px, 4vw, 28px) !important; line-height: 1.2 !important; text-align: left; }
body #privacy-settings .consent-dialog-close { flex: 0 0 44px !important; width: 44px !important; height: 44px !important; min-height: 44px; padding: 0; font-size: 26px !important; border-radius: 50%; }
body #privacy-settings .consent-choice { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px !important; padding: 16px !important; margin: 0; border: 1px solid var(--ms-public-border); border-radius: var(--ms-control-radius) !important; text-align: left; }
body #privacy-settings .consent-choice > div { min-width: 0; }
body #privacy-settings .consent-choice strong { font-size: 16px !important; font-weight: 600; line-height: 1.4; }
body #privacy-settings :is(.consent-choice p,.consent-dialog-note) { font-size: 14px !important; font-weight: 400; line-height: 1.55 !important; text-align: left; word-break: normal; overflow-wrap: break-word; margin: 6px 0 0; }
body #privacy-settings .consent-dialog-note { margin: 0; }
body #privacy-settings .consent-choice > span { padding: 6px 9px !important; font-size: 12px !important; line-height: 1.4; font-weight: 500; white-space: nowrap; }
body #privacy-settings input[type=checkbox] { width: 22px !important; height: 22px !important; margin: 0; }
body #privacy-settings .consent-dialog-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
body #privacy-settings .consent-dialog-actions > :is(a,button) { min-height: 44px !important; padding: 10px !important; font-size: 14px !important; font-weight: 600; line-height: 1.4 !important; white-space: normal; }
body #privacy-settings :is(a,button,input):focus-visible { outline: 2px solid #a80720; outline-offset: 3px; }
@media (max-width: 360px) {
  body #privacy-settings .consent-choice.is-required { grid-template-columns: minmax(0, 1fr); }
  body #privacy-settings .consent-choice.is-required > span { justify-self: start; }
}

/* Shared product/design image preview must clear fixed app navigation and keep
   its close action reachable in landscape, with long captions and safe areas. */
body .media-lightbox {
  z-index: 13000;
  padding: calc(72px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
body .media-lightbox figure { display: flex; flex-direction: column; min-height: 0; max-height: 100%; }
body .media-lightbox img { min-height: 0; max-height: calc(100dvh - 140px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); object-fit: contain; }
body .media-lightbox figcaption { flex: 0 0 auto; max-height: 25dvh; overflow: auto; overflow-wrap: break-word; font-size: var(--ms-type-body, 16px); font-weight: var(--ms-weight-label, 600); line-height: 1.4; }
body .media-lightbox-close { top: max(12px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); z-index: 1; min-height: var(--ms-control-height, 44px); font-size: var(--ms-type-control, 14px); font-weight: var(--ms-weight-action, 700); }

/* Give saved items the mobile drawer space, keeping its actions reachable. */
@media (max-width: 767px) {
  html body .shortlist-drawer {
    height: auto !important;
    max-height: min(620px, calc(100dvh - var(--app-mobile-header-height, 70px) - var(--app-bottom-nav-height, 68px) - 24px - env(safe-area-inset-bottom))) !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    gap: 10px !important;
  }
  html body .shortlist-drawer .shortlist-head { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 10px !important; }
  html body .shortlist-head > div { min-width: 0; }
  html body .shortlist-head .eyebrow { display: none; }
  html body .shortlist-head h2 { margin: 0 !important; font-size: 18px !important; line-height: 1.25 !important; }
  html body .shortlist-head .button { flex: 0 0 auto; width: auto !important; min-width: 64px; padding: 8px 12px !important; }
  html body .shortlist-drawer .form-note { margin: 0 !important; font-size: 12px !important; line-height: 1.4 !important; }
  html body .shortlist-drawer .shortlist-compare { display: flex; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
  html body .shortlist-compare strong { font-size: 13px !important; line-height: 1.4 !important; }
  html body .shortlist-compare > span { display: none; }
  html body .shortlist-drawer .shortlist-items { min-height: 0 !important; overflow-y: auto !important; overscroll-behavior: contain; }
  html body .shortlist-item-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  html body .shortlist-item-actions :is(a,button) { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 8px; box-sizing: border-box; }
  html body .shortlist-drawer .shortlist-actions { margin: 0 !important; }
  html body .shortlist-actions .button { min-height: 44px !important; }
  html body .shortlist-drawer.is-empty { height: auto !important; grid-template-rows: auto minmax(0, 1fr) !important; }
  html body .shortlist-drawer.is-empty .shortlist-actions { display: none !important; }
  html body .shortlist-drawer.is-empty .shortlist-items { overflow-y: auto !important; }
}
/* Review access text follows the existing form grid without another nested card. */
.u1-profile-review-form-section .review-access-note,
.platform-review-form .review-access-note { grid-column: 1 / -1; margin: 0 0 12px; font-size: 14px; line-height: 1.5; }
.review-access-note [data-review-google] { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-underline-offset: 3px; }

body.route-home.page-home dialog.platform-review-dialog {
  box-sizing: border-box;
  width: min(28rem, calc(100% - 1.25rem)) !important;
  max-height: calc(100dvh - 1.25rem);
  padding: 0;
  text-align: left;
}
body.route-home.page-home .platform-review-dialog .platform-review-dialog__head { padding: .65rem .9rem; }
body.route-home.page-home .platform-review-dialog #platform-review-dialog-title {
  font-size: 1.22rem !important;
  line-height: 1.2 !important;
}
body.route-home.page-home .platform-review-dialog form.platform-review-form {
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr));
  padding: .85rem .9rem; gap: .65rem;
}
body.route-home.page-home .platform-review-dialog form > label.ui-field { min-width: 0; text-align:left; gap:.2rem; }
body.route-home.page-home .platform-review-dialog .platform-review-rating-field { grid-column:1/-1; margin:0; text-align:left; }
body.route-home.page-home .platform-review-dialog .platform-review-body textarea { min-height:4rem; height:4rem; }
body.route-home.page-home .platform-review-dialog .platform-review-form > .ui-button { margin:0; }
@media (max-width: 820px) {
  html body.page-public #main-content .founder-b-marketplace-cta .hero-actions {
    grid-auto-flow: row !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)) !important;
  }
  html body.page-public #main-content .founder-b-marketplace-cta .hero-actions > a {
    grid-area: auto !important;
  }
}
html body.route-home.page-home .home-app-coming-soon-copy > :is(#home-app-coming-soon-title,p) {
  max-width: none !important;
}
@media (min-width:821px) {
  .home-app-coming-soon-copy { container-type:inline-size; min-width:0; }
  html body.route-home.page-home .home-app-coming-soon-copy > #home-app-coming-soon-title {
    font-size:clamp(1.1rem,7.4cqi,2.8rem) !important;
  }
}

/* Compact directory type, with full-size touch targets on every screen. */
html body.page-public #main-content .directory-mobile-filter-toolbar :is(.directory-filter-chip, .mobile-filter-toggle),
.catalog-directory-filters :is(summary, .directory-filter-chip) {
  font-size: .875rem !important;
  line-height: 1.25 !important;
  font-weight: 650 !important;
}
.catalog-directory-filters {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
  gap: .6rem;
  margin: .5rem 0 1rem;
  min-width: 0;
}
.catalog-filter-disclosure[open] { grid-column: 1 / -1; }
.catalog-filter-disclosure > summary,
.catalog-filter-shortcuts > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 44px;
  padding: .35rem .8rem;
  border: 1px solid #dfc5b8;
  border-radius: .7rem;
  background: #fffaf4;
  color: #751c24;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
}
.catalog-filter-disclosure > summary { width: fit-content; list-style: none; }
.catalog-filter-disclosure > summary::-webkit-details-marker { display: none; }
.catalog-filter-shortcuts {
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  padding: 2px;
  min-width: 0;
  max-width: 100%;
}
.catalog-filter-disclosure[open] + .catalog-filter-shortcuts { grid-column: 1 / -1; }
.catalog-filter-shortcuts > .is-active { border-color: #9c1831; background: #fff0ea; }
.catalog-filter-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  align-items: end;
  gap: .75rem;
  margin-top: .5rem;
  padding: .85rem;
  border: 1px solid #e9d6c9;
  border-radius: .8rem;
  background: #fffcf8;
}
.catalog-filter-fields label { display: grid; min-width: 0; gap: .25rem; font-size: .875rem; }
.catalog-filter-fields :is(input, select, button) { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; }
.catalog-filter-fields :is(input, select) {
  border: 1px solid #d9c5b9;
  border-radius: .6rem;
  padding: .5rem .65rem;
  background: #fff;
  color: #36251f;
  font: inherit;
}

.marketplace-seo-drawer > summary {
  box-sizing: border-box;
  min-height: 44px;
  padding-block: 12px;
  font-size: 1rem;
  line-height: 1.4;
  cursor: pointer;
}

/* Keep the four browse headings aligned with the provider directory. */
body.page-public:is(.route-artists, .route-services, .route-tutors, .route-courses) #main-content .discovery-v1-directory-heading {
  box-sizing: border-box;
  margin: 0 auto !important;
  padding: clamp(24px, 3vw, 44px) 16px !important;
  text-align: center;
}
body.page-public:is(.route-artists, .route-services, .route-tutors, .route-courses) #main-content .discovery-v1-directory-heading h1 {
  margin: 0 !important;
  font: inherit;
  font-size: clamp(18px, 2vw, 22px) !important;
  font-weight: 800 !important;
  line-height: 1.35 !important;
  text-align: center;
}
#main-content .offer-directory {
  margin: 0;
  padding: 0;
}
.offer-directory-content {
  box-sizing: border-box;
  padding: 0 48px 2rem;
}
.offer-directory .catalog-directory-filters { margin-top: 0; }
@media (max-width: 960px) {
  .offer-directory-content { padding-inline: 24px; }
}
@media (max-width: 700px) {
  body.page-public:is(.route-artists, .route-services, .route-tutors, .route-courses) #main-content .discovery-v1-directory-heading {
    padding-block: 20px !important;
  }
  .offer-directory-content { padding-inline: 16px; }
}
@media (min-width: 1200px) {
  body.page-public #main-content :is(#directory-product-grid, #directory-profile-grid, #directory-seller-grid, #directory-design-grid)[data-public-feed],
  .offer-directory .public-offers-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
}
