/* BB Calculator V15: premium, responsive, native HTML reading surfaces.
   Preserve actual links, color scheme, keyboard navigation and reduced motion. */
:root {
  --bb-v15-surface:var(--bb-ins-surface,var(--card,#fff));
  --bb-v15-border:var(--bb-ins-border,var(--line,#d9d1e8));
  --bb-v15-text:var(--bb-ins-text,var(--text,#282336));
  --bb-v15-muted:var(--bb-ins-muted,var(--muted,#645e72));
  --bb-v15-accent:var(--bb-ins-accent,var(--purple,#6b21a8));
  --bb-v15-link:var(--bb-ins-link,var(--blue,#0752af));
  --bb-v15-soft:var(--bb-ins-soft,var(--hover,#f2ecfb));
  --bb-v15-shadow:0 10px 28px color-mix(in srgb,var(--bb-v15-accent) 9%,transparent);
}
#bb-insights-page-root .bb-calculation-modes{
  margin:clamp(24px,4vw,48px) 0 12px;padding:clamp(18px,3vw,36px);
  background:linear-gradient(130deg,var(--bb-v15-soft),transparent 42%),var(--bb-v15-surface);
  border:1px solid var(--bb-v15-border);border-radius:24px;box-shadow:var(--bb-v15-shadow);
}
#bb-insights-page-root .bb-mode-kicker{display:block;text-transform:uppercase;letter-spacing:.13em;font-size:.71rem;font-weight:800;color:var(--bb-v15-accent)}
#bb-insights-page-root .bb-calculation-modes h2{margin:6px 0;color:var(--bb-v15-text);font-size:clamp(1.35rem,2.6vw,1.8rem);letter-spacing:-.025em}
#bb-insights-page-root .bb-mode-intro{margin:0 0 18px;color:var(--bb-v15-muted);font-size:.96rem}
#bb-insights-page-root .bb-mode-details{border:1px solid var(--bb-v15-border);border-radius:16px;overflow:hidden}
#bb-insights-page-root .bb-mode-details summary{cursor:pointer;padding:14px 17px;min-height:48px;font-weight:750;color:var(--bb-v15-accent);background:var(--bb-v15-soft)}
#bb-insights-page-root .bb-mode-list{list-style:none;margin:0;padding:12px;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,245px),1fr));gap:12px}
#bb-insights-page-root .bb-calculation-modes>.bb-mode-list{padding:0}
#bb-insights-page-root .bb-mode-list li{display:flex;flex-direction:column;min-width:0;margin:0;padding:0;border:1px solid var(--bb-v15-border);border-radius:14px;background:var(--bb-v15-surface);overflow:hidden;transition:box-shadow .22s,border-color .22s}
#bb-insights-page-root .bb-mode-list a{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:48px;padding:12px 15px;color:var(--bb-v15-link);text-decoration:none;line-height:1.35;font-weight:700;overflow-wrap:anywhere}
#bb-insights-page-root .bb-mode-list a.bb-mode-open{flex:1}
#bb-insights-page-root .bb-mode-list a.bb-mode-open::after{content:'›';flex:none;font-size:1.45em;color:var(--bb-v15-accent)}
#bb-insights-page-root .bb-mode-list a.bb-mode-read{min-height:44px;font-size:.84rem;border-top:1px solid var(--bb-v15-border);font-weight:650;color:var(--bb-v15-muted)}
#bb-insights-page-root .bb-mode-list a.bb-mode-read::after{content:'↗';color:var(--bb-v15-accent)}
#bb-insights-page-root .bb-mode-list li:hover{border-color:var(--bb-v15-accent);box-shadow:var(--bb-v15-shadow)}
#bb-insights-page-root .bb-mode-list a:hover{background:var(--bb-v15-soft);color:var(--bb-v15-link)}

/* Article section directory: fixed-size number chips, wrapped titles, distinct
   rows, large touch targets and current-section indication. */
#bb-insights-page-root .bb-toc-mobile{padding:0;border:1px solid var(--bb-v15-border);border-radius:20px;background:var(--bb-v15-surface);box-shadow:var(--bb-v15-shadow);overflow:hidden}
#bb-insights-page-root .bb-toc-mobile summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:52px;padding:16px 18px;list-style:none;font-size:1.03rem;color:var(--bb-v15-text);background:linear-gradient(115deg,var(--bb-v15-soft),transparent)}
#bb-insights-page-root .bb-toc-mobile summary::-webkit-details-marker{display:none}
#bb-insights-page-root .bb-toc-mobile summary::after{content:'+';font-size:1.45rem;color:var(--bb-v15-accent);line-height:1}
#bb-insights-page-root .bb-toc-mobile[open] summary::after{content:'−'}
#bb-insights-page-root .bb-toc-mobile nav{counter-reset:contents;display:grid;gap:7px;margin:0;padding:10px}
#bb-insights-page-root .bb-toc-mobile nav a{counter-increment:contents;display:grid;grid-template-columns:32px minmax(0,1fr) 12px;align-items:center;gap:10px;min-height:50px;padding:10px;border:1px solid var(--bb-v15-border);border-radius:12px;color:var(--bb-v15-text);text-decoration:none;line-height:1.38;font-size:.91rem;font-weight:600;transition:background .2s,border-color .2s}
#bb-insights-page-root .bb-toc-mobile nav a::before{content:counter(contents,decimal-leading-zero);display:grid;place-items:center;width:32px;height:32px;border-radius:10px;background:var(--bb-v15-soft);color:var(--bb-v15-accent);font-size:.72rem;font-weight:800;font-variant-numeric:tabular-nums}
#bb-insights-page-root .bb-toc-mobile nav a::after{content:'›';color:var(--bb-v15-accent);font-size:1.22rem}
#bb-insights-page-root .bb-toc-mobile nav a:hover,#bb-insights-page-root .bb-toc-mobile nav a[aria-current="location"]{background:var(--bb-v15-soft);border-color:var(--bb-v15-accent);color:var(--bb-v15-accent)}

/* Standalone mode pages retain their own authored method during interactive
   operation. Text-only and disabled-JS views never allocate an empty canvas. */
html[data-bb-mode-page] #bb-guide-fallback>header{position:sticky;top:0;z-index:25;background:color-mix(in srgb,var(--bb-v15-surface) 94%,transparent);backdrop-filter:blur(12px);border-bottom:1px solid var(--bb-v15-border)}
html[data-bb-mode-page] .bb-header-inner{gap:12px}
html[data-bb-mode-page] .bb-primary-nav{display:flex;gap:5px;flex-wrap:wrap}
html[data-bb-mode-page] .bb-primary-nav a,html[data-bb-mode-page] .bb-header-actions a,html[data-bb-mode-page] #bb-static-settings-toggle{display:inline-flex;align-items:center;justify-content:center;min-height:42px;padding:9px 13px;border:1px solid var(--bb-v15-border);border-radius:12px;background:var(--bb-v15-surface);color:var(--bb-v15-text);text-decoration:none;font-size:.88rem;font-weight:700}
html[data-bb-mode-page] .bb-primary-nav a:hover,html[data-bb-mode-page] .bb-header-actions a:hover{background:var(--bb-v15-soft);color:var(--bb-v15-accent)}
html[data-bb-mode-page] main{width:min(1160px,calc(100% - 32px));margin-inline:auto;padding-block:20px}
html[data-bb-mode-page] #bb-mode-interactive{margin-bottom:22px;position:relative;scroll-margin-top:80px}
html[data-bb-mode-page] #bb-mode-interactive[hidden]{display:none!important}
html[data-bb-mode-page] #bb-flutter-calculator-host{position:relative;isolation:isolate;overflow:hidden;height:max(740px,88dvh);width:100%;border:1px solid var(--bb-v15-border);border-radius:20px;background:var(--bb-v15-surface);box-shadow:var(--bb-v15-shadow)}
html[data-bb-mode-page] main>article.card{position:relative;max-width:100%;min-width:0;padding:clamp(20px,4vw,46px);border-radius:25px;border:1px solid var(--bb-v15-border);background:linear-gradient(130deg,var(--bb-v15-soft),transparent 30%),var(--bb-v15-surface);box-shadow:var(--bb-v15-shadow);line-height:1.7}
html[data-bb-mode-page] main>article.card>nav{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:18px;color:var(--bb-v15-muted);font-size:.82rem}
html[data-bb-mode-page] main>article.card>nav a{padding:7px 11px;border:1px solid var(--bb-v15-border);border-radius:99px;text-decoration:none;font-weight:700;background:var(--bb-v15-surface)}
html[data-bb-mode-page] main>article.card h1{color:var(--bb-v15-accent);letter-spacing:-.025em;font-size:clamp(1.75rem,4vw,2.65rem);line-height:1.14}
html[data-bb-mode-page] .bb-mode-actions{display:flex;flex-wrap:wrap;gap:10px;margin:16px 0 22px}
html[data-bb-mode-page] .bb-mode-actions a{display:inline-flex;justify-content:center;align-items:center;padding:12px 16px;min-height:46px;border-radius:12px;border:1px solid var(--bb-v15-border);text-decoration:none;font-weight:750;font-size:.91rem;transition:box-shadow .2s}
html[data-bb-mode-page] .bb-mode-primary{background:var(--bb-v15-accent);color:var(--bb-v15-surface)}
html[data-bb-mode-page] .bb-mode-secondary{background:var(--bb-v15-surface);color:var(--bb-v15-link)}
html[data-bb-mode-page] .bb-mode-actions a:hover{box-shadow:var(--bb-v15-shadow)}
html[data-bb-mode-page] .mode-method{border:1px solid var(--bb-v15-border);border-radius:17px;background:var(--bb-v15-surface);padding:clamp(16px,3vw,26px);margin-block:22px}
html[data-bb-mode-page] .mode-method h2:first-child{margin-top:0}
html[data-bb-mode-page] .bb-mode-interpretation{border-inline-start:3px solid var(--bb-v15-accent);background:var(--bb-v15-soft);padding:14px 16px;border-radius:0 12px 12px 0}
html[data-bb-mode-page] main>article.card ul{list-style:none;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,235px),1fr));gap:10px}
html[data-bb-mode-page] main>article.card ul li{padding:10px 13px;border:1px solid var(--bb-v15-border);border-radius:11px;background:var(--bb-v15-surface);margin:0;overflow-wrap:anywhere}
html[data-bb-mode-page] main>article.card ul li a{display:block;text-decoration:none;font-weight:700;padding:3px 0}
html[data-bb-mode-page] main>article.card ul li:has(a):hover{background:var(--bb-v15-soft);border-color:var(--bb-v15-accent)}
html[data-bb-mode-page] .bb-mode-unavailable{padding:12px 16px;border:1px solid var(--bb-v15-border);border-radius:12px;background:var(--bb-v15-surface);color:var(--bb-v15-muted)}

/* The Flutter mobile shell deliberately hands off its bottom navigation at
   the same 600 CSS-pixel breakpoint. Outside Flutter's clipped host. */
#bb-mobile-navigation{display:none}
@media(max-width:599.98px){
  body:has(#bb-mobile-navigation){padding-bottom:calc(84px + env(safe-area-inset-bottom,0px))}
  #bb-mobile-navigation{position:fixed;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2px;inset-inline:0;bottom:0;z-index:1000;padding:7px 6px calc(7px + env(safe-area-inset-bottom,0px));background:color-mix(in srgb,var(--bb-v15-surface) 96%,transparent);border-top:1px solid var(--bb-v15-border);box-shadow:0 -8px 30px #0002;backdrop-filter:blur(16px);color:var(--bb-v15-text)}
  #bb-mobile-navigation a{--nav-color:#087b36;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:56px;padding:3px 2px;border-radius:15px;text-decoration:none;font-size:clamp(.63rem,2.6vw,.77rem);line-height:1.15;font-weight:700;color:var(--bb-v15-text)}
  #bb-mobile-navigation a[data-bb-mobile-section="calculate"]{--nav-color:#0752af}
  #bb-mobile-navigation a[data-bb-mobile-section="convert"]{--nav-color:#007985}
  #bb-mobile-navigation a[data-bb-mobile-section="tools"]{--nav-color:#b84900}
  #bb-mobile-navigation a[data-bb-mobile-section="history"]{--nav-color:#c01943}
  #bb-mobile-navigation .bb-mobile-icon{display:grid;place-items:center;min-width:42px;height:30px;border-radius:99px;color:var(--nav-color)}
  #bb-mobile-navigation .bb-mobile-icon svg{width:22px;height:22px}
  #bb-mobile-navigation a[aria-current="page"] .bb-mobile-icon{background:var(--bb-v15-soft);box-shadow:inset 0 0 0 1px var(--bb-v15-border)}
  #bb-mobile-navigation a[aria-current="page"]{color:var(--bb-v15-accent)}
  #bb-insights-page-root>.bb-header .bb-primary-nav,html[data-bb-mode-page] .bb-primary-nav{display:none!important}
  html[data-bb-mode-page] .bb-header-inner{flex-wrap:wrap;gap:8px}
  html[data-bb-mode-page] .bb-brand picture img{width:min(140px,37vw);height:auto}
  html[data-bb-mode-page] .bb-header-actions{display:flex;gap:6px;flex-wrap:wrap}
  html[data-bb-mode-page] .bb-header-actions a,html[data-bb-mode-page] #bb-static-settings-toggle{padding:7px 9px}
  html[data-bb-mode-page] main{width:calc(100% - 22px);padding-top:12px}
  html[data-bb-mode-page] #bb-flutter-calculator-host{height:max(690px,90dvh);border-radius:15px}
  html[data-bb-mode-page] main>article.card{padding:18px;border-radius:19px}
  html[data-bb-mode-page] .bb-mode-actions{flex-direction:column}
  #bb-insights-page-root .bb-mode-list{grid-template-columns:minmax(0,1fr)}
  #bb-insights-page-root .bb-calculation-modes{border-radius:19px}
}
:root[data-bb-theme="dark"] #bb-mobile-navigation a{--nav-color:#55e58a}
:root[data-bb-theme="dark"] #bb-mobile-navigation a[data-bb-mobile-section="calculate"]{--nav-color:#70b7ff}
:root[data-bb-theme="dark"] #bb-mobile-navigation a[data-bb-mobile-section="convert"]{--nav-color:#2de0da}
:root[data-bb-theme="dark"] #bb-mobile-navigation a[data-bb-mobile-section="tools"]{--nav-color:#ffae40}
:root[data-bb-theme="dark"] #bb-mobile-navigation a[data-bb-mobile-section="history"]{--nav-color:#ff7995}
@media(prefers-color-scheme:dark){
  :root:not([data-bb-theme]) #bb-mobile-navigation a{--nav-color:#55e58a}
  :root:not([data-bb-theme]) #bb-mobile-navigation a[data-bb-mobile-section="calculate"]{--nav-color:#70b7ff}
  :root:not([data-bb-theme]) #bb-mobile-navigation a[data-bb-mobile-section="convert"]{--nav-color:#2de0da}
  :root:not([data-bb-theme]) #bb-mobile-navigation a[data-bb-mobile-section="tools"]{--nav-color:#ffae40}
  :root:not([data-bb-theme]) #bb-mobile-navigation a[data-bb-mobile-section="history"]{--nav-color:#ff7995}
}
#bb-mobile-navigation a:focus-visible,#bb-insights-page-root .bb-toc-mobile a:focus-visible,#bb-insights-page-root .bb-toc-mobile summary:focus-visible,#bb-insights-page-root .bb-calculation-modes a:focus-visible,#bb-insights-page-root .bb-mode-details summary:focus-visible,html[data-bb-mode-page] a:focus-visible{outline:3px solid var(--bb-v15-link);outline-offset:-3px}
@media(prefers-reduced-motion:reduce){#bb-mobile-navigation *,#bb-insights-page-root .bb-toc-mobile *,#bb-insights-page-root .bb-calculation-modes *,html[data-bb-mode-page] .bb-mode-actions *{transition:none!important;animation:none!important}}
@media print{#bb-mobile-navigation,#bb-mode-interactive,#bb-insights-page-root .bb-calculation-modes{display:none!important}}

/* Desktop Flutter already provides its full approved toolbar. Keep only
   that toolbar when interactive; text-only and failed startup retain HTML. */
@media(min-width:600px){
  html[data-bb-mode-page][data-bb-mode-ready] #bb-guide-fallback>header{display:none}
}

/* V15.2: the engine's native accessibility activation surface belongs to
   the embedded calculator, not to the document viewport. Preserve its
   accessibility role and interaction inside the host; constrain absolute
   and fixed descendants without changing the calculator's dimensions. */
@media(max-width:599.98px){
  #bb-insights-page-root #bb-flutter-calculator-host,
  html[data-bb-mode-page] #bb-flutter-calculator-host{
    position:relative;z-index:0;contain:layout paint;
  }
  #bb-insights-page-root .bb-editorial-section,
  html[data-bb-mode-page] main>article.card{
    position:relative;z-index:1;
  }
  /* Reserve fixed bars in native scroll-into-view and focus operations.
     The existing section scroll margins remain in effect. */
  html:has(#bb-mobile-navigation){
    scroll-padding-block-start:76px;
    scroll-padding-block-end:calc(84px + env(safe-area-inset-bottom,0px));
  }
}
