/**
 * Design tokens — cores, espaçamento, tipografia, sombras.
 * Tema claro é o padrão em :root; tema escuro sobrescreve via [data-theme="dark"].
 */

:root {
  /* Tipografia */
  --font-base: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.25rem;
  --fs-3xl: 3rem;

  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;

  --lh-tight: 1.2;
  --lh-base: 1.5;
  --lh-relaxed: 1.7;

  /* Espaçamento */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  --space-8: 3rem;
  --space-9: 4rem;
  --space-10: 6rem;

  /* Raio e bordas */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 999px;

  /* Transições */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;

  /* Paleta de marca — R5 Studio (dourado sobre preto) */
  --color-brand-300: hsl(38 52% 76%);
  --color-brand-400: hsl(38 50% 68%);
  --color-brand-500: #CEAB67;
  --color-brand-600: hsl(38 48% 54%);
  --color-brand-700: hsl(38 46% 44%);

  --color-accent-500: hsl(38 50% 68%);

  --color-success-500: hsl(152 55% 38%);
  --color-warning-500: hsl(38 80% 52%);
  --color-danger-500: hsl(4 72% 54%);

  /* Tema claro (padrão) */
  --bg-canvas: hsl(40 25% 97%);
  --bg-surface: hsl(0 0% 100%);
  --bg-surface-raised: hsl(0 0% 100%);
  --bg-subtle: hsl(40 20% 94%);
  --bg-hover: hsl(40 18% 91%);

  --glass-bg: hsla(0, 0%, 100%, 0.6);
  --glass-bg-raised: hsla(0, 0%, 100%, 0.75);
  --glass-border: hsla(30, 20%, 20%, 0.08);
  --glass-blur: 20px;

  --text-primary: hsl(0 0% 8%);
  --text-secondary: hsl(0 0% 33%);
  --text-tertiary: hsl(0 0% 50%);
  --text-on-brand: hsl(0 0% 8%);

  --border-subtle: hsl(38 20% 88%);
  --border-default: hsl(38 15% 80%);

  --shadow-sm: 0 1px 2px hsla(30, 40%, 8%, 0.06);
  --shadow-md: 0 8px 24px hsla(30, 40%, 8%, 0.08);
  --shadow-lg: 0 20px 48px hsla(30, 40%, 8%, 0.16);
  --shadow-glow: 0 0 0 1px hsla(38, 48%, 54%, 0.15), 0 8px 32px hsla(38, 60%, 54%, 0.12);

  --grid-line: hsla(30, 30%, 10%, 0.05);
  --scrim-radial: radial-gradient(ellipse 900px 500px at 50% -10%, hsla(38, 60%, 60%, 0.10), transparent 70%);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg-canvas: hsl(0 0% 3%);
  --bg-surface: hsl(0 0% 6%);
  --bg-surface-raised: hsl(0 0% 9%);
  --bg-subtle: hsl(0 0% 9%);
  --bg-hover: hsl(0 0% 14%);

  --glass-bg: hsla(0, 0%, 10%, 0.55);
  --glass-bg-raised: hsla(0, 0%, 15%, 0.92);
  --glass-border: hsla(38, 30%, 70%, 0.1);
  --glass-blur: 20px;

  --text-primary: hsl(40 30% 96%);
  --text-secondary: hsl(38 12% 68%);
  --text-tertiary: hsl(38 8% 48%);
  --text-on-brand: hsl(0 0% 8%);

  --border-subtle: hsla(38, 25%, 70%, 0.1);
  --border-default: hsla(38, 25%, 70%, 0.18);

  --shadow-sm: 0 1px 2px hsla(0, 0%, 0%, 0.4);
  --shadow-md: 0 8px 24px hsla(0, 0%, 0%, 0.5);
  --shadow-lg: 0 20px 48px hsla(0, 0%, 0%, 0.65);
  --shadow-glow: 0 0 0 1px hsla(38, 48%, 60%, 0.15), 0 8px 32px hsla(38, 60%, 54%, 0.16);

  --grid-line: hsla(38, 40%, 80%, 0.05);
  --scrim-radial: radial-gradient(ellipse 900px 500px at 50% -10%, hsla(38, 70%, 60%, 0.16), transparent 70%);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg-canvas: hsl(0 0% 3%);
    --bg-surface: hsl(0 0% 6%);
    --bg-surface-raised: hsl(0 0% 9%);
    --bg-subtle: hsl(0 0% 9%);
    --bg-hover: hsl(0 0% 14%);

    --glass-bg: hsla(0, 0%, 10%, 0.55);
    --glass-bg-raised: hsla(0, 0%, 15%, 0.92);
    --glass-border: hsla(38, 30%, 70%, 0.1);
    --glass-blur: 20px;

    --text-primary: hsl(40 30% 96%);
    --text-secondary: hsl(38 12% 68%);
    --text-tertiary: hsl(38 8% 48%);
    --text-on-brand: hsl(0 0% 8%);

    --border-subtle: hsla(38, 25%, 70%, 0.1);
    --border-default: hsla(38, 25%, 70%, 0.18);

    --shadow-sm: 0 1px 2px hsla(0, 0%, 0%, 0.4);
    --shadow-md: 0 8px 24px hsla(0, 0%, 0%, 0.5);
    --shadow-lg: 0 20px 48px hsla(0, 0%, 0%, 0.65);
    --shadow-glow: 0 0 0 1px hsla(38, 48%, 60%, 0.15), 0 8px 32px hsla(38, 60%, 54%, 0.16);

    --grid-line: hsla(38, 40%, 80%, 0.05);
    --scrim-radial: radial-gradient(ellipse 900px 500px at 50% -10%, hsla(38, 70%, 60%, 0.16), transparent 70%);

    color-scheme: dark;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-base);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--duration-base) var(--ease-standard), color var(--duration-base) var(--ease-standard);
  position: relative;
  min-height: 100vh;
}

/* ===== Fundo de marca: grid quadriculado + glow + marca no lado direito ===== */

.brand-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.brand-backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 0%, black 55%, transparent 100%);
}

.brand-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--scrim-radial);
}

.brand-backdrop__mark {
  position: absolute;
  top: 50%;
  right: -6vw;
  transform: translateY(-50%);
  width: 62vw;
  min-width: 620px;
  height: auto;
  opacity: 0.07;
  color: var(--color-brand-500);
}

:root:not([data-theme="dark"]) .brand-backdrop__mark {
  opacity: 0.045;
  color: hsl(0 0% 8%);
}

.brand-backdrop__mark path {
  fill: currentColor;
}

@media (max-width: 900px) {
  .brand-backdrop__mark {
    width: 130vw;
    min-width: 0;
    right: -30vw;
    opacity: 0.06;
  }
  :root:not([data-theme="dark"]) .brand-backdrop__mark {
    opacity: 0.04;
  }
}

/* ===== Cartões com efeito de vidro (glassmorphism) ===== */

.glass {
  background-color: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
}

.glass--raised {
  background-color: var(--glass-bg-raised);
}

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

img {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: var(--color-brand-600);
}

:root[data-theme="dark"] a {
  color: var(--color-brand-500);
}

::selection {
  background-color: var(--color-brand-500);
  color: var(--text-on-brand);
}

.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  display: inline-block;
  vertical-align: middle;
}

/* Foco visível para acessibilidade */
:focus-visible {
  outline: 2px solid var(--color-brand-500);
  outline-offset: 2px;
}
