/* Boulderix component contract. See docs/BRANDING.md and /brand-demo/.
   Loaded after the legacy theme so shared Bootstrap/Tabler surfaces agree.
   Semantic success/warning/danger colors remain reserved for actual states. */
:root {
  --bx-space-1: .5rem;
  --bx-space-2: 1rem;
  --bx-space-3: 1.5rem;
  --bx-space-4: 2rem;
  --bx-space-5: 3rem;
  --bx-nav-offset: 5.5rem;
  --bx-text-sm: .875rem;
  --bx-text-base: 1rem;
  --bx-h1: clamp(1.875rem, 3vw, 2.5rem);
  --bx-h2: clamp(1.375rem, 2vw, 1.625rem);
  --bx-h3: 1.125rem;
  --bs-body-color: var(--brand-ink);
  --bs-body-bg: var(--brand-surface);
  --bs-secondary-color: var(--muted);
  --bs-border-color: var(--line);
  --bs-tertiary-bg: var(--surface-2);
  --tblr-body-color: var(--brand-ink);
  --tblr-body-bg: var(--brand-surface);
  --tblr-border-color: var(--line);
  --tblr-secondary: var(--muted);
}
body.layout-fluid { font-family: var(--font-body); font-size: var(--bx-text-base); line-height: 1.65; }
h1, h2, h3, h4, h5, h6 { color: inherit; font-family: var(--font-display); font-weight: 700; line-height: 1.25; }
h1, .page-title { font-size: var(--bx-h1); line-height: 1.15; }
h2, .section-title { font-size: var(--bx-h2); }
h3, .detail-group-title { font-size: var(--bx-h3); }
h4, h5, h6 { font-size: 1rem; }
/* A panel title is subordinate to a section title, even when its tag is H2. */
.card-title { font-size: var(--bx-h3); line-height: 1.35; font-weight: 700; margin: 0; }
.small, small, .form-hint { font-size: var(--bx-text-sm); line-height: 1.55; }
.bx-eyebrow, .detail-label { font-family: var(--font-body); font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.bx-eyebrow { color: var(--brand-link); margin-bottom: .65rem; }
.bx-description, .section-sub { color: var(--muted); max-width: 65ch; }
.bx-description { margin: .5rem 0 1.25rem; }
.bx-meta { color: var(--muted); font: .8125rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.bx-reading { max-width: 70ch; }
.bx-section-heading { margin-bottom: var(--bx-space-3); }
.bx-section-heading h2 { margin-bottom: .4rem; }
.bx-section-heading p { margin: 0; }
.page-body { padding-block: 2rem; margin: 0; }
.page-body .page-header:not(.page-header--bare), .bx-page-intro {
  background: var(--surface-2); background-image: none;
  border: 1px solid var(--line); border-top: 3px solid var(--brand-accent);
  border-radius: var(--radius-lg); padding: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: var(--bx-space-4); box-shadow: var(--shadow-1);
}
.page-body .page-header .page-title { margin-bottom: .5rem; }
.bx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--bx-space-3); align-items: start; }
.bx-grid > *, .row > *, .d-flex > * { min-width: 0; }
.bx-stack { display: grid; gap: var(--bx-space-3); align-content: start; }
.bx-panel, .page-body .card {
  background: var(--surface-2); color: var(--brand-ink); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.bx-panel { padding: clamp(1.25rem, 2vw, 1.75rem); }
.bx-panel--accent, .page-body .pr-flat-card { border-top: 3px solid var(--brand-accent); }
.bx-panel--tint { background: color-mix(in srgb, var(--brand-accent) 5%, var(--surface-2)); }
.bx-panel > :last-child { margin-bottom: 0; }
.page-body .card-header { background: transparent; border-color: var(--line); padding: 1.25rem 1.5rem; flex-wrap: wrap; gap: .5rem; }
.page-body .card-body { padding: 1.5rem; }
.page-body .card-header + .card-body { padding-top: 1.25rem; }
.page-body .card-header .bx-description { margin: .35rem 0 0; width: 100%; }
.page-body .card-header:has(> .bx-description) { display: block; }
.bx-section { margin-block: var(--bx-space-5); }
.section { margin-block: var(--bx-space-5); }
.section-divider { margin-block: 2rem; }
.bx-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.bx-actions > .btn { max-width: 100%; white-space: normal; }
.btn { font-family: var(--font-body); font-size: .9375rem; font-weight: 600; min-height: 2.75rem; border-radius: 999px; }
.btn-sm { font-size: .875rem; min-height: 2.25rem; }
.btn-brand { padding: .65rem 1.25rem; }
.btn-outline-secondary { color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand-ink) 35%, transparent); }
.btn-outline-secondary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: var(--surface-2); }
a { text-underline-offset: .2em; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--brand-accent); outline-offset: 3px; }
.form-control, .form-select, .ts-control {
  background-color: var(--surface-2); color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand-ink) 28%, transparent);
  border-radius: var(--radius-sm); font-size: 1rem; min-height: 2.75rem;
}
.form-control::placeholder { color: var(--muted); opacity: 1; }
.form-label { color: var(--brand-ink); font-weight: 600; font-size: .9375rem; }
.form-text, .form-hint { color: var(--muted); }
.form-control:focus, .form-select:focus { color: var(--brand-ink); background: var(--surface-2); border-color: var(--brand-accent); box-shadow: var(--ring); }
.page-body .table { --bs-table-bg: transparent; --bs-table-color: var(--brand-ink); --bs-table-border-color: var(--line); --tblr-table-color: var(--brand-ink); color: var(--brand-ink); }
.page-body .table th { color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .05em; }
.page-body .table td { font-size: .9375rem; }
.page-body .list-group-item, .accordion-item { background: var(--surface-2); color: var(--brand-ink); border-color: var(--line); }
.accordion-button { background: var(--surface-2); color: var(--brand-ink); font: 600 1rem/1.5 var(--font-body); }
.accordion-button:not(.collapsed) { background: color-mix(in srgb, var(--brand-accent) 6%, var(--surface-2)); color: var(--brand-link); }
.accordion-body { line-height: 1.65; }
.card-collapse-toggle.collapsed .collapse-hide-label { display: none; }
.card-collapse-toggle:not(.collapsed) .collapse-show-label { display: none; }
.card-collapse-toggle .collapse-icon { transition: transform .2s ease-in-out; }
.card-collapse-toggle.collapsed .collapse-icon { transform: rotate(180deg); }
.bg-brand-lt { background: color-mix(in srgb, var(--brand-accent) 10%, var(--surface-2)) !important; color: var(--brand-link) !important; }
.badge { white-space: normal; line-height: 1.45; font-size: .75rem; }
.badge.bg-secondary { background-color: #475569 !important; color: #ffffff !important; }
.badge.bg-secondary-lt { background-color: #f1f5f9 !important; color: #1e293b !important; border: 1px solid #cbd5e1 !important; }
[data-bs-theme="dark"] .badge.bg-secondary-lt { background-color: #1e293b !important; color: #f8fafc !important; border-color: #334155 !important; }
.bx-empty-state { padding: 2rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); }
.bx-empty-state h2, .bx-empty-state h3 { font-size: var(--bx-h3); }
.bx-empty-state p { color: var(--muted); margin: .5rem auto 1rem; max-width: 45ch; }
/* Navigation collapses before the long marketplace menu stops fitting. */
.navbar { backdrop-filter: none; background: var(--surface-2); }
.navbar .container-fluid { max-width: 1440px; margin-inline: auto; }
.navbar .nav-link { font-size: .875rem; }
.navbar .navbar-brand { padding-block: .75rem; }
.navbar .dropdown-menu { background: var(--surface-2); color: var(--brand-ink); border-color: var(--line); }

/* Split top-level menu: keep the label link and caret on one row. */
.navbar .nav-item.nav-split {
  flex-direction: row;
  align-items: center;
}

/* Desktop: hovering a top-level item reveals its submenu, so the split
   label links stay clickable while the menu is easy to discover. */
@media (min-width: 992px) {
  .navbar .nav-item.nav-split:hover > .dropdown-menu {
    display: block;
    top: 100%;
    left: 0;
    margin-top: 0;
  }
}

/* Themed menus are tall; keep them usable on short screens. */
.navbar .nav-item.nav-split > .dropdown-menu {
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.navbar .dropdown-item { color: var(--brand-ink); }
.bx-home-hero { margin-bottom: var(--bx-space-4); }
.hero h1 { font-size: clamp(2.25rem, 4.3vw, 3.5rem); line-height: 1.1; }
.hero .bx-description,
.hero .text-secondary,
.hero .text-muted,
.bx-store-banner .text-secondary,
.bx-store-banner .text-muted { color: rgba(255,255,255,.88) !important; }
.hero .hero-search { border-radius: var(--radius); }
.hero .hero-search input { min-width: 0; width: 100%; }
.hero .hero-search:focus-within { outline: 3px solid var(--brand-accent); outline-offset: 3px; }
.hero .hero-search input:focus-visible { outline: none; }
.hero-caption { font-size: .875rem; line-height: 1.6; }
.hero-specimen img { border-radius: var(--radius); }
.bx-stat { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.bx-catalog-grid .specimen-card .card-body { padding: 1rem; }
.specimen-thumb { background: var(--brand-surface); }
.specimen-thumb.placeholder { background: var(--brand-surface); color: var(--muted); }
.bx-shop-layout .filter-bar { margin-bottom: 0 !important; }
.bx-shop-layout #shop-results { min-width: 0; }
.bx-shop-layout .shop-toolbar { position: static; margin-top: 0; padding-top: 0; }
.bx-filter-title { margin-bottom: 1rem; }
.bx-filter-title h2 { font-size: var(--bx-h3); margin-bottom: .4rem; }
.bx-filter-title p { margin: 0; color: var(--muted); font-size: .875rem; }
.bx-form-aside .brand-logo-svg { height: 2rem; }
.bx-form-aside h2 { margin-top: 1.25rem; }
.bx-form-aside ul { padding-left: 1.2rem; color: var(--muted); }
.bx-form-aside li + li { margin-top: .75rem; }
.bx-store-banner { color: #fff; background: var(--brand-deep); border-radius: var(--radius-lg); padding: 2rem; }
.bx-store-banner .bx-description { color: rgba(255,255,255,.85); margin-bottom: 0; }
.bx-sticky { position: static; }
.help-section { scroll-margin-top: var(--bx-nav-offset); }
.help-toc.sticky-top { top: var(--bx-nav-offset) !important; z-index: 5; }
/* Content stays readable when JavaScript/CDNs are unavailable. */
.reveal { opacity: 1; transform: none; }
@media (min-width: 992px) {
  .bx-grid--equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bx-grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(17rem, 1fr); }
  .bx-grid--form { grid-template-columns: minmax(0, 1.65fr) minmax(17rem, 1fr); }
  .bx-sticky { position: sticky; top: var(--bx-nav-offset); }
  .bx-shop-layout { grid-template-columns: minmax(15rem, .7fr) minmax(0, 2fr); }
}
@media (max-width: 575.98px) {
  .page-body { padding-block: 1.25rem; }
  .page-body .card-body, .page-body .card-header { padding: 1.125rem; }
  .hero { padding: 1.5rem; }
  .hero .hero-search { flex-wrap: wrap; padding: .75rem; }
  .hero .hero-search input { flex-basis: 100%; padding: .4rem; }
  .hero .hero-search .btn { width: 100%; }
  .hero-chip { font-size: .8125rem; }
  .page-header.d-flex { flex-wrap: wrap; gap: 1rem; }
  .bx-section, .section { margin-block: 2rem; }
  .bx-store-banner { padding: 1.25rem; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .specimen-card:hover, .specimen-card:hover img, .tile:hover { transform: none; }
}
/* Demo-only inspection aids expose layout boundaries without changing consumers. */
.bx-demo-nav { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.bx-demo-section { scroll-margin-top: var(--bx-nav-offset); margin-block: 3rem; }
.bx-demo-code { padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--brand-surface); color: var(--brand-ink); overflow-x: auto; font-size: .8125rem; line-height: 1.6; }
.bx-demo-outline { outline: 1px dashed var(--brand-accent); outline-offset: -1px; }
.bx-swatch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.bx-swatch { height: 4.5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .5rem; }
.bx-swatch--primary { background: var(--brand-primary); }
.bx-swatch--accent { background: var(--brand-accent); }
.bx-swatch--deep { background: var(--brand-deep); }
.bx-swatch--surface { background: var(--brand-surface); }
.bx-swatch--card { background: var(--surface-2); }
.bx-swatch--ink { background: var(--brand-ink); }
.bx-swatch--muted { background: var(--muted); }
.bx-swatch--button { background: var(--brand-btn-fill); }

@media (min-width: 992px) { .bx-shop-layout .bx-catalog-grid > .col-lg-3 { width: 50%; } }
@media (min-width: 1200px) { .bx-shop-layout .bx-catalog-grid > .col-lg-3 { width: 33.333333%; } }
.app-footer .text-white-50 { color: rgba(255,255,255,.75) !important; }

.bx-hero-guide { padding: 2rem; border: 1px solid rgba(255,255,255,.25); border-radius: var(--radius); background: rgba(255,255,255,.06); }
.bx-hero-guide p { color: rgba(255,255,255,.85); }

/* Filled controls and badges use fill tokens; text tokens brighten in dark mode. */
.bg-brand { background-color: var(--brand-btn-fill) !important; }
.btn-primary { background-color: var(--brand-btn-fill); border-color: var(--brand-btn-fill); color: #fff; }
.btn-outline-primary { color: var(--brand-link); border-color: var(--brand-link); }
.btn-outline-primary:hover { background: var(--brand-btn-fill); border-color: var(--brand-btn-fill); color: #fff; }

@media (max-width: 1199.98px) {
  .navbar .navbar-nav.flex-row { flex-wrap: wrap; gap: .25rem; margin-left: 0 !important; }

  /* The split label and caret stay on one line; the submenu wraps below them
     at full width instead of being squeezed into the remaining side column. */
  .navbar .nav-item.nav-split {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }
  .navbar .nav-item.nav-split > .nav-link { flex: 0 0 auto; }
  .navbar .nav-item.nav-split > .dropdown-menu {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    max-height: none;
    overflow: visible;
    margin: .25rem 0 .5rem;
    padding-left: .75rem;
  }

  .navbar .nav-item.dropdown { width: 100%; }
  .navbar .dropdown-menu {
    position: static;
    box-shadow: none;
    width: 100% !important;
    max-width: 100%;
  }
  .navbar .dropdown-item { white-space: normal; }

  /* A tall menu must scroll inside the sticky header, otherwise its last items
     sit below the viewport and cannot be reached. */
  .navbar-collapse {
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.navbar .nav-link, .navbar .nav-link.active { color: var(--brand-ink); }

/* Tabler fluid containers otherwise override the reading width and under-pad g-4 rows. */
.layout-fluid .container-xl { max-width: var(--container); padding-inline: 1.5rem; }

/* Network names/icons identify share destinations; their surfaces follow Boulderix. */
.share-block .shariff li[class] a { background: var(--surface-2); color: var(--brand-ink); border: 1px solid var(--line); border-radius: 999px; min-height: 2.25rem; }
.share-block .shariff li[class] a span { color: inherit; }
.share-block .shariff li[class] a:hover { background: var(--brand-btn-fill); color: #fff; border-color: var(--brand-btn-fill); }

/* Alpine: hide elements until the component initializes (prevents x-show flash). */
[x-cloak] { display: none !important; }

/* Shared landing-page block grid (apps.landing) */
.landing-block-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem;
  align-items: start;
}
.landing-block { min-width: 0; }
.landing-block > section { margin-bottom: 0 !important; }
@media (max-width: 767.98px) {
  .landing-block-grid { grid-template-columns: 1fr; }
  .landing-block { grid-column: 1 / -1 !important; }
}

.landing-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
