/* ==========================================================================
   WordPress: core output the static design did not have:
   content blocks, alignments, comments, widgets, sidebars, menus, forms.
   ========================================================================== */

/* ---------- Shared mixins ---------- */
.aurelle-field() {
  width: 100%;
  min-height: 3rem;
  padding: var(--space-1-5) var(--space-2);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--font-size-base);
  line-height: var(--lh-snug);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);

  &:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.25rem var(--color-focus);
  }
}

.aurelle-select() {
  .aurelle-field();
  padding-right: var(--space-5);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231c1c1a' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right var(--space-1-5) center;
  background-repeat: no-repeat;
  background-size: 1rem;
  cursor: pointer;
}

/* Base of the Bootstrap .btn (the purged CSS is plain CSS, so it cannot be extended) */
.aurelle-btn-base() {
  --bs-btn-padding-x: var(--space-3);
  --bs-btn-padding-y: var(--space-1-5);
  --bs-btn-font-size: var(--font-size-sm);
  --bs-btn-font-weight: var(--fw-semibold);
  --bs-btn-line-height: 1.25;
  --bs-btn-border-width: var(--border-width);
  --bs-btn-border-radius: var(--radius-pill);
  display: inline-flex;
  padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);
  border: var(--bs-btn-border-width) solid var(--bs-btn-border-color);
  border-radius: var(--bs-btn-border-radius);
  background-color: var(--bs-btn-bg);
  color: var(--bs-btn-color);
  font-family: var(--font-body);
  font-size: var(--bs-btn-font-size);
  font-weight: var(--bs-btn-font-weight);
  line-height: var(--bs-btn-line-height);
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;

  &:hover,
  &:focus-visible {
    border-color: var(--bs-btn-hover-border-color);
    background-color: var(--bs-btn-hover-bg);
    color: var(--bs-btn-hover-color);
  }

  &:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.25rem var(--color-focus);
  }

  &:disabled,
  &.disabled {
    opacity: 0.5;
    pointer-events: none;
  }
}

.aurelle-btn() {
  .aurelle-btn-base();
  &:extend(.btn all);
  &:extend(.btn-outline-primary all);
}

.aurelle-btn-primary() {
  .aurelle-btn-base();
  &:extend(.btn all);
  &:extend(.btn-primary all);
}

/* ---------- Layout helpers ---------- */
.pt-0 { padding-top: 0 !important; }
.pt-3 { padding-top: var(--space-3) !important; }
.mb-1 { margin-bottom: var(--space-1) !important; }

.site-main {
  display: block;
}

.skip-link:focus {
  z-index: calc(var(--z-progress) + 2);
}

.site-header__logo--image img,
.site-footer__logo--image img {
  width: auto;
  max-height: 2.5rem;
}

.site-footer__logo--image img {
  max-height: 3rem;
}

/* Two-column layout with a blog sidebar */
.content-layout {
  display: grid;
  gap: var(--space-6);

  > * {
    min-width: 0;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);

  .widget {
    padding: var(--space-3);
    border-radius: var(--radius-xl);
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }
}

.widget-title {
  margin-bottom: var(--space-1-5);
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--color-secondary);
}

.widget {
  font-size: var(--font-size-sm);

  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li {
    padding-block: var(--space-0-5);
  }

  li li {
    padding-left: var(--space-2);
  }

  a:hover {
    color: var(--color-secondary);
  }

  select {
    .aurelle-select();
  }
}

/* ---------- Page content ---------- */
.page-content__media {
  margin: 0 0 var(--space-6);
  border-radius: var(--radius-2xl);
  overflow: hidden;

  img {
    width: 100%;
  }
}

.page-content .entry-content.rte,
.page-content > .container > .entry-content {
  max-width: 50rem;
  margin-inline: auto;
}

.entry-content--full {
  > :where(:not(.alignfull):not(.alignwide):not(.elementor):not([class*='wp-block-woocommerce'])) {
    max-width: 50rem;
    margin-inline: auto;
    padding-inline: var(--bs-gutter-x);
  }

  > .alignwide {
    max-width: 82.5rem;
    margin-inline: auto;
    padding-inline: var(--bs-gutter-x);
  }
}

