/* =====================================================================
 *  website-layout.css  —  GLOBAL "Website Layout" shell.
 *
 *  The admin picks a Website Layout (Website Theme → Website Layout). theme.js
 *  puts it on <html data-dashboard="…"> on EVERY page, so this stylesheet
 *  reskins the SITE-WIDE navigation shell (the top bar) into that layout's
 *  form on every page — while each page keeps its own content.
 *
 *  Two header conventions exist site-wide; every rule targets BOTH:
 *    • member / admin / dashboard pages :  body > header  (wrapping nav.hdr-*)
 *    • public pages                     :  .navbar
 *
 *  'atelier' (Classic) is the baseline — it needs NO rules here (absence of
 *  overrides = today's look). Only the other four add a shell skin, under
 *  their own attribute, so Classic and any un-set page are 100% untouched.
 * ===================================================================== */
:root{
  /* The shell bar fill HONOURS the container-fill toggle: glassy translucent by
     default, opaque over the theme ink when the admin sets "Solid". This is why
     the transparent/solid switch now visibly affects every layout's chrome. */
  --wl-bar:  color-mix(in srgb, var(--cb-ink, #0b0b12) 58%, transparent);  /* glassy, still readable */
  --wl-line: rgba(var(--primary-rgb, 196,14,46), .22);
  --wl-side: 220px;   /* sidebar-layout rail width */
}
html[data-dash-containers="solid"]{
  --wl-bar:  color-mix(in srgb, var(--cb-text, #fff) 5%, var(--cb-ink, #0b0b12));  /* fully opaque */
}

/* Convenience: the "nav link" selector list, reused per layout (excludes the
   logo <a> and the notif buttons). */
/* (kept inline in each block — CSS has no selector variables) */


/* IMPORTANT — the per-layout link styling below targets ONLY real nav links:
   `.nav-links > a` and `.header-nav-links > a` (direct children). This
   deliberately EXCLUDES the notification buttons (.notif-btn, which are
   grandchildren via .notif-icons), the avatar dropdown links (.dropdown-link),
   and the logo — styling those broke the icon buttons (the bug where the notif
   icons went tiny/pill-shaped in Bento & Tabbed). Never widen this to a bare
   `nav a`. */

/* ══ TABULAR CONSOLE — a dense, uppercase, monospaced console bar ═════════ */
html[data-dashboard="tabular"] > body > header,
html[data-dashboard="tabular"] .navbar{
  padding-top: 8px !important; padding-bottom: 8px !important;
  background: var(--wl-bar) !important;
  border-bottom: 2px solid var(--wl-line) !important;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
html[data-dashboard="tabular"] > body > header nav{ gap: 12px; }
html[data-dashboard="tabular"] .navbar{ gap: 12px; }
html[data-dashboard="tabular"] .nav-links > a,
html[data-dashboard="tabular"] .header-nav-links > a{
  font-family: var(--cb-mono, ui-monospace, monospace) !important;
  font-size: 12px !important; letter-spacing: .06em; text-transform: uppercase;
}
html[data-dashboard="tabular"] .header-logo{ font-size: 18px; }

/* ══ BENTO COMMAND — a floating rounded bar; nav items read as tiles ══════ */
html[data-dashboard="bento"] > body > header{
  background: transparent !important; border: 0 !important;
}
html[data-dashboard="bento"] > body > header > nav,
html[data-dashboard="bento"] .navbar{
  margin: 14px 16px !important;
  border-radius: 22px !important;
  border: 1px solid var(--wl-line) !important;
  background: var(--wl-bar) !important;
  box-shadow: 0 12px 34px -14px rgba(0,0,0,.62) !important;
  padding: 12px 22px !important;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
html[data-dashboard="bento"] .nav-links > a,
html[data-dashboard="bento"] .header-nav-links > a{
  padding: 8px 14px !important; border-radius: var(--cb-rect-r, 14px);
  transition: background .15s, color .15s;
}
html[data-dashboard="bento"] .nav-links > a:hover,
html[data-dashboard="bento"] .header-nav-links > a:hover{
  background: rgba(var(--primary-rgb, 196,14,46), .12);
}
html[data-dashboard="bento"] .nav-links > a.active,
html[data-dashboard="bento"] .header-nav-links > a.active{
  background: rgba(var(--primary-rgb, 196,14,46), .16) !important; color: #fff;
}

/* ══ TABBED WORKSPACE — centered bar; nav items are big pill tabs ═════════ */
html[data-dashboard="tabs"] > body > header,
html[data-dashboard="tabs"] .navbar{
  background: var(--wl-bar) !important;
  border-bottom: 1px solid var(--wl-line) !important;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
html[data-dashboard="tabs"] > body > header nav,
html[data-dashboard="tabs"] .navbar{ justify-content: center !important; gap: 6px; }
html[data-dashboard="tabs"] .header-logo{ margin-right: auto; }
html[data-dashboard="tabs"] .navbar .nav-right,
html[data-dashboard="tabs"] > body > header .header-right{ margin-left: auto; }
html[data-dashboard="tabs"] .nav-links > a,
html[data-dashboard="tabs"] .header-nav-links > a{
  padding: 9px 18px !important; border-radius: 999px;
  transition: background .15s, color .15s;
}
html[data-dashboard="tabs"] .nav-links > a:hover,
html[data-dashboard="tabs"] .header-nav-links > a:hover{
  background: rgba(var(--primary-rgb, 196,14,46), .12);
}
html[data-dashboard="tabs"] .nav-links > a.active,
html[data-dashboard="tabs"] .header-nav-links > a.active{
  background: var(--gradient-active, var(--gradient, linear-gradient(100deg, var(--primary), var(--secondary)))) !important;
  color: #fff;
}

/* ══ SIDEBAR PANEL — the top bar becomes a fixed left rail; content shifts ══ */
html[data-dashboard="sidebar"] > body{ padding-left: var(--wl-side); }
html[data-dashboard="sidebar"] > body > header,
html[data-dashboard="sidebar"] .navbar{
  position: fixed !important; left: 0; top: 0; bottom: 0;
  width: var(--wl-side); height: 100vh; z-index: 900;
  background: var(--wl-bar) !important;
  border-right: 1px solid var(--wl-line) !important;
  border-bottom: 0 !important;
  overflow-y: auto; overflow-x: visible;
  display: flex !important; flex-direction: column !important;
  /* NO backdrop-filter here on purpose: a filter/backdrop-filter would make
     this rail the containing block for the account dropdown's position:fixed,
     clipping the flyout inside the rail. Without it the flyout escapes to the
     viewport (see .avatar-dropdown below). */
}
/* member/admin/dash: the inner <nav> FILLS the rail (flex:1 in a definite-height
   flex parent) and becomes the column — so margin-top:auto below can push the
   account block to the very bottom reliably. */
html[data-dashboard="sidebar"] > body > header > nav{
  flex: 1 1 auto !important; min-height: 0;
  display: flex !important; flex-direction: column !important; align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 6px !important; padding: 20px 14px !important; flex-wrap: nowrap !important;
}
/* public: .navbar IS the rail AND the column */
html[data-dashboard="sidebar"] .navbar{
  align-items: stretch !important; justify-content: flex-start !important;
  gap: 6px !important; padding: 20px 14px !important; flex-wrap: nowrap !important;
}
/* logo + a thin break line separating it from the notification icons */
html[data-dashboard="sidebar"] > body > header .header-logo,
html[data-dashboard="sidebar"] .navbar .header-logo{
  width: 100%; margin: 0 0 12px 0 !important;
  padding: 0 8px 14px !important;
  border-bottom: 1px solid var(--wl-line);
}
/* keep the icon cluster horizontal inside the rail */
html[data-dashboard="sidebar"] .notif-icons{
  flex-direction: row !important; flex-wrap: wrap; width: 100%;
  justify-content: flex-start; margin: 0 0 6px 0 !important;
}
/* stack every nav group vertically; links fill the rail width */
html[data-dashboard="sidebar"] .navbar .nav-links,
html[data-dashboard="sidebar"] .navbar .nav-right,
html[data-dashboard="sidebar"] > body > header .nav-links,
html[data-dashboard="sidebar"] > body > header .header-right,
html[data-dashboard="sidebar"] > body > header .header-nav-links{
  flex-direction: column !important; align-items: stretch !important;
  width: 100%; gap: 4px !important; margin: 0 !important;
}
/* push the account block / login actions to the BOTTOM of the rail */
html[data-dashboard="sidebar"] > body > header .header-right,
html[data-dashboard="sidebar"] .navbar .nav-right{ margin-top: auto !important; }
html[data-dashboard="sidebar"] > body > header .user-avatar-section{ width: 100%; }
/* nav links: full-width, with hover + ACTIVE highlighting */
html[data-dashboard="sidebar"] .navbar .nav-links a,
html[data-dashboard="sidebar"] > body > header .nav-links > a,
html[data-dashboard="sidebar"] > body > header .header-nav-links > a{
  display: block; width: 100%; text-align: left;
  padding: 9px 12px !important; border-radius: var(--cb-rect-r, 14px);
  transition: background .15s, color .15s;
}
html[data-dashboard="sidebar"] .navbar .nav-links a:hover,
html[data-dashboard="sidebar"] > body > header .nav-links > a:hover,
html[data-dashboard="sidebar"] > body > header .header-nav-links > a:hover{
  background: rgba(var(--primary-rgb, 196,14,46), .12);
}
html[data-dashboard="sidebar"] .navbar .nav-links a.active,
html[data-dashboard="sidebar"] > body > header .nav-links > a.active,
html[data-dashboard="sidebar"] > body > header .header-nav-links > a.active{
  background: var(--gradient-active, var(--gradient, linear-gradient(100deg, var(--primary), var(--secondary)))) !important;
  color: #fff !important;
}
/* the account menu: the avatar sits at the BOTTOM of the rail, so the menu opens
   UPWARD directly above it (the Slack / Discord / VS Code pattern) — clearly
   anchored to the avatar, not a detached pop-up at the screen bottom. Pinned
   FIXED (not absolute) so the rail's overflow can't clip it, and the rail has
   no backdrop-filter so "fixed" stays viewport-relative and escapes. */
html[data-dashboard="sidebar"] .avatar-dropdown{
  position: fixed !important;
  left: 12px !important;
  bottom: 86px !important;   /* just above the bottom-anchored avatar trigger */
  top: auto !important; right: auto !important;
  /* natural width so it OVERLAPS out over the content to the right of the rail
     (a floating overlay on top) instead of being squeezed inside the 220px rail
     and clipping its own right edge. */
  width: max-content !important; min-width: 244px !important;
  max-width: min(340px, calc(100vw - 24px)) !important;
  max-height: calc(100vh - 104px); overflow-y: auto;
  z-index: 2000 !important;
  transform-origin: bottom left;
}
/* the fixed rail replaces the sticky top header — drop content's top offset */
html[data-dashboard="sidebar"] > body > main{ margin-top: 0 !important; }

/* ── Responsive: below the tablet breakpoint every layout falls back to the
 *    normal flowing bar so a narrow screen is never trapped behind a rail. ── */
@media (max-width: 900px){
  html[data-dashboard="sidebar"] > body{ padding-left: 0; }
  html[data-dashboard="sidebar"] > body > header,
  html[data-dashboard="sidebar"] .navbar{
    position: static !important; width: auto; height: auto; bottom: auto;
    border-right: 0 !important; overflow: visible;
  }
  html[data-dashboard="sidebar"] > body > header > nav,
  html[data-dashboard="sidebar"] .navbar{
    flex-direction: row !important; flex-wrap: wrap !important;
    height: auto; padding: 12px 16px !important;
  }
  html[data-dashboard="sidebar"] .navbar .nav-links,
  html[data-dashboard="sidebar"] > body > header .nav-links,
  html[data-dashboard="sidebar"] > body > header .header-nav-links,
  html[data-dashboard="sidebar"] > body > header .header-right,
  html[data-dashboard="sidebar"] .navbar .nav-right{ flex-direction: row !important; width: auto; margin-top: 0 !important; }
  html[data-dashboard="sidebar"] > body > header .header-logo,
  html[data-dashboard="sidebar"] .navbar .header-logo{ width: auto; border-bottom: 0; padding-bottom: 0 !important; margin: 0 !important; }
  html[data-dashboard="sidebar"] .avatar-dropdown{
    position: absolute !important; left: auto !important; right: 0 !important;
    top: 60px !important; bottom: auto !important;
  }
  /* When nav-mobile.js's hamburger panel is OPEN, the dropdown must FLOW
     inside the panel: an absolute box inside the panel's overflow:auto
     item can't overlay out — it only inflates that item's scroll area
     (the trapped-menu bug, 2026-08-04). nav-mobile's own static rule has
     no !important, so it loses to the absolute re-assert above; this
     rule carries the same force plus the open-state class and wins. */
  html[data-dashboard="sidebar"] .mobile-nav-open .avatar-dropdown{
    position: static !important;
    top: auto !important; right: auto !important;
    left: auto !important; bottom: auto !important;
    width: 100% !important; min-width: 0 !important; max-width: none !important;
    margin-top: 10px; box-shadow: none;
  }
  /* the vertical-rail link geometry (block + width:100%) must be undone
     once the rail unwinds, or every link eats a full row on phones */
  html[data-dashboard="sidebar"] .navbar .nav-links a,
  html[data-dashboard="sidebar"] > body > header .nav-links a,
  html[data-dashboard="sidebar"] > body > header .header-nav-links a{
    display: inline-block !important; width: auto !important; text-align: center !important;
  }
  html[data-dashboard="bento"] > body > header > nav,
  html[data-dashboard="bento"] .navbar{ margin: 8px !important; }
}
/* phone tier: the bento/tabs pill paddings are !important, so the pages'
   own ≤460px tightening never applied — tighten them here instead */
@media (max-width: 460px){
  html[data-dashboard="bento"] > body > header > nav,
  html[data-dashboard="bento"] .navbar{ padding: 10px 12px !important; }
  html[data-dashboard="bento"] .nav-links > a,
  html[data-dashboard="bento"] .header-nav-links > a{ padding: 8px 10px !important; }
  html[data-dashboard="tabs"] .nav-links > a,
  html[data-dashboard="tabs"] .header-nav-links > a{ padding: 8px 12px !important; }
}
