/* ==========================================================================
   Be Family Shell v1.0.0 — shared across every Be site.

   Two jobs:
     1. The FAMILY VIEW STANDARD: one set of --be-* tokens (type scale, content
        width, section rhythm, control sizes) that every theme's own rules
        consume, so all ten sites sit at the same visual "zoom" on a desktop.
     2. The MOBILE APP SHELL: a bottom tab bar, scroll-aware header, safe-area
        handling and touch polish, so every site behaves like one app family
        on a phone.

   Themes never edit this file. Site colours arrive as inline :root overrides
   printed by be-shell.php from configs/<site>.json.
   ========================================================================== */

:root{
  /* ---- layout ---- */
  --be-max:1440px;                          /* the family content width. 1920 screens centre it. */
  --be-max-narrow:1080px;                   /* long-form prose */
  --be-gutter:clamp(20px,3.2vw,48px);       /* 20 @phone · 46 @1440 · 48 @1500+ */
  --be-sec-y:clamp(40px,3.9vw,64px);        /* per side: 40 @phone · 56 @1440 · 64 @1640+ */
  --be-sec-y-tight:clamp(28px,2.6vw,40px);
  --be-header-h:72px;                       /* desktop main header */
  --be-header-h-m:60px;                     /* phone main header */
  --be-bar-h:40px;                          /* family brand bar */

  /* ---- type: solved between 380px and 1800px so the size actually moves ----
         380     1440    1800  */
  --be-h1:clamp(36px,calc(26.366px + 2.5352vw),72px);          /* 36 · 63 · 72  hero headline */
  --be-h1-page:clamp(32px,calc(26.648px + 1.4085vw),52px);     /* 32 · 47 · 52  inner page headline */
  --be-h2:clamp(28px,calc(23.718px + 1.1268vw),44px);          /* 28 · 40 · 44  section heading */
  --be-h3:clamp(19px,calc(17.662px + .3521vw),24px);           /* 19 · 23 · 24  */
  --be-h3-card:clamp(17.5px,calc(16.831px + .1761vw),20px);    /* 17.5 · 19.4 · 20 dense card title */
  --be-lede-hero:clamp(19px,calc(17.93px + .2817vw),23px);     /* 19 · 22 · 23 */
  --be-lede:clamp(18px,calc(17.197px + .2113vw),21px);         /* 18 · 20 · 21 */
  --be-body:17.5px; --be-body-lh:1.6;                          /* flat: body copy does not scale */
  --be-body-card:16.25px;                                      /* denser measure inside cards */
  --be-small:14px;                                             /* captions, meta, footer links */
  --be-eyebrow:13px;                                           /* mono/uppercase labels */
  --be-nav:15px;                                               /* primary nav links */
  --be-btn:15.5px; --be-btn-h:48px; --be-btn-h-m:52px;         /* buttons */
  --be-h1-lh:1.05; --be-h2-lh:1.12; --be-h3-lh:1.25; --be-lede-lh:1.6;

  /* ---- app shell ---- */
  --be-tab-h:64px;
  --be-safe-b:env(safe-area-inset-bottom,0px);
  --be-tab-bp:900px;                                           /* tab bar shows below this (see media queries) */

  /* ---- colours: overridden per site by be-shell.php ---- */
  --be-accent:#1E63B8;        /* active tab, hero tab background */
  --be-accent-ink:#FFFFFF;    /* icon on the hero tab */
  --be-tab-bg:rgba(255,255,255,.88);
  --be-tab-ink:#12203A;
  --be-tab-mute:#5D6E86;
  --be-tab-hair:rgba(18,32,58,.12);
  --be-tab-shadow:0 -8px 30px -18px rgba(18,32,58,.35);
}

@media (max-width:640px){
  :root{ --be-body:17px; }
}

/* ==========================================================================
   Touch polish — every site, every width
   ========================================================================== */
html{ -webkit-text-size-adjust:100%; }
a,button,[role="button"],summary{ -webkit-tap-highlight-color:transparent; touch-action:manipulation; }
.be-hidden{ display:none !important; }

/* Scroll-aware header: be-shell.js toggles .be-scrolled on the configured
   header once the page has moved. A hairline plus a soft drop reads as
   "this bar is floating over content", which is what native apps do. */
.be-scrolled{ box-shadow:0 1px 0 rgba(0,0,0,.06),0 10px 30px -18px rgba(0,0,0,.28); }

/* ==========================================================================
   Bottom tab bar
   ========================================================================== */
