/* Mobile shell — 2026-10-13. Loaded after site.css on every public page.
   One section map (site.js) drives the menu, the bottom tab bar with its sheets and the folded footer. */

.m-sheet, .m-tabbar, .m-footer-groups { display: none; }

/* Sheet: full-screen menu or a bottom sheet for one tab group */
.m-sheet:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 200; }
.m-sheet__backdrop { position: absolute; inset: 0; background: rgba(23, 33, 32, .42); opacity: 0; transition: opacity .2s ease; }
.m-sheet.is-open .m-sheet__backdrop { opacity: 1; }
.m-sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 86svh; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0; background: var(--white); color: var(--ink);
  box-shadow: 0 -18px 50px rgba(23, 33, 32, .18);
  transform: translateY(24px); opacity: 0; transition: transform .22s ease, opacity .22s ease;
}
.m-sheet.is-open .m-sheet__panel { transform: none; opacity: 1; }
.m-sheet__panel:focus { outline: none; }
.m-sheet--menu .m-sheet__panel { top: 0; max-height: none; border-radius: 0; padding-top: 0; }
.m-sheet__head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; min-height: 60px; background: var(--white); }
.m-sheet__head::before { content: ""; position: absolute; left: 50%; top: 8px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--paper-deep); }
.m-sheet--menu .m-sheet__head::before { display: none; }
.m-sheet__title { font-family: var(--serif); font-size: 24px; line-height: 1.1; }
.m-sheet__close { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; }
.m-group { padding: 6px 0 14px; border-top: 1px solid var(--line); }
.m-group:first-child { border-top: 0; }
.m-sheet:not(.m-sheet--menu) .m-group h2 { display: none; }
.m-group h2 { margin: 12px 0 4px; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.m-group a { display: grid; gap: 2px; min-height: 52px; padding: 10px 12px; margin: 0 -12px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.m-group a strong { font-size: 17px; font-weight: 600; }
.m-group a span { font-size: 13px; color: var(--muted); }
.m-group a[aria-current="page"] { background: var(--paper); }
.m-group a[aria-current="page"] strong::after { content: " ·"; color: var(--clay); }
.m-group a:active { background: var(--paper); }
.m-sheet__telegram { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; margin-top: 10px; border-radius: 999px; background: var(--ink); color: var(--white); font-weight: 600; text-decoration: none; }
.m-sheet__telegram svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }

@media (max-width: 1120px) {
  /* The burger opens .m-sheet; the old in-header dropdown is retired on small screens. */
  .site-nav, .site-nav.is-open { display: none !important; }
}

@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 16px; }
  .header-row { min-height: 60px; }
  .site-header .header-cta { display: none; }

  /* Bottom tab bar */
  .lead-dock { display: none !important; }
  .m-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 150; display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); background: rgba(255, 253, 248, .97); backdrop-filter: blur(14px);
    transition: transform .2s ease;
  }
  .m-tabbar a, .m-tabbar button {
    display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 52px; padding: 4px 2px;
    border: 0; border-radius: 12px; background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; letter-spacing: .01em; text-decoration: none; cursor: pointer;
  }
  .m-tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .m-tabbar .is-active, .m-tabbar [aria-expanded="true"] { color: var(--ink); }
  .m-tabbar .is-active svg { stroke: #9b5f65; stroke-width: 1.8; }
  .m-tabbar a:focus-visible, .m-tabbar button:focus-visible { outline: 2px solid var(--clay); outline-offset: -2px; }
  body.has-tabbar { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  body.is-typing .m-tabbar { transform: translateY(110%); }
  .has-tabbar .site-footer { padding-bottom: 28px; }
  .has-tabbar .analytics-consent { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .analytics-consent { left: 10px; right: 10px; flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  .analytics-consent div { display: grid; grid-template-columns: 1fr 1fr; }
  .analytics-consent button { min-height: 44px; }
  .analytics-consent a { color: inherit; text-decoration: underline; }

  /* Folded footer */
  .site-footer { text-align: left; }
  .site-footer .footer-main { justify-items: stretch; text-align: left; gap: 18px; padding-bottom: 20px; }
  .site-footer .footer-main h2 { font-size: 24px; }
  .site-footer .footer-nav { display: none; }
  .m-footer-groups { display: block; border-top: 1px solid rgba(255, 253, 248, .16); }
  .m-footer-groups details { border-bottom: 1px solid rgba(255, 253, 248, .16); }
  .m-footer-groups summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; list-style: none; cursor: pointer; font-weight: 600; }
  .m-footer-groups summary::-webkit-details-marker { display: none; }
  .m-footer-groups summary::after { content: "+"; font-size: 20px; font-weight: 400; opacity: .7; }
  .m-footer-groups details[open] summary::after { content: "−"; }
  .m-footer-groups details a { display: block; padding: 10px 0; color: rgba(255, 253, 248, .74); }
  .m-footer-groups details[open] { padding-bottom: 8px; }
  .m-footer-legal { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 16px; font-size: 13px; }
  .m-footer-legal a { color: rgba(255, 253, 248, .6); padding: 6px 0; }
  .site-footer .footer-bottom { justify-content: flex-start; text-align: left; }

  /* Forms: 16px fields so iOS does not zoom, comfortable targets */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; min-height: 48px; }
  textarea { min-height: 96px; }
  .consent, .bb-consent { gap: 10px; font-size: 14px !important; line-height: 1.45; }
  .consent input[type=checkbox], .bb-consent input[type=checkbox] { width: 22px; height: 22px; flex: 0 0 22px; margin: 0; }
  .form-help { font-size: 13px; }
  .platform-form button[type=submit], .platform-form .button { width: 100%; min-height: 52px; }

  /* Readable minimums */
  .eyebrow { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .m-sheet__panel, .m-sheet__backdrop, .m-tabbar { transition: none; }
}

/* Forms: optional details folded (all widths) */
.form-more { border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 253, 248, .6); }
.form-more > summary { display: grid; gap: 2px; padding: 14px 44px 14px 16px; list-style: none; cursor: pointer; position: relative; font-weight: 600; }
.form-more > summary::-webkit-details-marker { display: none; }
.form-more > summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 400; color: var(--muted); }
.form-more[open] > summary::after { content: "−"; }
.form-more > summary span { font-size: 13px; font-weight: 400; color: var(--muted); }
.form-more[open] { display: grid; gap: 16px; padding-bottom: 16px; }
.form-more > label { margin-inline: 16px; }

