/*
Theme Name: SPM Blocks
Text Domain: spm
Version: 2023
Description: A block-based theme for SPM clients.
Author: Saint Paul Media
Author URI: https://stpaulmedia.com/
*/

/*
 * Reset
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;

  /* Prevent font size inflation */
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

* {
  margin: 0;
}

body {
  /* Improve text rendering */
  -webkit-font-smoothing: antialiased;
}

/* Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  height: auto;
  max-width: 100%;
}

/* Remove built-in form typography styles */
input,
button,
textarea,
select {
  font: inherit;
}

/* Style form fields */
button[type="submit"],
input[type="text"],
input[type="number"],
input[type="tel"],
input[type="email"],
input[type="url"],
input[type="file"],
textarea,
select {
  background-color: var(--wp--preset--color--background);
  border: 1px solid var(--wp--preset--color--foreground);
  color: var(--wp--preset--color--foreground);
  border-radius: 0;
  font-size: var(--wp--preset--font-size--small);
  line-height: 1.16667;
  padding: 12px;
  width: 100%;
}

button[type="submit"] {
  cursor: pointer;
  width: unset;
}

select {
  appearance: none;
  background-image: url("assets/img/arrow_filter.svg"),
    linear-gradient(
      to bottom,
      var(--wp--preset--color--background) 0%,
      var(--wp--preset--color--background) 100%
    );
  background-position: right 12px top 50%, 0 0;
  background-repeat: no-repeat, repeat;
  background-size: 20px, 100%;
  font-weight: var(--wp--custom--font-weight--regular);
  padding-right: 44px;
}

select::-ms-expand {
  display: none;
}

select[multiple="multiple"] {
  background: none;
  background-color: var(--wp--preset--color--background);
  padding-right: 12px;
}

/*
 * Typography
 */

address {
  font-style: normal;
  margin-bottom: 1rem;
}

dl div {
  margin-bottom: 0.25rem;
}

dt {
  font-weight: 700;
}

dd > :last-child {
  margin-bottom: 0;
}

time {
  font-style: italic;
}

/*
 * Link effects
 */

*:focus {
  outline: 2px solid var(--wp--preset--color--primary);
  outline-offset: 2px;
  transition: none;
}

a,
button,
input:focus,
input[type="button"],
input[type="submit"],
textarea:focus,
.wp-element-button {
  transition: all 0.2s ease-in-out;
}

h1 a,
h2 a,
h3 a,
h4 a,
h5 a,
h6 a {
  font-weight: inherit;
}

/*
 * Admin bar
 */

@media only screen and (max-width: 782px) {
  #wpadminbar {
    display: none !important;
  }
}

@media only screen and (min-width: 782px) {
  .admin-bar .site-container {
    padding-top: 32px;
  }
}

/*
 * Universal site elements
 */

.skip-link {
  position: absolute;
  top: -9999px;
  left: -9999px;
  display: block;
}

.skip-link:focus {
  top: 8px;
  left: 8px;
  background-color: var(--wp--preset--color--primary);
  border-radius: 10px;
  color: var(--wp--preset--color--background);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.1111;
  padding: 15px 30px;
  text-decoration: none;
  z-index: 99999;
}

.skip-link:hover {
  background-color: var(--wp--preset--color--secondary);
}

.site-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  padding: 25px 0;
}

.logo {
  max-width: 220px;
}

.logo__link {
  display: inline-block;
}

.logo__link:hover {
  opacity: 0.5;
}

.logo--footer {
  margin-bottom: 1rem;
}

.menu {
  display: flex;
  list-style: none;
  margin-bottom: 0;
  padding-left: 0;
}

.menu-header-secondary {
  align-items: center;
  display: none;
  justify-content: flex-end;
  margin: 0 -15px 30px -15px;
}

.menu-header-secondary > li {
  padding: 0 15px;
}

@media (min-width: 992px) {
  .menu-header-secondary {
    display: flex;
  }
}

.site-content {
  flex: 1;
}

.header {
  padding: 25px 0;
}

.site-footer {
  padding: 25px 0;
}

.menu-footer-primary,
.menu-footer-secondary {
  flex-direction: column;
  margin-bottom: 20px;
}

.menu-footer-primary > li + li,
.menu-footer-secondary > li + li {
  margin-top: 0.25em;
}

.social-media {
  display: flex;
  list-style: none;
  margin: 0 -5px;
  padding-left: 0;
}

.social-media .social-media__item {
  padding: 0 5px;
}

/*
 * Commonly used elements
 */

.excerpt {
  background-color: white;
  display: flex;
  flex-direction: column;
}