.be-tabbar{
  position:fixed; left:0; right:0; bottom:0; top:auto; z-index:940;
  margin:0; border-bottom:0; width:auto; max-width:none; min-height:0; /* themes style bare <nav>; none of it applies here */
  display:none;
  height:calc(var(--be-tab-h) + var(--be-safe-b));
  padding:0 max(4px,env(safe-area-inset-left,0px)) var(--be-safe-b) max(4px,env(safe-area-inset-right,0px));
  background:var(--be-tab-bg);
  -webkit-backdrop-filter:saturate(180%) blur(22px);
  backdrop-filter:saturate(180%) blur(22px);
  border-top:1px solid var(--be-tab-hair);
  box-shadow:var(--be-tab-shadow);
  font-family:inherit;
  transform:translateY(0);
  transition:transform .28s cubic-bezier(.22,.61,.36,1),opacity .2s;
}
.be-tabbar-in{
  display:grid; grid-template-columns:repeat(5,1fr); align-items:end;
  height:var(--be-tab-h); max-width:560px; margin:0 auto;
}
.be-tab{
  appearance:none; -webkit-appearance:none; background:none; border:0; margin:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  height:var(--be-tab-h); min-width:44px; padding:6px 2px 8px;
  color:var(--be-tab-mute); text-decoration:none; cursor:pointer;
  font:600 11px/1.1 inherit; letter-spacing:.01em; white-space:nowrap;
  transition:color .15s,transform .12s;
  position:relative;
}
.be-tab:active{ transform:scale(.92); }
.be-tab-i{ display:block; width:24px; height:24px; }
.be-tab-i svg{ display:block; width:24px; height:24px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.be-tab-l{ display:block; font-size:11px; font-weight:600; }
.be-tab.is-on{ color:var(--be-accent); }
.be-tab.is-on .be-tab-i svg{ stroke-width:2.2; }
.be-tab:focus-visible{ outline:2px solid var(--be-accent); outline-offset:-4px; border-radius:12px; }

/* the raised centre action */
.be-tab--hero{ color:var(--be-tab-ink); }
.be-tab--hero .be-tab-i{
  width:54px; height:54px; margin-top:-26px; border-radius:50%;
  background:var(--be-accent); color:var(--be-accent-ink);
  display:grid; place-items:center;
  box-shadow:0 10px 24px -8px color-mix(in srgb,var(--be-accent) 70%,transparent),0 0 0 4px var(--be-tab-bg);
  transition:transform .15s,box-shadow .15s;
}
.be-tab--hero .be-tab-i svg{ width:26px; height:26px; stroke:currentColor; stroke-width:2; }
.be-tab--hero .be-tab-i img{ width:28px; height:28px; display:block; }
.be-tab--hero:active .be-tab-i{ transform:scale(.94); }
.be-tab--hero .be-tab-l{ color:var(--be-tab-ink); }

/* numeric badge (cart count etc.) */
.be-tab-badge{
  position:absolute; top:6px; left:calc(50% + 6px);
  min-width:18px; height:18px; padding:0 5px; border-radius:999px;
  background:var(--be-accent); color:var(--be-accent-ink);
  font:700 11px/18px inherit; text-align:center;
}
.be-tab-badge[data-n="0"],.be-tab-badge[data-n=""]{ display:none; }

/* Show the bar on phones and small tablets, and give the page room for it.
   The page padding lives on <html> so no theme's body rule can cancel it. */
@media (max-width:899px){
  .be-tabbar{ display:block; }
  html.be-has-tabbar{ padding-bottom:calc(var(--be-tab-h) + var(--be-safe-b)); }
  html.be-has-tabbar body{ padding-bottom:0; }
  /* anything the site already floats above the bottom edge moves up */
  html.be-has-tabbar .be-raised{ bottom:calc(var(--be-tab-h) + var(--be-safe-b) + 14px) !important; }
  /* the theme's own drawer / menu takes the whole screen; the bar steps aside */
  html.be-drawer-open .be-tabbar{ transform:translateY(calc(100% + 40px)); pointer-events:none; }
  html.be-has-tabbar{ scroll-padding-bottom:calc(var(--be-tab-h) + var(--be-safe-b)); }
}

/* Installed to the home screen: no browser chrome, so the bar is the app's
   only persistent navigation. Slightly taller, no blur cost. */
@media (display-mode:standalone){
  :root{ --be-tab-h:68px; }
  html{ overscroll-behavior-y:none; }
}

@media (prefers-reduced-motion:reduce){
  .be-tabbar,.be-tab,.be-tab--hero .be-tab-i{ transition:none; }
}

@media print{ .be-tabbar{ display:none !important; } }

/* Keyboard up: the bar would sit on top of the keyboard, so it steps aside
   while a text field has focus (be-shell.js toggles .be-typing). */
@media (max-width:899px){
  html.be-typing .be-tabbar{ transform:translateY(calc(100% + 40px)); }
}