/* Page rhythm on phones: shorter pages, swipeable card rows instead of tall stacks */
@media (max-width: 760px) {
  .section { padding-block: 44px; }
  .section-head h2, .section h2 { font-size: clamp(30px, 8.4vw, 36px); line-height: 1.08; }
  .final-cta { padding-block: 48px; }

  .editorial-triptych, .topic-cards, .bc-seo-grid, .product-grid[data-home-jewelry], .topic-showcase .product-grid, .topic-showcase .platform-grid {
    display: grid !important; grid-template-columns: none !important; grid-auto-flow: column; grid-auto-columns: 84%;
    gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
    margin-inline: -20px; padding: 2px 20px 10px; scroll-padding-inline: 20px; scrollbar-width: none;
  }
  .editorial-triptych::-webkit-scrollbar, .topic-cards::-webkit-scrollbar, .bc-seo-grid::-webkit-scrollbar { display: none; }
  .editorial-triptych > *, .topic-cards > *, .bc-seo-grid > *, .product-grid[data-home-jewelry] > *, .topic-showcase .product-grid > *, .topic-showcase .platform-grid > * { scroll-snap-align: start; min-width: 0; margin: 0 !important; }
  .editorial-triptych .media-surface { aspect-ratio: 4 / 3; height: auto !important; min-height: 0 !important; }
  .editorial-triptych .media-surface img { width: 100%; height: 100%; object-fit: cover; }
  .editorial-triptych h3 { margin-top: 14px; }

  .trust-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .trust-grid > * { padding: 16px 14px !important; min-height: 0 !important; }
  .trust-grid h3 { font-size: 19px; margin: 8px 0 4px; }
  .trust-grid p { font-size: 13px; line-height: 1.45; margin: 0; }

  /* Home: one choice point (the hero), no repeated route blocks */
  .home-hero__content h1 { font-size: clamp(34px, 9.6vw, 42px); }
  .hero-choice a { min-height: 64px; padding: 14px 44px 14px 16px; position: relative; }
  .hero-choice a::after { content: "→"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 18px; }
  .final-cta--routes { display: none; }

  /* Calculators: the form comes first */
  .bc-card--hero-visual { display: none !important; }
  .bc-hero__grid { gap: 0 !important; }
  .bc-hero__facts { display: flex !important; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px !important; }
  .bc-hero__facts li { padding: 0 !important; border: 0 !important; }
  .bc-hero__facts li *:not(strong) { display: none; }
  .bc-hero__actions .bc-btn--secondary { display: none; }
  .bc-section--calculator { padding-top: 28px !important; }
  .bc-section-intro { margin-bottom: 16px !important; }
  .bc-section-intro h2 { font-size: 30px; }
}

