/*
 * Quark2 BAS — Bootstrap blog skin
 * --------------------------------
 * Recreates the look and feel of the Grav Bootstrap theme's blog index and
 * post pages on top of Quark 2. Everything here is scoped to `.bs-blog` /
 * `.bs-banner`, so the rest of Quark 2 (header, footer, hero, modular pages,
 * forms) is untouched.
 *
 * Colours resolve through --bas-* variables that partials/base.html.twig
 * writes from theme config, with Bootstrap 3's defaults as fallbacks.
 */

:root {
  /* *-base values are written by partials/base.html.twig from theme config;
     the literals here are the fallbacks. */
  --bas-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --bas-banner-bg: #62488a;
  --bas-banner-title-size: 60px;
  --bas-banner-subtitle-size: 30px;
  --bas-banner-align: center;
  --bas-banner-padding: 65px 0 50px;
  --bas-banner-overlay: 0.55;
  --bas-link: var(--bas-link-base, #428bca);
  --bas-link-hover: color-mix(in srgb, var(--bas-link) 78%, black);
  --bas-text: #333333;
  --bas-muted: #777777;
  --bas-surface: #ffffff;
  --bas-border: #dddddd;
  --bas-border-soft: #f0f0f0;
  --bas-label: var(--bas-label-base, #337ab7);
  --bas-label-hover: color-mix(in srgb, var(--bas-label) 82%, black);
  --bas-warning: #f0ad4e;
  --bas-warning-border: #eea236;
  --bas-radius: 4px;
  --bas-font-size: 14px;
  --bas-line-height: 1.42857143;
  --bas-container-width: 960px;
  --bas-content-width: 780px;
  --bas-post-title-size: 36px;
  --bas-list-title-size: 24px;
  --bas-logo-height: 46px;
  --bas-dropdown-max-width: min(90vw, 960px);
}

:root[data-theme="dark"] {
  --bas-link: color-mix(in oklab, var(--bas-link-base, #428bca) 68%, white 32%);
  --bas-link-hover: color-mix(in oklab, var(--bas-link) 75%, white 25%);
  --bas-text: #e6e6e8;
  --bas-muted: #9a9aa0;
  --bas-surface: #16181d;
  --bas-border: rgba(255, 255, 255, 0.16);
  --bas-border-soft: rgba(255, 255, 255, 0.1);
  --bas-label: color-mix(in oklab, var(--bas-label-base, #337ab7) 84%, white 16%);
  --bas-label-hover: color-mix(in oklab, var(--bas-label) 78%, white 22%);
}

/* ---------- Banner ---------- */

/* Every rule below is doubled up as `.bs-blog.bs-banner` (both classes are
 * always present together on the banner element — see bs-banner.html.twig).
 * That gives these rules specificity (0,2,x), which beats the generic
 * `.bs-blog h1` / `.bs-blog a` typography rules further down this file
 * (0,1,x) regardless of source order. Single-class `.bs-banner` selectors
 * looked fine reading top to bottom, but lost every one of those ties in
 * the actual cascade — that's why Banner Text Color had no visible effect
 * even though the variable itself was wired correctly. */

.bs-blog.bs-banner {
  position: relative;
  padding: var(--bas-banner-padding);
  margin-bottom: 30px;
  text-align: var(--bas-banner-align);
  font-family: var(--bas-font);
  color: var(--bas-banner-text, color-mix(in srgb, var(--bas-banner-bg) 12%, white));
  background-image: linear-gradient(
    color-mix(in srgb, var(--bas-banner-bg) 90%, black),
    color-mix(in srgb, var(--bas-banner-bg) 88%, white)
  );
  background-size: cover;
  background-position: center;
}

.bs-blog.bs-banner.has-image {
  color: var(--bas-banner-text, #ffffff);
  background-image: none;
}

.bs-blog.bs-banner .bs-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgb(0 0 0 / var(--bas-banner-overlay)),
    rgb(0 0 0 / calc(var(--bas-banner-overlay) * 0.62))
  );
}

.bs-blog.bs-banner .container {
  position: relative;
  z-index: 1;
  color: inherit;
}

.bs-blog.bs-banner h1 {
  font-family: var(--bas-font);
  font-size: var(--bas-banner-title-size);
  font-weight: 500;
  line-height: 1.1;
  color: inherit;
  margin: 0 0 10px;
}

.bs-blog.bs-banner h1::before {
  content: none;
}

.bs-blog.bs-banner h2,
.bs-blog.bs-banner p {
  font-family: var(--bas-font);
  font-weight: 400;
  margin-top: 0;
  color: inherit;
}

.bs-blog.bs-banner h2 {
  font-size: var(--bas-banner-subtitle-size);
}

.bs-blog.bs-banner a {
  color: inherit;
  text-decoration: underline;
}

.bs-blog.bs-banner .btn {
  font-size: 22px;
  padding: 10px 30px;
  margin-top: 30px;
  border: 0;
  box-shadow: none;
  color: inherit;
}

@media (max-width: 991px) {
  .bs-blog.bs-banner h1 {
    font-size: clamp(30px, calc(var(--bas-banner-title-size) * 0.66), var(--bas-banner-title-size));
  }
}

@media (max-width: 767px) {
  .bs-blog.bs-banner {
    padding: 45px 0 35px;
  }
  .bs-blog.bs-banner h1 {
    font-size: clamp(26px, calc(var(--bas-banner-title-size) * 0.5), var(--bas-banner-title-size));
    line-height: 1.2;
    margin-bottom: 1.5rem;
  }
}

/* ---------- Blog page shell ---------- */

.bs-blog {
  font-family: var(--bas-font);
  font-size: var(--bas-font-size);
  line-height: var(--bas-line-height);
  color: var(--bas-text);
}

/* #body-wrapper carries an ID-level padding rule in theme.css, so match it */
#body-wrapper.bs-blog.has-banner {
  padding-top: 0;
}

.bs-blog .container {
  max-width: var(--bas-container-width);
}

.bs-blog .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

@media (min-width: 768px) {
  .bs-blog .row {
    grid-template-columns: minmax(0, 8fr) minmax(0, 3fr);
    column-gap: 8.333%;
  }
  .bs-blog .row > .col-main:only-child {
    grid-column: 1 / -1;
  }
}

.bs-blog .col-main,
.bs-blog .col-side {
  min-width: 0;
}

/* ---------- Typography inside the blog ---------- */

.bs-blog :is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--bas-font);
  font-weight: 500;
  line-height: 1.1;
  color: inherit;
  letter-spacing: 0;
}

.bs-blog :is(h1, h2, h3)::before,
.bs-blog :is(h4, h5, h6)::before {
  content: none;
}

.bs-blog h1 {
  font-size: var(--bas-post-title-size);
  margin: 20px 0 10px;
}
.bs-blog h2 {
  font-size: 30px;
  margin: 20px 0 10px;
}
.bs-blog h3 {
  font-size: var(--bas-list-title-size);
  margin: 20px 0 10px;
}
.bs-blog h4 {
  font-size: 18px;
  margin: 10px 0;
}
.bs-blog h5 {
  font-size: 14px;
  margin: 10px 0;
}
.bs-blog h6 {
  font-size: 12px;
  margin: 10px 0;
}

.bs-blog p,
.bs-blog ul,
.bs-blog ol,
.bs-blog dl {
  margin: 0 0 10px;
}

.bs-blog .lead {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.4;
  color: var(--bas-muted);
  margin-bottom: 10px;
}

.bs-blog a {
  color: var(--bas-link);
  text-decoration: none;
}

.bs-blog a:hover,
.bs-blog a:focus {
  color: var(--bas-link-hover);
  text-decoration: underline;
}

.bs-blog img {
  max-width: 100%;
  height: auto;
}

.bs-blog blockquote {
  padding: 10px 20px;
  margin: 0 0 20px;
  font-size: 17.5px;
  border-left: 5px solid var(--bas-border);
  background: none;
}

.bs-blog .text-center {
  text-align: center;
}

.bs-blog .pull-right {
  float: right;
}

/* ---------- List item ---------- */

.bs-blog .list-item {
  margin: 30px 0 50px;
  display: block;
  background: none;
  box-shadow: none;
  border: 0;
  padding: 0;
}

.bs-blog .list-item:first-child {
  margin-top: 0;
}

.bs-blog .list-blog-header {
  overflow: hidden;
}

.bs-blog .list-blog-header :is(h1, h2, h3) {
  margin-top: 0;
  margin-bottom: 10px;
}

.bs-blog .list-blog-header :is(h1, h2, h3) a {
  color: var(--bas-link);
}

.bs-blog .list-blog-header :is(h1, h2, h3) a:hover {
  color: var(--bas-link-hover);
  text-decoration: underline;
}

.bs-blog .list-blog-date {
  display: inline-block;
  color: var(--bas-muted);
  font-size: 13px;
}

.bs-blog .list-blog-date i {
  margin-right: 4px;
}

.bs-blog .blog-header-image,
.bs-blog .list-blog-header img {
  display: block;
  margin: 15px 0;
  width: 100%;
  height: auto;
  border-radius: 0;
}

.bs-blog .list-blog-padding {
  padding-top: 5px;
}

.bs-blog .list-blog-padding > :first-child {
  margin-top: 0;
}

.bs-blog .continue-link {
  font-weight: 400;
}

/* ---------- Tags / labels ---------- */

.bs-blog .tags {
  display: inline-block;
}

.bs-blog .label {
  display: inline-block;
  padding: 0.2em 0.6em 0.3em;
  margin-left: 3px;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25em;
  box-shadow: none;
  background-color: var(--bas-muted);
}

.bs-blog .label-primary {
  background-color: var(--bas-label);
  color: #ffffff;
}

.bs-blog .label:hover,
.bs-blog .label-primary:hover {
  background-color: var(--bas-label-hover);
  color: #ffffff;
  text-decoration: none;
  opacity: 1;
}

/* ---------- Buttons ---------- */

.bs-blog .btn {
  display: inline-block;
  padding: 6px 12px;
  margin-bottom: 0;
  font-family: var(--bas-font);
  font-size: 14px;
  font-weight: 400;
  line-height: var(--bas-line-height);
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--bas-radius);
  box-shadow: none;
  text-decoration: none;
  transition: background-color 0.15s ease-in-out;
}

.bs-blog .btn-default {
  color: var(--bas-text);
  background-color: var(--bas-surface);
  border-color: var(--bas-border);
}

.bs-blog .btn-default:hover,
.bs-blog .btn-default:focus {
  color: var(--bas-text);
  background-color: color-mix(in srgb, var(--bas-surface) 92%, black);
  border-color: color-mix(in srgb, var(--bas-border) 80%, black);
  text-decoration: none;
}

.bs-blog .btn-warning {
  color: #ffffff;
  background-color: var(--bas-warning);
  border-color: var(--bas-warning-border);
}

.bs-blog .btn-warning:hover,
.bs-blog .btn-warning:focus {
  color: #ffffff;
  background-color: color-mix(in srgb, var(--bas-warning) 90%, black);
  text-decoration: none;
}

.bs-blog .btn-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
}

