/* =============================================================================
   KAÔ STUDIO — DESIGN SYSTEM
   base.css · Fontes, reset, tipografia, grão, superfícies, acessibilidade
   Depende de tokens.css (carregar antes).
   ============================================================================= */

/* =============================================================================
   FONTES (§4) — três papéis exclusivos. font-display: swap em todas.
   ============================================================================= */
@font-face {
  font-family: "Clash Grotesk";
  src: url("../assets/fonts/ClashGrotesk-Variable.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Clash Display";
  src: url("../assets/fonts/ClashDisplay-Variable.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DRUZHOK";
  src: url("../assets/fonts/DRUZHOK.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Papéis tipográficos (§4) */
  --font-grotesk: "Clash Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Clash Display", "Clash Grotesk", system-ui, sans-serif;
  --font-druzhok: "DRUZHOK", "Clash Display", system-ui, sans-serif;

  /* Layout */
  --container-max: 1320px;
  --container-pad: clamp(20px, 5vw, 64px);
  --section-pad:   clamp(64px, 10vw, 128px);

  /* Grão de filme (§8) — data URI, mesma intensidade em todo braço */
  --grain-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-opacity: 0.5;

  /* Motion */
  --ease-petala: cubic-bezier(0.6, 0.02, 0.1, 1);
  --dur-fast: 0.25s;
  --dur-med:  0.45s;
  --dur-slow: 0.8s;
}

/* =============================================================================
   RESET COMPLEMENTAR
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-grotesk);
  font-weight: 400;
  font-size: clamp(1rem, 0.55vw + 0.9rem, 1.125rem);
  line-height: 1.6;
  color: var(--color-text-on-light);
  background: var(--kao-color-creme);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--color-identity); color: var(--kao-color-creme); }

/* =============================================================================
   TIPOGRAFIA (§4) — papéis sem sobreposição
   ============================================================================= */

/* DRUZHOK — só wordmark (§4). Nunca texto corrido. */
.wordmark { font-family: var(--font-druzhok); font-weight: 400; letter-spacing: 0.01em; line-height: 1; }

/* Clash Display — títulos grandes e marcantes, uso pontual (§4) */
.t-hero {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(3rem, 10.5vw, 9rem);
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.t-display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: 0.96;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

/* Clash Grotesk — títulos menores, corpo, toda a UI (§4, default) */
.t-h2 {
  font-family: var(--font-grotesk);
  font-weight: 600;
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.t-h3 {
  font-family: var(--font-grotesk);
  font-weight: 600;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  line-height: 1.15;
}
.t-lead {
  font-size: clamp(1.125rem, 1.6vw, 1.5rem);
  line-height: 1.45;
  font-weight: 400;
}
.eyebrow {
  font-family: var(--font-grotesk);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.t-num {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 0.85;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* =============================================================================
   LAYOUT
   ============================================================================= */
.container { width: 100%; max-width: var(--container-max); margin-inline: auto; padding-inline: var(--container-pad); }
.section { position: relative; padding-block: var(--section-pad); }
.stack > * + * { margin-top: var(--kao-space-24); }

/* =============================================================================
   SUPERFÍCIES + GRÃO (§5, §8)
   Ordem de camadas garantida: cor sólida -> grão (::before) -> conteúdo (z1).
   Grão nunca toca a tipografia porque o texto vive acima do ::before.
   ============================================================================= */
.surface { position: relative; isolation: isolate; }
.surface > * { position: relative; z-index: 1; }
.surface::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--grain-url);
  background-size: 140px 140px;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* Papéis de cor de fundo com seu texto correto (contraste AA, exceto exceção âmbar) */
.surface-cream { background: var(--kao-color-creme); color: var(--color-text-on-light); }
.surface-bordo { background: var(--kao-color-bordo); color: var(--color-text-on-dark); }
.surface-coxia { background: var(--kao-color-coxia); color: var(--color-text-on-dark); }
.surface-verde { background: var(--kao-color-verde); color: var(--color-text-on-dark); }
/* Âmbar: exceção estética assumida da marca — creme sobre âmbar (§5.1 nota) */
.surface-amber { background: var(--kao-color-laranja-ambar); color: var(--kao-color-bordo); }
.surface-ink   { background: #0e0e0e; color: var(--kao-color-creme); }

/* Bloco divisor sólido bordô (§5.1 papel extra) — nunca gradiente */
.divider-bordo { background: var(--color-divider); height: clamp(48px, 8vw, 120px); }

/* Cor de destaque textual */
.hl { color: var(--color-identity); }
.hl-2 { color: var(--color-highlight-secondary); }

/* =============================================================================
   REVEAL / MOTION — blocos entram (ref. agero). Respeita reduced-motion.
   ============================================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--dur-slow) var(--ease-petala),
              transform var(--dur-slow) var(--ease-petala);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* =============================================================================
   ACESSIBILIDADE (§10)
   ============================================================================= */
:focus-visible {
  outline: var(--kao-focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--kao-focus-ring-offset);
  border-radius: 2px;
}
.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--kao-color-bordo); color: var(--kao-color-creme);
  padding: 12px 18px; border-radius: 8px; z-index: 200;
  transition: top var(--dur-fast) ease;
}
.skip-link:focus { top: 12px; }
.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;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