/* Admin: the section list folds into one "Раздел" control on phones; desktop keeps the sidebar */
.admin-nav > summary { display: none; }
.admin-nav__links { display: contents; }
@media (max-width: 1120px) {
  .admin-sidebar { display: block !important; padding: 10px 20px !important; overflow: visible !important; }
  .admin-nav__links { display: flex; gap: 10px; overflow-x: auto; }
}
@media (max-width: 760px) {
  .admin-top { padding: 12px 16px; font-size: 13px; }
  .admin-top nav { gap: 14px; }
  .admin-sidebar { position: sticky; top: 46px; z-index: 70; padding: 8px 12px !important; background: #f5f1e9; }
  .admin-nav > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); list-style: none; cursor: pointer; }
  .admin-nav > summary::-webkit-details-marker { display: none; }
  .admin-nav > summary span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  .admin-nav > summary strong { flex: 1; font-size: 15px; }
  .admin-nav > summary::after { content: "▾"; color: var(--muted); }
  .admin-nav[open] > summary::after { content: "▴"; }
  .admin-nav__links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; max-height: 70svh; overflow-y: auto; padding: 14px 4px 6px; }
  .admin-nav__links section { display: grid !important; gap: 2px; align-content: start; }
  .admin-nav__links section > span { display: block !important; padding: 0 8px 4px; font-size: 10px; }
  .admin-nav__links a { padding: 10px 8px; font-size: 14px; white-space: normal; }
  .admin-layout > .admin-shell { width: calc(100% - 24px); margin: 16px auto 60px; }
  .admin-page-head { display: block; margin-bottom: 18px; }
  .admin-page-head h1 { font-size: 32px; }
  .admin-grid, .admin-grid--workshops, .admin-workshop-list--overview, .admin-workshop-card { grid-template-columns: 1fr !important; }
  .admin-workshop-card > div { padding: 16px; }
  .admin-workshop-card > img { min-height: 0; aspect-ratio: 16 / 9; }
  .admin-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .admin-stats a { padding: 14px; }
  .admin-stats strong { font-size: 34px; }
  .admin-cards .platform-card, .admin-shell .platform-card { padding: 16px; }
  .admin-form-section summary { padding: 16px; font-size: 22px; }
  .admin-form-section > div { padding: 0 16px 18px; }
  .admin-actions .button, .admin-actions button { min-height: 44px; }
  .admin-savebar { bottom: 8px; justify-content: stretch; }
  .admin-savebar > * { flex: 1; }
  .admin-shell table { display: block; overflow-x: auto; white-space: nowrap; }
  .form-grid { grid-template-columns: 1fr; }
}
.m-sheet--menu .m-sheet__head, .m-sheet--menu .m-sheet__body { max-width: 680px; margin-inline: auto; }
