/* ==========================================================================
   DESIGN SYSTEM TOKENS — NOVA IDENTIDADE VISUAL SERTÃO NA ARTE / ROCK SERTÃO
   Estética de colagem / cartaz de festival (papel rasgado + pinceladas)
   Cores reais amostradas de DESIGNER EM PRODUÇÃO/ e validadas em WCAG AA
   ========================================================================== */

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

  /* Paleta base (amostrada dos materiais oficiais) */
  --color-cream: #efe2c7;
  --color-cream-light: #f7efe0;
  --color-cream-pure: #fbf6eb;
  --color-cream-deep: #e3d3b1;

  --color-ink: #0f1a12;
  --color-ink-soft: #17261b;
  --color-ink-elevated: #213426;

  --color-mustard: #fbb522;
  --color-orange-logo: #fea901;
  --color-rust: #bd5a21;
  --color-petrol: #12444d;
  --color-electric: #0443de;
  --color-cactus: #628a03;

  /* Superfícies — TEMA CLARO (padrão em toda nova visita) */
  --bg-canvas: #efe2c7;
  --bg-surface: #f7efe0;
  --bg-surface-elevated: #fbf6eb;
  --bg-surface-subtle: #e5d5b4;
  --bg-contrast-band: #0f1a12;
  --bg-header: rgba(239, 226, 199, 0.94);
  --bg-overlay: rgba(15, 26, 18, 0.82);

  /* Texto & Contraste (WCAG AA/AAA sobre #EFE2C7 e #F7EFE0) */
  --text-primary: #111812;         /* 14.08:1 sobre #EFE2C7 */
  --text-secondary: #3b372e;       /*  9.24:1 sobre #EFE2C7 */
  --text-muted: #595246;           /*  6.02:1 sobre #EFE2C7 */
  --text-inverse: #efe2c7;         /* 13.91:1 sobre #0F1A12 */
  --text-on-mustard: #0d160f;      /* 10.30:1 sobre #FBB522 */

  /* Bordas */
  --border-subtle: rgba(15, 26, 18, 0.16);
  --border-default: rgba(15, 26, 18, 0.32);
  --border-ink: #111812;
  --border-warm: #8f3e11;

  /* Acentos semânticos AA no tema claro */
  --accent-primary: #fbb522;
  --accent-primary-hover: #fea901;
  --accent-text: #8f3e11;          /* Ferrugem ajustado AA: 5.71:1 sobre #EFE2C7 */
  --accent-petrol-text: #12444d;   /* Petróleo real AA: 8.35:1 sobre #EFE2C7 */
  --accent-electric-text: #0443de; /* Azul elétrico AA: 5.72:1 sobre #EFE2C7 */
  --accent-open-bg: #12444d;
  --accent-open-text: #fbf6eb;
  --accent-soon-bg: #fbb522;
  --accent-soon-text: #0d160f;
  --accent-closed-bg: rgba(15, 26, 18, 0.08);
  --accent-closed-text: #474137;
  --accent-error: #9e2a1c;
  --accent-error-bg: rgba(158, 42, 28, 0.1);
  --accent-success: #165e2d;
  --accent-success-bg: rgba(22, 94, 45, 0.1);

  /* Texturas temáticas */
  --paper-texture-opacity: 0.28;
  --divider-to-alt: url('../img/textures/divisor-rasgado-escuro.webp');
  --divider-to-canvas: url('../img/textures/divisor-rasgado-creme.webp');

  /* Sombras de colagem / cartaz */
  --shadow-poster: 4px 4px 0 #111812;
  --shadow-poster-sm: 3px 3px 0 #111812;
  --shadow-paper: 0 10px 26px rgba(15, 26, 18, 0.14);
  --shadow-modal: 0 24px 60px rgba(8, 13, 6, 0.45);

  /* Tipografia (Anton condensada pesada + Plus Jakarta Sans legível) */
  --font-display: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', Consolas, monospace;

  /* Escala tipográfica em rem (escala com widget de acessibilidade) */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.35rem;
  --text-2xl: clamp(1.45rem, 2.6vw, 2rem);
  --text-3xl: clamp(1.85rem, 4.2vw, 3rem);
  --text-hero: clamp(2.6rem, 6.8vw, 5.2rem);

  /* Espaçamento */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Raios (mais retos / artesanais, sem aspecto bolha) */
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-full: 9999px;

  /* Layout e camadas */
  --container-max: 76rem;
  --header-height: 5rem;
  --z-header: 60;
  --z-drawer: 80;
  --z-fab: 90;
  --z-modal: 120;
  --z-lightbox: 140;

  /* Transições */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 160ms;
  --duration-base: 260ms;
}

/* ==========================================================================
   TEMA ESCURO — Preto Esverdeado (#0F1A12) + Tinta Creme (#EFE2C7)
   ========================================================================== */