.rte,
.entry-content {
  > * + * {
    margin-top: 0;
  }

  h2,
  h3,
  h4 {
    margin-top: var(--space-5);
  }

  h2:first-child,
  h3:first-child {
    margin-top: 0;
  }

  img {
    border-radius: var(--radius-lg);
  }

  figure {
    margin: 0 0 var(--space-4);
  }

  figcaption {
    margin-top: var(--space-1);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-align: center;
  }

  table {
    width: 100%;
    margin-bottom: var(--space-4);
    border-collapse: collapse;
    font-size: var(--font-size-sm);

    th,
    td {
      padding: var(--space-1-5);
      border-bottom: var(--border-width) solid var(--color-border);
      text-align: left;
    }

    th {
      font-weight: var(--fw-semibold);
    }
  }

  hr {
    margin-block: var(--space-6);
    border: 0;
    border-top: var(--border-width) solid var(--color-border);
    opacity: 1;
  }

  pre,
  code {
    font-size: var(--font-size-sm);
  }

  pre {
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    background-color: var(--color-primary-dark);
    color: var(--color-white);
    overflow-x: auto;
  }

  :not(pre) > code {
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
    background-color: var(--color-accent-soft);
  }

  blockquote:not(.wp-block-pullquote blockquote):not(.quote-card__text) {
    margin: 0 0 var(--space-4);
    padding: var(--space-1) 0 var(--space-1) var(--space-3);
    border-left: 0.1875rem solid var(--color-secondary);
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    line-height: var(--lh-snug);

    p:last-child {
      margin-bottom: 0;
    }

    > cite,
    p + cite {
      display: block;
      margin-top: var(--space-1);
      font-family: var(--font-body);
      font-size: var(--font-size-sm);
      font-style: normal;
      color: var(--color-text-muted);
    }
  }

  dl dt {
    font-weight: var(--fw-semibold);
  }

  dl dd {
    margin: 0 0 var(--space-1-5);
  }
}

/* Full-bleed blocks inside a narrow column */
.rte .alignfull,
.article-body .alignfull {
  width: 100vw;
  max-width: 100vw;
  margin-inline: calc(50% - 50vw);
}

.rte .alignwide {
  max-width: none;
}

.entry-content .alignleft,
.entry-content .alignright {
  max-width: 50%;
}

/* ---------- Core blocks ---------- */
.wp-block-button__link,
.wp-element-button {
  .aurelle-btn-primary();
}

.wp-block-button.is-style-outline > .wp-block-button__link {
  .aurelle-btn();
  background-color: transparent;
}

.wp-block-button.is-style-aurelle-light > .wp-block-button__link {
  &:extend(.btn-light all);
}

.wp-block-buttons {
  gap: var(--space-1);
}

.wp-block-pullquote {
  margin: var(--space-6) 0;
  padding: var(--space-5) var(--space-3);
  border: 0;
  border-radius: var(--radius-2xl);
  background-color: var(--color-section-sand);
  text-align: center;

  blockquote {
    margin: 0;
  }

  p {
    font-family: var(--font-heading);
    font-size: var(--font-size-h3);
    line-height: var(--lh-heading);
  }

  cite {
    font-size: var(--font-size-sm);
    font-style: normal;
    color: var(--color-text-muted);
  }
}

.wp-block-separator {
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
  opacity: 1;

  &.is-style-dots::before {
    color: var(--color-secondary);
  }
}

.wp-block-cover {
  border-radius: var(--radius-2xl);
  overflow: hidden;

  &.alignfull {
    border-radius: 0;
  }
}

.wp-block-image.is-style-aurelle-rounded img {
  border-radius: var(--radius-2xl);
}