.excerpt__content {
  flex: 1;
  padding: 20px;
}

.excerpt p {
  margin-bottom: 0;
}

.excerpt__footer {
  font-size: var(--wp--preset--font-size--small);
  padding: 0 20px 20px 20px;
}

.excerpt + .excerpt {
  margin-top: 20px;
}

.post-categories {
  list-style: none;
  margin-bottom: 0;
  padding-left: 0;
}

.post-categories li {
  display: inline-block;
  margin-right: 1em;
}

.post-categories li:last-child {
  margin-right: 0;
}

.posts-navigation {
  margin-top: 30px;
}

.posts-navigation .nav-links {
  display: flex;
  justify-content: space-between;
}

.result {
  border-bottom: 1px solid var(--wp--preset--color--foreground);
  margin-bottom: 30px;
  padding-bottom: 30px;
}

.result:last-child {
  margin-bottom: 0;
}

.result .result__title {
  margin-bottom: 0;
}

.result .result__excerpt {
  margin-top: 10px;
}

@media (min-width: 768px) {
  .result .result__excerpt {
    margin-top: 12px;
  }
}

.wp-element-button {
  display: inline-block;
}

/*
 * Plugin styles
 */

/*
 * Gravity Forms
 */

.gfield {
  border: 0;
  margin: 0 0 20px 0;
  padding: 0;
}

.gfield_label {
  color: var(--wp--preset--color--foreground);
  display: block;
  font-size: var(--wp--preset--font-size--medium);
  font-weight: var(--wp--custom--font-weight--bold);
  margin-bottom: 8px;
  padding: 0 !important;
}

.gfield_description,
.gform-field-label--type-sub {
  display: block;
  font-size: var(--wp--preset--font-size--small);
  margin: 8px 0;
}

.field_description_above .gfield_description {
  margin-top: 0;
}

/* Hidden labels */
.gform_wrapper .hidden_label .gfield_label,
.gform_wrapper label.hidden_sub_label,
.gform_wrapper label.screen-reader-text {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  width: 1px;
}

.gform_wrapper li.hidden_label input {
  margin-top: 8px;
}

.gform_wrapper
  .field_sublabel_hidden_label
  .ginput_complex.ginput_container
  input[type="text"],
.gform_wrapper
  .field_sublabel_hidden_label
  .ginput_complex.ginput_container
  select {
  margin-bottom: 8px;
}

.gform_wrapper .left_label li.hidden_label input,
.gform_wrapper .right_label li.hidden_label input {
  margin-left: 3.7%;
}

.gform_wrapper .hidden_label input.large,
.gform_wrapper .hidden_label select.large,
.gform_wrapper .top_label input.large,
.gform_wrapper .top_label select.large {
  width: 100%;
}

/* Sections */
.gsection_title {
  margin-bottom: 0;
}

/* Fields with choices */
.gchoice,
.gfield-image-choice-wrapper-inner,
.ginput_container_consent {
  align-items: center;
  display: flex;
}

.gfield-choice-input,
.ginput_container_consent input[type="checkbox"] {
  margin-right: 10px;
}

.gfield-choice-input + label,
.ginput_container_consent input[type="checkbox"] + label {
  font-size: var(--wp--preset--font-size--small);
}

.gchoice + .gchoice {
  margin-top: 15px;
}

.gfield-choice-image-wrapper {
  margin-bottom: 15px;
}

/* List fields */
.gfield_list_icons {
  margin-top: 15px;
}

.gfield_list_group + .gfield_list_group {
  margin-top: 15px;
}

.add_list_item,
.delete_list_item {
  display: none;
}

/* Upload fields */
.gform_fileupload_rules {
  margin-top: 15px;
  margin-bottom: 0;
}

/* Complex fields */
.ginput_container--name {
  display: flex;
  margin: 0 -15px;
}

.ginput_container--name > span {
  flex: 1;
  padding: 0 15px;
}

.ginput_container_address {
  display: flex;
  flex-direction: column;
}

.ginput_container_address > span + span {
  margin-top: 15px;
}

.gfield--type-time .ginput_complex {
  align-items: center;
  display: flex;
  margin: 0 0.125em;
}

.gfield--type-time .ginput_complex > div {
  padding: 0 0.125em;
}

/*Datepicker*/
.gform-theme-datepicker:not(.gform-legacy-datepicker) {
  background-color: var(--wp--preset--color--background);
  border: 0;
  padding: 10px;
}

.ui-datepicker-prev,
.ui-datepicker-next {
  display: inline-block;
  margin-bottom: 10px;
  width: 50%;
}

