/* ===== AEM Social - Estilos Customizados ===== */

:root {
  --aem-blue: 220 80% 22%;
  --aem-blue-deep: 222 85% 14%;
  --aem-blue-light: 215 75% 40%;
  --aem-green: 95 70% 45%;
  --aem-green-deep: 110 65% 32%;
  --aem-orange: 28 95% 55%;
  --aem-orange-light: 35 100% 62%;

  --background: 0 0% 100%;
  --foreground: 222 85% 14%;
  --card: 0 0% 100%;
  --muted: 220 20% 96%;
  --muted-foreground: 220 15% 40%;
  --border: 220 20% 90%;

  --gradient-hero: linear-gradient(135deg, hsl(222 85% 14%) 0%, hsl(220 80% 22%) 50%, hsl(110 65% 32%) 100%);
  --gradient-brand: linear-gradient(90deg, hsl(220 80% 22%), hsl(95 70% 45%), hsl(28 95% 55%));
  --gradient-orange: linear-gradient(135deg, hsl(28 95% 55%), hsl(35 100% 62%));
  --gradient-blue: linear-gradient(135deg, hsl(222 85% 14%), hsl(220 80% 22%));
  --gradient-green: linear-gradient(135deg, hsl(110 65% 32%), hsl(95 70% 45%));

  --shadow-glow-orange: 0 10px 40px -10px hsl(28 95% 55% / 0.5);
  --shadow-glow-blue: 0 10px 40px -10px hsl(220 80% 22% / 0.5);
  --shadow-elegant: 0 20px 60px -20px hsl(222 85% 14% / 0.3);
  --shadow-card: 0 8px 30px -10px hsl(222 85% 14% / 0.15);
}

body {
  font-family: 'Montserrat', sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  letter-spacing: calc(-0.02em + ((var(--a11y-letter-spacing) - 1) * 0.04em));
}

.font-display {
  font-family: 'Racing Sans One', sans-serif;
  letter-spacing: calc(0.02em + ((var(--a11y-letter-spacing) - 1) * 0.04em));
}

/* Gradientes utilitários */
.bg-gradient-hero    { background: var(--gradient-hero); }
.bg-gradient-orange  { background: var(--gradient-orange); }
.bg-gradient-blue    { background: var(--gradient-blue); }
.bg-gradient-green   { background: var(--gradient-green); }
.bg-gradient-brand   { background: var(--gradient-brand); }

.text-gradient-brand {
  background: var(--gradient-brand);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.text-gradient-orange {
  background: var(--gradient-orange);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.shadow-glow-orange { box-shadow: var(--shadow-glow-orange); }
.shadow-glow-blue   { box-shadow: var(--shadow-glow-blue); }
.shadow-elegant     { box-shadow: var(--shadow-elegant); }
.shadow-card        { box-shadow: var(--shadow-card); }

/* Decorações */
.speed-lines::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    90deg, transparent 0, transparent 40px,
    hsl(var(--aem-orange) / 0.08) 40px,
    hsl(var(--aem-orange) / 0.08) 41px);
  pointer-events: none;
}

