/* Carlos Bernardo — semantic theme foundation
   Tokens are RGB triplets so Tailwind opacity modifiers remain theme-aware. */

:root,
html[data-theme="dark"] {
  color-scheme: dark;

  --theme-surface-container-highest: 18 58 96;
  --theme-primary: 131 182 236;
  --theme-on-error: 105 0 5;
  --theme-background: 6 27 51;
  --theme-on-primary-fixed-variant: 173 205 240;
  --theme-on-secondary: 255 255 255;
  --theme-tertiary-fixed: 255 236 180;
  --theme-surface-container-high: 13 45 78;
  --theme-surface-bright: 16 54 92;
  --theme-on-tertiary-fixed: 51 38 0;
  --theme-inverse-surface: 244 247 251;
  --theme-glass-stroke: 255 255 255;
  --theme-glass-stroke-opacity: 0.08;
  --theme-tertiary-fixed-dim: 250 189 19;
  --theme-surface-container-low: 9 36 64;
  --theme-primary-container: 20 74 130;
  --theme-on-secondary-fixed: 0 40 15;
  --theme-secondary: 131 216 158;
  --theme-surface-container: 11 41 72;
  --theme-tertiary-container: 90 68 0;
  --theme-secondary-fixed: 196 245 210;
  --theme-tertiary: 250 189 19;
  --theme-surface-tint: 131 182 236;
  --theme-canvas-light: 244 247 251;
  --theme-on-tertiary: 51 38 0;
  --theme-surface-variant: 18 58 96;
  --theme-inverse-primary: 2 86 179;
  --theme-inverse-on-surface: 11 31 51;
  --theme-on-surface-variant: 155 176 196;
  --theme-secondary-fixed-dim: 131 216 158;
  --theme-secondary-container: 0 74 30;
  --theme-outline: 95 116 138;
  --theme-on-primary-container: 210 228 248;
  --theme-on-secondary-fixed-variant: 40 110 65;
  --theme-on-primary: 6 27 51;
  --theme-error-container: 147 0 10;
  --theme-on-surface: 232 238 245;
  --theme-glass-fill: 6 20 36;
  --theme-glass-fill-opacity: 0.72;
  --theme-on-secondary-container: 150 230 175;
  --theme-primary-fixed: 210 228 248;
  --theme-on-tertiary-fixed-variant: 90 68 0;
  --theme-surface: 6 27 51;
  --theme-primary-fixed-dim: 131 182 236;
  --theme-on-tertiary-container: 250 189 19;
  --theme-outline-variant: 40 66 96;
  --theme-error: 255 180 171;
  --theme-on-error-container: 255 218 214;
  --theme-surface-container-lowest: 4 18 33;
  --theme-surface-dim: 6 27 51;
  --theme-on-primary-fixed: 4 20 40;
  --theme-on-background: 232 238 245;

  --theme-nav-bg: 6 20 36;
  --theme-nav-bg-opacity: 0.82;
  --theme-noise-opacity: 0.025;
  --theme-focus-ring: 131 182 236;
  --theme-hero-text: 244 247 251;
  --theme-hero-muted: 192 204 216;
  --theme-hero-accent: 131 182 236;
}

html[data-theme="light"] {
  color-scheme: light;

  --theme-surface-container-highest: 214 224 234;
  --theme-primary: 2 86 179;
  --theme-on-error: 255 255 255;
  --theme-background: 244 247 251;
  --theme-on-primary-fixed-variant: 2 60 125;
  --theme-on-secondary: 255 255 255;
  --theme-tertiary-fixed: 255 236 180;
  --theme-surface-container-high: 224 231 240;
  --theme-surface-bright: 255 255 255;
  --theme-on-tertiary-fixed: 51 38 0;
  --theme-inverse-surface: 11 31 51;
  --theme-glass-stroke: 45 60 80;
  --theme-glass-stroke-opacity: 0.14;
  --theme-tertiary-fixed-dim: 250 189 19;
  --theme-surface-container-low: 238 242 247;
  --theme-primary-container: 197 220 246;
  --theme-on-secondary-fixed: 0 40 15;
  --theme-secondary: 17 141 59;
  --theme-surface-container: 232 237 243;
  --theme-tertiary-container: 255 232 170;
  --theme-secondary-fixed: 196 245 210;
  --theme-tertiary: 146 110 5;
  --theme-surface-tint: 2 86 179;
  --theme-canvas-light: 244 247 251;
  --theme-on-tertiary: 255 255 255;
  --theme-surface-variant: 220 229 238;
  --theme-inverse-primary: 131 182 236;
  --theme-inverse-on-surface: 244 247 251;
  --theme-on-surface-variant: 82 101 121;
  --theme-secondary-fixed-dim: 120 200 145;
  --theme-secondary-container: 196 235 208;
  --theme-outline: 108 124 140;
  --theme-on-primary-container: 2 40 90;
  --theme-on-secondary-fixed-variant: 20 90 45;
  --theme-on-primary: 255 255 255;
  --theme-error-container: 255 218 214;
  --theme-on-surface: 11 31 51;
  --theme-glass-fill: 255 255 255;
  --theme-glass-fill-opacity: 0.76;
  --theme-on-secondary-container: 0 60 22;
  --theme-primary-fixed: 197 220 246;
  --theme-on-tertiary-fixed-variant: 90 68 0;
  --theme-surface: 244 247 251;
  --theme-primary-fixed-dim: 120 165 220;
  --theme-on-tertiary-container: 51 38 0;
  --theme-outline-variant: 200 214 228;
  --theme-error: 179 38 30;
  --theme-on-error-container: 65 0 2;
  --theme-surface-container-lowest: 255 255 255;
  --theme-surface-dim: 224 231 240;
  --theme-on-primary-fixed: 2 30 70;
  --theme-on-background: 11 31 51;

  --theme-nav-bg: 244 247 251;
  --theme-nav-bg-opacity: 0.88;
  --theme-noise-opacity: 0.015;
  --theme-focus-ring: 2 86 179;
}