.ui-datepicker-next {
  text-align: right;
}

.ui-datepicker-month {
  margin-bottom: 10px;
}

.ui-datepicker-year {
  margin-bottom: 10px;
}

/* Messages */
.gform_validation_errors,
.gfield_validation_message {
  background-color: var(--wp--preset--color--neutral);
  font-size: var(--wp--preset--font-size--small);
  font-style: italic;
  padding: 10px;
}

.validation_message--hidden-on-empty {
  padding: 0;
}

/* Hide icons */
.gform_save_link svg {
  display: none;
}

/* Required fields */
.gfield_required {
  color: red;
}

.gfield_required:before {
  content: " ";
}

/*
 * Search & Filter
 */

.searchandfilter ul {
  align-items: center;
  display: flex;
  list-style: none;
  margin: 0 -15px 30px -15px;
  padding-left: 0;
}

.searchandfilter li {
  padding: 0 15px;
}

/*
 * Block spacing - outer blocks
 */

.spm-blocks > * + * {
  margin-top: 30px;
}

.spm-blocks > *:not(.has-bg):first-child {
  margin-top: 30px;
}

.spm-blocks > *:not(.has-bg):last-child {
  margin-bottom: 30px;
}

.has-bg {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  padding: 30px 0;
}

.has-bg--neutral {
  background-color: var(--wp--preset--color--neutral);
}

.spm-blocks > .has-bg + .has-bg {
  margin-top: 0;
}

.has-bg--neutral + .has-bg--neutral {
  padding-top: 0;
}

@media (min-width: 992px) {
  .spm-blocks > * + * {
    margin-top: 60px;
  }

  .spm-blocks > *:not(.has-bg):first-child {
    margin-top: 60px;
  }

  .spm-blocks > *:not(.has-bg):last-child {
    margin-bottom: 60px;
  }

  .has-bg {
    padding: 60px 0;
  }
}

/*
 * Block spacing - inner blocks
 */

.spm-inner-blocks-row {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.spm-inner-blocks-row > * + * {
  margin-block-start: 25px;
}

@media (min-width: 768px) {
  .spm-inner-blocks-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0 -15px;
  }

  .spm-inner-blocks-row > * + * {
    margin-block-start: unset;
  }

  /* Default: 1 item, 3 items or 5+ items */
  .spm-inner-blocks-row > * {
    flex: 0 1 33.3333%;
    padding: 0 15px;
  }

  .spm-inner-blocks-row > *:not(:nth-child(-n + 3)) {
    margin-block-start: 30px;
  }

  /* Special case: exactly 2 items */
  .spm-inner-blocks-row:has(> :nth-child(2):last-child) > * {
    flex: 0 1 50%;
  }

  /* Special case: exactly 4 items */
  .spm-inner-blocks-row:has(> :nth-child(4):last-child) > * {
    flex: 0 1 25%;
    margin-block-start: 0;
  }
}

.spm-inner-block-content-wrap {
  background-color: white;
  padding: 15px;
}

/*
 * Utility classes
 */

.embed-container {
  position: relative;
  padding-bottom: 56.25%;
  overflow: hidden;
  max-width: 100%;
  height: auto;
}

.embed-container iframe,
.embed-container object,
.embed-container embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.wysiwyg > :last-child {
  margin-bottom: 0;
}

.pagination {
  align-items: center;
  display: flex;
  font-size: var(--wp--preset--font-size--small);
  font-weight: var(--wp--custom--font-weight--bold);
  justify-content: center;
  line-height: 1.5;
  margin: 30px -20px 0 -20px;
}

.pagination > * {
  padding: 0 20px;
}

.pagination .prev,
.pagination .next {
  background-repeat: no-repeat;
  background-size: 24px 24px;
  display: block;
  height: 24px;
  width: 24px;
}

.pagination .prev {
  background-image: url("assets/img/arrow_left.svg");
  background-position: center left;
}

.pagination .next {
  background-image: url("assets/img/arrow_right.svg");
  background-position: center right;
}

.pagination .current {
  background-color: var(--wp--preset--color--foreground);
  color: var(--wp--preset--color--background);
  display: block;
  padding-top: 10px;
  padding-bottom: 10px;
}

/*
 * WordPress search form
 */

.search-form {
  border: 1px solid var(--wp--preset--color--neutral);
  border-radius: 10px;
  display: flex;
}

.search-form .search-field {
  border: 0;
  border-radius: 10px 0 0 10px;
  height: 60px;
  padding-right: 15px;
  padding-left: 15px;
}

.search-form .search-submit {
  border-radius: 0 10px 10px 0;
}