[data-theme="dark"] {
  color-scheme: dark;

  --bg-canvas: #0f1a12;
  --bg-surface: #17261b;
  --bg-surface-elevated: #203325;
  --bg-surface-subtle: #0b140d;
  --bg-contrast-band: #17261b;
  --bg-header: rgba(15, 26, 18, 0.94);
  --bg-overlay: rgba(8, 13, 6, 0.88);

  /* Texto & Contraste (WCAG AA/AAA sobre #0F1A12 e #17261B) */
  --text-primary: #efe2c7;         /* 13.91:1 sobre #0F1A12 */
  --text-secondary: #cbc0a8;       /*  9.90:1 sobre #0F1A12 */
  --text-muted: #a19783;           /*  6.18:1 sobre #0F1A12 */
  --text-inverse: #0d160f;
  --text-on-mustard: #0d160f;      /* 10.30:1 sobre #FBB522 */

  /* Bordas */
  --border-subtle: rgba(239, 226, 199, 0.16);
  --border-default: rgba(239, 226, 199, 0.30);
  --border-ink: #efe2c7;
  --border-warm: rgba(251, 181, 34, 0.55);

  /* Acentos semânticos AA no tema escuro */
  --accent-primary: #fbb522;
  --accent-primary-hover: #fea901;
  --accent-text: #e5844a;          /* Ferrugem claro AA: 6.57:1 sobre #0F1A12 */
  --accent-petrol-text: #52b8c4;   /* Petróleo claro AA: 7.66:1 sobre #0F1A12 */
  --accent-electric-text: #7ea8ff; /* Azul elétrico claro AA: 7.1:1 sobre #0F1A12 */
  --accent-open-bg: #fbb522;
  --accent-open-text: #0d160f;
  --accent-soon-bg: rgba(251, 181, 34, 0.16);
  --accent-soon-text: #fbb522;
  --accent-closed-bg: rgba(239, 226, 199, 0.08);
  --accent-closed-text: #cbc0a8;
  --accent-error: #f28b82;
  --accent-error-bg: rgba(242, 139, 130, 0.12);
  --accent-success: #6dd58c;
  --accent-success-bg: rgba(109, 213, 140, 0.12);

  --paper-texture-opacity: 0.04;
  --divider-to-alt: url('../img/textures/divisor-rasgado-creme.webp');
  --divider-to-canvas: url('../img/textures/divisor-rasgado-escuro.webp');

  --shadow-poster: 4px 4px 0 #050a06;
  --shadow-poster-sm: 3px 3px 0 #050a06;
  --shadow-paper: 0 14px 32px rgba(0, 0, 0, 0.42);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.72);
}

/* ==========================================================================
   ALTO CONTRASTE ACESSÍVEL — Funciona por cima dos temas Claro e Escuro
   ========================================================================== */
[data-contrast="high"],
[data-theme="light"][data-contrast="high"],
[data-theme="dark"][data-contrast="high"] {
  --bg-canvas: #000000;
  --bg-surface: #0a0a0a;
  --bg-surface-elevated: #141414;
  --bg-surface-subtle: #050505;
  --bg-contrast-band: #000000;
  --bg-header: #000000;
  --bg-overlay: rgba(0, 0, 0, 0.96);

  --text-primary: #ffffff;
  --text-secondary: #ffffff;
  --text-muted: #f2f2f2;
  --text-inverse: #000000;
  --text-on-mustard: #000000;

  --border-subtle: rgba(255, 255, 255, 0.65);
  --border-default: #ffffff;
  --border-ink: #ffd400;
  --border-warm: #ffd400;

  --accent-primary: #ffd400;
  --accent-primary-hover: #ffe44d;
  --accent-text: #ffd400;
  --accent-petrol-text: #5cf2ff;
  --accent-electric-text: #7fb2ff;
  --accent-open-bg: #ffd400;
  --accent-open-text: #000000;
  --accent-soon-bg: #000000;
  --accent-soon-text: #ffd400;
  --accent-closed-bg: #141414;
  --accent-closed-text: #ffffff;
  --accent-error: #ff8080;
  --accent-success: #6dff8f;

  --paper-texture-opacity: 0;
  --shadow-poster: none;
  --shadow-poster-sm: none;
  --shadow-paper: none;
}

[data-contrast="high"] a:not(.btn):not(.site-nav__link) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

[data-contrast="high"] .card,
[data-contrast="high"] .notice-card,
[data-contrast="high"] .media-card,
[data-contrast="high"] .modal__dialog,
[data-contrast="high"] .site-header {
  border-width: 2px;
}

/* Transição suave ao alternar tema (respeita prefers-reduced-motion) */
html.theme-transitioning,
html.theme-transitioning body,
html.theme-transitioning .site-header,
html.theme-transitioning .card,
html.theme-transitioning .notice-card,
html.theme-transitioning .media-card,
html.theme-transitioning .btn,
html.theme-transitioning .section {
  transition:
    background-color var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}
