/*
 * Hilux Base: WordPress glue that the framework does not ship.
 * Loaded after hilux.min.css. Everything sits in @layer components so a
 * child theme's @layer site always wins without specificity fights.
 * Tokens only: no raw colours, sizes or durations here.
 */
@layer components {
  /* Header logo (custom-logo). */
  .hx-header__logo {
    block-size: 2.25rem;
    inline-size: auto;
  }

  /* Text + image section. */
  /* Text + image: two page-grid halves (see sections/media-text.php). */
  .hx-media-text {
    align-items: center;
  }

  /* Footer columns: 2 per row on phones and tablets, 4 across on desktop. */
  @media (width < 48rem) {
    .hx-footer__cols > * { grid-column: span 2; }
  }

  .hx-media-text > .hx-frame > :is(span:empty) {
    inline-size: 100%;
    block-size: 100%;
    background-color: var(--hx-color-surface-2);
  }

  /* Logo wall. */
  .hx-logos {
    --hx-cluster-gap: var(--hx-space-l-xl);
    align-items: center;
  }

  .hx-logos__item {
    display: flex;
    align-items: center;
    color: var(--hx-color-text-2);
  }

  .hx-logos__img {
    max-block-size: 2.5rem;
    inline-size: auto;
    filter: grayscale(1);
    opacity: 0.75;
    transition: filter var(--hx-duration-base) var(--hx-ease-standard), opacity var(--hx-duration-base) var(--hx-ease-standard);
  }

  .hx-logos__item:hover .hx-logos__img {
    filter: none;
    opacity: 1;
  }

  .hx-logos__name {
    font-family: var(--hx-font-display);
    font-size: var(--hx-step-1);
    font-weight: var(--hx-weight-bold);
    letter-spacing: var(--hx-heading-tracking);
    white-space: nowrap;
  }

  .hx-logos a {
    color: inherit;
    text-decoration: none;
  }

  /* Pagination (paginate_links, wp_link_pages). */
  .hx-pagination :is(a, span) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-inline-size: var(--hx-tap-min);
    min-block-size: var(--hx-tap-min);
    padding-inline: var(--hx-space-xs);
    border: var(--hx-border-width) solid var(--hx-color-border);
    border-radius: var(--hx-radius-m);
    color: var(--hx-color-text-1);
    text-decoration: none;
  }

  .hx-pagination a:hover {
    background-color: var(--hx-color-surface-2);
  }

  .hx-pagination .current {
    border-color: var(--hx-color-brand);
    background-color: var(--hx-color-brand);
    color: var(--hx-color-on-brand);
  }

  .hx-pagination .dots {
    border-color: transparent;
  }

  /* Comments. */
  .hx-comments__list,
  .hx-comments__list .children {
    display: grid;
    gap: var(--hx-space-m);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .hx-comments__list .children {
    margin-block-start: var(--hx-space-m);
    padding-inline-start: var(--hx-space-l);
    border-inline-start: var(--hx-border-width) solid var(--hx-color-border);
  }

  .hx-comments .comment-body {
    display: grid;
    gap: var(--hx-space-2xs);
  }

  .hx-comments .comment-meta {
    font-size: var(--hx-step--1);
    color: var(--hx-color-text-2);
  }

  .hx-comments .avatar {
    border-radius: var(--hx-radius-round);
  }

  .hx-comments .comment-form :is(input:not([type="checkbox"], [type="submit"]), textarea) {
    inline-size: 100%;
  }

  /* Editor-only contact placeholder. */
  [data-hx-placeholder-form] :disabled {
    cursor: not-allowed;
  }

  /* Empty, editable slots (logged-in editors only; the front-end editor plugin styles these properly). */
  [data-hx-empty] {
    display: inline-block;
    min-inline-size: 4ch;
    min-block-size: 1lh;
    outline: 1px dashed var(--hx-color-border-strong);
    outline-offset: 2px;
  }

  /* Core leftovers on classic pages. */
  .screen-reader-text {
    position: absolute !important;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .wp-caption-text,
  .gallery-caption {
    font-size: var(--hx-step--1);
    color: var(--hx-color-text-2);
  }
}

/* Admin bar + sticky header: keep the header below the bar. */
@layer site {
  body.admin-bar .hx-header[data-sticky] {
    inset-block-start: var(--wp-admin--admin-bar--height, 32px);
  }

  @media (width < 600px) {
    body.admin-bar .hx-header[data-sticky] {
      inset-block-start: 0;
    }
  }
}
