/* ============================================================================
   ib-nav.css — the SINGLE source of truth for the nav's styles.
   Used by <ib-nav> on every surface (static pages, calculator SPA, homepage,
   Next.js account pages). Dark is the default; [data-theme="light"] overrides.
   ============================================================================ */

ib-nav { display: block; }

/* ── Top bar ── */
.ib-nav { position: sticky; top: 0; z-index: 200; background: rgba(14,14,16,0.80); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(255,255,255,0.07); transition: transform .28s ease; will-change: transform; }
.ib-nav-inner { max-width: 1180px; margin: 0 auto; padding: 0 36px; height: 48px; display: flex; align-items: center; gap: 28px; }
.ib-brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; text-decoration: none; }
.ib-brand-text { font-family: 'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; font-size: 15px; color: #f0f0f2; letter-spacing: -0.01em; }
.ib-brand-text strong { color: #0fbcad; font-weight: 500; }
.ib-nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.ib-nav-divider { width: 1px; height: 18px; background: rgba(255,255,255,0.07); margin: 0 4px; }
.ib-nav-signin { font-family: 'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; font-size: 12px; color: #0fbcad; letter-spacing: 0.03em; padding: 5px 12px; border-radius: 5px; border: 1px solid rgba(15,188,173,0.35); text-decoration: none; transition: background 0.15s,border-color 0.15s; white-space: nowrap; margin-left: 4px; }
.ib-nav-signin:hover { background: rgba(15,188,173,0.1); border-color: rgba(15,188,173,0.6); }
.ib-nav-signup { background: rgba(15,188,173,0.08); }

/* ── Dropdowns (always in DOM; shown when the wrap has .open) ── */
.ib-dropdown-wrap { position: relative; }
.ib-dropdown-btn { display: flex; align-items: center; gap: 5px; font-family: 'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; font-size: 12px; color: rgba(240,240,242,0.5); letter-spacing: 0.03em; padding: 6px 10px; background: none; border: none; cursor: pointer; border-radius: 5px; transition: color 0.15s; white-space: nowrap; text-decoration: none; }
.ib-dropdown-btn:hover, .ib-dropdown-wrap.open .ib-dropdown-btn { color: #f0f0f2; }
.ib-dropdown-caret { font-size: 9px; opacity: 0.6; transition: transform 0.15s; }
.ib-dropdown-wrap.open .ib-dropdown-caret { transform: rotate(180deg); }
.ib-dropdown-menu { display: none; position: absolute; top: calc(100% + 8px); right: 0; background: rgba(20,22,26,0.99); border: 1px solid rgba(255,255,255,0.16); border-radius: 5px; box-shadow: 0 16px 40px rgba(0,0,0,0.5),inset 0 1px 0 rgba(255,255,255,0.18); min-width: 190px; max-height: min(72vh,560px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; z-index: 300; }
.ib-dropdown-wrap.open > .ib-dropdown-menu { display: block; }
@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) { .ib-dropdown-menu { backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%); } }
.ib-dropdown-menu a, .ib-dropdown-menu .ib-dropdown-item { display: block; width: 100%; text-align: left; padding: 10px 16px; font-family: 'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; font-size: 13px; color: rgba(240,240,242,0.6); transition: background 0.12s,color 0.12s; text-decoration: none; background: none; border: none; cursor: pointer; }
.ib-dropdown-menu a:hover, .ib-dropdown-menu .ib-dropdown-item:hover { background: rgba(255,255,255,0.05); color: #f0f0f2; }
.ib-dropdown-menu .ib-dropdown-item.active { color: #0fbcad; }
.ib-dropdown-menu--2col { min-width: 360px; column-count: 2; }

/* ── Theme toggle (desktop) ── */
.ib-theme-toggle { background: none; border: 1px solid rgba(255,255,255,0.13); border-radius: 6px; cursor: pointer; padding: 5px 8px; color: rgba(240,240,242,0.45); display: flex; align-items: center; line-height: 1; transition: color 0.15s,border-color 0.15s; }
.ib-theme-toggle:hover { color: #f0f0f2; }

/* ── Avatar + user menu ── */
.ib-avatar-btn { position: relative; display: flex; align-items: center; text-decoration: none; background: none; border: none; padding: 0; cursor: pointer; }
.ib-avatar-pic { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; display: block; border: 1.5px solid rgba(15,188,173,0.33); flex-shrink: 0; }
.ib-avatar-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ib-avatar-initials { display: flex; align-items: center; justify-content: center; background: rgba(15,188,173,0.13); font-family: 'Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-size: 11px; font-weight: 500; color: #0fbcad; }
.ib-user-wrap { margin-left: 4px; }
.ib-user-menu { padding: 8px; min-width: 180px; }
.ib-user-head { padding: 6px 12px 8px; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 4px; }
.ib-user-name { font-family: 'Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-size: 13px; font-weight: 600; color: #f0f0f2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 156px; }
.ib-user-email { font-family: 'Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-size: 10px; color: rgba(240,240,242,0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 156px; }
.ib-user-founder { display: inline-block; margin-top: 3px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #e0b341; background: rgba(224,179,65,0.13); border: 1px solid rgba(224,179,65,0.4); border-radius: 999px; padding: 1px 8px; }
.ib-user-sep { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 0; }
.ib-user-signout { font-family: 'Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-size: 12px; color: #ff5757; padding: 7px 12px; border-radius: 6px; cursor: pointer; background: none; border: none; width: 100%; text-align: left; }

/* ── CTA quick icons (homepage) ── */
.ib-nav-cta-wrap { display: flex; align-items: center; gap: 2px; }
.ib-nav-cta { display: flex; align-items: center; padding: 6px; color: rgba(240,240,242,0.55); text-decoration: none; border-radius: 6px; transition: color 0.15s,background 0.15s; }
.ib-nav-cta:hover { color: #0fbcad; background: rgba(255,255,255,0.05); }

/* ── Hamburger + mobile pfp (mobile only) ── */
.ib-hamburger { display: none; background: none; border: none; cursor: pointer; padding: 8px; color: #f0f0f2; margin-left: 10px; }
.ib-nav-pfp { display: none; }

@media (max-width: 767px) {
  .ib-nav-inner { padding: 0 18px; }
  .ib-nav-links { display: none; }
  .ib-hamburger { display: flex; align-items: center; }
  .ib-nav-cta-wrap { display: none; }
  /* leftDrawer mode: burger LEFT, brand centred, pfp RIGHT */
  .ib-nav--drawer .ib-nav-inner { position: relative; }
  .ib-nav--drawer .ib-brand { position: absolute; left: 50%; transform: translateX(-50%); }
  .ib-nav--drawer .ib-hamburger { order: -1; margin-left: 0; margin-right: auto; }
  .ib-nav--drawer .ib-nav-pfp { display: flex; align-items: center; margin-left: auto; -webkit-tap-highlight-color: transparent; text-decoration: none; }
}
.ib-nav-pfp .ib-avatar-pic { width: 30px; height: 30px; }

/* ── Off-canvas master-detail drawer (the canonical TRT-calculator sidebar) ── */
.ib-calc-rail { display: none; }
.ib-rail-overlay { display: none; }
@media (max-width: 767px) {
  .ib-calc-rail { display: block; position: fixed; top: 0; left: 0; height: 100dvh; width: 300px; max-width: 86vw; z-index: 400; transform: translateX(-100%); visibility: hidden; transition: transform .25s ease,visibility 0s linear .25s; background: rgba(14,14,16,0.85); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-right: 1px solid rgba(255,255,255,0.13); box-shadow: 4px 0 30px rgba(0,0,0,.45); }
  .ib-calc-rail.open { transform: translateX(0); visibility: visible; transition: transform .25s ease,visibility 0s; }
  .ib-rail-inner { height: 100%; overflow-y: auto; padding: 14px 14px 28px; display: flex; flex-direction: column; gap: 18px; }
  .ib-rail-overlay { display: block; position: fixed; inset: 0; z-index: 399; background: rgba(0,0,0,.42); opacity: 0; visibility: hidden; backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); transition: opacity .25s ease,backdrop-filter .25s ease,-webkit-backdrop-filter .25s ease,visibility 0s linear .25s; }
  .ib-rail-overlay.open { opacity: 1; visibility: visible; backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); transition: opacity .25s ease,backdrop-filter .25s ease,-webkit-backdrop-filter .25s ease,visibility 0s; }
  .ib-rail-mhead { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; justify-content: flex-start; background: rgba(14,14,16,0.92); margin: -14px -14px 4px; padding: 14px 14px 10px; }
  .ib-rail-mhead-brand { font-family: 'Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-size: 16px; color: #f0f0f2; }
  .ib-rail-mhead-brand strong { color: #0fbcad; font-weight: 500; }
  .ib-rail-close { background: none; border: none; color: rgba(240,240,242,0.45); font-size: 26px; cursor: pointer; padding: 2px 8px; line-height: 1; }
  .ib-rail-pfp { margin-left: auto; display: flex; align-items: center; text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .ib-rail-pfp .ib-avatar-pic { width: 40px; height: 40px; }
  /* Suggestions button docked in the drawer header (beside the profile picture),
     replacing the floating #ib-suggest-bubble on mobile. */
  .ib-rail-suggest { margin-left: auto; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; color: #0fbcad; text-decoration: none; -webkit-tap-highlight-color: transparent; flex-shrink: 0; }
  .ib-rail-suggest:active { background: rgba(15,188,173,0.14); }
  .ib-rail-mhead .ib-rail-pfp { margin-left: 8px; }
  /* The floating suggestion bubble (#ib-suggest-bubble — Next + static twins) is
     redundant on mobile now that it lives in the drawer header. */
  #ib-suggest-bubble { display: none !important; }
  .ib-rail-proto-slot:empty { display: none; }
  .ib-rail-md { display: flex; gap: 8px; align-items: stretch; flex: 1 1 auto; min-height: 0; }
  .ib-rail-md-cats { display: flex; flex-direction: column; gap: 2px; flex: 0 0 116px; }
  .ib-rail-cat { font-family: 'Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-size: 12.5px; font-weight: 600; text-align: left; padding: 11px 10px; border: none; border-radius: 5px; background: rgba(255,255,255,0.04); color: rgba(240,240,242,0.78); cursor: pointer; line-height: 1.25; }
  .ib-rail-cat.active { background: rgba(15,188,173,0.14); color: #0fbcad; }
  .ib-rail-md-panel { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
  .ib-rail-md-pane { display: flex; flex-direction: column; gap: 1px; }
  .ib-rail-md-pane[hidden] { display: none; }
  .ib-rail-mditem { font-family: 'Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-size: 12.5px; color: rgba(240,240,242,0.82); padding: 9px 10px; background: #18181c; border: none; border-radius: 4px; text-align: left; width: 100%; text-decoration: none; display: block; line-height: 1.3; cursor: pointer; }
  .ib-rail-mditem.active { color: #0fbcad; font-weight: 600; }
  .ib-rail-md-hint { font-family: 'Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-size: 12px; color: rgba(240,240,242,0.4); padding: 11px 6px; }
  .ib-rail-foot { flex: 0 0 auto; margin-top: auto; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.07); }
  .ib-rail-link { display: block; width: 100%; text-align: left; font-family: 'Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-size: 13px; color: rgba(240,240,242,0.7); padding: 9px 2px; background: none; border: none; border-bottom: 1px solid rgba(255,255,255,0.07); text-decoration: none; cursor: pointer; }
  .ib-rail-link.danger { color: #ff5757; }
  .ib-theme-row { display: flex; align-items: center; gap: 10px; border-bottom: none; }
}

/* ── Hide-on-scroll (root class toggled by ib-nav.js) ── */
html.ib-nav-hidden .ib-nav { transform: translateY(-100%); }
.ib-hamburger { transition: transform .28s ease; }
html.ib-nav-hidden .ib-hamburger { transform: translateY(48px); z-index: 250; pointer-events: auto; background: rgba(127,127,127,0.34); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-radius: 8px; border: 1px solid rgba(127,127,127,0.5); }
@media (max-width: 767px) {
  html.ib-nav-hidden .ib-nav { transform: none; background: transparent !important; border-bottom-color: transparent !important; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); -webkit-mask-image: linear-gradient(to bottom,#000 55%,transparent 100%); mask-image: linear-gradient(to bottom,#000 55%,transparent 100%); pointer-events: none; }
  .ib-nav-inner > * { transition: opacity .5s ease; }
  html.ib-nav-hidden .ib-nav-inner > * { opacity: 0; pointer-events: none; }
  html.ib-nav-hidden .ib-hamburger { opacity: 1; transform: none; pointer-events: auto; z-index: 250; background: rgba(127,127,127,0.34); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-radius: 8px; border: 1px solid rgba(127,127,127,0.5); }
  html.ib-nav-hidden .ib-nav-pfp { opacity: 1; pointer-events: auto; z-index: 250; }
}
@media (prefers-reduced-motion: reduce) { .ib-nav, .ib-hamburger, .ib-nav-inner > * { transition: none; } }

/* ── Light theme ── */
[data-theme="light"] .ib-nav { background: rgba(248,248,252,0.80); border-bottom-color: rgba(0,0,0,0.08); }
[data-theme="light"] .ib-brand-text { color: #1a1a1e; }
[data-theme="light"] .ib-hamburger { color: #1a1a1e; }
[data-theme="light"] .ib-nav-divider { background: rgba(0,0,0,0.08); }
[data-theme="light"] .ib-dropdown-btn { color: rgba(20,20,28,0.7); }
[data-theme="light"] .ib-dropdown-btn:hover, [data-theme="light"] .ib-dropdown-wrap.open .ib-dropdown-btn { color: #1a1a1e; }
[data-theme="light"] .ib-dropdown-menu { background: rgba(255,255,255,0.99); border-color: rgba(0,0,0,0.08); box-shadow: 0 16px 36px rgba(31,38,55,0.18),inset 0 1px 0 rgba(255,255,255,0.9); }
[data-theme="light"] .ib-dropdown-menu a, [data-theme="light"] .ib-dropdown-menu .ib-dropdown-item { color: rgba(20,20,28,0.7); }
[data-theme="light"] .ib-dropdown-menu a:hover, [data-theme="light"] .ib-dropdown-menu .ib-dropdown-item:hover { background: rgba(0,0,0,0.04); color: #1a1a1e; }
[data-theme="light"] .ib-theme-toggle { color: rgba(20,20,28,0.55); border-color: rgba(0,0,0,0.13); }
[data-theme="light"] .ib-user-name { color: #1a1a1e; }
[data-theme="light"] .ib-calc-rail { background: rgba(244,244,246,0.85); border-right-color: rgba(0,0,0,0.14); }
[data-theme="light"] .ib-rail-mhead { background: rgba(244,244,246,0.9); }
[data-theme="light"] .ib-rail-mhead-brand { color: #1a1a1e; }
[data-theme="light"] .ib-rail-close { color: rgba(20,20,28,0.5); }
[data-theme="light"] .ib-rail-cat { background: rgba(0,0,0,0.04); color: rgba(20,20,28,0.78); }
[data-theme="light"] .ib-rail-cat.active { background: rgba(15,188,173,0.14); color: #0c8479; }
[data-theme="light"] .ib-rail-mditem { background: #fff; color: rgba(20,20,28,0.82); }
[data-theme="light"] .ib-rail-md-hint { color: rgba(20,20,28,0.4); }
[data-theme="light"] .ib-rail-foot { border-top-color: rgba(0,0,0,0.08); }
[data-theme="light"] .ib-rail-link { color: rgba(20,20,28,0.7); border-bottom-color: rgba(0,0,0,0.08); }
