/* ==========================================================================
   Brand base - component rules shared by every brand palette in brand/.

   Loaded by theme::css() right after the brand file, and only for a brand file
   whose header has the line "Uses: css/brand-base.css". A brand file without
   that line (an older, self-contained one such as brand/e107sk.css) brings
   its own component rules and must not get these: they read --brand-* tokens
   such a file does not define.

   Tokens read here, which every brand file using this base has to define
   (light and dark): --brand-1, --brand-1-bar, --brand-1-head, --brand-1-hover,
   --brand-2, --brand-2-tint, --brand-accent-size, --brand-ink, --brand-line,
   --brand-mute, --brand-on-accent, --brand-on-dark, --brand-radius,
   --brand-white.

   These rules exist only because Tabler declares several of its variables
   INSIDE the component block that reads them (.navbar, .dropdown-menu, .card,
   .accordion). A value set on :root is reset the moment the component
   matches, so those have to be set on the component itself.

   This file was section 2 of brand-hpfanfiction.css and brand-hpkizi.css,
   where it was identical. Edit it here, not in a brand file.
   ========================================================================== */

body {
  background-color: var(--tblr-body-bg);
}

/* Cards: square, purple frame, salmon strip across the top.
   Tabler declares all three variables INSIDE .card (tabler.css:4552-4584), so
   :root cannot reach them. The border-top comes after Tabler's own border
   shorthand and so wins on source order - this file must load after
   tabler.min.css. */
.card {
  --tblr-card-border-color:  var(--brand-1);
  --tblr-card-border-radius: var(--brand-radius);
  --tblr-card-box-shadow:    none;

  border-top: var(--brand-accent-size) solid var(--brand-2);
}

/* Brand row and navigation row.
   header_default.html puts .main-header on the brand row and .main-navbar on
   the navigation row; header_3columns.html carries .main-navbar only.

   Each selector repeats for a nested .navbar because Tabler declares these
   variables inside the .navbar block (tabler.css:4118-4124), so a nested
   .navbar resets them all back to Tabler's defaults. */
.navbar-brand-site {
  background: var(--brand-white);
  color: var(--brand-ink);
}

.main-header,
.main-header .navbar {
  --tblr-navbar-bg:                  var(--brand-white);
  --tblr-navbar-color:               var(--brand-mute);
  --tblr-navbar-hover-color:         var(--brand-ink);
  --tblr-navbar-active-color:        var(--brand-ink);
  --tblr-navbar-brand-color:         var(--brand-ink);
  --tblr-navbar-active-border-color: transparent;

  background: var(--brand-white);
  color: var(--brand-ink);
}

.main-navbar,
.main-navbar .navbar {
  --tblr-navbar-bg:           var(--brand-1-bar);
  --tblr-navbar-color:        color-mix(in srgb, var(--brand-on-dark) 75%, transparent);
  --tblr-navbar-hover-color:  var(--brand-on-dark);
  --tblr-navbar-active-color: var(--brand-on-dark);
  --tblr-navbar-brand-color:  var(--brand-on-dark);

  /* Controls the 2px underline Tabler draws under the current item through
     .nav-item.active:after (tabler.css:14210). */
  --tblr-navbar-active-border-color: var(--brand-2);

  background: var(--brand-1-bar);
  color: var(--brand-on-dark);
}

/* The salmon accent, repeated under the navigation bar. */
.main-navbar {
  border-bottom: var(--brand-accent-size) solid var(--brand-2);
}

/* Home layout. The body class comes from {LAYOUT_ID} in theme.html, which
   expands to "layout-" + name2id(THEME_LAYOUT). */
.layout-home .main-header {
  background: var(--brand-white);
}

/* Navigation dropdowns.
   Scoped to #mainNav, the collapse wrapper both headers put around
   {NAVIGATION} - the user and private-message dropdowns sit outside it and
   keep Tabler's own styling.

   The variables go on the components themselves: Tabler declares every
   dropdown variable inside .dropdown-menu (tabler.css:3597-3620) and
   --tblr-nav-link-hover-bg inside .navbar-nav (tabler.css:14823). */
#mainNav .dropdown-menu {
  --tblr-dropdown-bg:                var(--brand-1-bar);
  --tblr-dropdown-color:             color-mix(in srgb, var(--brand-on-dark) 75%, transparent);
  --tblr-dropdown-border-color:      var(--brand-2);
  --tblr-dropdown-link-color:        color-mix(in srgb, var(--brand-on-dark) 75%, transparent);
  --tblr-dropdown-link-hover-color:  var(--brand-on-dark);
  --tblr-dropdown-link-hover-bg:     color-mix(in srgb, var(--brand-on-dark) 8%, transparent);
  --tblr-dropdown-link-active-color: var(--brand-on-dark);
  --tblr-dropdown-link-active-bg:    color-mix(in srgb, var(--brand-on-dark) 12%, transparent);

  --tblr-dropdown-border-radius:       var(--brand-radius);
  --tblr-dropdown-inner-border-radius: var(--brand-radius);
}

#mainNav .navbar-nav {
  --tblr-nav-link-hover-bg: color-mix(in srgb, var(--brand-on-dark) 8%, transparent);
}

