/* Erasmus brand anim + theme toggle + replay overlay */
.brand-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Never shrink — empty→mounted brand used to compress the slot and shove nav links */
  min-width: max-content;
  flex: none;
  position: relative;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}
.brand-anim-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
}
.brand-anim {
  display: block;
  /* Hug the ball + ERASMUS letters — fixed 268px left a dead gap before theme/Jogar */
  width: auto;
  min-width: 0;
  max-width: none;
  height: 40px;
  line-height: 0;
  overflow: visible;
  position: relative;
  flex: none;
  box-sizing: border-box;
}
@media (max-width: 720px) {
  .brand-anim { height: 36px; }
}
/* Beat `.nav button { position: relative }` so the control
   centres on the brand mark's top-right corner, not in-flow. */
.brand-anim-wrap > .brand-replay {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(50%, -50%);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: currentColor;
  opacity: 0.38;
  cursor: pointer;
}
.brand-anim-wrap > .brand-replay:hover,
.brand-anim-wrap > .brand-replay:focus-visible {
  opacity: 0.9;
}
.brand-anim-wrap > .brand-replay:focus-visible {
  outline: 2px solid rgba(31, 92, 46, 0.45);
  outline-offset: 2px;
}
.brand-anim-wrap > .brand-replay svg {
  width: 12px;
  height: 12px;
  display: block;
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1.5px solid rgba(15, 61, 31, 0.28);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  flex: none;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
/* Mobile: prefs pill only inside the burger drawer (not the top bar) */
@media (max-width: 860px) {
  .nav-tools > .prefs-pill {
    display: none !important;
  }
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--green-dark);
  background: var(--green-soft);
}
.theme-toggle:focus-visible {
  outline: 2px solid rgba(31, 92, 46, 0.4);
  outline-offset: 2px;
}
/* Inside the split prefs pill, border/outline live on the pill shell */
.prefs-pill .theme-toggle:hover,
.prefs-pill .theme-toggle:focus-visible {
  border-color: transparent;
}
.prefs-pill .theme-toggle:focus-visible {
  outline: none;
  outline-offset: 0;
}
[data-theme="dark"] .prefs-pill .theme-toggle {
  border-color: transparent;
}
.theme-toggle .theme-icon {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}
.theme-toggle .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-toggle {
  border-color: rgba(184, 233, 134, 0.45);
  color: #f2f4f0;
}
[data-theme="dark"] .theme-toggle .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-moon { display: block; }

