/* --------- Buttons --------- */

/* Mirrors elements.button in theme.json — keep both in step. */
.btn {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font-size: var(--wp--preset--font-size--medium);
  font-weight: 500;
  /* A <button> takes line-height: normal from the browser; the block
     buttons this mirrors inherit it. */
  line-height: inherit;
  padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--50);
  border-radius: 999px;
  background-color: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--secondary);
}

.btn:hover {
  background-color: var(--wp--preset--color--primary-dark);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn--secondary {
  background-color: var(--wp--preset--color--secondary);
  color: var(--wp--preset--color--contrast);
}

.btn--secondary:hover {
  background-color: color-mix(
    in srgb,
    var(--wp--preset--color--secondary) 88%,
    #000
  );
}

.btn--tertiary {
  background-color: var(--wp--preset--color--tertiary);
  color: var(--wp--preset--color--contrast);
}

.btn--tertiary:hover {
  background-color: color-mix(
    in srgb,
    var(--wp--preset--color--tertiary) 88%,
    #000
  );
}

/* --------- Menus --------- */

/* e88_render_menu() adds site-menu to every menu it renders. */
.site-menu,
.site-menu .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-menu a {
  transition: color 0.3s ease;
  white-space: nowrap;
}

/* --------- Pagination --------- */

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: var(--wp--preset--spacing--40);
}

.pagination .page-numbers {
  padding: 8px 14px;
  border: 1px solid var(--wp--preset--color--border);
}

.pagination .page-numbers.current,
.pagination .page-numbers:hover {
  background-color: var(--wp--preset--color--primary);
  border-color: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--base);
}

/* --------- Form fields --------- */

/* Never under 16px: below that iOS Safari zooms the page on focus. Form
   controls take line-height: normal from the browser instead of inheriting. */
input,
textarea,
select {
  border: none;
  border-radius: 15px;
  font-size: 16px;
  line-height: inherit;
  padding: 14px 20px;
  color: var(--wp--preset--color--contrast);
  background-color: color-mix(
    in srgb,
    var(--wp--preset--color--tertiary) 40%,
    var(--wp--preset--color--base)
  );
}

textarea {
  padding: 20px;
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 52px;
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: var(--wp--preset--color--primary);
  opacity: 1;
}

/* base.css and the rule above shape text fields; a checkbox gets the
   browser's own box back. */
input[type="checkbox"] {
  -webkit-appearance: auto;
  -moz-appearance: auto;
  appearance: auto;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  accent-color: var(--wp--preset--color--primary);
  cursor: pointer;
}

input[type="checkbox"][aria-invalid="true"] {
  outline: 1px solid var(--color-error);
  outline-offset: 2px;
}

/* The hidden first option is the select's placeholder; it is the only one with
   an empty value, so :invalid means it is still showing. */
select:invalid {
  color: var(--wp--preset--color--primary);
}

/* A select cannot hold a pseudo-element, so the chevron sits on a wrapper. */
.form-select {
  position: relative;
  display: block;
}

.form-select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 20px;
  width: 16px;
  height: 10px;
  transform: translateY(-50%);
  background-color: var(--wp--preset--color--primary);
  -webkit-mask: url(../img/chevron-down.svg) no-repeat center / contain;
  mask: url(../img/chevron-down.svg) no-repeat center / contain;
  pointer-events: none;
}

/* --------- Contact form --------- */

/* Not first: in the Contact section pattern it follows the intro paragraph,
   and needs more room than the column's block gap. */
.contact-box:not(:first-child) {
  margin-top: var(--wp--preset--spacing--40);
}

.contact-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.contact-form__input-wrap {
  width: 100%;
  max-width: 480px;
}

.contact-form__input-wrap--wide {
  max-width: none;
}

.contact-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 480px;
}

@media (max-width: 479px) {
  .contact-form__row {
    grid-template-columns: 1fr;
  }
}

.form-consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.form-consent input {
  flex: none;
}

.form-consent p {
  margin: 0;
}