.is-style-aurelle-card {
  padding: var(--space-4);
  border-radius: var(--radius-2xl);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

p.is-style-aurelle-eyebrow {
  margin-bottom: var(--space-1-5);
  font-size: var(--font-size-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--color-secondary);
}

ul.is-style-aurelle-checks {
  padding-left: 0;
  list-style: none;

  li {
    position: relative;
    padding-left: var(--space-4);

    + li {
      margin-top: var(--space-1);
    }

    &::before {
      content: '';
      position: absolute;
      top: 0.2em;
      left: 0;
      width: 1.25rem;
      height: 1.25rem;
      border-radius: var(--radius-round);
      background: var(--color-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 0.75rem no-repeat;
    }
  }
}

.wp-block-search__inside-wrapper {
  gap: var(--space-1);
}

.wp-block-search__input {
  .aurelle-field();
  border-radius: var(--radius-pill);
}

.wp-block-latest-posts {
  padding-left: 0;

  li + li {
    margin-top: var(--space-1-5);
  }

  &__post-date {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
  }
}

.wp-block-table {
  overflow-x: auto;

  &.is-style-stripes tbody tr:nth-child(odd) {
    background-color: var(--color-section-sand);
  }
}

.wp-block-details {
  padding-block: var(--space-2);
  border-bottom: var(--border-width) solid var(--color-border);

  summary {
    font-weight: var(--fw-semibold);
    cursor: pointer;
  }
}

.wp-block-gallery.has-nested-images figure.wp-block-image img {
  border-radius: var(--radius-lg);
}

.wp-block-embed {
  margin: 0 0 var(--space-4);

  iframe {
    border-radius: var(--radius-lg);
  }
}

.wp-block-file {
  display: flex;
  align-items: center;
  gap: var(--space-2);

  .wp-block-file__button {
    .aurelle-btn-primary();
    padding: var(--space-1) var(--space-2);
  }
}

/* Gallery shortcode */
.gallery {
  display: grid;
  grid-template-columns: repeat(var(--gallery-cols, 3), 1fr);
  gap: var(--space-1-5);
  margin-bottom: var(--space-4);

  &-columns-1 { --gallery-cols: 1; }
  &-columns-2 { --gallery-cols: 2; }
  &-columns-4 { --gallery-cols: 4; }
  &-columns-5 { --gallery-cols: 5; }
  &-columns-6 { --gallery-cols: 6; }
  &-columns-7 { --gallery-cols: 7; }
  &-columns-8 { --gallery-cols: 8; }
  &-columns-9 { --gallery-cols: 9; }

  &-item {
    min-width: 0;
    margin: 0;

    img {
      width: 100%;
      height: auto;
      border-radius: var(--radius-md);
    }
  }
}

/* Phones: at most two gallery columns, so captions stay readable */
@media (max-width: 35.99em) {
  .gallery:not(.gallery-columns-1) {
    grid-template-columns: repeat(2, 1fr);
  }
}

.gallery-caption {
  margin-top: var(--space-0-5);
  font-size: var(--font-size-xs);
  line-height: var(--lh-snug);
  color: var(--color-text-muted);
}

/* Audio / video shortcodes (MediaElement player) */
.wp-audio-shortcode,
.wp-video,
.entry-content .mejs-container {
  margin-bottom: var(--space-3);
}

.mejs-container,
.mejs-container .mejs-controls {
  border-radius: var(--radius-md);
}

.wp-video {
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

/* ---------- Forms (search form, password form, generic inputs) ---------- */
input[type='text'],
input[type='email'],
input[type='url'],
input[type='password'],
input[type='search'],
input[type='number'],
input[type='tel'],
input[type='date'],
textarea {
  font-family: inherit;
}

.search-form {
  width: 100%;
  max-width: 32rem;
  margin-inline: auto;
}

.post-password-form {
  max-width: 32rem;

  input[type='password'] {
    .aurelle-field();
    margin-block: var(--space-1);
  }

  input[type='submit'] {
    .aurelle-btn-primary();
  }
}

.page-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin-block: var(--space-4);

  &__title {
    font-weight: var(--fw-semibold);
  }

  .post-page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tap-size);
    height: var(--tap-size);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-round);
    font-weight: var(--fw-semibold);
    text-decoration: none;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);

    &:hover:not(.current) {
      border-color: var(--color-primary);
      color: var(--color-primary);
    }

    &.current {
      border-color: var(--color-primary);
      background-color: var(--color-primary);
      color: var(--color-white);
    }
  }
}

.pagination {
  flex-wrap: wrap;

  &__link--dots {
    border-color: transparent;
  }
}

/* ---------- Article extras ---------- */
.article-layout--sidebar {
  grid-template-columns: minmax(0, 1fr);
}

.toc__inner[hidden] {
  display: none;
}

.post-navigation {
  margin-top: var(--space-6);

  .nav-links {
    display: grid;
    gap: var(--space-2);
  }

  a {
    display: flex;
    flex-direction: column;
    gap: var(--space-0-5);
    height: 100%;
    padding: var(--space-3);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-xl);
    text-decoration: none !important;
    transition: border-color var(--transition-fast);

    &:hover {
      border-color: var(--color-primary);
    }
  }

  .nav-next {
    text-align: right;
  }

  &__label {
    font-size: var(--font-size-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
    color: var(--color-secondary);
  }

  &__title {
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    line-height: var(--lh-heading);
  }
}

