/* Mehndisathi semantic design authority. Loaded after legacy adapters.
 * New components consume these tokens; route-specific geometry stays in its
 * component. Priority declarations below are bounded legacy compatibility,
 * not permission to add another global override file. */
:root {
  --ms-color-brand: #a60813;
  --ms-color-brand-hover: #8d0711;
  --ms-color-ink: #35241e;
  --ms-color-muted: #68564d;
  --ms-color-success: #187246;
  --ms-color-line: #ead7ca;
  --ms-color-surface: #fffaf5;
  --ms-font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --ms-font-display: Fraunces, Georgia, serif;
  --ms-type-title: 40px;
  --ms-type-section: 30px;
  --ms-type-subheading: 20px;
  --ms-type-body: 16px;
  --ms-type-small: 13px;
  --ms-type-label: 14px;
  --ms-type-control: 14px;
  --ms-type-input: 16px;
  --ms-type-page-compact: 22px;
  --ms-type-card-title: 18px;
  --ms-weight-body: 400;
  --ms-weight-label: 600;
  --ms-weight-action: 700;
  --ms-leading-copy: 1.5;
  --ms-leading-heading: 1.25;
  --ms-control-height: 44px;
  --ms-control-radius: 12px;
  --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-public-border: var(--ms-color-line);
  --ms-public-surface: var(--ms-color-surface);
  --ms-public-ink: var(--ms-color-ink);
  --ms-public-muted: var(--ms-color-muted);
}
body { font-family: var(--ms-font-body); }
html body :is(button,input,select,textarea) { font-family: var(--ms-font-body) !important; }
html body :is(input,textarea)::placeholder { color: var(--ms-color-muted); opacity: 1; }
body:is(.member-workspace-shell,.page-admin) {
  --work-brand: var(--ms-color-brand);
  --work-ink: var(--ms-color-ink);
  --work-muted: var(--ms-color-muted);
  --work-line: var(--ms-color-line);
}
.ms-copy { font-size: var(--ms-type-body); line-height: var(--ms-leading-copy); }
.ms-actions > :is(a,button) { font-size: var(--ms-type-control); font-weight: var(--ms-weight-action); }
html body:is(.page-home,.page-public) #main-content :is(.button,.ui-button) {
  font-size: var(--ms-type-control) !important; min-height: var(--ms-control-height) !important;
  font-weight: var(--ms-weight-action) !important; line-height: 1.4 !important;
}
html body.page-public.route-gallery #main-content .marketplace-card-publisher {
  font-size: var(--ms-type-small) !important; line-height: 1.4 !important;
  font-weight: var(--ms-weight-body) !important;
}
html body.route-about #main-content h1,
html body.route-search #main-content #unified-search-title { font-size: var(--ms-type-title) !important; line-height: var(--ms-leading-heading) !important; }
html body.route-about #main-content h2 { font-size: var(--ms-type-section) !important; line-height: var(--ms-leading-heading) !important; }
html body.route-about #main-content p:not(.eyebrow) { font-size: var(--ms-type-body) !important; line-height: var(--ms-leading-copy) !important; font-weight: var(--ms-weight-body) !important; }

/* One card type scale across Home rail, directories and migrated result grids.
 * No grid, aspect-ratio or accepted per-surface width is changed here. */
html body #main-content [data-shared-provider-card] .discovery-v1-provider-card__body h3 { font-size: var(--ms-type-card-title) !important; line-height: 1.3 !important; }
html body #main-content [data-shared-provider-card] .discovery-v1-provider-card__body :is(strong,p,small) { font-size: var(--ms-type-small) !important; line-height: 1.4 !important; }
html body #main-content [data-shared-provider-card] .discovery-v1-provider-card__body .ui-button {
  min-height: var(--ms-control-height) !important; height: auto !important;
  font-size: var(--ms-type-control) !important; line-height: 1.4 !important;
  font-weight: var(--ms-weight-action) !important; background: var(--ms-color-brand) !important; color: #fff !important;
}