.checker-bg {
  background-image:
    linear-gradient(45deg, hsl(var(--aem-blue-deep)) 25%, transparent 25%),
    linear-gradient(-45deg, hsl(var(--aem-blue-deep)) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, hsl(var(--aem-blue-deep)) 75%),
    linear-gradient(-45deg, transparent 75%, hsl(var(--aem-blue-deep)) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0px;
}

/* Borda animada do navbar */
.navbar-brand-border { position: relative; background-clip: padding-box; }
.navbar-brand-border::before {
  content: ''; position: absolute; inset: 0; padding: 3px; border-radius: inherit;
  background: linear-gradient(90deg,
    hsl(var(--aem-blue)) 0%,
    hsl(var(--aem-blue-light)) 20%,
    hsl(var(--aem-green)) 45%,
    hsl(var(--aem-orange)) 70%,
    hsl(var(--aem-orange-light)) 85%,
    hsl(var(--aem-blue)) 100%);
  background-size: 200% 100%;
  animation: brand-border-flow 8s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

/* Speed streaks no Hero */
.speed-streak {
  position: absolute; left: -20%; width: 30%; height: 4px; border-radius: 9999px;
  background: linear-gradient(90deg, transparent, hsl(var(--aem-orange) / 0.6), transparent);
  animation: streak 3s linear infinite;
  opacity: 0;
}

/* Form */
.form-input {
  width: 100%; padding: 0.75rem 1rem; border-radius: 0.75rem;
  border: 2px solid hsl(var(--border)); background: hsl(var(--background));
  font-weight: 500; outline: none; transition: border-color .2s;
}
.form-input:focus { border-color: hsl(var(--aem-orange)); }

/* Nav links */
.nav-link {
  position: relative; padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 600;
  color: hsl(var(--aem-blue-deep)); transition: color .2s;
}
.nav-link:hover { color: hsl(var(--aem-orange)); }
.nav-link::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 0; height: 2px; background: var(--gradient-orange); transition: width .3s;
}
.nav-link:hover::after { width: 75%; }

.mob-link {
  padding: 0.75rem 1rem; color: hsl(var(--aem-blue-deep));
  font-weight: 600; border-radius: 0.5rem;
}
.mob-link:hover { background: hsl(var(--aem-blue-deep) / 0.05); }

/* Busca no site */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.site-search-input {
  width: 100%; padding: 0.625rem 0.875rem 0.625rem 2.5rem;
  border-radius: 9999px; border: 2px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.5); font-size: 0.875rem; font-weight: 500;
  color: hsl(var(--aem-blue-deep)); outline: none; transition: border-color .2s, box-shadow .2s;
}
.site-search-input::placeholder { color: hsl(var(--muted-foreground)); }
.site-search-input:focus {
  border-color: hsl(var(--aem-orange));
  box-shadow: 0 0 0 3px hsl(var(--aem-orange) / 0.15);
  background: hsl(var(--background));
}

#siteSearchDesktop .site-search-input { width: 10rem; }
@media (min-width: 1280px) {
  #siteSearchDesktop .site-search-input { width: 12rem; }
}

.site-search-icon {
  position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%);
  width: 1rem; height: 1rem; color: hsl(var(--muted-foreground)); pointer-events: none;
}

.site-search-results {
  position: fixed; z-index: 60; overflow-y: auto;
  max-height: min(24rem, calc(100vh - 7rem));
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: 1rem; box-shadow: var(--shadow-elegant);
}

.site-search-results.is-empty {
  padding: 1rem 1.25rem; font-size: 0.875rem;
  color: hsl(var(--muted-foreground)); text-align: center;
}

.site-search-result {
  display: flex; align-items: flex-start; gap: 0.75rem;
  width: 100%; padding: 0.875rem 1rem; text-align: left;
  border-bottom: 1px solid hsl(var(--border) / 0.7);
  transition: background-color .15s;
}
.site-search-result:last-child { border-bottom: 0; }
.site-search-result:hover,
.site-search-result:focus-visible {
  background: hsl(var(--aem-blue-deep) / 0.05); outline: none;
}

.site-search-result-type {
  flex-shrink: 0; font-size: 0.625rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: hsl(var(--aem-orange)); background: hsl(var(--aem-orange) / 0.1);
  padding: 0.25rem 0.5rem; border-radius: 9999px; margin-top: 0.125rem;
}

.site-search-result-title {
  font-size: 0.875rem; font-weight: 700; color: hsl(var(--aem-blue-deep));
  line-height: 1.3;
}

.site-search-result-desc {
  font-size: 0.75rem; color: hsl(var(--muted-foreground));
  margin-top: 0.125rem; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.doc-card.is-search-highlight {
  border-color: hsl(var(--aem-orange)) !important;
  box-shadow: var(--shadow-glow-orange);
}

.social-icon {
  width: 2.75rem; height: 2.75rem; border-radius: 9999px;
  background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center;
  transition: all .2s; color: white;
}
.social-icon:hover { background: var(--gradient-orange); transform: scale(1.1); }

/* Animations */
@keyframes brand-border-flow {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes streak {
  0%   { transform: translateX(0);    opacity: 0; }
  50%  { opacity: 0.6; }
  100% { transform: translateX(500%); opacity: 0; }
}
@keyframes float-slow {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-20px); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 30px hsl(var(--aem-orange) / 0.4); }
  50%      { box-shadow: 0 0 60px hsl(var(--aem-orange) / 0.7); }
}

.animate-float-slow { animation: float-slow 6s ease-in-out infinite; }
.animate-pulse-glow { animation: pulse-glow 3s ease-in-out infinite; }