/* Side panels get the same frame as a card: purple border, salmon strip. */
#accLeft,
#accUser,
#accLatest,
.accordion-brand {
  border: 1px solid var(--brand-1);
  border-top: var(--brand-accent-size) solid var(--brand-2);
}

/* Tabler declares --tblr-accordion-btn-bg but never reads it - both
   .accordion-button and .accordion-header hardcode a transparent background -
   so the surface has to be set directly. */
#accLeft .accordion-button,
#accUser .accordion-button,
#accLatest .accordion-button,
.accordion-brand .accordion-button {
  /* .accordion-header is an <h2>, which Tabler sizes at 1.25rem, and
     .accordion-button inherits it. Panel titles are not page headings.
     Padding is left alone: accordionItem() sets py-2 and overriding the
     shorthand here would silently discard it. */
  font-size: .9rem;
  color: var(--brand-on-dark);
  background-color: var(--brand-1-head);
  border-radius: var(--brand-radius);
}

#accLeft .accordion-button:not(.collapsed),
#accUser .accordion-button:not(.collapsed),
#accLatest .accordion-button:not(.collapsed),
.accordion-brand .accordion-button:not(.collapsed) {
  color: var(--brand-on-dark);
  background-color: var(--brand-1);
}

/* The chevron is an icon element in Tabler, not a ::after background image as
   in Bootstrap, so it takes its colour by inheritance. */
#accLeft .accordion-button-toggle,
#accUser .accordion-button-toggle,
#accLatest .accordion-button-toggle,
.accordion-brand .accordion-button-toggle {
  color: inherit;
}

/* The frame is on the panel, so the items inside carry no border of their
   own - otherwise every row doubles the line. */
#accLeft .accordion-item,
#accUser .accordion-item,
#accLatest .accordion-item,
.accordion-brand .accordion-item {
  background-color: var(--brand-white);
  border: 0;
}

/* Panel contents. The colour goes on .accordion-body, not on the list group:
   not every panel holds a .list-group, and the ones that do would leave the
   surrounding padding uncoloured. */
#accLeft .accordion-body,
#accUser .accordion-body,
#accLatest .accordion-body,
.accordion-brand .accordion-body {
  background-color: var(--brand-2-tint);
  color: var(--brand-ink);
}

/* Rows keep their separators but not their own surface. Both the group and
   the item are listed: tabler.css:20684 declares
   .list-group-item { background-color: inherit }, which comes after the rule
   reading --tblr-list-group-bg (line 4939) at the same specificity. */
#accLeft .list-group,
#accUser .list-group,
#accLatest .list-group,
.accordion-brand .list-group,
#accLeft .list-group-item,
#accUser .list-group-item,
#accLatest .list-group-item,
.accordion-brand .list-group-item {
  --tblr-list-group-bg: transparent;
  /* Tabler's 1rem/1.25rem is sized for standalone cards; in a narrow side
     panel it makes the rows too tall. */
  --tblr-list-group-item-padding-x: .7rem;
  --tblr-list-group-item-padding-y: .7rem;
  background-color: transparent;
  border-color: var(--brand-line);
  color: inherit;
}

/* Login button.
   sc_lm_loginbutton() (login_menu_shortcodes.php:184) hardcodes
   "btn btn-default btn-secondary" and accepts no class parm, so the button
   comes out grey and the template cannot say otherwise. The variables go on
   the button itself: .btn-secondary declares all of them inside its own block
   (tabler.css:16636-16649). */
.login-menu .btn.login {
  --tblr-btn-color:        var(--brand-on-dark);
  --tblr-btn-bg:           var(--brand-1);
  --tblr-btn-border-color: transparent;
  --tblr-btn-hover-color:  var(--brand-on-dark);
  --tblr-btn-hover-bg:     var(--brand-1-hover);
  --tblr-btn-active-color: var(--brand-on-dark);
  --tblr-btn-active-bg:    var(--brand-1-bar);
}

/* Accent utilities. Tabler has bg-* for its own palette but not for a brand
   colour. These also feed .card-status-top / .card-status-start, which take
   their colour from whatever background class sits beside them. */
.bg-brand-1 { background-color: var(--brand-1); color: var(--brand-on-dark); }
.bg-brand-2 { background-color: var(--brand-2); color: var(--brand-on-accent); }

.badge.bg-brand-1 { --tblr-badge-color: var(--brand-on-dark); }
.badge.bg-brand-2 { --tblr-badge-color: var(--brand-on-accent); }

/* Alternating row tint inside a panel. Opt-in per list. */
.list-tint-brand > *:nth-child(odd) {
  background-color: color-mix(in srgb, var(--brand-2) 25%, transparent);
}

/* --------------------------------------------------------------------------
   Compatibility — DELETE once the markup is updated
   -------------------------------------------------------------------------- */
.badge-dahlia,
.bg-brand-dahlia { background-color: var(--brand-2); color: var(--brand-on-accent); }
.list-tint-dahlia > *:nth-child(odd) { background-color: color-mix(in srgb, var(--brand-2) 25%, transparent); }
.text-brand-royal-display,
.text-brand-ink-display,
.text-brand-blue-display {
  color: var(--brand-1);
  font-size: 2.5rem;
  font-weight: 700;
}