/* Shared app chrome: preserve identity, icon geometry and the seven-item dock. */
body :is(.site-header,.mobile-app-nav,.workspace-topbar) img { object-fit: contain; }
html body.page-home #main-content .home-app-search button { min-width: var(--ms-control-height) !important; min-height: var(--ms-control-height) !important; }
html body.page-home #main-content .home-app-search input { min-height: var(--ms-control-height) !important; }
html body.page-home #main-content .home-app-location { font-size: var(--ms-type-control) !important; }
html body .workspace-topbar :is(button,.button) { min-height: var(--ms-control-height) !important; font-size: var(--ms-type-control) !important; line-height: 1.4 !important; }
html body :is(.shortlist-head,.pwa-install-banner) .button { min-height: var(--ms-control-height) !important; font-size: var(--ms-type-control) !important; line-height: 1.4 !important; }
body :is(.public-skip-link,.dashboard-skip-link):focus-visible,
body :is(button,a,input,select,textarea,summary):focus-visible { outline: 2px solid var(--ms-color-brand); outline-offset: 3px; }
/* Anchor and keyboard scrolling must leave room for fixed app chrome.
 * Scroll padding changes focus positioning, never the accepted page spacing. */
html { scroll-padding-block-start: calc(var(--app-header-height, 86px) + 16px); scroll-padding-block-end: 16px; }

/* Consent is outside main and is not covered by page-family adapters. */
@media (max-width: 980px) {
  html { scroll-padding-block-start: calc(var(--app-mobile-header-height, 70px) + 12px); }
  /* Four compact header actions remain usable without shrinking their hit area. */
  html body.phase1-foundation .site-header .mobile-header-actions { flex: 0 0 auto !important; }
  html body.phase1-foundation .site-header .brand { min-width: 0 !important; }
  html body.phase1-foundation .site-header .mobile-header-actions .mobile-header-action {
    flex-basis: var(--ms-control-height) !important;
    width: var(--ms-control-height) !important;
    min-width: var(--ms-control-height) !important;
    height: var(--ms-control-height) !important;
    min-height: var(--ms-control-height) !important;
  }
  /* The legacy text cross must not create a second grid row below the button.
   * Keep the existing accessible Close label and one centered visual symbol. */
  html body .site-header .nav-toggle[aria-expanded="true"] .nav-toggle-icon { visibility: hidden; }
  html body .site-header .nav-toggle[aria-expanded="true"]::before,
  html body .site-header .nav-toggle[aria-expanded="true"]::after {
    content: "";
    position: absolute;
    display: block;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-top: 2px solid currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
    pointer-events: none;
  }
  html body .site-header .nav-toggle[aria-expanded="true"]::after {
    transform: translate(-50%, -50%) rotate(-45deg);
  }
}
html body .consent-banner .consent-banner-copy h2 { font-size: var(--ms-type-subheading) !important; line-height: 1.3 !important; }
html body .consent-banner .consent-banner-copy :is(p,a) { font-size: var(--ms-type-body) !important; line-height: var(--ms-leading-copy) !important; }
html body .consent-banner .consent-banner-actions :is(button,a) {
  font-size: var(--ms-type-control) !important; font-weight: var(--ms-weight-action) !important;
  min-height: var(--ms-control-height) !important; line-height: 1.35 !important;
}

/* At high zoom and on short landscape screens, keep the full privacy notice
   reachable above the sticky header. Its actions scroll with the copy. */
@media (max-height: 30rem) {
  html body .consent-banner {
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - max(1rem, env(safe-area-inset-top)) - max(1rem, env(safe-area-inset-bottom)));
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 12051;
  }
}

/* Authentication presentation only. Providers, validation and redirects remain
 * owned by the existing auth implementation. Inputs retain a readable16px. */
