/* ============================================================================
   MOBILE BAR — one thumb-zone shell for every page.
   Hidden until mobile-bar.js adds .has-mbar, so no-JS keeps the existing
   header navigation. The centre Log opens a sheet; Menu reuses the nav sheet.
   ========================================================================== */
.mbar,
.logsheet,
.logsheet__scrim { display: none; }

@media (max-width: 900px) {
  body.has-mbar {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  /* The bar owns Menu on mobile. Without JS the header burger stays. */
  body.has-mbar .topnav .nav-burger { display: none; }

  body.has-mbar .consent-bar {
    bottom: calc(86px + env(safe-area-inset-bottom));
  }

  body.has-mbar .mbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in oklch, var(--surface) 94%, transparent);
    border-top: 1px solid var(--border);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
    box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.28);
  }

  .mbar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    padding: 5px 2px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--muted);
    font-family: var(--font-body, inherit);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mbar__item svg {
    width: 21px;
    height: 21px;
    flex: none;
    stroke: currentColor;
  }

  .mbar__item:hover { color: var(--fg); }
  .mbar__item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }

  .mbar__item.is-current { color: var(--fg); }
  .mbar__item.is-current::after {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px color-mix(in oklch, var(--accent) 70%, transparent);
  }

  .mbar__log {
    gap: 0;
    color: var(--fg);
  }

  .mbar__logdot {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    margin-top: -25px;
    margin-bottom: 2px;
    border: 4px solid var(--bg);
    border-radius: 50%;
    background: var(--grad);
    color: #08090b;
    font-family: var(--font-display, inherit);
    font-size: 26px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28), 0 0 0 1px var(--border-strong);
  }

  .mbar__log.is-current::after { display: none; }

  /* Log sheet ------------------------------------------------------------- */
  body.has-mbar .logsheet__scrim.is-open {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: block;
    background: color-mix(in oklch, var(--bg) 68%, transparent);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
  }

  body.has-mbar .logsheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 96;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-strong);
    border-radius: 22px 22px 0 0;
    background: var(--surface);
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.4);
    visibility: hidden;
    transform: translateY(105%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  }

  body.has-mbar .logsheet.is-open { visibility: visible; transform: none; }

  .logsheet__handle {
    width: 38px;
    height: 4px;
    margin: 0 auto 2px;
    border-radius: 99px;
    background: var(--border-strong);
  }

  .logsheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .logsheet__head b {
    font-family: var(--font-display, inherit);
    font-size: 20px;
    letter-spacing: -0.02em;
  }

  .logsheet__x {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--fg);
    cursor: pointer;
  }

  .logsheet__x:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .logsheet__grid { display: grid; gap: 8px; }

  .logsheet__opt {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--fg);
    text-decoration: none;
  }

  .logsheet__opt:hover { border-color: var(--border-strong); }
  .logsheet__opt:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .logsheet__opt span:first-child {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--fg-soft);
    color: var(--accent);
  }

  .logsheet__opt svg { width: 20px; height: 20px; }

  .logsheet__opt b {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
  }

  .logsheet__opt small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
  }

  .logsheet__note {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
    text-align: center;
  }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  body.has-mbar .logsheet { transition: none; }
}

@media print {
  .mbar,
  .logsheet,
  .logsheet__scrim { display: none !important; }
}
