/* Marriage Biodata Maker redesign (loaded after marriage-biodata.css, overrides it).
   "mbm2-" classes are the new page chrome: hero, 3-step progress, stage headers, builder toolbar,
   Details/Design tabs and the phone bottom bar. Gallery cards now show a real scaled-down render
   of each template (.mbm-thumb-doc, drawn lazily by marriage-biodata-app.js). */

#about.mbm2 { padding: 108px 0 40px; } /* clears the fixed site header (80px desktop); beats the theme's #about rule */
.mbm2 .mbm-wrap { max-width: 1280px; }

/* ---- Hero ---- */
.mbm2-hero-text { min-width: 0; }
.mbm2-hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: center; background: linear-gradient(135deg, rgba(190,18,60,0.07), rgba(217,119,6,0.07)); border: 1px solid rgba(190,18,60,0.14); border-radius: 20px; padding: 24px 28px; margin-bottom: 18px; }
.mbm2-hero h1 { font-size: 28px; font-weight: 800; line-height: 1.25; color: var(--text-primary, #1e293b); margin: 6px 0 8px; }
.mbm2-hero p { font-size: 15px; color: var(--text-secondary, #64748b); margin: 0 0 14px; max-width: 64ch; }
.mbm2-hero .mbm-breadcrumb { margin-bottom: 8px; }
.mbm2-feats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.mbm2-feats li { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-primary, #1e293b); background: var(--bg-card, #fff); border: 1px solid var(--border-color, #e2e8f0); border-radius: 999px; padding: 5px 12px; }
.mbm2-feats i { color: #be123c; }
.mbm2-hero-side { background: var(--bg-card, #fff); border: 1px solid var(--border-color, #e2e8f0); border-radius: 16px; padding: 16px; text-align: center; }
.mbm2-side-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-secondary, #64748b); text-transform: uppercase; letter-spacing: .04em; }
.mbm2-hero-side .mbm-lang-switch { margin: 8px auto 10px; }
.mbm2-privacy { font-size: 12px; color: var(--text-secondary, #64748b); margin: 0; text-align: left; display: flex; gap: 8px; }
.mbm2-privacy i { color: #16a34a; margin-top: 2px; }

/* ---- 3-step progress ---- */
.mbm2-progress { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 18px; counter-reset: none; }
.mbm2-progress li { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--bg-subtle, #f1f5f9); color: var(--text-secondary, #64748b); font-size: 13.5px; font-weight: 700; position: relative; }
.mbm2-pn { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-card, #fff); border: 2px solid currentColor; font-size: 12.5px; }
.mbm2-progress li.is-current { background: linear-gradient(135deg, #be123c, #9d174d); color: #fff; box-shadow: 0 8px 18px rgba(157,23,77,0.25); }
.mbm2-progress li.is-current .mbm2-pn { background: #fff; color: #be123c; border-color: #fff; }
.mbm2-progress li.is-done { background: rgba(34,197,94,0.12); color: #15803d; }
.mbm2-progress li.is-done .mbm2-pn { font-size: 0; background: #16a34a; border-color: #16a34a; }
.mbm2-progress li.is-done .mbm2-pn::after { content: "\2713"; font-size: 13px; color: #fff; }

/* ---- Draft banner ---- */
.mbm2-draft { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: rgba(37,99,235,0.07); border: 1px solid rgba(37,99,235,0.28); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; color: var(--text-primary, #1e293b); margin-bottom: 18px; }
.mbm2-draft[hidden] { display: none; }
.mbm2-draft i { color: #2563eb; }
.mbm2-draft span { flex: 1; min-width: 200px; }

/* ---- Stages ---- */
.mbm2-stage { background: var(--bg-card, #fff); border: 1px solid var(--border-color, #e2e8f0); border-radius: 20px; padding: 24px; box-shadow: 0 10px 28px var(--shadow-color, rgba(15,23,42,0.05)); margin-bottom: 28px; }
.mbm2-stage[hidden] { display: none; }
.mbm2-stage-title { font-size: 21px; font-weight: 800; color: var(--text-primary, #1e293b); margin: 0 0 4px; }
.mbm2-stage-sub { font-size: 13.5px; color: var(--text-secondary, #64748b); margin: 0 0 16px; }
.mbm2-stage-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
#mbmStageRole { text-align: center; }

/* Role cards */
#mbmStageRole .mbm-role-grid { max-width: 620px; margin: 18px auto 18px; }
#mbmStageRole .mbm-role-card { padding: 30px 16px 24px; border-radius: 20px; box-shadow: 0 6px 18px var(--shadow-color, rgba(15,23,42,0.05)); }
#mbmStageRole .mbm-role-card:focus-visible { outline: 3px solid rgba(190,18,60,0.4); outline-offset: 2px; }
#mbmStageRole .mbm-role-card .mbm-role-emoji { font-size: 60px; }
#mbmStageRole .mbm-role-card h3 { font-size: 21px; }
.mbm2-role-sub { display: block; font-size: 13px; color: var(--text-secondary, #64748b); margin-top: 4px; }
.mbm2-role-foot { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-secondary, #64748b); }
.mbm2-role-foot [hidden] { display: none; }
.mbm2-how { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0; margin: 24px 0 0; text-align: left; }
.mbm2-how li { display: flex; gap: 10px; background: var(--bg-subtle, #f8fafc); border-radius: 14px; padding: 14px; font-size: 12.5px; color: var(--text-secondary, #64748b); }
.mbm2-how b { flex: none; width: 28px; height: 28px; border-radius: 50%; background: rgba(190,18,60,0.1); color: #be123c; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.mbm2-how strong { display: block; font-size: 13.5px; color: var(--text-primary, #1e293b); margin-bottom: 2px; }

/* ---- Gallery ---- */
#mbmStageGallery .mbm-gallery-toolbar { margin-bottom: 12px; }
#mbmStageGallery .mbm-search-box { flex: 1; min-width: 220px; }
#mbmCategoryFilter { display: none; } /* replaced by the category chips below; kept for app state */
.mbm2-cat-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: thin; }
.mbm-cat-chip { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-color, #e2e8f0); background: var(--bg-card, #fff); color: var(--text-primary, #1e293b); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.mbm-cat-chip span { font-size: 11px; font-weight: 700; color: var(--text-secondary, #64748b); background: var(--bg-subtle, #f1f5f9); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.mbm-cat-chip:hover { border-color: #be123c; }
.mbm-cat-chip.is-active { background: #1e293b; color: #fff; border-color: #1e293b; }
.mbm-cat-chip.is-active span { background: rgba(255,255,255,0.2); color: #fff; }
#mbmStageGallery .mbm-chip-row { align-items: center; }
.mbm2-gallery-info { margin-left: auto; font-size: 12.5px; color: var(--text-secondary, #64748b); }
#mbmStageGallery .mbm-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 18px; }
.mbm-gallery-thumb.is-live { height: auto; aspect-ratio: 3 / 4; display: block; background: linear-gradient(160deg, var(--mbm-thumb-a, #9d174d), var(--mbm-thumb-b, #d97706)); }
.mbm-thumb-open { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; overflow: hidden; display: block; }
.mbm-thumb-doc { position: absolute; top: 0; left: 0; width: 794px; transform-origin: top left; pointer-events: none; box-shadow: none !important; margin: 0 !important; }
.mbm-gallery-card.is-visible .mbm-thumb-doc { animation: mbm2-fade .25s ease; }
@keyframes mbm2-fade { from { opacity: 0; } to { opacity: 1; } }
.mbm-gallery-thumb.is-live::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: linear-gradient(to bottom, transparent, rgba(15,23,42,0.18)); pointer-events: none; }
.mbm-gallery-card:hover .mbm-thumb-open::after { content: "\f00e"; font-family: FontAwesome; position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(15,23,42,0.6); color: #fff; font-size: 18px; line-height: 46px; text-align: center; }
.mbm-gallery-body h4 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mbm2-more-wrap { text-align: center; }
#mbmGalleryMore[hidden] { display: none; }

/* ---- Builder toolbar ---- */
.mbm2-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--border-color, #e2e8f0); }
.mbm2-tpl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.mbm2-tpl-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary, #64748b); }
.mbm2-tpl b { font-size: 15px; color: var(--text-primary, #1e293b); }
.mbm2-inline-field { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-weight: 600; color: var(--text-secondary, #64748b); }
.mbm2-draft-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mbm-btn-link { background: transparent; color: var(--text-secondary, #64748b); border: none; box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }
.mbm-btn-link.is-danger { color: #dc2626; }

/* ---- Details / Design tabs ---- */
.mbm2-panel-tabs { display: flex; gap: 4px; background: var(--bg-subtle, #f1f5f9); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.mbm2-panel-tabs button { flex: 1; border: none; background: transparent; padding: 10px; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: var(--text-secondary, #64748b); cursor: pointer; }
.mbm2-panel-tabs button.is-active { background: var(--bg-card, #fff); color: #be123c; box-shadow: 0 2px 8px rgba(15,23,42,0.08); }
#mbmDetailsPanel[hidden], #mbmCustomizePanel[hidden] { display: none; }
.mbm2-design > summary { display: none; } /* the tab acts as the heading */
.mbm2-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-secondary, #64748b); margin: 0 0 6px; }
.mbm2-hint { font-size: 11.5px; color: var(--text-secondary, #64748b); margin: -2px 0 8px; }

/* ---- Form step navigation: numbered pills with a label ---- */
.mbm-steps-nav { flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: thin; }
.mbm-step-dot { flex: none; min-width: 0; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 7px 7px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.mbm-step-n { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-card, #fff); color: var(--text-secondary, #64748b); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.mbm-step-dot.is-active .mbm-step-n { color: #be123c; }
.mbm-step-dot.is-done .mbm-step-n { background: #16a34a; color: #fff; }
.mbm-step-controls { position: sticky; bottom: 0; background: var(--bg-card, #fff); padding: 12px 0 4px; z-index: 3; }
.mbm-step-controls .mbm-btn { min-width: 120px; }

/* ---- Preview ---- */
.mbm-preview-panel { top: 90px; background: var(--bg-subtle, #f8fafc); border: 1px solid var(--border-color, #e2e8f0); border-radius: 16px; padding: 12px; }
.mbm2-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.mbm2-preview-title { font-size: 13.5px; font-weight: 700; color: var(--text-primary, #1e293b); }
.mbm2-preview-title i { color: #be123c; }
.mbm-doc-outer { max-height: calc(100vh - 290px); min-height: 360px; background: #e2e8f0; overflow-x: hidden; } /* the page is scaled to fit, so no sideways scroll */
.mbm-export-bar { display: block; margin-top: 12px; }
.mbm-export-bar .mbm2-pdf { width: 100%; padding: 13px 18px; font-size: 15px; }
.mbm2-export-more { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.mbm2-export-more .mbm-btn { min-width: 0; padding: 8px 6px; font-size: 12px; background: var(--bg-card, #fff); }
.mbm2-tip { font-size: 11.5px; color: var(--text-secondary, #64748b); margin: 8px 0 0; text-align: center; }
.mbm2-tip i { color: #d97706; }

/* ---- SEO block spacing ---- */
.mbm2 .stt-seo-content { margin-top: 10px; }

/* ---- Phone / tablet ---- */
.mbm-mobile-tabs .is-download { display: none; }
@media (max-width: 1100px) {
    .mbm2-export-more { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    #about.mbm2 { padding-top: 76px; }
    .mbm2-hero { grid-template-columns: minmax(0, 1fr); padding: 18px; gap: 14px; }
    .mbm2-hero-side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; text-align: left; padding: 12px; }
    .mbm2-hero-side .mbm-lang-switch { margin: 0; }
    .mbm2-privacy { flex-basis: 100%; }
    .mbm2-draft-actions { margin-left: 0; }
    /* Edit / Preview / PDF become a fixed bottom bar so they are always in thumb reach. */
    #mbmStageBuilder .mbm-mobile-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--bg-card, #fff); box-shadow: 0 -6px 18px rgba(15,23,42,0.12); }
    .mbm-mobile-tabs .is-download { display: block; background: #16a34a; color: #fff; border-color: transparent; }
    #mbmStageBuilder { margin-bottom: 70px; }
    .mbm-preview-panel { padding: 8px; }
    .mbm-doc-outer { max-height: none; min-height: 0; padding: 8px; }
    .mbm-step-controls { bottom: 62px; }
}
@media (max-width: 700px) {
    /* Keep the hero short on phones so step 1 is visible without scrolling. */
    .mbm2-hero { padding: 14px; gap: 10px; border-radius: 16px; }
    .mbm2-hero h1 { font-size: 20px; margin: 4px 0 8px; }
    .mbm2-hero p, .mbm2-side-label { display: none; }
    .mbm2-feats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
    .mbm2-feats li { flex: none; font-size: 11.5px; padding: 4px 10px; }
    .mbm2-hero-side { padding: 0; border: 0; background: transparent; }
    .mbm2-privacy { font-size: 11.5px; }
    .mbm2-progress { gap: 4px; }
    .mbm2-progress li { flex-direction: column; gap: 4px; padding: 8px 4px; text-align: center; font-size: 11.5px; line-height: 1.2; }
    .mbm2-stage { padding: 16px 12px; border-radius: 16px; }
    .mbm2-stage-title { font-size: 18px; }
    #mbmStageRole .mbm-role-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    #mbmStageRole .mbm-role-card { padding: 20px 8px 16px; }
    #mbmStageRole .mbm-role-card .mbm-role-emoji { font-size: 46px; }
    .mbm2-how { grid-template-columns: 1fr; }
    .mbm2-gallery-info { flex-basis: 100%; margin-left: 0; }
    #mbmStageGallery .mbm-gallery-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .mbm-gallery-body { padding: 8px 10px 10px; }
    .mbm-gallery-actions { flex-direction: column; }
    /* The base sheet pins the export bar to the bottom on phones; the new bottom bar has PDF,
       so keep the full export options inline under the preview instead. */
    .mbm-export-bar { position: static; box-shadow: none; padding: 0; background: transparent; margin-top: 10px; }
    .mbm-wrap { padding-bottom: 0; }
    .mbm2-toolbar { gap: 8px; }
}

/* ---- God picture & mantra header (inside the biodata document) ----
   Inserted as the first child of .doc-header by marriage-biodata-app.js, so it inherits each
   layout's header alignment and band. It replaces the template's own built-in mark (Om / mantra
   / emblem drawn by .doc-header::before on layouts 19, 21, 28, 29, 33) so the two never stack. */
.mbm-doc .doc-devotional { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; flex: 0 0 100%; order: -1; margin: 0 0 10px; color: var(--mbm-primary); text-align: center; }
.mbm-doc .doc-devotional.dv-center { flex-direction: column; gap: 4px; }
.mbm-doc .doc-devotional.dv-sides { justify-content: space-between; padding: 0 4px; }
.mbm-doc .doc-devotional.dv-sides .dv-mantra { flex: 1; }
.mbm-doc .dv-pic { display: inline-flex; line-height: 0; flex: none; }
.mbm-doc .dv-img { display: block; object-fit: contain; }
.mbm-doc .dv-upload { max-width: 150px; border-radius: 8px; }
.mbm-doc .dv-glyph, .mbm-god-tile .dv-glyph { display: inline-flex; align-items: center; justify-content: center; font-family: 'Noto Sans Devanagari', 'Noto Sans Gurmukhi', sans-serif; font-weight: 700; line-height: 1; color: var(--mbm-primary, #9d174d); }
.mbm-doc .dv-mantra { font-family: 'Noto Serif Devanagari', 'Noto Sans Devanagari', 'Noto Sans Gurmukhi', 'Noto Naskh Arabic', var(--mbm-heading-font), serif; font-weight: 700; font-size: 16px; line-height: 1.45; letter-spacing: .02em; }
.mbm-doc .dv-size-s .dv-mantra { font-size: 14px; }
.mbm-doc .dv-size-l .dv-mantra { font-size: 18px; }
.mbm-doc.has-devotional .doc-header { flex-wrap: wrap; }
.mbm-doc.has-devotional.mbm-layout-19 .doc-header::before,
.mbm-doc.has-devotional.mbm-layout-21 .doc-header::before,
.mbm-doc.has-devotional.mbm-layout-28 .doc-header::before,
.mbm-doc.has-devotional.mbm-layout-29 .doc-header::before,
.mbm-doc.has-devotional.mbm-layout-33 .doc-header::before { display: none; }
/* dark / coloured header bands */
.mbm-doc.dv-light .doc-devotional, .mbm-doc.dv-light .dv-glyph { color: #fff8e1; }
.mbm-doc.dv-light .dv-img:not(.dv-upload) { background: #fff; border-radius: 50%; padding: 7%; box-sizing: border-box; box-shadow: 0 0 0 3px rgba(255,255,255,0.35); }

/* ---- God picture panel (builder) ---- */
#mbmGodPanel[hidden], #mbmGodCustomWrap[hidden] { display: none; }
.mbm2-tab-om { font-weight: 800; font-family: 'Noto Sans Devanagari', sans-serif; }
.mbm-god-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; margin-bottom: 8px; }
.mbm-god-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 88px; padding: 8px 4px; border: 1.5px solid var(--border-color, #e2e8f0); border-radius: 12px; background: var(--bg-card, #fff); cursor: pointer; }
.mbm-god-tile:hover { border-color: #be123c; }
.mbm-god-tile.is-active { border-color: #be123c; background: rgba(190,18,60,0.05); box-shadow: 0 0 0 3px rgba(190,18,60,0.15); }
.mbm-god-tile small { font-size: 10.5px; line-height: 1.2; font-weight: 600; color: var(--text-secondary, #64748b); text-align: center; }
.mbm-god-tile .dv-img { display: block; object-fit: contain; }
.mbm-god-tile .dv-upload { max-width: 64px; border-radius: 6px; }
.mbm-god-none { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; color: var(--text-secondary, #94a3b8); }
.mbm-god-upload .mbm-god-none { color: #be123c; }
.mbm-shape-btn:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 700px) {
    .mbm2-panel-tabs button { font-size: 12px; padding: 9px 4px; }
    .mbm2-panel-tabs i, .mbm2-panel-tabs .mbm2-tab-om { display: none; }
    .mbm-god-grid { grid-template-columns: repeat(3, 1fr); }
}