html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
}

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

.wp-site-blocks {
  min-height: 100vh;
}

/* Header */

.ml-header-inner {
  gap: 1.5rem;
}

.ml-header-brand {
  gap: 0.85rem;
}

.ml-site-header .wp-block-site-title {
  margin: 0;
  font-weight: 600;
}

.ml-site-header .wp-block-site-title a {
  text-decoration: none;
}

.ml-site-header .wp-block-navigation {
  gap: 1.2rem;
}

.ml-site-header .wp-block-navigation a {
  text-decoration: none;
}

.ml-site-header .wp-block-navigation__submenu-container {
  border: 1px solid #e4ded4;
}

/* Header wrapper, spacing + sticky */

.wp-site-blocks > header.wp-block-template-part {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: #ffffff;
  border-bottom: 1px solid #e4ded4;
  padding-left: clamp(16px, 4vw, 40px);
  padding-right: clamp(16px, 4vw, 40px);
  box-sizing: border-box;
}

.wp-site-blocks > header.wp-block-template-part .ml-site-header {
  background: transparent;
  border-bottom: 0;
}

.wp-site-blocks > header.wp-block-template-part .ml-header-inner {
  box-sizing: border-box;
}

/* Admin bar offset */

.admin-bar .wp-site-blocks > header.wp-block-template-part {
  top: 32px;
}

/* Footer */

.ml-site-footer {
  margin-top: 0;
  padding-top: 1rem;
  padding-bottom: 1rem;
  background: #f6f4ef;
  border-top: 1px solid #e4ded4;
}

/* Content */

.ml-article-section {
  margin-top: 3.5rem;
  margin-bottom: 3.5rem;
}

.ml-intro {
  font-size: 1.16rem;
  line-height: 1.75;
}

.ml-box {
  padding: 1.5rem;
  background: #f6f4ef;
  border: 1px solid #e4ded4;
}

.ml-center-image {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.ml-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

/* Mobile */

@media (max-width: 782px) {
  .admin-bar .wp-site-blocks > header.wp-block-template-part {
    top: 46px;
  }

  .ml-article-section {
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
  }
}

/* ================================
   Global page spacing
   ================================ */

:root {
  --ml-page-top-space: clamp(2rem, 4vw, 4rem);
  --ml-h1-bottom-space: clamp(1.6rem, 3vw, 2.4rem);
  --ml-page-footer-space: clamp(3rem, 5vw, 5rem);
}

/* Distance from sticky header to page content */
.wp-site-blocks > main.wp-block-main {
  margin-block-start: 0 !important;
  padding-top: var(--ml-page-top-space);
}

/* Distance after first H1 */
.wp-site-blocks > main.wp-block-main h1.wp-block-heading:first-of-type {
  margin-top: 0 !important;
  margin-bottom: var(--ml-h1-bottom-space) !important;
}

/* Avoid double spacing after H1 */
.wp-site-blocks > main.wp-block-main h1.wp-block-heading:first-of-type + * {
  margin-block-start: 0 !important;
}

/* Distance from last page content to footer */
.wp-site-blocks > footer.wp-block-template-part {
  margin-block-start: var(--ml-page-footer-space) !important;
}

/* Mobile spacing */
@media (max-width: 782px) {
  :root {
    --ml-page-top-space: 1.5rem;
    --ml-h1-bottom-space: 1.4rem;
    --ml-page-footer-space: 3rem;
  }
}

/* ================================
   Content section and heading spacing
   ================================ */

:root {
  --ml-section-top-space: clamp(3rem, 5vw, 4.8rem);
  --ml-h2-top-space: clamp(2.4rem, 4vw, 3.4rem);
  --ml-h3-top-space: clamp(1.8rem, 3vw, 2.4rem);
  --ml-heading-to-content-space: 0.15rem;
}

/* Space between main content sections */
.wp-site-blocks > main.wp-block-main .entry-content > .wp-block-group + .wp-block-group {
  margin-top: var(--ml-section-top-space) !important;
  margin-block-start: var(--ml-section-top-space) !important;
}

/* H2/H3 get clear space above when they are not first in a section */
.wp-site-blocks > main.wp-block-main .entry-content .wp-block-group > h2.wp-block-heading,
.wp-site-blocks > main.wp-block-main .entry-content .wp-block-group > h3.wp-block-heading {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.wp-site-blocks > main.wp-block-main .entry-content .wp-block-group > h2.wp-block-heading {
  margin-top: var(--ml-h2-top-space) !important;
}

.wp-site-blocks > main.wp-block-main .entry-content .wp-block-group > h3.wp-block-heading {
  margin-top: var(--ml-h3-top-space) !important;
}

/* If H2/H3 is the first element in a section, spacing is handled by the section above */
.wp-site-blocks > main.wp-block-main .entry-content .wp-block-group > h2.wp-block-heading:first-child,
.wp-site-blocks > main.wp-block-main .entry-content .wp-block-group > h3.wp-block-heading:first-child {
  margin-top: 0 !important;
}

/* Reduce WordPress block-gap on the element directly after H2/H3 */
.wp-site-blocks > main.wp-block-main .entry-content .wp-block-group > h2.wp-block-heading + *,
.wp-site-blocks > main.wp-block-main .entry-content .wp-block-group > h3.wp-block-heading + * {
  margin-top: var(--ml-heading-to-content-space) !important;
  margin-block-start: var(--ml-heading-to-content-space) !important;
  padding-top: 0 !important;
}

/* If an H3 follows directly after an H2, keep proper subsection spacing */
.wp-site-blocks > main.wp-block-main .entry-content .wp-block-group > h2.wp-block-heading + h3.wp-block-heading {
  margin-top: var(--ml-h3-top-space) !important;
  margin-block-start: var(--ml-h3-top-space) !important;
}

/* Mobile spacing */
@media (max-width: 782px) {
  :root {
    --ml-section-top-space: 2.2rem;
    --ml-h2-top-space: 2rem;
    --ml-h3-top-space: 1.5rem;
    --ml-heading-to-content-space: 0.1rem;
  }
}

/* ================================
   Main content side spacing
   ================================ */

:root {
  --ml-content-side-space: clamp(16px, 4vw, 40px);
}

/* Adds side spacing only to the main content area */
.wp-site-blocks > main.wp-block-main {
  padding-left: var(--ml-content-side-space);
  padding-right: var(--ml-content-side-space);
  box-sizing: border-box;
}

/* ================================
   Footer grid alignment
   ================================ */

.ml-footer-grid {
  align-items: center;
}

.ml-footer-col-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

/* ================================
   Footer responsive grid: 3 columns to 1 column
   ================================ */

.ml-site-footer.ml-footer-grid,
.ml-footer-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: clamp(1.2rem, 3vw, 2rem) !important;
  align-items: center;
  width: 100%;
}

.ml-site-footer.ml-footer-grid > *,
.ml-footer-grid > * {
  min-width: 0;
}

/* Mobile */
@media (max-width: 700px) {
  .ml-site-footer.ml-footer-grid,
  .ml-footer-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    text-align: center;
    justify-items: center;
  }

  .ml-site-footer.ml-footer-grid > *,
  .ml-footer-grid > * {
    width: 100%;
  }
}