.bs-blog .btn-group > .btn {
  border-radius: 0;
  margin-left: -1px;
}

.bs-blog .btn-group > .btn:first-child {
  margin-left: 0;
  border-radius: var(--bas-radius) 0 0 var(--bas-radius);
}

.bs-blog .btn-group > .btn:last-child {
  border-radius: 0 var(--bas-radius) var(--bas-radius) 0;
}

/* ---------- Prev / next ---------- */

.bs-blog .prev-next {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 40px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--bas-border-soft);
}

/* ---------- Breadcrumbs ---------- */

.bs-blog .breadcrumbs,
.bs-blog ol.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  padding: 8px 0;
  margin-bottom: 20px;
  list-style: none;
  background: transparent;
  font-size: 13px;
  color: var(--bas-muted);
}

.bs-blog .breadcrumbs li + li::before {
  content: "/\00a0";
  padding: 0 5px;
  color: #cccccc;
}

/* ---------- Pagination ---------- */

.bs-blog .pagination {
  display: inline-block;
  padding-left: 0;
  margin: 20px 0;
  border-radius: var(--bas-radius);
  gap: 0;
}

.bs-blog .pagination li {
  display: inline;
  border: 0;
}

.bs-blog .pagination li > a,
.bs-blog .pagination li > span {
  position: relative;
  float: left;
  padding: 6px 12px;
  margin-left: -1px;
  line-height: var(--bas-line-height);
  color: var(--bas-link);
  text-decoration: none;
  background-color: var(--bas-surface);
  border: 1px solid var(--bas-border);
  border-radius: 0;
}

