/* The Wedding Book — phones (≤767 px). 6.3.1, owner 2026-10-04: "the UI on mobile is very basic".
   Same elements and actions as desktop (mobile ↔ desktop parity); only the shape changes. The PM's studio is inline-styled,
   so each rule targets a data-m hook added by scripts/wedding_book/build_studio.py (T8) and needs !important.
   Thumb zone: the one primary action sits at the bottom; targets ≥ 44 px; controls ≥ 16 px (iPhone focus-zoom). */

#dc-root button, #dc-root a, #dc-root label { -webkit-tap-highlight-color: transparent; }
#dc-root button:focus-visible, #dc-root a:focus-visible { outline: 2px solid #e2b84a; outline-offset: 2px; }

@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) {
  #dc-root button, #dc-root [data-m="vshare"] a { transition: transform .12s ease, filter .12s ease, background-color .2s ease; }
  #dc-root button:active, #dc-root [data-m="vshare"] a:active { transform: scale(.97); }

  /* ── Gallery: hero ─────────────────────────────────────────── */
  #dc-root [data-m="hero"] { padding-top: 28px !important; padding-bottom: 8px !important; gap: 28px !important; }
  #dc-root [data-m="hero"] h1 { font-size: 44px !important; line-height: 1.02 !important; }
  #dc-root [data-m="hero"] p { font-size: 16px !important; line-height: 1.6 !important; }
  #dc-root [data-m="hcta"] { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; gap: 10px !important; }
  #dc-root [data-m="hcta"] > button { justify-content: center; min-height: 52px; padding: 14px 18px !important; font-size: 15px !important; white-space: nowrap; }
  #dc-root [data-m="hsteps"] { gap: 8px !important; max-width: none !important; }
  #dc-root [data-m="hsteps"] > div { padding: 12px 10px !important; }
  #dc-root [data-m="hsteps"] > div > span:first-child { font-size: 22px !important; }
  #dc-root [data-m="hsteps"] > div > span + span { font-size: 12.5px !important; line-height: 1.3; }

  /* ── Gallery: 2-up poster grid ─────────────────────────────── */
  #dc-root [data-m="gcard"] { gap: 10px !important; }
  #dc-root [data-m="gcard"] > div:first-child { border-radius: 18px !important; box-shadow: 0 14px 30px rgba(0,0,0,.35) !important; }
  #dc-root [data-m="gbadges"] { top: 8px !important; left: 8px !important; gap: 4px !important; flex-wrap: wrap; max-width: calc(100% - 52px); }
  #dc-root [data-m="gbadges"] span { padding: 4px 7px !important; font-size: 10px !important; letter-spacing: .08em !important; }
  #dc-root [data-m="gbadges"] span[style*="background: #fff"] { color: #8a3a12 !important; }   /* NEW: 7:1 on white (was 2.1:1) */
  #dc-root [data-m="gfav"] { top: 4px !important; right: 4px !important; width: 44px !important; height: 44px !important; }
  #dc-root [data-m="gpill"] { left: 8px !important; right: 8px; bottom: 8px !important; padding: 5px 9px !important; font-size: 10.5px !important; gap: 5px !important; justify-content: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #dc-root [data-m="gname"] { font-size: 20px !important; }
  #dc-root [data-m="gsub"] { font-size: 12.5px !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #dc-root [data-m="gcats"] { max-height: 22px; overflow: hidden; }   /* one row of WHOLE tags — the rest wrap out of sight, never a cut word */
  #dc-root [data-m="gbtns"] { grid-template-columns: minmax(0, 1fr) !important; gap: 6px !important; margin-top: auto; }   /* buttons line up across a row */
  #dc-root [data-m="gbtns"] > button { min-height: 44px; padding: 10px 8px !important; font-size: 14px !important; }
  #dc-root [data-m="gbtns"] > button + button { order: -1; background: var(--v-cta) !important; color: var(--v-on-cta) !important; }
  #dc-root [data-m="gbtns"] > button:first-child { background: transparent !important; }

  /* ── Viewer: the invite as a card, a compact product sheet with the CTA in the thumb zone ── */
  #dc-root [data-m="vcard"] { width: calc(100% - 20px) !important; margin: 0 auto calc(10px + env(safe-area-inset-bottom)) !important; padding: 14px 14px 12px !important; border-radius: 22px !important; gap: 10px !important; }
  #dc-root [data-m="vcard"] > div:first-child { flex-wrap: nowrap !important; align-items: center !important; }
  #dc-root [data-m="vname"] { font-size: 24px !important; }
  #dc-root [data-m="vname"] + span { font-size: 13px !important; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  #dc-root [data-m="vback"] { padding: 8px 12px !important; font-size: 13px !important; min-height: 44px; }
  #dc-root [data-stage-col] { overflow: hidden; }
  html[data-wb="viewer"] [data-m="toast"] { bottom: auto !important; top: 16px !important; }   /* never over the viewer's actions */
  #dc-root [data-viewer-row] > button { min-height: 44px; }
  #dc-root [data-m="vcta"] { justify-content: center; min-height: 54px; padding: 14px 18px !important; font-size: 16px !important; }
  #dc-root [data-m="vcta"] > span:nth-child(2) { flex: none !important; }
  #dc-root [data-m="vcta-sub"] { display: none; }
  #dc-root [data-m="vshare"] { gap: 8px !important; }
  #dc-root [data-m="vshare"] > * { min-height: 44px; padding: 9px 6px !important; font-size: 14px !important; gap: 6px !important; white-space: nowrap; min-width: 0; }
  #dc-root [data-m="vshare"] > a > span { flex: none; }

  /* ── Studio: header, stepper, body, the thumb bar ──────────── */
  #dc-root [data-m="shead"] { height: 54px !important; gap: 10px !important; }
  #dc-root [data-m="shead"] strong { font-size: 15px; }
  #dc-root [data-m="shead"] button { padding: 9px 12px !important; min-height: 44px; }
  #dc-root [data-m="shead"] [data-saved] { display: inline !important; font-size: 11px !important; max-width: 64px; overflow: hidden; text-overflow: ellipsis; }   /* "Saved ✓" — parity with desktop */
  #dc-root [data-m="steps"] { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 !important; padding: 0 6px !important; overflow: visible !important; }
  #dc-root [data-m="steps"] > button { flex-direction: column; justify-content: center; gap: 5px !important; padding: 10px 2px 9px !important; font-size: 12px !important; min-width: 0; min-height: 60px; }
  #dc-root [data-m="steps"] > button > span { width: 26px !important; height: 26px !important; font-size: 12px !important; font-weight: 700; }
  #dc-root [data-m="sbody"] { padding: 22px 16px 28px !important; }
  #dc-root [data-m="sbody"] h2 { font-size: 30px !important; line-height: 1.1; }
  #dc-root [data-m="sbody"] input:not([type=checkbox]):not([type=file]):not([type=radio]), #dc-root [data-m="sbody"] textarea { min-height: 48px; border-radius: 12px !important; padding: 12px 14px !important; }
  #dc-root [data-m="sbody"] textarea { min-height: 88px; }
  #dc-root [data-m="sbody"] input:focus, #dc-root [data-m="sbody"] textarea:focus { border-color: var(--s-gold) !important; box-shadow: 0 0 0 3px rgba(226,184,74,.18); }
  #dc-root [data-m="chip"] { min-height: 42px; padding: 9px 16px !important; }
  #dc-root [data-m="switch"] { position: relative; }
  #dc-root [data-m="switch"]::after { content: ""; position: absolute; inset: -10px -4px; }   /* 46×26 switch, 46×46 tap area */
  #dc-root [data-m="secmove"] { width: 42px !important; height: 36px !important; font-size: 13px !important; }
  #dc-root [data-m="secmoves"] { gap: 6px !important; }
  #dc-root [data-m="chaprow"] { grid-template-columns: minmax(0, 1fr) 48px !important; }
  #dc-root [data-m="chaprow"] > textarea { grid-column: 1 / -1; }
  #dc-root [data-m="chapx"] { width: 48px !important; min-height: 48px; }
  #dc-root [data-m="sbody"] { scroll-padding-bottom: 32px; }
  #dc-root [data-m="sbody"] :is(input, textarea) { scroll-margin: 16px 0 32px; }
  #dc-root [data-m="sfoot"] { gap: 8px !important; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) !important; background: color-mix(in srgb, var(--s-panel) 92%, transparent) !important; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 -10px 30px rgba(0,0,0,.28); }
  #dc-root [data-m="sfoot"] > button, #dc-root [data-m="sfoot"] > * > button { min-height: 50px; border-radius: 14px !important; font-size: 15px !important; }
  #dc-root [data-m="sfoot"] > button:first-child { flex: none; padding: 10px 14px !important; }
  #dc-root [data-m="sfoot"] [data-open-preview] { flex: 1 1 0 !important; }
  #dc-root [data-m="snext"] { flex: 1.35 1 0; white-space: nowrap; box-shadow: 0 8px 20px rgba(226,184,74,.25); }
  #dc-root [data-m="sfoot"] > sc-if, #dc-root [data-m="sfoot"] > div { display: contents; }
  #dc-root [data-m="dtpl"] { flex-direction: column; align-items: stretch !important; }
  #dc-root [data-m="dtpl"] > button { min-height: 46px; }

  /* ── Share / FAQ pop-ups → bottom sheets ───────────────────── */
  #dc-root [data-m="sheet"] { align-items: flex-end !important; padding: 0 !important; }
  #dc-root [data-m="sheet"] > div { max-width: none !important; width: 100% !important; max-height: 90%; overflow-y: auto; border-radius: 24px 24px 0 0 !important; padding: 12px 18px calc(18px + env(safe-area-inset-bottom)) !important; gap: 16px !important; animation: wbSheetUp .32s cubic-bezier(.2,.8,.2,1) !important; }
  #dc-root [data-m="sheet"] > div::before { content: ""; display: block; flex: none; width: 40px; height: 4px; margin: 0 auto 2px; border-radius: 4px; background: rgba(255,255,255,.22); }
  #dc-root [data-m="sheet"] h3 { font-size: 26px !important; }
  #dc-root [data-m="sheet"] img[alt="QR code"] { width: 96px; height: 96px; }
  #dc-root [data-m="sheet"] a { min-height: 44px; }
  #dc-root [data-m="sheet"] button[aria-label="Close"] { min-width: 44px; min-height: 44px; }
}
@keyframes wbSheetUp { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #dc-root [data-m="sheet"] > div { animation: none !important; } #dc-root button:active, #dc-root [data-m="vshare"] a:active { transform: none !important; } #dc-root button, #dc-root [data-m="vshare"] a { transition: none !important; } }
@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) {
  /* the viewer title row: one line, the name gives way (ellipsis), never the Back button */
  #dc-root [data-m="vcard"] > div:first-child > div { flex: 1 1 auto; }
  #dc-root [data-m="vname"] { font-size: 23px !important; flex-wrap: wrap; row-gap: 4px; }
  #dc-root [data-m="vname"] > sc-if, #dc-root [data-m="vname"] > span { flex: none; }
  /* phone preview: the invite gets the screen — the studio bar steps aside (the preview bar has ← Edit; Share is one tap back) */
  html[data-wb="studio-preview"] #dc-root [data-m="shead"] { display: none !important; }
  #dc-root [data-preview-bar] { padding: 8px 10px !important; }
  #dc-root [data-preview-bar] > button { min-height: 42px; }
}
@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) {
  /* the hero's three fanned posters are laid out on a 430 px stage and scaled from its top centre — centre that stage on the
     phone (it was clamped to the column and drifted right, cutting the third poster at the screen edge) */
  #dc-root [data-hero-posters] { flex: 0 0 430px !important; max-width: none !important; margin-left: calc((100% - 430px) / 2) !important; margin-right: calc((100% - 430px) / 2) !important; }
}

/* phone LANDSCAPE (short touch screens): give the content the height — no sticky gallery bar, no site header in the studio,
   the viewer card beside the invite, sheets that fit and scroll */
@media (max-height: 500px) and (pointer: coarse) {
  #dc-root [data-m="gtop"] { position: static !important; }
  html[data-wb^="studio"] #vivah-site-header { display: none !important; }
  #dc-root [data-m="steps"] > button { min-height: 46px; flex-direction: row; align-items: center !important; gap: 6px !important; padding-block: 6px !important; }
  #dc-root [data-m="sheet"] { align-items: center !important; padding: 12px !important; }
  #dc-root [data-m="sheet"] > div { max-width: 560px !important; max-height: calc(100% - 24px) !important; border-radius: 22px !important; overscroll-behavior: contain; }
  html[data-wb="viewer"] #dc-root [data-stage-col] { flex-direction: row !important; align-items: stretch; }
  html[data-wb="viewer"] #dc-root [data-stage-col] > div[style*="perspective"] { flex: 1 1 50% !important; }
  #dc-root [data-m="vcard"] { flex: 0 0 48% !important; width: auto !important; max-width: none !important; margin: 8px 10px 8px 0 !important; overflow-y: auto; }
}
