/* 12º CNED v0.5.62 — refinamento progressivo da navegação e motion design.
   Sem JS: menus utilizam hover/focus-within e todo o conteúdo permanece visível. */
body.cned-theme .site-header .nav-links > li.menu-item-has-children > a {
  padding-inline-end: 22px;
}
body.cned-theme .site-header .nav-links > li.menu-item-has-children {
  position: relative;
}
body.cned-theme .site-header .cned-submenu-toggle {
  position: absolute;
  inset-inline-end: 0;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 22px;
  height: 32px;
  padding: 0;
  background: transparent;
  color: #24334e;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  z-index: 2;
}
body.cned-theme .site-header .cned-submenu-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 200ms ease;
}
body.cned-theme .site-header .nav-links > li.menu-item-has-children:is(:hover, .cned-submenu-open) > .cned-submenu-toggle {
  color: var(--cned-primary, #2f51e8);
}
body.cned-theme .site-header .cned-submenu-toggle:focus-visible {
  outline: 2px solid var(--cned-primary, #2f51e8);
  outline-offset: 2px;
}
body.cned-theme .site-header .nav-links .sub-menu {
  box-sizing: border-box;
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  width: max-content;
  min-width: min(265px, calc(100vw - 32px));
  max-width: min(320px, calc(100vw - 32px));
  margin: 0;
  padding: 10px;
  border: 1px solid #dfe5f2;
  border-radius: 13px;
  background: #fff;
  color: #18243a;
  box-shadow: 0 16px 38px rgba(24, 31, 58, .17);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 210ms ease, transform 210ms ease, visibility 210ms;
}
body.cned-theme .site-header .nav-links .sub-menu li {
  display: block;
  width: 100%;
  border: 0;
}
body.cned-theme .site-header .nav-links .sub-menu a {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 43px;
  padding: 11px 13px;
  border-radius: 8px;
  background: transparent;
  color: #18243a;
  font-family: 'Bricolage Grotesque', Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.45;
  text-transform: none;
  white-space: normal;
  overflow-wrap: break-word;
  transition: color 175ms ease, background-color 175ms ease;
}
body.cned-theme .site-header .nav-links .sub-menu a:hover,
body.cned-theme .site-header .nav-links .sub-menu a:focus-visible {
  background: #edf2ff;
  background: color-mix(in srgb, var(--cned-primary, #2f51e8) 7%, white);
  color: var(--cned-primary, #2f51e8);
}
body.cned-theme .site-header .nav-links .sub-menu .current-menu-item > a,
body.cned-theme .site-header .nav-links .sub-menu .current_page_item > a {
  background: #e8efff;
  background: color-mix(in srgb, var(--cned-primary, #2f51e8) 11%, white);
  color: var(--cned-primary, #2449bf);
  font-weight: 800;
}
body.cned-theme .site-header .nav-links > li.menu-item-has-children:is(:hover, .cned-submenu-open):not(.cned-submenu-force-closed) > .sub-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
body.cned-theme .site-header .nav-links > li.menu-item-has-children:is(:hover, .cned-submenu-open):not(.cned-submenu-force-closed) > .cned-submenu-toggle svg {
  transform: rotate(180deg);
}
/* Sem JS, a navegação desktop ainda pode abrir pelo foco do teclado. */
@media (min-width: 901px) {
  html:not(.cned-navigation-enhanced) body.cned-theme .site-header .nav-links > li.menu-item-has-children:focus-within > .sub-menu {
    opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  }
}
/* Aplica-se a itens WordPress com filhos; nenhum nome de menu é fixado. */
@media (min-width: 901px) {
  body.cned-theme .site-header .nav-links > li.menu-item-has-children:last-child > .sub-menu,
  body.cned-theme .site-header .nav-links > li.menu-item-has-children:nth-last-child(2) > .sub-menu { left: auto; right: 0; }
}
@media (max-width: 900px) {
  body.cned-theme .site-header .main-navigation.is-open {
    max-height: min(78vh, 650px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body.cned-theme .site-header .nav-links > li.menu-item-has-children > a {
    padding-inline-end: 52px;
  }
  body.cned-theme .site-header .cned-submenu-toggle {
    top: 0;
    inset-inline-end: 0;
    transform: none;
    width: 44px;
    height: 44px;
  }
  body.cned-theme .site-header .nav-links .sub-menu {
    position: static;
    width: auto;
    min-width: 0;
    max-width: 100%;
    max-height: 0;
    margin: 0;
    padding: 0 7px;
    overflow: hidden;
    border: 0;
    border-radius: 9px;
    background: #f5f7ff;
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: none;
    transition: max-height 260ms ease, opacity 200ms ease, padding 260ms ease, visibility 260ms;
  }
  body.cned-theme .site-header .nav-links > li.menu-item-has-children:is(:hover, :focus-within) > .sub-menu {
    /* No toque e no teclado, somente o botão de expansão controla o accordion. */
    max-height: 0;
    padding-block: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  body.cned-theme .site-header .nav-links > li.menu-item-has-children.cned-submenu-open > .sub-menu {
    max-height: 70vh;
    margin-block: 0 10px;
    padding-block: 7px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    overflow-y: auto;
  }
  body.cned-theme .site-header .nav-links > li.menu-item-has-children.cned-submenu-open > .cned-submenu-toggle svg {
    transform: rotate(180deg);
  }
  body.cned-theme .site-header .nav-links .sub-menu a {
    font-size: 14px;
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.cned-theme .site-header .nav-links .sub-menu,
  body.cned-theme .site-header .nav-links .sub-menu a,
  body.cned-theme .site-header .cned-submenu-toggle svg { transition: none !important; }
}

/* Scroll reveal progressivo: usa translate individual para não conflitar com
   transform dos cards, hover, carrosséis, disco e elementos rotatórios. */
@media (prefers-reduced-motion: no-preference) {
  html.cned-motion-ready .cned-reveal-item:not(.cned-reveal-visible) {
    opacity: 0;
    translate: var(--cned-reveal-x, 0px) var(--cned-reveal-y, 26px);
  }
  html.cned-motion-ready .cned-reveal-item {
    transition: opacity 660ms cubic-bezier(.22,1,.36,1),
      translate 660ms cubic-bezier(.22,1,.36,1);
    transition-delay: var(--cned-reveal-delay, 0ms);
  }
  html.cned-motion-ready .cned-reveal-item.cned-reveal-visible {
    opacity: 1;
    translate: 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cned-reveal-item { opacity: 1 !important; translate: none !important; transition: none !important; }
}