.post-card .format-badge {
  pointer-events: none;
}

.post-card__title a:hover {
  color: var(--color-secondary);
}

/* Sticky post badge in the card meta line */
.post-card__sticky {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-pill);
  background-color: var(--color-primary);
  color: var(--color-white);
  font-weight: var(--fw-semibold);
  letter-spacing: normal;
  text-transform: none;
}

/* ---------- Comments ---------- */
.comments-area {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: var(--border-width) solid var(--color-border);
}

.comment-list {
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;

  .children {
    margin: 0;
    padding-left: var(--space-4);
    list-style: none;
  }

  .comment-body {
    margin-bottom: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-xl);
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }

  .comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1);
    margin-bottom: var(--space-1-5);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
  }

  .comment-author {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    font-size: var(--font-size-sm);
    color: var(--color-text);

    .avatar {
      width: 2.75rem;
      height: 2.75rem;
      border-radius: var(--radius-round);
    }

    .says {
      display: none;
    }
  }

  .comment-content p:last-child {
    margin-bottom: 0;
  }

  .reply {
    margin-top: var(--space-1-5);
    font-size: var(--font-size-sm);
    font-weight: var(--fw-semibold);

    a {
      color: var(--color-primary);
      text-decoration: none !important;
    }
  }

  .bypostauthor > .comment-body {
    border-left: 0.1875rem solid var(--color-secondary);
  }
}

.comment-respond {
  .comment-notes,
  .logged-in-as {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
  }

  label {
    display: block;
    margin-bottom: var(--space-0-5);
    font-size: var(--font-size-sm);
    font-weight: var(--fw-medium);
  }

  input[type='text'],
  input[type='email'],
  input[type='url'],
  textarea {
    .aurelle-field();
  }

  .comment-form-cookies-consent {
    display: flex;
    align-items: flex-start;
    gap: var(--space-1);

    label {
      font-weight: var(--fw-regular);
    }
  }

  .comment-reply-title {
    color: var(--color-text);

    small {
      display: inline-block;
    }
  }

  #cancel-comment-reply-link {
    margin-left: var(--space-1);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-secondary);
    vertical-align: middle;
  }
}

/* Replying: the form sits under the comment as a light card */
.comment-list .comment-respond {
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-xl);
  background-color: var(--color-section-sand);
  color: var(--color-text);

  .comment-reply-title {
    margin-bottom: var(--space-1);
    font-size: var(--font-size-xl);
  }
}

/* ---------- Footer menu + widgets ---------- */
.site-footer__legal-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--font-size-sm);

  a:hover {
    color: var(--color-white);
  }
}

.footer-widget {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li {
    padding-block: 0.3rem;
  }

  a {
    color: var(--color-on-dark-muted);
    transition: color var(--transition-fast);

    &:hover {
      color: var(--color-white);
    }
  }

  p {
    font-size: var(--font-size-sm);
    color: var(--color-on-dark-muted);
  }

  + .footer-widget {
    margin-top: var(--space-4);
  }
}

/* ---------- Newsletter widget area ---------- */
.newsletter-widget {
  > p,
  .wp-block-paragraph {
    color: var(--color-on-dark-muted);
  }

  + .newsletter-widget {
    margin-top: var(--space-2);
  }

  h2,
  .wp-block-heading {
    color: var(--color-white);
  }

  /* Other plugins' sign-up forms (the design's .subscribe form styles itself) */
  form:not(:has(.subscribe)) {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    max-width: 32rem;
    margin-inline: auto;

    input[type='email'],
    input[type='text'] {
      .aurelle-field();
      flex: 1;
      min-width: 12rem;
      border-color: transparent;
      border-radius: var(--radius-pill);
    }

    button,
    input[type='submit'] {
      &:extend(.btn all);
      &:extend(.btn-light all);
      .aurelle-btn-base();
    }
  }
}

/* ---------- Scroll animations switched off in the Customizer ---------- */
.no-animations [data-reveal],
.no-animations [data-split] {
  opacity: 1 !important;
  transform: none !important;
}