.bs-blog .pagination li:first-child > a,
.bs-blog .pagination li:first-child > span {
  margin-left: 0;
  border-radius: var(--bas-radius) 0 0 var(--bas-radius);
}

.bs-blog .pagination li:last-child > a,
.bs-blog .pagination li:last-child > span {
  border-radius: 0 var(--bas-radius) var(--bas-radius) 0;
}

.bs-blog .pagination li.active > span {
  z-index: 2;
  color: #ffffff;
  background-color: var(--bas-label);
  border-color: var(--bas-label);
}

.bs-blog .pagination li.disabled > span {
  color: var(--bas-muted);
  background-color: var(--bas-surface);
  opacity: 0.65;
}

.bs-blog #listing-footer {
  margin-top: 20px;
}

/* ---------- Sidebar ---------- */

.bs-blog .sidebar-content {
  margin-bottom: 50px;
  padding: 0;
  background: none;
  box-shadow: none;
  border: 0;
}

.bs-blog .sidebar-content h4 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 500;
  color: var(--bas-text);
  text-transform: none;
  letter-spacing: 0;
}

.bs-blog .sidebar-content p {
  color: var(--bas-muted);
}

.bs-blog .sidebar-content ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.bs-blog .sidebar-content ul li {
  border-bottom: 1px solid var(--bas-border-soft);
  line-height: 34px;
  padding: 0;
}

