/* Fundacao global.
   Reune reset, elementos HTML base, helpers minimos de estado e animacoes compartilhadas. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--surface);
  font-size: calc(16px * var(--font-scale));
}

body {
  background-color: var(--surface);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(20, 32, 43, 0.045) 1px, transparent 0),
    linear-gradient(135deg, rgba(11, 61, 46, 0.025), rgba(255, 255, 255, 0) 42%);
  background-size: 18px 18px, auto;
  color: var(--text);
  display: flex;
  flex-direction: column;
  font-family: "IBM Plex Sans", sans-serif;
  line-height: var(--line-height-base);
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

body.login-body {
  background: #0f1b14;
}

body.login-body .app-footer {
  display: none;
}

/* Font size preference classes
   --font-scale e consumida em "html" (font-size do root), mas a classe e
   aplicada em "body" (filho de html). Propriedades customizadas nao sobem
   de filho para pai, por isso a definicao precisa usar :has() em :root. */
:root:has(body.font-size-pequena)      { --font-scale: 0.875; }
:root:has(body.font-size-media)        { --font-scale: 1; }
:root:has(body.font-size-grande)       { --font-scale: 1.125; }
:root:has(body.font-size-extra-grande) { --font-scale: 1.25; }

/* OpenDyslexic self-hosted font */
@font-face {
  font-family: "OpenDyslexic";
  src: url("../fonts/OpenDyslexic/OpenDyslexic-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "OpenDyslexic";
  src: url("../fonts/OpenDyslexic/OpenDyslexic-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Font family preference classes */
body.font-ibm { font-family: "IBM Plex Sans", sans-serif; }
body.font-opendyslexic { font-family: "OpenDyslexic", sans-serif; }

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
  max-width: 100%;
}

.is-hidden {
  display: none !important;
}

.u-mt-0 { margin-top: 0 !important; }
.u-mb-0 { margin-bottom: 0 !important; }
.u-mr-auto { margin-right: auto !important; }
.u-full-width { width: 100% !important; }
.u-text-right { text-align: right !important; }
.u-text-center { text-align: center !important; }

body.has-open-modal {
  overflow: hidden;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes row-highlight {
  0% { box-shadow: 0 0 0 0 rgba(11, 61, 46, 0.22); }
  100% { box-shadow: 0 0 0 12px rgba(11, 61, 46, 0); }
}

@keyframes skeleton-wave {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* =======================
   Acessibilidade / Motion
======================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

