/* ==========================================================================
   BASE & RESET — SERTÃO NA ARTE / ROCK SERTÃO (ESTÉTICA DE COLAGEM)
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1.25rem);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Textura sutil de papel (controlada e atrás das superfícies lisas de leitura) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url('../img/textures/papel-creme-base.webp');
  background-size: 560px auto;
  background-repeat: repeat;
  opacity: var(--paper-texture-opacity);
}

main {
  flex: 1 0 auto;
  padding-top: var(--header-height);
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent-petrol-text);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--accent-text);
}

/* Títulos em Anton (condensada pesada, caixa alta, limpa — nunca grunge no texto) */
h1,
h2,
h3,
h4,
h5 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--text-primary);
  overflow-wrap: break-word;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

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

/* Foco visível acessível */
:focus-visible {
  outline: 3px solid var(--accent-electric-text);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Pular para o conteúdo */
.skip-link {
  position: fixed;
  top: -100%;
  left: var(--space-4);
  z-index: 999;
  padding: var(--space-3) var(--space-5);
  background: var(--color-mustard);
  color: var(--text-on-mustard);
  border: 2px solid var(--color-ink);
  font-weight: 700;
  font-size: var(--text-sm);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: var(--space-4);
}

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

/* Container & Seções */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2rem);
}

.section {
  padding-block: clamp(3.25rem, 6vw, 5.25rem);
  position: relative;
}

.section--alt {
  background-color: var(--bg-surface-subtle);
}

/* Faixa escura de alto impacto (papel preto rasgado — funciona em ambos os temas!) */
.section--ink {
  background-color: #0f1a12;
  color: #efe2c7;
  --bg-surface: #17261b;
  --bg-surface-elevated: #203325;
  --bg-surface-subtle: #0b140d;
  --text-primary: #efe2c7;
  --text-secondary: #cbc0a8;
  --text-muted: #a19783;
  --border-subtle: rgba(239, 226, 199, 0.16);
  --border-default: rgba(239, 226, 199, 0.32);
  --border-ink: #efe2c7;
  --accent-petrol-text: #52b8c4;
  --accent-text: #fbb522;
  --accent-soon-bg: rgba(251, 181, 34, 0.16);
  --accent-soon-text: #fbb522;
  --shadow-poster: 4px 4px 0 #050a06;
  --shadow-poster-sm: 3px 3px 0 #050a06;
}

[data-contrast="high"] .section--ink {
  background-color: #000000;
  color: #ffffff;
  --text-primary: #ffffff;
  --text-secondary: #ffffff;
}

/* Divisores rasgados decorativos (imagem única reaproveitada) */
.torn-divider {
  display: block;
  width: 100%;
  height: clamp(1.35rem, 2.6vw, 2.15rem);
  background-repeat: repeat-x;
  background-size: auto 100%;
  background-position: center bottom;
  pointer-events: none;
  user-select: none;
}

.torn-divider--dark {
  background-image: url('../img/textures/divisor-rasgado-escuro.webp');
}

.torn-divider--cream {
  background-image: url('../img/textures/divisor-rasgado-creme.webp');
}

.torn-divider--flip {
  transform: scaleY(-1);
}

/* No tema escuro, o divisor de saída de seção clara vira borda creme sobre escuro */
[data-theme="dark"] .torn-divider--auto-ink {
  background-image: url('../img/textures/divisor-rasgado-creme.webp');
  opacity: 0.22;
}

[data-theme="light"] .torn-divider--auto-ink {
  background-image: url('../img/textures/divisor-rasgado-escuro.webp');
}

[data-contrast="high"] .torn-divider {
  display: none;
}

/* Eyebrow / Kicker */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-petrol-text);
  margin-bottom: var(--space-3);
}

.eyebrow--rust {
  color: var(--accent-text);
}

.eyebrow svg {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
}

.section-header {
  max-width: 46rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section-header--center {
  margin-inline: auto;
  text-align: center;
}

.section-header--row {
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

.section-title {
  font-size: var(--text-3xl);
}

/* Destaque de título: faixa mostarda com tinta preta (100% WCAG AAA!) */
.title-mark {
  display: inline-block;
  padding: 0.04em 0.24em;
  background-color: var(--color-mustard);
  color: var(--text-on-mustard);
  transform: rotate(-1deg);
}

.section-subtitle {
  margin-top: var(--space-3);
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 60ch;
}

.section-header--center .section-subtitle {
  margin-inline: auto;
}

/* Grids utilitários */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid > * {
  min-width: 0;
}

.grid--2,
.grid--3,
.grid--4 {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid--2,
  .grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stack-sm > * + * { margin-top: var(--space-3); }
.stack-md > * + * { margin-top: var(--space-5); }
.stack-lg > * + * { margin-top: var(--space-8); }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: var(--text-sm); }
.text-xs-strong { font-size: var(--text-xs); font-weight: 700; }
.mono-value { font-family: var(--font-mono); font-size: 1.05rem; }

.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-4 { margin-bottom: var(--space-4); }

.placeholder-note {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 2px dashed var(--accent-text);
  background: var(--bg-surface-elevated);
  color: var(--accent-text);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* Respeita prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .title-mark,
  .card--tilted-left,
  .card--tilted-right {
    transform: none !important;
  }
}