.bs-blog .sidebar-content ul li:last-child {
  border-bottom: 0;
}

.bs-blog .sidebar-content ul a {
  display: block;
  padding: 0;
  background: none;
  color: var(--bas-link);
}

.bs-blog .sidebar-content ul a:hover {
  color: var(--bas-link-hover);
  background: none;
}

.bs-blog .sidebar-content .menu-score,
.bs-blog .sidebar-content .score {
  display: block;
  float: right;
  color: #999999;
  font-size: 85%;
}

.bs-blog .sidebar-content .related-pages {
  padding: 0;
  list-style: none;
}

/* Search box, when SimpleSearch is enabled */
.bs-blog .sidebar-content input[type="text"],
.bs-blog .sidebar-content input[type="search"] {
  width: 100%;
  height: 34px;
  padding: 6px 12px;
  font-size: 14px;
  line-height: var(--bas-line-height);
  color: var(--bas-text);
  background-color: var(--bas-surface);
  border: 1px solid var(--bas-border);
  border-radius: var(--bas-radius);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}

/* ---------- Post body niceties carried over from Quark ---------- */

.bs-blog .e-content table {
  width: 100%;
  margin-bottom: 20px;
  font-size: var(--bas-font-size);
}

.bs-blog .e-content :is(pre, code) {
  font-size: 13px;
}

/* ---------- Centered content when there's no sidebar ---------- */

.bs-blog .row.no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}

.bs-blog .row.no-sidebar > .col-main,
.bs-blog .row > .col-main:only-child {
  width: 100%;
  max-width: var(--bas-content-width, 780px);
  margin-inline: auto;
}

/* ---------- Sidebar lists: Bootstrap's boxed archive look ---------- */

.bs-blog .sidebar-content ul.archives,
.bs-blog .sidebar-content ul.recent-posts,
.bs-blog .sidebar-content ul.related-pages {
  border: 1px solid var(--bas-border);
  border-radius: var(--bas-radius);
  overflow: hidden;
}

.bs-blog .sidebar-content ul.archives li,
.bs-blog .sidebar-content ul.recent-posts li,
.bs-blog .sidebar-content ul.related-pages li {
  line-height: 1.4;
  border-bottom: 1px solid var(--bas-border);
}

.bs-blog .sidebar-content ul.archives li:last-child,
.bs-blog .sidebar-content ul.recent-posts li:last-child,
.bs-blog .sidebar-content ul.related-pages li:last-child {
  border-bottom: 0;
}

.bs-blog .sidebar-content ul.archives a,
.bs-blog .sidebar-content ul.recent-posts a,
.bs-blog .sidebar-content ul.related-pages a {
  padding: 9px 14px;
}

.bs-blog .sidebar-content ul.archives a:hover,
.bs-blog .sidebar-content ul.recent-posts a:hover,
.bs-blog .sidebar-content ul.related-pages a:hover {
  background: color-mix(in srgb, var(--bas-surface) 94%, black);
}

.bs-blog .sidebar-content .tags {
  display: block;
  line-height: 2.1;
}

.bs-blog .sidebar-content .tags .label {
  margin: 0 3px 3px 0;
}