/* FAQ accordion */
.faq-item {
  background: hsl(var(--card)); border-radius: 1rem;
  border: 1px solid hsl(var(--border)); padding: 0 1.5rem; box-shadow: var(--shadow-card);
  transition: border-color .2s;
}
.faq-item.open { border-color: hsl(var(--aem-orange) / 0.4); }
.faq-trigger {
  width: 100%; text-align: left; font-weight: 700; color: hsl(var(--aem-blue-deep));
  padding: 1.25rem 0; display: flex; justify-content: space-between; align-items: center;
  background: none; border: none; cursor: pointer; font-size: 1rem;
}
.faq-trigger .chevron { transition: transform .3s; }
.faq-item.open .faq-trigger .chevron { transform: rotate(180deg); }
.faq-content {
  max-height: 0; overflow: hidden; transition: max-height .3s ease;
  color: hsl(var(--muted-foreground));
}
.faq-item.open .faq-content { max-height: 500px; padding-bottom: 1.25rem; }

/* Acessibilidade */
:root {
  --a11y-content-scale: 1;
  --a11y-font-scale: 1;
  --a11y-line-height: 1;
  --a11y-letter-spacing: 1;
  --a11y-invert: 0;
  --a11y-grayscale: 0;
  --a11y-saturate: 100%;
  --a11y-contrast: 1;
  --a11y-brightness: 1;
}

html {
  font-size: 16px;
}

#a11yContent {
  zoom: var(--a11y-content-scale);
  letter-spacing: calc((var(--a11y-letter-spacing) - 1) * 0.04em);
  filter:
    invert(var(--a11y-invert))
    grayscale(var(--a11y-grayscale))
    saturate(var(--a11y-saturate))
    contrast(var(--a11y-contrast))
    brightness(var(--a11y-brightness));
}

#a11yContent .text-xs { font-size: calc(0.75rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-sm { font-size: calc(0.875rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-base { font-size: calc(1rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-lg { font-size: calc(1.125rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-xl { font-size: calc(1.25rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-2xl { font-size: calc(1.5rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-3xl { font-size: calc(1.875rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-4xl { font-size: calc(2.25rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-5xl { font-size: calc(3rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-6xl { font-size: calc(3.75rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-7xl { font-size: calc(4.5rem * var(--a11y-font-scale)) !important; }
#a11yContent .text-8xl { font-size: calc(6rem * var(--a11y-font-scale)) !important; }

#a11yContent :where(h1, h2, h3, h4, h5, h6, p, li, a, label, button, input, textarea, small, blockquote) {
  line-height: var(--a11y-line-height) !important;
}

#a11yContent .tracking-wide {
  letter-spacing: calc(0.025em + ((var(--a11y-letter-spacing) - 1) * 0.04em)) !important;
}

#a11yContent .tracking-wider {
  letter-spacing: calc(0.05em + ((var(--a11y-letter-spacing) - 1) * 0.04em)) !important;
}

#a11yContent .tracking-widest {
  letter-spacing: calc(0.1em + ((var(--a11y-letter-spacing) - 1) * 0.04em)) !important;
}

/* Linhas mais nitidas na seção de contato quando contraste ativo */
html.a11y-contrast-active #contato > .absolute.top-0 {
  height: 3px !important;
  opacity: 1;
}

html.a11y-contrast-active #contato #contactForm {
  border-width: 2px !important;
  border-color: hsl(var(--aem-blue-deep) / 0.75) !important;
  box-shadow: 0 0 0 1px hsl(var(--aem-blue-deep) / 0.35), var(--shadow-elegant);
}

html.a11y-contrast-active #contato .form-input {
  border-width: 2px !important;
  border-color: hsl(var(--aem-blue-deep) / 0.85) !important;
  box-shadow: inset 0 0 0 1px hsl(var(--aem-blue-deep) / 0.28);
}

html.a11y-contrast-active #contato .form-input:focus {
  border-color: hsl(var(--aem-orange)) !important;
  box-shadow: 0 0 0 2px hsl(var(--aem-orange) / 0.2);
}

/* Contraste escuro: linhas e bordas mais escuras / nítidas (inclui página Kart Nicolas e docs) */
html.a11y-contrast-active:not(.a11y-light-contrast-active) #a11yContent :is(article.bg-card, aside.bg-white).border.border-border,
html.a11y-contrast-active:not(.a11y-light-contrast-active) #docs .doc-card {
  border-width: 2px !important;
  border-color: hsl(220 38% 9%) !important;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 10px 24px -14px rgba(0, 0, 0, 0.35);
}

html.a11y-contrast-active:not(.a11y-light-contrast-active) #faqs .faq-item {
  border-width: 2px !important;
  border-color: hsl(220 38% 11%) !important;
}

