/* ==========================================================================
   Navigation: the five tabs (R2). Loaded last.
   Home, Explore, + (Speak up), Causes, Profile.
   Phones: a bar docked to the bottom, above the iPhone home indicator.
   Computers: the same five in the top bar.
   R3 (design system) should fold these values into the shared tokens.
   ========================================================================== */
:root{ --tabbar-h:62px; --nav-ease:160ms ease; }

/* ---------- top bar ---------- */
html.skin-h .topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:nowrap;min-height:72px}
html.skin-h .h-mark{width:56px;height:56px}
html.skin-h .acct-btn{margin-left:0}
.tabbar{display:flex;align-items:center;gap:2px;margin:0 auto}
.tabbar a,.tabbar .tb-plus{position:relative;display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 14px;border:0;border-radius:6px;background:none;
  font:600 15px/1 var(--serif);color:var(--muted);text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent;
  transition:color var(--nav-ease),background-color var(--nav-ease),transform var(--nav-ease),box-shadow var(--nav-ease)}
.tabbar .tb-ic{display:none;width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.tabbar a:hover,.tabbar a:focus-visible{color:var(--ink);background:var(--surface)}
.tabbar a[aria-current="page"]{color:var(--navy);box-shadow:inset 0 -2px 0 var(--navy);border-radius:6px 6px 0 0}
.tabbar a:focus-visible,.tabbar .tb-plus:focus-visible{outline:2px solid var(--focus,var(--navy));outline-offset:2px}
.tabbar a:active,.tabbar .tb-plus:active{transform:scale(.97)}
/* the + button: the one filled control in the bar */
.tabbar .tb-plus{margin:0 10px;padding:0 16px 0 12px;background:var(--navy);color:var(--paper)}
.tabbar .tb-disc{display:inline-grid;place-items:center;width:20px;height:20px}
.tabbar .tb-disc svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round}
.tabbar .tb-plus:hover,.tabbar .tb-plus:focus-visible{transform:translateY(-1px);box-shadow:0 3px 10px rgba(46,34,22,.22)}
.tabbar .tb-plus:active{transform:scale(.97);box-shadow:none}
.tabbar .tb-plus.on{box-shadow:0 0 0 2px var(--paper),0 0 0 4px var(--brass)}
.tabbar .me-dot{position:absolute;top:8px;right:4px;margin:0}

@media (max-width:760px){
  html.skin-h .topbar{min-height:60px;gap:8px;padding-left:16px;padding-right:16px}
  html.skin-h .h-mark{width:46px;height:46px}
  /* docked bottom bar */
  html.skin-h header.top .tabbar{position:fixed;left:0;right:0;bottom:0;z-index:20;margin:0;
    display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:end;gap:0;
    padding:0 4px env(safe-area-inset-bottom,0px);min-height:calc(var(--tabbar-h) + env(safe-area-inset-bottom,0px));
    background:var(--surface);border-top:1px solid var(--hair)}
  .tabbar a,.tabbar .tb-plus{flex-direction:column;justify-content:flex-end;gap:3px;min-height:var(--tabbar-h);padding:6px 2px 9px;border-radius:0;
    font-size:12.5px;letter-spacing:0;white-space:nowrap}
  .tabbar .tb-ic{display:block}
  .tabbar a:hover,.tabbar a:focus-visible{background:none}
  .tabbar a[aria-current="page"]{box-shadow:inset 0 2px 0 var(--navy);border-radius:0;font-weight:700}
  .tabbar .tb-plus{margin:0;padding:0 2px 9px;background:none;color:var(--muted);box-shadow:none !important;transform:none !important}
  .tabbar .tb-disc{width:48px;height:48px;margin-top:-16px;border-radius:50%;background:var(--navy);color:var(--paper);
    box-shadow:0 0 0 4px var(--surface),0 3px 8px rgba(46,34,22,.28);transition:transform var(--nav-ease),box-shadow var(--nav-ease)}
  .tabbar .tb-disc svg{width:26px;height:26px}
  .tabbar .tb-plus:hover .tb-disc,.tabbar .tb-plus:focus-visible .tb-disc{transform:translateY(-2px)}
  .tabbar .tb-plus:active .tb-disc{transform:scale(.94)}
  .tabbar .tb-plus.on{color:var(--navy);font-weight:700}
  .tabbar .tb-plus.on .tb-disc{box-shadow:0 0 0 4px var(--surface),0 0 0 6px var(--brass)}
  .tabbar .me-dot{top:8px;right:calc(50% - 18px)}
  /* keep page content and the sticky split counter clear of the bar */
  html.skin-h .site-foot{padding-bottom:calc(var(--tabbar-h) + 44px + env(safe-area-inset-bottom,0px))}
  html.skin-h .vfoot{bottom:calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom,0px))}
}
html.skin-h[data-theme="dark"] .tabbar .tb-disc,html.skin-h[data-theme="dark"] .tabbar .tb-plus:hover{box-shadow:0 0 0 4px var(--surface)}
@media (min-width:761px){ html.skin-h[data-theme="dark"] .tabbar .tb-disc{box-shadow:none} }
@media (prefers-reduced-motion:reduce){ .tabbar a,.tabbar .tb-plus,.tabbar .tb-disc,.sheet-list a{transition:none !important;transform:none !important} }

