:root {
  /*
   * Breakpoints canônicos MGM (usar em CSS novo):
   * -- mobile  ≤ 767px
   * -- tablet  768px – 1023px
   * -- desktop ≥ 1024px
   * (valores em px: media queries não aceitam custom properties)
   */
  --mgm-bp-mobile-max: 767;
  --mgm-bp-tablet-min: 768;
  --mgm-bp-tablet-max: 1023;
  --mgm-bp-desktop-min: 1024;

  /* Largura útil da viewport (desconta a scrollbar quando visível) */
  --mgm-viewport-width: calc(100vw - (100vw - 100%));
  --mgm-header-height: 148px;
  --mgm-touch-min: 44px;

  /*
   * Sistema definitivo de containers (MGM)
   * wide 1280 · main 1200 · narrow 960 · reading 760
   */
  --mgm-container-wide: 1280px;
  --mgm-container-main: 1200px;
  --mgm-container-narrow: 960px;
  --mgm-container-reading: 760px;
  --mgm-page-gutter: clamp(18px, 3vw, 32px);

  /* Aliases (legado / theme.json wide ≈ main) */
  --mgm-reading-width: var(--mgm-container-reading);
  --mgm-wide-width: var(--mgm-container-main);

  /* Cores (= theme.json palette) */
  --mgm-navy-900: #00002B;
  --mgm-navy-700: #17173E;
  --mgm-ivory: #F8F5EF;
  --mgm-gray-100: #F1F3F6;
  --mgm-gray-600: #5E6673;
  --mgm-charcoal: #1D2433;
  --mgm-white: #FFFFFF;

  /* Dourado sitewide (= botão CTA) */
  --mgm-gold: #C5A059;
  --mgm-gold-hover: #D4B06E;
  --mgm-gold-soft: #E8D4A8;
  /* Texto dourado sobre fundo claro (≥4.5:1 com branco) */
  --mgm-gold-text: #8A6A2F;
  --mgm-gold-rgb: 197, 160, 89;
  --mgm-gold-on-dark: #C5A059;
  --mgm-gold-on-dark-rgb: 197, 160, 89;
  --mgm-gold-hover-on-dark: #D4B06E;
  --mgm-focus: 3px solid var(--mgm-gold);
  /* CTA dourado: mesmo ouro + texto navy */
  --mgm-cta-gold: #C5A059;
  --mgm-cta-gold-hover: #D4B06E;
  --mgm-cta-gold-text: #00002B;

  /* Forma */
  --mgm-radius-sm: 4px;
  --mgm-radius-md: 6px;
  --mgm-radius-lg: 12px;
  --mgm-shadow-soft: 0 12px 40px rgba(0, 0, 43, .10);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}