/* ---------- Bootstrap-style navbar dropdown ---------- */

.dropmenu.bs-dropdown li > ul {
  top: calc(100% + 2px);
  min-width: 160px;
  max-width: var(--bas-dropdown-max-width);
  padding: 5px 0;
  gap: 0;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--bas-radius);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
}

/* Alignment of the top-level panel (right by default, so a wide menu on a
   right-aligned navbar can't run off-screen) */
.dropmenu.bs-dropdown.align-right > ul > li > ul,
.dropmenu.bs-dropdown.align-right ul.navigation > li > ul {
  left: auto;
  right: 0;
}

.dropmenu.bs-dropdown.align-left > ul > li > ul,
.dropmenu.bs-dropdown.align-left ul.navigation > li > ul {
  left: 0;
  right: auto;
}

/* Optional: let long entries wrap instead of stretching the panel */
.dropmenu.bs-dropdown.wrap li > ul a {
  white-space: normal;
}

.dropmenu.bs-dropdown li > ul a {
  display: block;
  padding: 3px 20px;
  border-radius: 0;
  font-family: var(--bas-font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.42857143;
  letter-spacing: 0;
  color: #333333;
  white-space: nowrap;
}

.dropmenu.bs-dropdown li > ul a:hover,
.dropmenu.bs-dropdown li > ul a:focus {
  background: #f5f5f5;
  color: #262626;
}

.dropmenu.bs-dropdown li > ul a.active {
  background: var(--bas-label);
  color: #ffffff;
}

.dropmenu.bs-dropdown li.divider {
  height: 1px;
  margin: 9px 0;
  padding: 0;
  overflow: hidden;
  background: #e5e5e5;
}

/* Bootstrap's caret triangle in place of Quark's chevron */
.dropmenu.bs-dropdown li.has-children > a::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 5px;
  border-top: 4px solid currentColor;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  border-bottom: 0;
  border-radius: 0;
  transform: none;
  opacity: 1;
  vertical-align: middle;
}

.dropmenu.bs-dropdown li li.has-children > a::after {
  margin-left: auto;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 4px solid currentColor;
  border-right: 0;
  transform: none;
}

/* Divider is dropdown-only chrome — hide it in the mobile tree menu */
.tree li.divider,
.overlay-menu li.divider {
  display: none;
}

:root[data-theme="dark"] .dropmenu.bs-dropdown li > ul {
  background: var(--q2-bg-elev);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.55);
}

:root[data-theme="dark"] .dropmenu.bs-dropdown li > ul a {
  color: var(--q2-text);
}

:root[data-theme="dark"] .dropmenu.bs-dropdown li > ul a:hover,
:root[data-theme="dark"] .dropmenu.bs-dropdown li > ul a:focus {
  background: var(--q2-bg-muted);
  color: var(--q2-text-strong);
}

:root[data-theme="dark"] .dropmenu.bs-dropdown li.divider {
  background: rgba(255, 255, 255, 0.12);
}


/* ---------- Site logo ---------- */

.navbar-brand img.site-logo {
  display: block;
  height: var(--bas-logo-height);
  width: auto;
  max-width: 100%;
}

@media (max-width: 767px) {
  .navbar-brand img.site-logo {
    height: 36px;
  }
}

.mobile-logo img.site-logo {
  height: 44px;
}

/* ---------- Archives / count badges ---------- */

/* Quark draws the post count as a filled circular badge, which collides with
 * Bootstrap's plain archive rows. Flatten it back to a muted number. */
.bs-blog .sidebar-content ul.archives a,
.bs-blog .sidebar-content ul.menu a,
.bs-blog .sidebar-content ul.recent-posts a,
.bs-blog .sidebar-content ul.related-pages a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.bs-blog .sidebar-content .menu-score,
.bs-blog .sidebar-content .score {
  order: 2;
  flex: 0 0 auto;
  float: none;
  display: inline;
  min-width: 0;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--bas-muted);
  font-family: var(--bas-font);
  font-size: 85%;
  font-weight: 400;
  line-height: inherit;
}

.bs-blog .sidebar-content .menu-text {
  order: 1;
  font-family: var(--bas-font);
  font-size: 14px;
  line-height: 1.4;
}

/* Month names shouldn't wrap onto two lines */
.bs-blog .sidebar-content ul.archives .menu-text,
.bs-blog .sidebar-content ul.menu .menu-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