/* Flappy Plane: match RUMO top-bar outline pill */
.flappy-play {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  min-width: 72px;
  max-width: none;
  box-sizing: border-box;
  margin: 0;
  padding: 0 10px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  flex: none;
  box-shadow: none;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.flappy-play:active {
  transform: none;
}
.flappy-play:hover,
.flappy-play:focus-visible {
  background: var(--green-soft);
  border-color: rgba(0, 0, 0, 0.3);
  color: var(--ink);
  outline: none;
  box-shadow: none;
}
.flappy-play:focus-visible {
  outline: 2px solid rgba(31, 92, 46, 0.35);
  outline-offset: 2px;
}
.flappy-play-ico {
  display: block;
  flex: none;
  pointer-events: none;
  width: 16px;
  height: 16px;
  line-height: 0;
  color: inherit;
}
.flappy-play-ico svg {
  display: block;
  width: 16px;
  height: 16px;
}
.flappy-play-label {
  line-height: 1;
}
@media (max-width: 860px) {
  .flappy-play-label {
    display: inline;
  }
  .flappy-play {
    min-width: 0;
    height: 36px;
    gap: 5px;
    padding: 0 10px;
  }
  .flappy-play-ico {
    width: 14px;
    height: 14px;
  }
  .flappy-play-ico svg {
    width: 14px;
    height: 14px;
  }
}
[data-theme="dark"] .flappy-play {
  border-color: rgba(255, 255, 255, 0.15);
  background: transparent;
  color: #f2f4f0;
  box-shadow: none;
}
[data-theme="dark"] .flappy-play:hover,
[data-theme="dark"] .flappy-play:focus-visible {
  background: rgba(122, 181, 29, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  color: #f2f4f0;
}

.erasmus-brand-host,
.erasmus-brand {
  width: auto;
  height: 100%;
}
.erasmus-brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  color: var(--ink);
  overflow: visible;
}
.erasmus-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.erasmus-ball {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: none;
}
.erasmus-wordmark {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.04em;
  height: 1.4rem; /* letters only — ball stays 28px */
  min-width: 0;
  perspective: 420px;
  flex: none;
}
/* HTML-first brand before SVG wordmark mounts */
.erasmus-wordmark-fallback {
  display: inline-block;
  height: 1.4rem;
  line-height: 1.4rem;
  font-family: Figtree, system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.04em;
  color: inherit;
  flex: none;
  white-space: nowrap;
}
.erasmus-brand:not(.is-run):not(.is-done) .erasmus-wordmark {
  opacity: 0;
}
.erasmus-brand.is-run .erasmus-wordmark,
.erasmus-brand.is-done .erasmus-wordmark {
  opacity: 1;
}
.nav,
.nav-inner,
.brand-slot,
.brand,
.brand-anim-wrap,
.brand-anim,
.erasmus-brand-host,
.erasmus-brand {
  overflow: visible;
}
.erasmus-letter {
  display: inline-flex;
  height: 100%;
  transform-origin: left center;
  position: relative;
  overflow: hidden;
  /* empty until the plane wake reveals (--reveal grows 0% → 100%) */
  clip-path: inset(0 calc(100% - var(--reveal, 0%)) 0 0);
}
.erasmus-letter.is-revealed,
.erasmus-brand.is-done .erasmus-letter {
  clip-path: none;
}
.erasmus-letter .L {
  display: block;
  height: 100%;
  width: auto;
  overflow: visible;
  color: inherit;
}
.erasmus-px-cover { display: none !important; }

/* Big plane: climb from left nav → exit off the top at mid-screen */
.erasmus-plane {
  position: fixed;
  top: 0;
  left: 0;
  width: clamp(224px, 33.6vw, 336px);
  height: auto;
  /* Visually above the nav; never captures clicks/touches (nav stays usable) */
  pointer-events: none !important;
  z-index: 520;
  opacity: 1 !important;
  /* left/center origin so --x is the left edge — entrance from off-screen is predictable */
  transform-origin: 0 50%;
  transform: translate3d(var(--x, -100vw), var(--y, 20px), 0) rotate(var(--rot, -38deg));
  filter: none;
  mix-blend-mode: normal;
  will-change: transform;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: auto;
  backface-visibility: hidden;
  -webkit-user-select: none;
  user-select: none;
}
.erasmus-plane.is-flying {
  opacity: 1 !important;
  visibility: visible;
}
.erasmus-plane:not(.is-flying) {
  visibility: hidden;
  opacity: 0 !important;
}

/* Legacy option variants still stagger letter motion under the same plane */
.erasmus-brand.anim-wipe:not(.is-done) .erasmus-letter .L {
  clip-path: inset(0 100% 0 0);
}
.erasmus-brand.anim-wipe.is-run .erasmus-letter.is-revealed .L {
  animation: erasmus-wipe 0.35s steps(8, end) both;
}
@keyframes erasmus-wipe {
  0% { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

.erasmus-brand.anim-lift:not(.is-done) .erasmus-letter .L {
  opacity: 0;
  transform: translateY(10px);
}
.erasmus-brand.anim-lift.is-run .erasmus-letter.is-revealed .L {
  animation: erasmus-lift 0.35s steps(6, end) both;
}
@keyframes erasmus-lift {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .erasmus-plane { display: none !important; }
  .erasmus-px-cover { display: none !important; }
  .erasmus-brand .erasmus-letter .L {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
}

/* Dark theme tokens (Erasmus) */
[data-theme="dark"] {
  --ink: #f2f4f0;
  --muted: #a8b0a4;
  --line: #2a322c;
  --white: #121412;
  --green-soft: #1a2418;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
[data-theme="dark"] body {
  background: #121412;
  color: var(--ink);
}
[data-theme="dark"] .nav,
[data-theme="dark"] body[data-page="home"] .nav {
  background: rgba(18, 20, 18, 0.92);
  border: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .brand,
[data-theme="dark"] .nav-links a,
[data-theme="dark"] .erasmus-brand {
  color: var(--ink);
}
[data-theme="dark"] .nav-links a:hover {
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .nav-links a[aria-current="page"] {
  background: rgba(122, 181, 29, 0.18);
}
[data-theme="dark"] .bento > li,
[data-theme="dark"] .news-card {
  background: #171a17;
}
[data-theme="dark"] .home-band {
  background: var(--home-band-bg, #121412);
}
[data-theme="dark"] .site-footer,
[data-theme="dark"] footer {
  background: #0e100e;
  color: var(--ink);
  border-top-color: rgba(226, 230, 222, 0.1);
}
[data-theme="dark"] .footer-grid p,
[data-theme="dark"] .footer-grid li,
[data-theme="dark"] .footer-grid a,
[data-theme="dark"] .footer-grid button.rules-link,
[data-theme="dark"] .footer-brand strong {
  color: var(--ink);
}
[data-theme="dark"] .footer-grid a:hover,
[data-theme="dark"] .footer-grid button.rules-link:hover {
  color: var(--green);
}
[data-theme="dark"] .footer-kicker {
  color: var(--green);
}
[data-theme="dark"] .footer-copy,
[data-theme="dark"] .footer-note,
[data-theme="dark"] .footer-bar .footer-mail,
[data-theme="dark"] .footer-bar .footer-mail a {
  color: var(--muted);
}
[data-theme="dark"] .footer-copy {
  border-top-color: rgba(226, 230, 222, 0.1);
}
[data-theme="dark"] .footer-social a,
[data-theme="dark"] .site-footer .copy-mail,
[data-theme="dark"] .copy-mail {
  background: #171a17;
  border-color: rgba(226, 230, 222, 0.18);
  color: var(--ink);
  box-shadow: none;
}
[data-theme="dark"] .logo-inete-word .logo-glyph {
  fill: #e2e6de;
  stroke: #a8b0a4;
}
