/* ---- Global CSS ---- */
:root {
  --gray-gradient-reversed: linear-gradient(to bottom, #808080 0%, #ffffff 100%);
}

/* ---- Header ---- */

/* Template parts/Patterns */
.header-vertical .wp-block-site-logo img {
  max-height: 80px;
  object-fit: contain;
}

.mxs-light-bg .header-hero-title-inside a:hover,
.mxs-light-bg .header-hero-title-inside a:active {
  color: var(--wp--preset--color--black);
}

.mxs-dark-bg .header-hero-title-inside a:hover,
.mxs-dark-bg .header-hero-title-inside a:active {
  color: var(--wp--preset--color--white);
}

.wp-site-blocks:has(.mxs-thin-header) {
  padding-top: 0;
}

.site-header > .wp-block-group.mxs-thin-header {
  padding: 0;
}

.mxs-thin-header {
  margin-bottom: 1rem;

  .wp-block-site-logo a {
    display: inline;
  }
}

.mxs-thin-header {
  .wp-block-navigation {
    &.is-style-tabs,
    &.is-style-wide-tab {
      align-self: flex-end;
    }
  }
}

.mxs-thin-header.mxs-light-bg {
  .wp-block-navigation__responsive-container-open {
    color: var(--almost-black);
  }
}

.mxs-thin-header,
.mxs-slide-down-header .mxs-card {
  .wp-block-site-logo {
    min-width: 80px;
  }
}

.is-layout-flex > :is(.mxs-logo-nav-container) {
  margin-top: auto;
  margin-bottom: auto;
}

.mxs-slide-down-header {
  .mxs-header,
  .mxs-centered-logo-header {
    background-color: var(--wp--preset--color--base);
    margin-bottom: 0.5rem;
  }

  &:has(.mxs-card) {
    margin-left: var(--wp--style--block-gap, 1.5em);
    margin-right: var(--wp--style--block-gap, 1.5em);
    margin-bottom: 1em;
  }
}

.mxs-centered-logo-header {
  margin-bottom: 0;
}

@media (max-width: 374px) {
  .mxs-thin-header {
    flex-direction: column;
    row-gap: 0.5rem;

    .mxs-logo-nav-container {
      align-self: flex-start;
    }
  }
}

@media (max-width: 600px) {
  .mxs-thin-header.is-not-stacked-on-mobile {
    .mxs-logo-nav-container,
    .mxs-button-panel {
      flex-basis: 50% !important;
    }
  }

  .mxs-logo-nav-container .is-layout-flex > :is(.is-responsive) {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }

  .wp-block-navigation.is-responsive {
    &.is-style-tabs,
    &.is-style-wide-tab {
      align-self: center;
    }
  }
}

/* Site Title / Tagline / Logo */
.wp-block-site-title,
.wp-block-site-tagline {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.wp-block-site-logo {
  margin: 1em;
}

.wp-block-site-title a,
.wp-block-site-logo a {
  border-bottom: transparent;
}

@media (min-width: 1024px) {
  .mxs-header .wp-block-site-title,
  .mxs-header .wp-block-site-tagline {
    width: 50%;
  }

  .mxs-header-searchbar-center .wp-block-site-title,
  .mxs-header-searchbar-center .wp-block-site-tagline {
    width: auto;
  }

  .header-vertical .wp-block-site-logo img {
    max-height: none;
  }
}

/* ---- Content ---- */
/* List item styles */
.wp-block-archives,
.wp-block-categories,
ul.wp-block-list,
.wp-block-page-list,
.wp-block-rss {
  li {
    list-style-type: none;
  }

  li::before {
    margin-right: 0.5rem;
    vertical-align: middle;
  }

  .mxs-light-theme-bg &,
  .mxs-dark-theme-bg .mxs-light-bg & {
    li::before {
      content: url(../../images/list-bullet-dark.svg);
    }
  }

  .mxs-dark-theme-bg &,
  .mxs-light-theme-bg .mxs-dark-bg & {
    li::before {
      content: url(../../images/list-bullet-light.svg);
    }
  }
}

.wp-block-rss {
  .wp-block-rss__item-title {
    display: inline-block;
  }
}

/* Posts */
.wp-block-post-template {
  display: flex;
  flex-direction: column;
}

.wp-block-post-template.is-flex-container {
  margin-top: 2em;
  margin-bottom: 2em;
}

.wp-block-post {
  margin-top: 2em;
  margin-bottom: 2em;
}

.entry-meta {
  flex-direction: column;
  margin-bottom: 1em;
  margin-top: 1em;
}

body .entry-meta:where(.is-layout-flex),
body .is-layout-constrained .entry-meta:where(.is-layout-flex) {
  gap: 0.5rem;
  margin-block-end: 1rem;
}

@media (min-width: 640px) {
  .entry-meta {
    flex-direction: row;
  }
}

@media (min-width: 1366px) {
  .sticky {
    .wp-block-post-title,
    .entry-meta {
      width: var(--wp--custom--widths--wide);
    }

    .entry-meta {
      margin-left: calc(10% - 1em);
    }

    .wp-block-post-excerpt {
      margin-left: calc(10% - 1em);
      margin-right: calc(10% - 1em);
    }
  }
}

/* Index/Post Navigation */
a.wp-block-query-pagination-next:where(:not(.wp-element-button)),
a.wp-block-query-pagination-previous:where(:not(.wp-element-button)),
.wp-block-post-navigation-link a:where(:not(.wp-element-button)) {
  color: var(--wp--preset--color--contrast);
}

.wp-block-query-pagination,
.wp-block-post-navigation-link {
  a {
    padding-bottom: 0;
  }
}

.wp-block-post-navigation-link {
  font-weight: bold;
}

/* Shared button styles */
.wp-element-button:not(.has-background) {
  .mxs-centered-logo-header & {
    background-color: var(--wp--preset--color--tertiary);

    &:hover,
    &:focus,
    &:active {
      background-color: var(--wp--preset--color--tertiary);
    }
  }
}

.wp-block-button__link,
.wp-block-file__button {
  margin: 0.5em;
}

/* Categories / Archives */
.wp-block-archives,
.wp-block-categories {
  padding-left: 1rem;
}

.wp-block-query-title {
  font-family: var(--wp--preset--font-family--body);
  font-size: 1.5rem;
  max-width: var(--wp--custom--widths--default);
  margin-left: auto;
  margin-right: auto;
  text-shadow: none;
}

/* Code / Verse */
pre.wp-block-verse {
  background-color: transparent;
  font-family: var(--monospace-font) !important;
  line-height: 2em;
}

/* File block */
.wp-block-file {
  padding: 0.5em 1em;
  text-align: center;
}

/* Gallery / Image block */
.wp-post-image,
.wp-block-gallery .wp-block-image:not(.is-style-rounded) img {
  border-radius: 16px;
}

/* Next / Previous posts */
.mxs-post-links {
  border-radius: 0.5em;
  display: flex;
  flex-direction: column;
  margin-left: 1em;
  margin-right: 1em;
  padding: 0.25em 1em;
  text-align: center;
}

@media (min-width: 782px) {
  .mxs-post-links {
    flex-direction: row;
  }
}

@media (min-width: 1366px) {
  .mxs-post-links {
    margin-left: 20%;
    margin-right: 20%;
  }
}

/* Quote / Pullquote */
.wp-block-quote.is-style-default {
  padding-left: 1em;
  border-left: 2px solid;
}

/* - Contrast colors - */
/* Post Content */
.wp-block-post-content {
  .post-page-numbers:not(.current) {
    background: linear-gradient(to bottom, rgb(255 255 255 / 0.75) 0%, rgb(128 128 128 / 0.75) 100%);
    background-color: var(--almost-white);
    color: var(--darker-gray);
    font-weight: bold;
    text-decoration: none;

    &:hover,
    &:focus {
      background-color: var(--wp--preset--color--primary);
    }
  }

  .mxs-dark-theme-bg &,
  .mxs-light-theme-bg .mxs-dark-bg & {
    .post-page-numbers.current {
      border-color: var(--white-25pcnt);
    }

    .post-page-numbers {
      border-color: var(--white-50pcnt);
    }
  }

  .mxs-light-theme-bg &,
  .mxs-dark-theme-bg .mxs-light-bg & {
    .post-page-numbers.current {
      border-color: var(--black-25pcnt);
    }

    .post-page-numbers {
      border-color: var(--black-50pcnt);
    }
  }
}

/* Index/Post navigation */
.wp-block-query-pagination,
.wp-block-post-navigation-link {
  a {
    border-color: transparent;
  }

  .mxs-light-theme-bg &,
  .mxs-dark-theme-bg .mxs-light-bg & {
    a {
      color: var(--dark-gray);
    }

    a:hover,
    a:active {
      border-bottom-color: var(--black-75pcnt);
    }
  }

  .mxs-dark-theme-bg &,
  .mxs-light-theme-bg .mxs-dark-bg & {
    a {
      color: var(--light-gray);
    }

    a:hover,
    a:active {
      border-bottom-color: var(--white-75pcnt);
    }
  }
}

/* Shared button styles */
.wp-element-button {
  .mxs-card.mxs-light-bg & {
    color: var(--almost-black);
  }

  .mxs-card.mxs-dark-bg & {
    color: var(--almost-white);
  }

  .mxs-light-theme-bg .mxs-card.mxs-light-bg &,
  .mxs-dark-theme-bg .mxs-card.mxs-light-bg & {
    border-color: var(--wp--preset--color--primary-semitransparent);
  }

  .mxs-thin-header.mxs-light-bg &,
  .mxs-thin-header.mxs-dark-bg & {
    background-color: var(--wp--preset--color--primary);

    &:hover,
    &:focus,
    &:active {
      background-color: var(--wp--preset--color--primary);
    }
  }

  .mxs-thin-header.mxs-light-bg & {
    border-color: var(--black-50pcnt);
  }

  .mxs-thin-header.mxs-dark-bg & {
    border-color: var(--white-50pcnt);
  }
}

/* Next / Previous posts */
.mxs-post-links {
  .mxs-light-theme-bg &,
  .mxs-dark-theme-bg .mxs-light-bg & {
    background-color: var(--black-12pcnt);
  }

  .mxs-dark-theme-bg &,
  .mxs-light-theme-bg .mxs-dark-bg & {
    background-color: var(--white-12pcnt);
  }
}

/* More link */
.mxs-light-bg .wp-block-post-excerpt__more-link {
  color: var(--wp--preset--color--mxs-link-alt);

  &:hover,
  &:focus {
    color: var(--wp--preset--color--mxs-link-alt-hover);
  }
}

/* Preformatted/Code blocks */
.wp-block-preformatted,
.wp-block-code {
  .mxs-dark-theme-bg &,
  .mxs-light-theme-bg .mxs-dark-bg & {
    background-color: var(--white-6pcnt);
  }
}

.wp-block-preformatted,
.wp-block-code {
  .mxs-light-theme-bg &,
  .mxs-dark-theme-bg .mxs-light-bg & {
    background-color: var(--black-6pcnt);
  }
}

.wp-block-preformatted,
.wp-block-code code {
  .mxs-card.mxs-light-bg & {
    color: #000000;
  }
}

.mxs-card.mxs-light-bg .wp-block-code {
  background-color: var(--wp--preset--color--secondary);
}

/* Quote / Pullquote */
.wp-block-quote.is-style-default {
  .mxs-card.mxs-light-bg & {
    border-left-color: var(--silver);
  }

  .mxs-light-theme-bg & {
    border-left-color: var(--black-25pcnt);
  }

  .mxs-dark-theme-bg &,
  .mxs-light-theme-bg .mxs-dark-bg & {
    border-left-color: var(--white-25pcnt);
  }
}

/* ---- Sidebar ---- */
.sidebar {
  > div,
  > ul {
    margin-top: 0;
    margin-bottom: 2.5rem;
  }

  > h3 {
    margin-bottom: 0.5rem;
  }
}

.sidebar-horizontal {
  display: flex;
  flex-direction: column;
}

.sidebar-horizontal > [class^="wp-block-"] {
  margin-top: 1em;
  margin-bottom: 1em;
}

/* ---- Block Alignments ---- */
.wp-site-blocks .alignleft {
  float: left;
}

.wp-site-blocks .alignright {
  float: right;
}

@media (max-width: 767px) {
  .wp-block-post-content .alignwide {
    max-width: none;
  }
}

.wp-block-image .alignleft {
  margin: 0 1em 1em 0;
}

.wp-block-image .alignright {
  margin: 0 0 1em 1em;
}

.wp-block-image .aligncenter {
  margin-bottom: 1em;
}

@media (min-width: 1366px) {
  body .is-layout-constrained > .alignleft,
  body .is-layout-flow > .alignleft {
    margin-inline-start: 20%;
  }

  body .is-layout-constrained > .alignright,
  body .is-layout-flow > .alignright {
    margin-inline-end: 20%;
  }
}
