/* NHX CP09 · Public appearance control
 * Scope: header preference controls only.
 * Palette ownership remains in the CP07 semantic theme tokens in utilities.css.
 * This file MUST consume semantic tokens; it must not become a second palette owner.
 */

.nhx-theme-cycle {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--nhx-control-border);
  border-radius: 999px;
  background: var(--nhx-control-bg);
  color: var(--nhx-control-text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nhx-accent) 8%, transparent);
  cursor: pointer;
  line-height: 1;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}

.nhx-theme-cycle:hover {
  color: var(--nhx-accent);
  border-color: color-mix(in srgb, var(--nhx-accent) 48%, var(--nhx-control-border));
}

.nhx-theme-cycle:focus-visible {
  outline: 2px solid var(--nhx-focus-ring);
  outline-offset: 3px;
}

.nhx-theme-cycle:active {
  transform: translateY(1px);
}

.nhx-theme-cycle__icon {
  display: none;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.nhx-theme-cycle__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nhx-theme-cycle[data-nhx-theme-state="system"] .nhx-theme-cycle__icon--system,
.nhx-theme-cycle[data-nhx-theme-state="light"] .nhx-theme-cycle__icon--light,
.nhx-theme-cycle[data-nhx-theme-state="night"] .nhx-theme-cycle__icon--night {
  display: block;
}

/* Desktop: language -> appearance -> CTA, as one compact preference/action cluster. */
@media (min-width: 901px) {
  .nhx-header .nhx-lang-switcher {
    min-width: 64px;
    height: 36px;
    padding: 3px 6px;
  }

  .nhx-header .nhx-lang-switcher__option {
    min-width: 24px;
    padding: 6px 4px;
    font-size: .72rem;
  }

  .nhx-header .nhx-header__desktop-cta {
    gap: 6px;
  }

  .nhx-header .nhx-lang-switcher + .nhx-header__desktop-cta {
    margin-left: -4px;
  }
}

/* Mobile/tablet: keep language + appearance visible before the hamburger.
 * These selectors intentionally outrank the older inline responsive coordinates in header.html.
 * The CTA itself remains hidden; its wrapper owns the single visible theme button.
 */
@media (max-width: 900px) {
  .nhx-header .nhx-header__inner .nhx-header__desktop-cta {
    display: flex !important;
    position: absolute !important;
    top: 50% !important;
    right: 62px !important;
    bottom: auto !important;
    left: auto !important;
    transform: translateY(-50%) !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 1003 !important;
  }

  .nhx-header .nhx-header__inner .nhx-header__desktop-cta > .nhx-button,
  .nhx-header .nhx-header__inner .nhx-header__desktop-cta > .wp-block-buttons,
  .nhx-header .nhx-header__inner .nhx-header__desktop-cta > .wp-block-button,
  .nhx-header .nhx-header__inner .nhx-header__desktop-cta > .wp-block-button__link,
  .nhx-header .nhx-header__inner .nhx-header__desktop-cta > .wp-element-button {
    display: none !important;
  }

  .nhx-header .nhx-header__inner .nhx-theme-cycle {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
  }

  .nhx-header .nhx-header__inner .nhx-lang-switcher {
    right: 104px !important;
    min-width: 58px !important;
    height: 34px !important;
    padding: 3px 5px !important;
  }

  .nhx-header .nhx-header__inner .nhx-lang-switcher__option {
    min-width: 22px !important;
    padding: 5px 3px !important;
    font-size: .69rem !important;
  }

  .nhx-header .nhx-header__inner.nhx-header__inner {
    padding-right: 166px !important;
  }
}

@media (max-width: 420px) {
  .nhx-header .nhx-header__inner .nhx-header__desktop-cta {
    right: 58px !important;
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
  }

  .nhx-header .nhx-header__inner .nhx-theme-cycle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  .nhx-header .nhx-header__inner .nhx-lang-switcher {
    right: 97px !important;
    min-width: 55px !important;
    height: 32px !important;
    padding-inline: 4px !important;
  }

  .nhx-header .nhx-header__inner .nhx-lang-switcher__divider {
    display: none;
  }

  .nhx-header .nhx-header__inner.nhx-header__inner {
    padding-right: 158px !important;
  }
}