html.a11y-contrast-active:not(.a11y-light-contrast-active) #a11yContent > header {
  border-bottom: 2px solid hsl(220 38% 9%) !important;
}

/* FAQ mais claro no contraste claro */
html.a11y-light-contrast-active #faqs .faq-item {
  background: hsl(0 0% 100%) !important;
  border-width: 2px !important;
  border-color: hsl(var(--aem-blue-deep) / 0.55) !important;
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.12);
}

html.a11y-light-contrast-active #faqs .faq-trigger {
  color: #000 !important;
  text-shadow: 0 0 0.01px currentColor;
}

html.a11y-light-contrast-active #faqs .faq-content {
  color: #000 !important;
}

html.a11y-light-contrast-active #docs > button {
  border-width: 2px !important;
  border-color: hsl(var(--aem-blue-deep) / 0.5) !important;
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.1);
  background: hsl(0 0% 100%) !important;
}

html.a11y-light-contrast-active #docs > button h3 {
  color: hsl(var(--aem-blue-deep)) !important;
}

html.a11y-light-contrast-active #docs > button p {
  color: hsl(var(--muted-foreground)) !important;
}

/* Contraste claro: texto cinza em fundo branco vira preto */
html.a11y-light-contrast-active #a11yContent :is(.bg-white, .bg-card, .bg-background, .bg-muted\/40, .bg-muted\/30)
  :is(.text-muted-foreground, [class*="text-gray-"], [class*="text-slate-"], [class*="text-zinc-"], [class*="text-neutral-"], [class*="text-stone-"], [class*="text-white/70"], [class*="text-white/60"], [class*="text-white/50"]) {
  color: #000 !important;
}

/* Contraste claro: texto herdado dentro de blocos marcados como secundários (filhos diretos também) */
html.a11y-light-contrast-active #a11yContent :is(.bg-white, .bg-card, .bg-background, .bg-muted\/40, .bg-muted\/30)
  .text-muted-foreground :where(p, li, dd, span, td, th),
html.a11y-light-contrast-active #a11yContent :is(.bg-white, .bg-card, .bg-background, .bg-muted\/40, .bg-muted\/30)
  article .space-y-5 :where(p, li),
html.a11y-light-contrast-active #a11yContent :is(.bg-white, .bg-card, .bg-background, .bg-muted\/40, .bg-muted\/30)
  aside dl :where(dd) {
  color: #000 !important;
}

/* Contraste claro: linhas dos cartões mais escuras / visíveis (páginas internas, etc.) */
html.a11y-light-contrast-active #a11yContent :is(article.bg-card, aside.bg-white).border.border-border {
  border-width: 2px !important;
  border-color: hsl(var(--aem-blue-deep) / 0.55) !important;
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.12);
}

.a11y-highlight-links a {
  text-decoration: underline !important;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.15em;
}

.a11y-highlight-headings h1,
.a11y-highlight-headings h2,
.a11y-highlight-headings h3,
.a11y-highlight-headings h4,
.a11y-highlight-headings h5,
.a11y-highlight-headings h6 {
  outline: 2px dashed hsl(var(--aem-orange));
  outline-offset: 0.12em;
}

.a11y-widget {
  position: fixed !important;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  pointer-events: auto;
}

.a11y-fab {
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 9999px;
  background: hsl(212 100% 42%);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 4px 20px rgba(0, 120, 215, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.a11y-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(0, 120, 215, 0.6);
}

.a11y-panel {
  position: absolute;
  right: 0;
  top: 4rem;
  width: min(90vw, 360px);
  max-height: 80vh;
  overflow: auto;
  background: #fff;
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.35);
  padding: 1rem;
}

.a11y-panel.hidden { display: none; }

.a11y-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.a11y-header button {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.a11y-quick-font {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.a11y-quick-font button {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
  border-radius: 0.6rem;
  padding: 0.35rem 0.65rem;
  font-weight: 700;
  cursor: pointer;
}

.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.a11y-action {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
  border-radius: 0.7rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.a11y-action.is-active {
  border-color: hsl(var(--aem-blue));
  background: hsl(var(--aem-blue) / 0.12);
  color: hsl(var(--aem-blue-deep));
}

.a11y-sliders {
  display: grid;
  gap: 0.8rem;
}

.a11y-sliders label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  align-items: center;
}

.a11y-sliders input {
  grid-column: 1 / -1;
  width: 100%;
}

.a11y-sliders output {
  font-size: 0.8rem;
  font-weight: 700;
}