html body.page-auth #main-content :is(h1,.auth-heading) { font-size: var(--ms-type-title) !important; line-height: var(--ms-leading-heading) !important; }
html body.page-auth #main-content :is(.auth-flow-copy,.auth-reset-link,.auth-switch-link,.register-consent-check) { font-size: var(--ms-type-label) !important; line-height: var(--ms-leading-copy) !important; }
html body.page-auth #main-content :is(.button,.ui-button,.auth-option,.auth-mode-switch a,.auth-primary-submit) {
  min-height: var(--ms-control-height) !important; font-size: var(--ms-type-control) !important;
  font-weight: var(--ms-weight-action) !important; line-height: 1.4 !important;
}
html body.page-auth #main-content :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea) { font-size: var(--ms-type-input) !important; }
html body.page-auth #main-content .password-toggle { min-height: 44px !important; min-width: 44px !important; }

/* Directory filters share the same readable labels and mobile-safe input scale. */
html body.page-public:is(.route-artists,.route-tutors,.route-products,.route-gallery) #main-content :is(.artist-filter-form,.marketplace-filter-form) > label > span {
  font-size: var(--ms-type-label) !important; line-height: 1.4 !important;
}
html body.page-public:is(.route-artists,.route-tutors,.route-products,.route-gallery) #main-content :is(.artist-filter-form,.marketplace-filter-form) :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]),select,textarea) {
  font-size: var(--ms-type-input) !important; line-height: 1.4 !important; min-height: var(--ms-control-height) !important;
}
html body.page-public:is(.route-artists,.route-tutors,.route-products,.route-gallery) #main-content :is(.artist-filter-form,.marketplace-filter-form) :is(input,select,textarea,button,a) { scroll-margin-block-start: 64px; }

/* Community controls include the composer and its keyboard listbox. */
html body.route-requests #main-content .cm-community { --cm-accent: var(--ms-color-brand); --cm-ink: var(--ms-color-ink); --cm-muted: var(--ms-color-muted); --cm-border: var(--ms-color-line); }
html body.route-requests #main-content .cm-community :is(.button,button:not(.cm-filter-backdrop),.cm-join-link) { font-size: var(--ms-type-control) !important; min-height: var(--ms-control-height) !important; line-height: 1.4 !important; }
html body.route-requests #main-content .cm-community .cm-join-link { display: inline-flex; align-items: center; }
html body.route-requests #main-content .cm-community :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea) { font-size: var(--ms-type-input) !important; }
html body.route-requests #main-content .cm-community :is(label,.cm-help,.cm-post-location) { font-size: var(--ms-type-label) !important; }