html {
  background: rgb(var(--theme-background));
}

:where(#inicio, #empresas, #trajetoria, #contato) {
  scroll-margin-top: 5rem;
}

body {
  background: rgb(var(--theme-background));
  color: rgb(var(--theme-on-surface));
  transition: background-color 400ms ease, color 400ms ease;
}

body::before {
  content: "";
  position: fixed;
  z-index: 60;
  inset: 0;
  pointer-events: none;
  opacity: var(--theme-noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  transition: opacity 400ms ease;
}

::selection {
  background: rgb(var(--theme-primary));
  color: rgb(var(--theme-on-primary));
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid rgb(var(--theme-focus-ring));
  outline-offset: 3px;
}

.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;
}

.theme-toggle {
  position: relative;
  z-index: 1;
  display: inline-grid;
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  color: rgb(var(--theme-primary));
  border: 1px solid rgb(var(--theme-primary) / 0.36);
  border-radius: 50%;
  background: rgb(var(--theme-surface-container-low) / 0.72);
  box-shadow: inset 0 0 0 1px rgb(var(--theme-on-surface) / 0.03);
  transition:
    color 300ms ease,
    border-color 300ms ease,
    background-color 300ms ease,
    transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-toggle:hover {
  color: rgb(var(--theme-on-surface));
  border-color: rgb(var(--theme-primary) / 0.72);
  background: rgb(var(--theme-primary) / 0.1);
  transform: translateY(-1px);
}

.theme-toggle .material-symbols-outlined {
  font-size: 1.15rem;
  line-height: 1;
}

.theme-toggle__moon,
html[data-theme="light"] .theme-toggle__sun {
  display: none;
}

html[data-theme="light"] .theme-toggle__moon {
  display: inline-block;
}

input,
select,
textarea {
  color: rgb(var(--theme-on-surface));
  caret-color: rgb(var(--theme-primary));
}

input::placeholder,
textarea::placeholder {
  color: rgb(var(--theme-on-surface-variant) / 0.82);
  opacity: 1;
}

select option {
  color: rgb(var(--theme-on-surface));
  background: rgb(var(--theme-surface-container-lowest));
}

.hero-section {
  color: rgb(var(--theme-hero-text));
  background: rgb(6 27 51);
}

.hero-section .text-on-surface,
.hero-section .text-on-background {
  color: rgb(var(--theme-hero-text)) !important;
}

.hero-section .text-on-surface-variant {
  color: rgb(var(--theme-hero-muted)) !important;
}

.hero-section .text-primary {
  color: rgb(var(--theme-hero-accent)) !important;
}

.hero-section .bg-primary {
  background-color: rgb(var(--theme-hero-accent)) !important;
}

/* The Hero keeps its peach accent in both themes, so its filled controls need
   the matching dark ink instead of the page-level on-primary token. */
.hero-section .text-on-primary {
  color: rgb(255 255 255) !important;
}

.hero-section .border-background {
  border-color: rgb(6 27 51) !important;
}

.hero-section .bg-surface-container {
  background-color: rgb(9 47 86) !important;
}

header,
footer,
main > section,
.glass {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 400ms;
  transition-timing-function: ease;
}

@media (prefers-reduced-motion: reduce) {
  body,
  header,
  footer,
  main > section,
  .glass,
  .theme-toggle {
    transition-duration: 0.01ms;
  }

  /* The Empresas section keeps its static panel when motion is reduced. */
  .empresas-video-bg {
    display: none;
  }
}
