/* Theme only: preserves the approved composition and image colors. */
.theme-toggle { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--header-muted); cursor: pointer; }
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { background: var(--header-active); border-color: var(--header-line); color: var(--header-accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--header-accent); outline-offset: 3px; }
.theme-toggle .theme-sun, [data-theme="dark"] .theme-toggle .theme-moon { display: none; }
[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
[data-theme="light"] .site-header { --header-background: #fbfaf7; --header-line: #c9d9e6; --header-fg: #193b64; --header-muted: #375b79; --header-accent: #193b64; --header-active: #d6e2ed80; --header-menu: #faf9f6; }
html[data-theme="dark"] { color-scheme: dark; --background: #101820; --text: #e1eaf3; }
[data-theme="dark"] .site-header {
  --header-background: #101820; --header-line: #35495b; --header-fg: #e1eaf3;
  --header-muted: #b1c4d6; --header-accent: #a6cbed; --header-active: #a6cbed18; --header-menu: #17232e;
}
[data-theme="dark"] .brand-logo, [data-theme="dark"] .ed-footer img { filter: brightness(0) invert(1); opacity: .9; }
[data-theme="light"] .site-header .brand-logo { filter: none; }
[data-theme="dark"] .hero { background: radial-gradient(ellipse 50% 68% at 75% 49%, #1b3043 0%, transparent 76%), #101820; }
[data-theme="dark"] .hero h1, [data-theme="dark"] .hero-position, [data-theme="dark"] .showcase-current strong { color: #dbe8f5; }
[data-theme="dark"] .title-line-italic { color: #91b6da; }
[data-theme="dark"] :is(.hero-description, .hero-topline, .hero-bottom, .showcase-current, .showcase-current small, .showcase-current > span) { color: #a6bbcf; }
[data-theme="dark"] .hero-actions .button-primary { background: #a6cbed; color: #101820; }
[data-theme="dark"] .hero-actions .button-primary:hover { background: #c3def7; }
[data-theme="dark"] .hero-actions .button-outline { color: #b5d2ef; border-color: #7193b1; }
[data-theme="dark"] .hero-actions .button-outline::before { background: #b5d2ef; }
[data-theme="dark"] .hero::after { opacity: .13; }
[data-theme="dark"] .hero-orbit { border-color: #769bbb45; }
[data-theme="dark"] .showcase-card { background: #17232e; border-color: #526d84; }
[data-theme="dark"] .showcase-card::after { background: linear-gradient(transparent, #101820bb); }
[data-theme="dark"] .showcase-card-top { background: #1b2a37; color: #c1d3e3; border-color: #35495b; }
[data-theme="dark"] .showcase-button { color: #c0d7ed; border-color: #526d84; background: transparent; }
[data-theme="dark"] .showcase-button:hover { background: #2b4359; }
[data-theme="dark"] :is(.editorial-section, .ed-footer) { --ed-ink: #dbe8f5; --ed-muted: #a6bbcf; --ed-line: #35495b; color-scheme: dark; background: #101820; }
[data-theme="dark"] .ed-tint { background: #141f2a; }
[data-theme="dark"] .ed-contact { background: #192a39; }
[data-theme="dark"] :is(.ed-kicker, .ed-caption, .ed-tags, .ed-private, .ed-diagram figcaption, .ed-location, .ed-footer p) { color: #a6bbcf; }
[data-theme="dark"] :is(.editorial-section em) { color: #91b6da; }
[data-theme="dark"] :is(.ed-link, .editorial-section .project-details summary, .ed-job .ed-company, .ed-skill-stack, .ed-degree .ed-institution, .editorial-section .copy-email, .editorial-section .copy-status) { color: #dbe8f5; }
[data-theme="dark"] :is(.ed-diagram, .ed-image) { background: #1b2c3b; border-color: #40596d; }
[data-theme="dark"] .ed-diagram li { border-color: #40596d; }
[data-theme="dark"] .ed-diagram li::marker { color: #91b6da; }
[data-theme="dark"] .ed-enlarge { background: #17232e; color: #dbe8f5; }
[data-theme="dark"] :is(.ed-tags li, .ed-email, .ed-footer) { border-color: #40596d; }
[data-theme="dark"] .editorial-section :focus-visible { outline-color: #a6cbed; }

/* Prata do Hero nos detalhes, preservando o azul editorial. */
[data-theme="dark"] :is(.editorial-section, .ed-footer) { --ed-ink: #e2e7ec; --ed-muted: #b2bdc8; --ed-line: #485562; background-color: #151c23; }
[data-theme="dark"] .ed-tint { background-color: #1a222a; }
[data-theme="dark"] .ed-contact { background-color: #202a34; }
[data-theme="dark"] :is(.ed-image, .ed-diagram) { border-color: #65717c; box-shadow: 0 20px 48px #05090d66, 0 0 0 1px #bdc7d31a; }
[data-theme="dark"] .ed-diagram { background-image: linear-gradient(135deg, #aebbc70b 0 1px, transparent 1px 100%); background-size: 18px 18px; }
[data-theme="dark"] :is(.ed-kicker, .ed-caption, .ed-private, .ed-location, .ed-footer p) { color: #bbc5ce; }

/* Formação permanece parada enquanto Contato sobe no fluxo do scroll. */
#formacao {
  position: sticky;
  top: var(--header-height, 76px);
  z-index: 1;
}
#contato {
  --contact-edge: #151c23;
  position: relative;
  z-index: 60;
  min-height: 100svh;
  padding-block: clamp(70px, 12vh, 140px);
  scroll-margin-top: 0;
}
[data-theme="light"] #contato { --contact-edge: #faf9f6; }
#contato::before {
  content: "";
  position: absolute;
  inset: -100px 0 auto;
  height: 101px;
  background: linear-gradient(to bottom, transparent, var(--contact-edge));
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  #formacao { position: relative; top: auto; }
}
.site-header.is-contact-hidden {
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
}
.site-header { transition: transform .45s ease, opacity .35s ease, background-color .38s ease, color .38s ease; }

/* Continuous page field: section backgrounds blend through their shared edges. */
[data-theme="dark"] main > .editorial-section,
[data-theme="dark"] main > .hero {
  background-color: #151c23;
  background-image: linear-gradient(180deg, #151c23, #1a222a 48%, #151c23);
}
[data-theme="dark"] main > .editorial-section.ed-contact { background-image: linear-gradient(180deg, #151c23, #202a34 50%, #151c23); }
[data-theme="dark"] .ed-footer { background: linear-gradient(180deg, #151c23, #11171d); border-top-color: transparent; }
[data-theme="light"] main > .editorial-section { background-color: #faf9f6; background-image: linear-gradient(180deg, #faf9f6, #f1f3f5 50%, #faf9f6); }
[data-theme="light"] main > .editorial-section.ed-contact { background-image: linear-gradient(180deg, #faf9f6, #edf1f4 50%, #faf9f6); }
[data-theme="light"] .ed-footer { background: linear-gradient(180deg, #faf9f6, #f2f3f3); border-top-color: transparent; }

/* Native snapshots keep the old palette on the right until the silver edge passes. */
.theme-edge { position: fixed; top: 0; left: 0; bottom: 0; width: 2px; pointer-events: none; opacity: 0; background: linear-gradient(180deg, #a4b3c080, #f2f5f8 45%, #c2cdd7 70%, #a4b3c080); box-shadow: 0 0 12px 2px #dce8f760; z-index: 9999; view-transition-name: theme-edge; }
.theme-sweeping .theme-edge { opacity: 1; }
.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }
::view-transition-group(root) { animation: none; }
::view-transition-old(root) { animation: none; }
::view-transition-new(root) { mix-blend-mode: normal; animation: theme-reveal .85s cubic-bezier(.22,.61,.36,1) both; }
::view-transition-group(theme-edge) { z-index: 1; animation: theme-edge-sweep .85s cubic-bezier(.22,.61,.36,1) both; }
::view-transition-old(theme-edge) { display: none; }
::view-transition-new(theme-edge) { animation: none; }
/* Keep the orbit's live animation outside the frozen page snapshot. */
::view-transition-group(hero-orbit-layer) { animation: none; z-index: 0; }
::view-transition-old(hero-orbit-layer) { display: none; }
::view-transition-new(hero-orbit-layer) { animation: none; mix-blend-mode: normal; }
@keyframes theme-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@keyframes theme-edge-sweep { from { transform: translateX(-2px); } to { transform: translateX(100vw); } }
@media (max-width: 599px) { .theme-toggle { width: 32px; } }
