/* The chrome shared by every navigated page: the banner, the bottom tab
   bar that takes over under 860px, and the Réglages dialog. The banner is
   full-bleed so « Oathbrush » starts at the same pixel everywhere. */
body>header{
  position:sticky; top:0; z-index:30;
  padding-top:env(safe-area-inset-top);
  background:color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter:saturate(180%) blur(12px);
  border-bottom:1px solid var(--line);
}
.navbar{display:flex;align-items:center;gap:14px;padding:9px 20px}
.nbrand{display:flex;align-items:baseline;gap:10px;text-decoration:none}
.nbrand .nlogo{width:26px;height:26px;align-self:center}
.nbrand h1{font-size:16px;font-weight:650;letter-spacing:-.01em;margin:0}
.nbrand .tag{font-size:12.5px;color:var(--ink-3);letter-spacing:.01em;white-space:nowrap}
.navlinks{display:flex;gap:4px;margin-left:8px;margin-right:auto}
.navlinks a{padding:5px 11px;border-radius:8px;font-size:13.5px;color:var(--ink-2);text-decoration:none;white-space:nowrap}
.navlinks a:hover{background:var(--panel-2);color:var(--ink)}
.navlinks a.on{background:var(--ink);color:var(--bg)}
.navlinks a .sm{display:none}

/* Under ~700px the banner keeps its single line: tagline hidden, short
   labels, tighter gaps — sized to fit the 360px floor. */
@media (max-width:700px){
  .navbar{gap:10px;padding:9px 14px}
  .nbrand .tag{display:none}
  .navlinks{gap:2px;margin-left:0}
  .navlinks a{padding:8px 9px;font-size:13px}
  .navlinks a .lg{display:none}
  .navlinks a .sm{display:inline}
}
@media (hover:none){
  .navlinks a{min-height:44px;display:inline-flex;align-items:center}
}

/* ---------- the bottom tab bar (≤860px: the width decides the topology) ---------- */
/* the bar's height above the home indicator — iOS's own is 49pt, ours
   breathes 4px more above the icons; the labels sit on the safe area, as a
   native bar's do */
:root{--tabbar-h:52px}
.tabbar{
  position:fixed;left:0;right:0;bottom:0;z-index:40;
  display:none;grid-template-columns:repeat(4,1fr);
  background:color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter:saturate(180%) blur(12px);
  border-top:1px solid var(--line);
  padding:6px calc(8px + env(safe-area-inset-right)) env(safe-area-inset-bottom) calc(8px + env(safe-area-inset-left));
}
.tbtn{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  min-height:calc(var(--tabbar-h) - 6px);padding:2px 0;border:0;background:none;cursor:pointer;
  color:var(--ink-3);font-size:11px;font-weight:600;text-decoration:none;
  border-radius:var(--radius-s);
}
.tbtn svg{width:22px;height:22px}
.tbtn.on{color:var(--ink)}
.tbtn:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
@media (hover:none){ .tbtn:active{background:var(--panel-2)} }

@media (max-width:860px){
  .tabbar{display:grid}
  .navlinks,#settingsBtn{display:none}
  /* pages breathe past the bar; the toast rides above it */
  body:has(.tabbar){padding-bottom:calc(var(--tabbar-h) + 4px + env(safe-area-inset-bottom))}
  body:has(.tabbar) #toast{bottom:calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom))}
}

/* ---------- sub-page chrome: a page one level under an oath (recipes, painting) ----------
   Under 860px the banner steps aside for a sticky sub-page header — back,
   title and context, the page's own controls; at the pointer the banner
   stays and a breadcrumb takes over. */