body { margin: 0; padding: 0; text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; }
a, button, input, select, textarea { transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
:focus-visible { outline: var(--mgm-focus); outline-offset: 3px; }

/* ·· Containers semânticos ·· */
.mgm-container--wide {
  width: min(calc(100% - (var(--mgm-page-gutter) * 2)), var(--mgm-container-wide));
  max-width: var(--mgm-container-wide);
  margin-inline: auto;
}
.mgm-container,
.mgm-container--main {
  width: min(calc(100% - (var(--mgm-page-gutter) * 2)), var(--mgm-container-main));
  max-width: var(--mgm-container-main);
  margin-inline: auto;
}
.mgm-container--narrow {
  width: min(calc(100% - (var(--mgm-page-gutter) * 2)), var(--mgm-container-narrow));
  max-width: var(--mgm-container-narrow);
  margin-inline: auto;
}
.mgm-reading,
.mgm-reading-width {
  width: min(100%, var(--mgm-container-reading));
  max-width: var(--mgm-container-reading);
}
.mgm-reading-width--center {
  width: min(100%, var(--mgm-container-reading));
  max-width: var(--mgm-container-reading);
  margin-inline: auto;
}

/* Comprimento de linha editorial (não aplicar em cards/grids) */
.mgm-prose {
  max-width: min(100%, 68ch);
}
.mgm-lead {
  max-width: min(100%, 62ch);
}

.mgm-eyebrow { font-family: var(--wp--preset--font-family--interface); font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--mgm-gold-text, #8A6A2F); }
.is-dark .mgm-eyebrow,
.mgm-hero .mgm-eyebrow,
.has-navy-900-background-color .mgm-eyebrow,
.has-navy-700-background-color .mgm-eyebrow,
.mgm-dark-cta .mgm-eyebrow,
.mgm-footer .mgm-eyebrow {
  color: var(--mgm-gold);
}
/* Skip link canônico do WordPress (um só · evita duplicata com o tema) */
.skip-link.screen-reader-text:focus,
#wp-skip-link:focus {
  background: var(--mgm-white, #fff);
  color: var(--mgm-navy-900, #00002b);
  outline: var(--mgm-focus);
  outline-offset: 3px;
  border-radius: var(--mgm-radius-sm, 4px);
  box-shadow: var(--mgm-shadow-soft);
  z-index: 100000;
}
.mgm-skip-link { position: absolute; left: 1rem; top: -100px; z-index: 9999; background: #fff; color: #00002b; padding: .75rem 1rem; }
.mgm-skip-link:focus { top: 1rem; }

@media (forced-colors: active) {
  :focus-visible {
    outline: 3px solid Highlight;
    outline-offset: 3px;
  }
  .mgm-mega-cta--primary,
  .wp-element-button,
  .mgm-form__submit {
    border: 2px solid ButtonText;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (prefers-contrast: more) {
  :root {
    --mgm-focus: 3px solid var(--mgm-navy-900);
  }
  a, button, .wp-element-button {
    text-decoration-thickness: from-font;
  }
}

/* Alvos de toque mínimos (tablet + mobile) */
@media (max-width: 1023px) {
  .mgm-header__cta .wp-block-button__link,
  .mgm-header .wp-element-button {
    min-height: var(--mgm-touch-min) !important;
    padding: .55rem 1rem !important;
    font-size: .6875rem !important;
  }
}


main { min-height: 60vh; }
.mgm-section { padding-block: clamp(4rem, 8vw, 7rem); }
.mgm-section__heading { max-width: 780px; margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.mgm-header__inner {
  min-height: 0;
  gap: .75rem 1rem;
  flex-wrap: nowrap !important;
  align-items: center !important;
}
.mgm-site-logo { flex: 0 0 auto; line-height: 0; }
.mgm-site-logo img { display: block; width: auto; height: auto; max-height: var(--mgm-header-logo-max-h, 56px); max-width: var(--mgm-header-logo-max-w, 320px); }
.mgm-primary-nav { font-family: var(--wp--preset--font-family--interface); font-size: .84rem; flex: 0 1 auto; min-width: 0; justify-content: flex-end; }
.mgm-primary-nav a { text-decoration: none; }
/* Menu principal em caixa alta (rótulos e submenu) */
.mgm-primary-nav .wp-block-navigation-item__label,
.mgm-primary-nav .wp-block-navigation-item__content {
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
.mgm-primary-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__label,
.mgm-primary-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
  text-transform: none;
  letter-spacing: .025em;
  font-weight: 500;
  font-size: 1.05em;
}
.mgm-lang-switcher { flex: 0 0 auto; }
.mgm-header__cta { flex: 0 0 auto; margin: 0 !important; }
.mgm-header__cta .wp-block-button__link,
.mgm-header .wp-element-button {
  min-height: 32px !important;
  padding: .35rem .75rem !important;
  font-size: .625rem !important;
  font-weight: 600 !important;
  letter-spacing: .04em !important;
  white-space: nowrap;
  line-height: 1.15;
  border-radius: 4px !important;
  box-shadow: none !important;
}
.mgm-footer { padding-block: clamp(4rem, 7vw, 6rem) 2rem; }
.mgm-footer a { color: #fff; text-decoration-color: rgba(255,255,255,.35); }
.mgm-footer__grid { gap: clamp(2rem, 4vw, 4rem); }
.mgm-footer__legal { color: rgba(255,255,255,.72); }
.mgm-footer__legal strong { color: #fff; }
.mgm-footer ul { list-style: none; padding-left: 0; }
.mgm-footer li { margin-block: .55rem; }

/* Language switcher · PT / EN / ES; quadrados na proporção da bandeira (~22:16) */
.mgm-lang-switcher {
  --mgm-lang-flag-w: 1.75rem;
  --mgm-lang-flag-h: 1.25rem;
  display: inline-flex;
  gap: .65rem;
  align-items: center;
  font-family: var(--wp--preset--font-family--interface);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.mgm-lang-switcher__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--mgm-lang-flag-w);
  height: var(--mgm-lang-flag-h);
  aspect-ratio: 22 / 16;
  text-decoration: none;
  color: var(--wp--preset--color--gray-600);
  padding: 0;
  border: 0;
  border-radius: 3px;
  line-height: 1;
  overflow: hidden;
  outline: none;
  box-shadow: none;
}
.mgm-lang-switcher__link:hover,
.mgm-lang-switcher__link:focus-visible {
  color: var(--wp--preset--color--gold-600);
  background: transparent !important;
  border: 0;
  outline: none;
  box-shadow: none;
}
.mgm-lang-switcher__link.is-current {
  color: var(--wp--preset--color--navy-900);
  background: var(--wp--preset--color--gray-100);
  border: 0;
  cursor: default;
}
@media (hover: hover) and (min-width: 1024px) {
  .mgm-lang-switcher__link.is-current:hover,
  .mgm-lang-switcher__link.is-current:focus-visible {
    background: transparent !important;
    border: 0;
    outline: none;
    box-shadow: none;
  }
}
@media (max-width: 1023px), (hover: none), (pointer: coarse) {
  .mgm-lang-switcher__link.is-current {
    background: transparent;
  }
}
.mgm-lang-switcher__code {
  line-height: 1;
  transition: opacity .16s ease;
  position: relative;
  z-index: 1;
}
.mgm-lang-switcher__flag {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
  z-index: 2;
}
/* Desktop com hover: bandeira só no hover; focus-visible mantém código sem caixa */
@media (hover: hover) and (min-width: 1024px) {
  .mgm-lang-switcher__link:hover .mgm-lang-switcher__code {
    opacity: 0;
  }
  .mgm-lang-switcher__link:hover .mgm-lang-switcher__flag {
    opacity: 1;
  }
  .mgm-lang-switcher__link:focus-visible .mgm-lang-switcher__code {
    text-decoration: underline;
    text-underline-offset: 0.18em;
  }
}

/*
 * Touch / coarse / ≤1023px: bandeiras sempre visíveis.
 * - Esmaecidas (~0.7); .is-current / :active = vivas (1)
 * - Sem caixa branca no current (evita moldura / linha no SVG BR)
 * - Hit ≥44px via ::before (não infla o layout — bordas content-box
 *   cortavam EN/ES no header mobile)
 */
@media (max-width: 1023px), (hover: none), (pointer: coarse) {
  .mgm-lang-switcher__link {
    box-sizing: border-box;
    width: var(--mgm-lang-flag-w);
    height: var(--mgm-lang-flag-h);
    min-width: var(--mgm-lang-flag-w);
    min-height: var(--mgm-lang-flag-h);
    padding: 0;
    overflow: visible;
    background: transparent !important;
    border: 0 !important;
  }

  .mgm-lang-switcher__link::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--mgm-touch-min);
    height: var(--mgm-touch-min);
    transform: translate(-50%, -50%);
    z-index: 0;
  }

  .mgm-lang-switcher__link:hover,
  .mgm-lang-switcher__link:focus-visible,
  .mgm-lang-switcher__link.is-current,
  .mgm-lang-switcher__link.is-current:hover,
  .mgm-lang-switcher__link.is-current:focus-visible,
  .mgm-lang-switcher__link.is-current:active {
    background: transparent !important;
    border: 0 !important;
  }

  .mgm-lang-switcher__flag {
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    transform: none;
    opacity: .7 !important;
  }

  .mgm-lang-switcher__link.is-current .mgm-lang-switcher__flag,
  .mgm-lang-switcher__link:active .mgm-lang-switcher__flag {
    opacity: 1 !important;
  }

  .mgm-lang-switcher__code {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0 !important;
  }

  .mgm-lang-switcher__link:hover .mgm-lang-switcher__code,
  .mgm-lang-switcher__link:focus-visible .mgm-lang-switcher__code {
    opacity: 0 !important;
  }
}

.is-dark .mgm-lang-switcher__link,
.mgm-header.has-navy-900-background-color .mgm-lang-switcher__link { color: rgba(255,255,255,.85); }
/* Desktop: caixa clara atrás do código PT/EN/ES do idioma atual */
@media (hover: hover) and (min-width: 1024px) {
  .is-dark .mgm-lang-switcher__link.is-current,
  body.home .mgm-lang-switcher__link.is-current {
    color: var(--wp--preset--color--navy-900, #00002B);
    background: #fff;
  }
  body.home .mgm-lang-switcher__link.is-current:hover,
  body.home .mgm-lang-switcher__link.is-current:focus-visible {
    background: transparent !important;
  }
}
/* Touch: sem caixa branca no current (linha/moldura no BR) */
@media (max-width: 1023px), (hover: none), (pointer: coarse) {
  body.home .mgm-lang-switcher__link.is-current,
  body.home .mgm-lang-switcher__link.is-current:hover,
  body.home .mgm-lang-switcher__link.is-current:focus-visible,
  body.home .mgm-lang-switcher__link:not(.is-current),
  body.home .mgm-lang-switcher__link:not(.is-current):hover,
  body.home .mgm-lang-switcher__link:not(.is-current):focus-visible,
  body.mgm-inner-page .mgm-lang-switcher__link.is-current,
  body.mgm-inner-page .mgm-lang-switcher__link.is-current:hover,
  body.mgm-inner-page .mgm-lang-switcher__link.is-current:focus-visible,
  .is-dark .mgm-lang-switcher__link.is-current {
    background: transparent !important;
  }

  @media (hover: hover) {
    .mgm-lang-switcher__link:hover .mgm-lang-switcher__flag {
      opacity: 1 !important;
    }
  }
}