.form-consent label {
  cursor: pointer;
}

.form-consent a {
  text-decoration: underline;
}

.contact-form .btn {
  margin-top: 12px;
}

.form-input {
  display: block;
  width: 100%;
}

.form-input:focus-visible {
  outline: 2px solid var(--wp--preset--color--primary);
  outline-offset: 2px;
}

.form-input[aria-invalid="true"] {
  box-shadow: inset 0 0 0 1px var(--color-error);
}

/* Empty until the script puts the browser's validation message here. */
.field-error:not(:empty) {
  display: block;
  margin-top: 6px;
  color: var(--color-error);
  font-size: var(--wp--preset--font-size--x-small);
}

.form-status:empty {
  display: none;
}

.form-status {
  margin: 0;
}

.form-status.is-error {
  color: var(--color-error);
}

.form-status.is-success {
  color: var(--color-success);
}

/* --------- Social share (Sassy Social Share) --------- */

.share {
  --share-tint: color-mix(
    in srgb,
    var(--wp--preset--color--contrast) 2%,
    transparent
  );
  --share-muted: color-mix(
    in srgb,
    var(--wp--preset--color--primary) 45%,
    var(--wp--preset--color--base)
  );
  margin-top: var(--wp--preset--spacing--70);
}

.share-icons .heateor_sss_sharing_ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

/* The plugin writes its sizes and colours as inline styles, some marked
   !important; the !important here answers those, not our own cascade. */
.share-icons .heateor_sss_sharing_ul > a {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
}

/* display: block, not just a flex item: the More button carries an inline
   display: inline-block !important, so for it the flex above never applies. */
.share-icons .heateor_sss_sharing_ul > a::after {
  content: attr(data-label);
  display: block;
  margin-top: 8px;
  text-align: center;
  color: var(--wp--preset--color--contrast);
  font-size: var(--wp--preset--font-size--x-small);
  line-height: 1.25;
  transition: color 0.2s ease;
}

.share-icons .heateor_sss_svg {
  position: relative;
  float: none !important;
  background-color: var(--share-tint) !important;
  transition: background-color 0.2s ease;
}

.share-icons .heateor_sss_svg svg {
  display: none !important;
}

/* The plugin's svg is hidden and the icon redrawn as a mask over a colour, so
   hover can recolour it. Centred by absolute positioning, not flex: the plugin
   marks display inline !important on the More button alone, and nothing in a
   stylesheet outranks that. */
.share-icons .heateor_sss_svg::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 24px;
  height: 24px;
  margin: auto;
  background-color: var(--wp--preset--color--contrast);
  -webkit-mask: var(--share-icon) no-repeat center / contain;
  mask: var(--share-icon) no-repeat center / contain;
  transition: background-color 0.2s ease;
}

.share-icons
  .heateor_sss_sharing_ul
  > a:is(:hover, :focus-visible)
  .heateor_sss_svg {
  background-color: var(--wp--preset--color--primary) !important;
}

.share-icons
  .heateor_sss_sharing_ul
  > a:is(:hover, :focus-visible)
  .heateor_sss_svg::before {
  background-color: var(--wp--preset--color--base);
}

.share-icons .heateor_sss_sharing_ul > a:is(:hover, :focus-visible)::after {
  color: var(--wp--preset--color--primary);
}

/* Classes the plugin generates: telegram, messenger and X as
   heateor_sss_button_<name>, whatsapp, email and more as heateor_sss_<name>.
   A plugin update that renames one leaves that icon blank. */
.share-icons .heateor_sss_button_telegram {
  --share-icon: url(../img/socshare/telegram.svg);
}

.share-icons .heateor_sss_button_facebook_messenger {
  --share-icon: url(../img/socshare/chat.svg);
}

.share-icons .heateor_sss_button_x {
  --share-icon: url(../img/socshare/x.svg);
}

.share-icons .heateor_sss_whatsapp {
  --share-icon: url(../img/socshare/whatsapp.svg);
}

.share-icons .heateor_sss_email {
  --share-icon: url(../img/socshare/email.svg);
}