.subhead{
  position:sticky;top:0;z-index:30;display:none;align-items:center;gap:8px;
  padding:calc(8px + env(safe-area-inset-top)) 14px 8px;background:color-mix(in srgb,var(--bg) 88%,transparent);
  backdrop-filter:saturate(180%) blur(12px);border-bottom:1px solid var(--line);
}
.subhead .sht{display:flex;flex-direction:column;min-width:0;flex:1}
.subhead .sht b{font-size:16px;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.subhead .sht span{font-size:12px;color:var(--ink-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crumbs{padding:14px 20px 0;font-size:13px;color:var(--ink-3);width:100%}
.crumbs a{color:var(--ink-2);text-decoration:underline;text-underline-offset:2px}
.crumbs a:hover{color:var(--ink)}
.crumbs .csep{margin:0 6px}
.crumbs .ccur{color:var(--ink);font-weight:600}
@media (max-width:860px){
  body:has(.subhead)>header,.crumbs{display:none}
  .subhead{display:flex}
}

/* the keyboard owns the bottom of the screen: the fixed chrome yields */
html.kb .tabbar,html.kb .rfoot,html.kb .sharebar{display:none}

/* ---------- Réglages: popover under the gear, bottom sheet over the bar ---------- */
#setdlg{--dlg-w:320px;margin:64px 20px auto auto}
@media (min-width:861px){
  .sethead .ibtn{display:none} /* a popover: click-outside or Échap */
  #setdlg::backdrop{background:none;backdrop-filter:none}
}
#setdlg .setin{position:relative;padding:14px 20px 18px;display:flex;flex-direction:column;gap:16px}
.setgrab{display:none;width:36px;height:4px;border-radius:99px;background:var(--line);margin:0 auto;flex:none}
.sethead{display:flex;align-items:center;gap:8px}
#setdlg h3{margin:0;font-size:19px;letter-spacing:-.01em;flex:1}
.setlab{display:block;margin-bottom:7px}
.setsep{border:0;border-top:1px solid var(--line);margin:0}
.seg{display:flex}
/* three labels share the row whatever the width: they shrink, never overflow */
.seg .btn{flex:1 1 0;min-width:0;overflow:hidden;padding:0 8px;font-size:13.5px;border-radius:0;margin-left:-1px;position:relative}
.seg .btn:first-child{border-radius:var(--radius-s) 0 0 var(--radius-s);margin-left:0}
.seg .btn:last-child{border-radius:0 var(--radius-s) var(--radius-s) 0}
.seg .btn[aria-pressed="true"]{background:var(--ink);border-color:var(--ink);color:var(--bg);z-index:1}
.setabout{display:flex;align-items:center;gap:10px;text-decoration:none}
.setaboutmain{flex:1;min-width:0}
.setabout .t{text-decoration:underline;text-underline-offset:2px;font-weight:600;font-size:15px}
.setabout>svg{flex:none;color:var(--ink-3)}
/* the quiet line under something: a hint, a sentence, a warning */
.sethint{display:block;font-size:12.5px;color:var(--ink-3);margin:0}
.setver{font-size:12px;color:var(--ink-3);text-decoration:underline;text-underline-offset:2px;align-self:flex-start}
.setver:hover{color:var(--ink)}
/* One dot, several reasons (lib/notice.js): `notice` is the aggregate that
   marks the gear and the Réglages tab — there are never two dots — while
   each reason marks its own row inside the panel, so opening it always
   shows what was calling. `news`: a minor version not read on news.html.
   `bakdue`: a backup overdue. */
html.notice #settingsBtn,html.notice #settingsTab{position:relative}
html.notice #settingsBtn::after,html.notice #settingsTab::after{
  content:'';position:absolute;width:8px;height:8px;border-radius:50%;
  background:var(--accent);box-shadow:0 0 0 2px var(--bg);
}
html.notice #settingsBtn::after{top:-3px;right:-3px}
html.notice #settingsTab::after{top:4px;left:calc(50% + 9px)}
html.news .setver::before,html.bakdue .setstate::before{
  content:'';display:inline-block;width:7px;height:7px;border-radius:50%;
  background:var(--accent);margin-right:6px;vertical-align:1px;
}

/* Données: the sentence, the two gestures, the one line they answer with */
.setacts{display:flex;gap:8px;margin-top:9px}
.setacts .btn{flex:1 1 0;min-width:0;gap:6px}
.setstate{margin:9px 0 0;font-size:12.5px;color:var(--ink-2)}
#bakPersist{margin-top:7px}
.setstate.bad{color:var(--warn)}
html.bakdue .setstate{color:var(--accent)}

@media (max-width:860px){
  .setgrab{display:block}
  #setdlg{
    margin:auto 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom:0;
  }
  /* the veil stops at the tab bar — the Réglages tab stays reachable, lit */
  #setdlg::backdrop{bottom:calc(var(--tabbar-h) + env(safe-area-inset-bottom))}
}

/* ---------- restoring a backup ---------- */
#bakdlg{--dlg-w:460px}
.bakreport{display:flex;flex-direction:column;gap:8px;font-size:13.5px}
.bakline{margin:0}
.baklist{margin:0;padding-left:18px;color:var(--ink-2)}
.baklist li{margin:2px 0}
.bakbad{margin:0;color:var(--warn)}
.bakbad ul{margin:6px 0 0;padding-left:18px}
.bakbad li{overflow-wrap:anywhere}