/* ---------- things taken off the screen in R2 (code kept) ---------- */
.trail[hidden],.stories[hidden],.page-hero[hidden],.step-n[hidden],.settings[hidden],.sheet-list a[hidden]{display:none !important}

/* ---------- Home / lists: one section, two modes ---------- */
#view-floor[data-mode="home"] .lists-only,
#view-floor[data-mode="lists"] .home-only,
#view-floor[data-mode="lists"] #daily{display:none !important}
#view-floor[data-mode="home"] .pg-title{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
html.skin-h .pg-title{font-size:30px;line-height:1.1;margin:2px 0 12px}
html.skin-h main.wrap{padding-top:16px}
.home-more{display:flex;flex-wrap:wrap;align-items:center;gap:4px 16px;margin:0 0 16px;padding:0 0 6px;border-bottom:1px solid var(--hair);font-size:15px}
.home-more span{color:var(--muted)}
.home-more a{display:inline-flex;align-items:center;min-height:44px;font-weight:700;color:var(--navy);text-underline-offset:3px;transition:color var(--nav-ease)}
.home-more a:hover,.home-more a:focus-visible{color:var(--ink)}
.view > .crumbs{margin:6px 0 12px}

/* ---------- Speak up menu ---------- */
dialog.sheet{border:1px solid var(--hair);border-radius:10px;background:var(--surface);color:var(--ink);padding:18px 20px 12px;width:min(440px,calc(100vw - 32px));box-shadow:0 18px 50px rgba(0,0,0,.28)}
dialog.sheet::backdrop{background:rgba(0,0,0,.45)}
.sheet-top{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:4px}
html.skin-h .sheet-top h2{margin:0;font-size:24px}
.sheet-top .linkbtn{min-height:44px;padding:0 4px}
.sheet-list{display:flex;flex-direction:column}
.sheet-list a{display:flex;flex-direction:column;gap:2px;justify-content:center;min-height:64px;padding:10px 8px;margin:0 -8px;border-top:1px solid var(--rule);border-radius:6px;
  text-decoration:none;color:var(--ink);transition:background-color var(--nav-ease),transform var(--nav-ease)}
.sheet-list a:first-child{border-top:0}
.sheet-list a b{font-size:17px;color:var(--navy)}
.sheet-list a span{font-size:14.5px;color:var(--muted);line-height:1.35}
.sheet-list a:hover,.sheet-list a:focus-visible{background:var(--paper);transform:translateX(2px)}
.sheet-list a:active{transform:scale(.99)}
@media (max-width:760px){
  dialog.sheet{width:100%;max-width:100%;margin:auto 0 0;border-radius:14px 14px 0 0;border-width:1px 0 0;padding:16px 20px calc(14px + env(safe-area-inset-bottom,0px))}
}

/* ---------- Causes (not open yet) ---------- */
.causes-page{max-width:640px}
.causes-art{display:block;width:100%;height:auto;max-height:240px;object-fit:cover;object-position:50% 35%;border-radius:8px;border:1px solid var(--hair);margin:0 0 16px;background:var(--surface)}
.causes-page .hero-tag{display:inline-block;margin-bottom:6px}
html.skin-h .causes-page h1{font-size:34px;line-height:1.05;margin:0 0 12px}
.causes-next{margin-top:6px}
@media (max-width:760px){ .causes-art{max-height:150px} }
.causes-next .btn{min-height:44px;display:inline-flex !important;align-items:center}

/* ---------- Profile > Settings ---------- */
.settings{margin-top:36px;padding-top:18px;border-top:1px solid var(--hair);max-width:640px}
html.skin-h .settings h2{font-size:22px;margin:0 0 6px}
.set-row{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:56px;padding:8px 0;border-bottom:1px solid var(--rule)}
.set-row b{display:block;font-size:16px}
.set-row span{font-size:14.5px;color:var(--muted)}
.set-row .theme-switch{min-width:44px;min-height:44px;justify-content:flex-end;padding:0}
.set-links{display:flex;flex-wrap:wrap;gap:0 22px;padding:6px 0}
.set-links a{display:inline-flex;align-items:center;min-height:44px;font-weight:700;color:var(--navy)}
.set-links a[hidden]{display:none}

/* ---------- R2 check: narrow computers / tablets (761 to 900px): keep the top bar on one line ---------- */
.tabbar a,.tabbar .tb-plus{white-space:nowrap}
html.skin-h .topbar > *{flex-shrink:0}
@media (min-width:761px) and (max-width:900px){
  html.skin-h .topbar{gap:8px}
  .tabbar{gap:0}
  .tabbar a{padding:0 9px}
  .tabbar .tb-plus{margin:0 4px;padding:0 12px 0 9px}
}
/* very small phones (under 360px): the sort switch wraps instead of pushing the page sideways */
@media (max-width:359px){
  html.skin-h .sort-switch{flex-wrap:wrap;border-radius:14px;max-width:100%}
}
/* an item page with nothing to show: keep the message clear of the Back button */
.item-back + .x-lede{margin-top:14px}