.share-icons .heateor_sss_more {
  --share-icon: url(../img/socshare/more.svg);
}

.share-link-title {
  margin: var(--wp--preset--spacing--50) 0 10px;
  color: var(--share-muted);
  font-size: var(--wp--preset--font-size--x-small);
  font-weight: 600;
  text-align: center;
}

.share-link {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 512px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 16px;
  background-color: var(--share-tint);
}

.share-link input[type="url"] {
  flex-grow: 1;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background-color: transparent;
  color: var(--share-muted);
  font-size: 14px;
  text-overflow: ellipsis;
}

.share-copy {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background-color: var(--wp--preset--color--primary);
  -webkit-mask: url(../img/socshare/copy.svg) no-repeat center / contain;
  mask: url(../img/socshare/copy.svg) no-repeat center / contain;
  transition: background-color 0.2s ease;
}

.share-copy:is(:hover, :focus-visible),
.share-copy.is-copied {
  background-color: var(--wp--preset--color--contrast);
}

.share-copied:not(:empty) {
  margin: 10px 0 0;
  color: var(--wp--preset--color--primary);
  font-size: var(--wp--preset--font-size--x-small);
  text-align: center;
}

/* --------- Utilities --------- */

.grecaptcha-badge {
  display: none;
  visibility: hidden;
}

/* --------- Popup --------- */

.has-popup {
  overflow: hidden;
  scrollbar-gutter: stable;
}

/* The panel never grows past the screen: a long text scrolls inside
   .popup__content, while the close button and anything else outside it stay
   put. */
.popup {
  position: fixed;
  inset: 0;
  z-index: var(--z-popup);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px var(--wp--style--root--padding-left);
}

.popup[hidden] {
  display: none;
}

.popup--light {
  --popup-bg: color-mix(
    in srgb,
    var(--wp--preset--color--surface) 97%,
    transparent
  );
  --popup-ink: var(--wp--preset--color--contrast);
  --popup-accent: var(--wp--preset--color--primary);
}

.popup--dark {
  --popup-bg: color-mix(
    in srgb,
    var(--wp--preset--color--primary) 95%,
    transparent
  );
  --popup-ink: var(--wp--preset--color--base);
  --popup-accent: var(--wp--preset--color--secondary);
}

.popup__panel {
  --popup-pad-y: var(--wp--preset--spacing--50);
  --popup-pad-x: var(--wp--preset--spacing--50);
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 944px;
  max-height: 100%;
  overflow: hidden;
  border-radius: 16px;
  background-color: var(--popup-bg);
  color: var(--popup-ink);
}

@media (max-width: 767px) {
  .popup__panel {
    --popup-pad-y: var(--wp--preset--spacing--40);
    --popup-pad-x: var(--wp--preset--spacing--30);
  }
}

.popup__content {
  min-height: 0;
  padding: var(--popup-pad-y) var(--popup-pad-x);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.popup__content:focus {
  outline: none;
}

@media (prefers-reduced-motion: no-preference) {
  .popup__panel {
    animation: popup-in 0.25s ease-out;
  }
}

@keyframes popup-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.popup__close {
  position: absolute;
  top: 12px;
  right: 22px;
  z-index: 1;
  width: 40px;
  height: 40px;
  color: inherit;
}

@media (max-width: 767px) {
  .popup__close {
    top: 4px;
    right: 4px;
  }
}

.popup__close::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: currentColor;
  -webkit-mask: url(../img/close.svg) no-repeat center / 12px;
  mask: url(../img/close.svg) no-repeat center / 12px;
}

.popup__title {
  margin: 0;
  padding-right: 40px;
  font-size: var(--wp--preset--font-size--xl);
}

.popup__body {
  max-width: 750px;
  margin-top: var(--wp--preset--spacing--40);
  font-size: var(--wp--preset--font-size--medium);
}

.popup__body > * {
  margin-block: 0;
}

.popup__body > * + * {
  margin-block-start: var(--wp--style--block-gap);
}