@media (max-width: 820px) {
  html { scroll-padding-block-end: calc(82px + env(safe-area-inset-bottom, 0px)); }
  :root {
    --ms-type-title: 24px;
    --ms-type-section: 20px;
    --ms-type-subheading: 16px;
    --ms-type-body: 14px;
    --ms-type-small: 12px;
    --ms-type-label: 13px;
    --ms-type-control: 13px;
    --ms-type-page-compact: 18px;
    --ms-type-card-title: 16px;
    --ms-card-gap: 12px;
    --ms-panel-padding: 16px;
    --ms-section-gap: 24px;
  }
  html body:is(.page-home,.page-public,.page-auth) .mobile-app-nav.mobile-app-nav--community .mobile-app-nav-item { font-size: 10px !important; font-weight: 600 !important; }
  html body .mobile-app-nav--community .mobile-community-circle { font-size: 9px; background: var(--ms-color-brand); }
  html body.page-auth #main-content p:not(.eyebrow),
  html body #main-content .admin-login-workspace p,
  html body.founder-phase1-section-d.member-workspace-shell #main-content .receipt-shell p { font-size: var(--ms-type-body) !important; line-height: var(--ms-leading-copy) !important; }
  html body.route-about #main-content .eyebrow { font-size: var(--ms-type-label) !important; line-height: var(--ms-leading-copy) !important; }
  html body.route-search #main-content .unified-search-summary,
  html body.route-home #main-content .home-community-proof-copy p:not(.eyebrow) { font-size: var(--ms-type-body) !important; line-height: var(--ms-leading-copy) !important; }
  /* Home uses compact discovery heading and horizontal card rails by design. */
  html body.route-home.page-home #main-content #home-hero-title { font-size: 23px !important; line-height: var(--ms-leading-heading) !important; }
  html body.route-home.page-home #main-content :is(.home-app-section-head h2,.home-confidence-section h2,.customer-task-section h2,.home-community-proof-copy h2,.home-app-coming-soon h2) { font-size: var(--ms-type-section) !important; line-height: var(--ms-leading-heading) !important; }
  html body.route-home.page-home #main-content :is(.home-confidence-grid,.customer-task-grid) :is(p,li) { font-size: var(--ms-type-body) !important; line-height: var(--ms-leading-copy) !important; font-weight: var(--ms-weight-body) !important; }
  html body.route-home.page-home #main-content :is(.home-confidence-grid,.customer-task-grid) :is(summary,strong) { font-size: var(--ms-type-label) !important; line-height: 1.4 !important; }
  html body.route-home.page-home #main-content .home-app-section-head > a { min-height: 44px; display: inline-flex; align-items: center; font-size: var(--ms-type-label) !important; }
  html body.route-home.page-home #main-content .home-app-card > span { font-size: var(--ms-type-small) !important; line-height: 1.4 !important; }
  html body.route-home.page-home #main-content .home-app-card > strong { font-size: var(--ms-type-label) !important; line-height: 1.4 !important; }

  /* Late legacy profile-pilot rules previously reset actions to10px. */
  html body.route-profile #main-content .profile-mobile-pilot h1 { font-size: var(--ms-type-title) !important; line-height: var(--ms-leading-heading) !important; }
  html body.route-profile #main-content .profile-mobile-pilot :is(.u1-profile-about-card p,.u1-profile-summary,.profile-pilot-intro p,.discovery-v1-profile__location) { font-size: var(--ms-type-body) !important; line-height: var(--ms-leading-copy) !important; }
  html body.route-profile #main-content .profile-mobile-pilot :is(.u1-profile-actions .ui-button,.profile-share-menu > summary,.profile-pilot-tabs button) { font-size: var(--ms-type-control) !important; min-height: var(--ms-control-height) !important; line-height: 1.35 !important; }
  html body.route-profile #main-content .profile-mobile-pilot .profile-pilot-related-card small { font-size: var(--ms-type-small) !important; }
  html body.route-profile #main-content .profile-mobile-pilot .u1-profile-actions { gap: 8px !important; }


  /* Community retains its short one-line brand title and public/private model. */
  html body.route-requests #main-content .cm-community h1 { font-size: min(var(--ms-type-title), 6vw) !important; }
  html body.route-requests #main-content .cm-community :is(h2,h3) { font-size: var(--ms-type-section) !important; }
  html body.route-requests #main-content .cm-community h3.cm-post-title { font-size: var(--ms-type-card-title) !important; line-height: var(--ms-leading-heading) !important; }
  html body.route-requests #main-content .cm-community p { font-size: var(--ms-type-body) !important; }
  html body:is(.page-home,.page-public) #main-content :is(.catalog-empty-state,.artist-live-empty-state) :is(h2,h3) { font-size: var(--ms-type-section) !important; }
  html body:is(.page-home,.page-public) #main-content :is(.catalog-empty-state,.artist-live-empty-state,.empty-state) p { font-size: var(--ms-type-body) !important; line-height: var(--ms-leading-copy) !important; }
}
@media (max-width: 360px) {
  :root { --ms-type-title: 22px; }
  html body.route-home.page-home #main-content #home-hero-title { font-size: 21px !important; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  body .mobile-community-circle { animation: none !important; }
}
/* The keyboard-operable account ledger scroll proxy needs a usable target. */
body.page-admin .admin-database-scroll-top { min-height: 28px; }
/* Shared WhatsApp controls retain readable white text at compact label sizes. */
html body .button.whatsapp { background: #157a46 !important; border-color: #157a46 !important; color: #fff !important; }
html body .button.whatsapp:is(:hover,:focus-visible) { background: #10663a !important; border-color: #10663a !important; }
