/* =========================================================
   Pixel Educação — colors_and_type.css
   Canonical design tokens + semantic typography styles.
   Source of truth: brand-assets/BRAND.md, colors/palette.md
   ========================================================= */

/* ---------- Webfonts ----------
   Carbona: official files now present under fonts/ (variable + static OTFs).
   Articulat CF (body) and Roca (editorial) still substituted via Google Fonts
   (Manrope + Fraunces) until licensed files arrive.
----------------------------------------------------------- */
@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&display=swap");

/* Carbona — variable first, OTF statics as graceful fallbacks per weight/style */
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona_Variable.ttf") format("truetype-variations"),
       url("fonts/Carbona_Variable.ttf") format("truetype");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-ExtraLight.otf") format("opentype");
  font-weight: 200; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-Light.otf") format("opentype");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-Regular.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-Medium.otf") format("opentype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-SemiBold.otf") format("opentype");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-Bold.otf") format("opentype");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-ExtraBold.otf") format("opentype");
  font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-Black.otf") format("opentype");
  font-weight: 900; font-style: normal; font-display: swap;
}
/* Slanted (Carbona has slanted, not true italics) */
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-RegularSlanted.otf") format("opentype");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-MediumSlanted.otf") format("opentype");
  font-weight: 500; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-SemiBoldSlanted.otf") format("opentype");
  font-weight: 600; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-BoldSlanted.otf") format("opentype");
  font-weight: 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-ExtraBoldSlanted.otf") format("opentype");
  font-weight: 800; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Carbona";
  src: url("fonts/Carbona-BlackSlanted.otf") format("opentype");
  font-weight: 900; font-style: italic; font-display: swap;
}

/* Carbona Mono — official monospace variant of the family */
@font-face {
  font-family: "Carbona Mono";
  src: url("fonts/Carbona-MonoRegular.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona Mono";
  src: url("fonts/Carbona-MonoMedium.otf") format("opentype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona Mono";
  src: url("fonts/Carbona-MonoSemiBold.otf") format("opentype");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona Mono";
  src: url("fonts/Carbona-MonoBold.otf") format("opentype");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona Mono";
  src: url("fonts/Carbona-MonoBlack.otf") format("opentype");
  font-weight: 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carbona Mono";
  src: url("fonts/Carbona-MonoSlanted.otf") format("opentype");
  font-weight: 400; font-style: italic; font-display: swap;
}

:root {
  /* =========================================================
     1. BRAND COLORS — raw tokens (from palette.md)
     ========================================================= */

  /* Azuis — autoridade, estrutura */
  --blue-core:       #101C7E;   /* Azul núcleo  */
  --blue-support:    #2D3BAB;   /* Azul apoio   */
  --blue-light:      #606FEF;   /* Azul apoio claro */

  /* Laranjas — energia, CTA */
  --orange-impulse:  #FE5000;   /* Laranja impulso */
  --orange-support:  #CC4100;   /* Laranja apoio (hover/contraste) */
  --orange-light:    #FFA38D;   /* Laranja claro */

  /* Lilás — conexão, comunidade */
  --lilac-connect:   #D8B3FD;   /* Lilás conexão  */
  --lilac-support:   #C986F6;   /* Lilás apoio    */
  --lilac-deep:      #7C50B1;   /* Lilás escuro   */

  /* Neutros — fundo, divisórias */
  --bg-base:         #F2F1ED;   /* Fundo principal */
  --neutral-soft:    #DFDFDF;   /* Neutro apoio    */
  --neutral-dense:   #C5C5C5;   /* Neutro denso    */

  /* Complementares calculados (não estão no palette.md;
     derivados via oklch para contraste dark/forms) */
  --ink:             #0A1254;   /* sombra mais densa do blue-core p/ texto máximo */
  --paper:           #FBFAF6;   /* off-white mais claro que bg-base, p/ cards */
  --ink-soft:        rgba(16, 28, 126, 0.72); /* fg em blue-core 72% */
  --ink-mute:        rgba(16, 28, 126, 0.52);
  --ink-faint:       rgba(16, 28, 126, 0.28);

  /* =========================================================
     2. SEMANTIC COLOR TOKENS
     ========================================================= */

  /* Superfícies */
  --surface-canvas:  var(--bg-base);       /* fundo padrão da página */
  --surface-card:    var(--paper);         /* cards em cima do canvas */
  --surface-raised:  #FFFFFF;              /* elevação máxima — usar com parcimônia */
  --surface-inset:   var(--neutral-soft);  /* inputs, áreas pressionadas */
  --surface-dark:    var(--blue-core);     /* hero escuro, reports editorial */
  --surface-deep:    var(--ink);           /* dark mode base */

  /* Foreground (texto e ícones) */
  --fg-1:            var(--blue-core);     /* títulos, texto principal */
  --fg-2:            var(--ink-soft);      /* texto de apoio */
  --fg-3:            var(--ink-mute);      /* legenda, metadata */
  --fg-4:            var(--ink-faint);     /* placeholder, divisores com texto */
  --fg-on-dark:      var(--bg-base);       /* texto sobre surface-dark */
  --fg-on-accent:    #FFFFFF;              /* texto sobre laranja impulso */

  /* Ações */
  --action-primary:        var(--orange-impulse);
  --action-primary-hover:  var(--orange-support);
  --action-primary-soft:   var(--orange-light);
  --action-secondary:      var(--blue-core);
  --action-secondary-hover: var(--blue-support);
  --action-muted:          var(--neutral-soft);

  /* Acentos conceituais (vêm do BRAND.md: azul ancora, laranja ativa, lilás conecta) */
  --accent-authority: var(--blue-core);
  --accent-energy:    var(--orange-impulse);
  --accent-connect:   var(--lilac-connect);

  /* Estados (derivados — não há tokens explícitos na palette) */
  --state-success:   #1F8A5C;   /* harmoniza com blue-core, sóbrio */
  --state-warning:   #C97A00;
  --state-danger:    var(--orange-support);
  --state-info:      var(--blue-light);

  /* Bordas */
  --border-subtle:   var(--neutral-soft);
  --border-default:  var(--neutral-dense);
  --border-strong:   var(--ink-faint);
  --border-focus:    var(--orange-impulse);

  /* =========================================================
     3. TYPOGRAPHY — families, weights, tracking
     ========================================================= */

  /* Famílias — Carbona oficial em display; Manrope/Fraunces ainda substituem Articulat/Roca */
  --font-display:    "Carbona", system-ui, -apple-system, sans-serif;
  --font-body:       "Manrope", "Articulat CF", system-ui, -apple-system, sans-serif; /* Articulat CF: substituto */
  --font-editorial:  "Fraunces", "Roca", Georgia, "Times New Roman", serif;           /* Roca: substituto */
  --font-mono:       "Carbona Mono", "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  /* Pesos semânticos */
  --weight-display:  800;     /* Carbona Black p/ headlines */
  --weight-title:    700;
  --weight-strong:   600;
  --weight-body:     500;
  --weight-regular:  400;

  /* Escala tipográfica (modular ratio ~1.25, tuned) */
  --fs-caption:      12px;
  --fs-small:        14px;
  --fs-body:         16px;
  --fs-body-lg:      18px;
  --fs-h6:           20px;
  --fs-h5:           24px;
  --fs-h4:           32px;
  --fs-h3:           40px;
  --fs-h2:           56px;
  --fs-h1:           72px;
  --fs-display:      112px;   /* números grandes, manchetes editoriais */

  /* Line-heights — amplos, condizem com "respiro" no BRAND.md */
  --lh-tight:        1.02;    /* display */
  --lh-headline:     1.08;
  --lh-title:        1.18;
  --lh-body:         1.55;
  --lh-loose:        1.7;

  /* Tracking */
  --track-display:   -0.035em; /* Carbona grande quer tracking negativo */
  --track-headline:  -0.02em;
  --track-title:     -0.01em;
  --track-body:      0em;
  --track-eyebrow:   0.14em;   /* eyebrow em caixa alta, espaçado */

  /* =========================================================
     4. SPACING — base 4, generous ("bastante espaço negativo")
     ========================================================= */
  --space-0:   0;
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   24px;
  --space-6:   32px;
  --space-7:   48px;
  --space-8:   64px;
  --space-9:   96px;
  --space-10:  128px;
  --space-11:  192px;

  /* =========================================================
     5. RADII — modular, generoso mas não redondo demais
     ========================================================= */
  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-2xl: 40px;
  --radius-pill: 999px;

  /* =========================================================
     6. SHADOWS — suaves, editoriais, quase nunca coloridas
     ========================================================= */
  --shadow-xs:  0 1px 2px rgba(16, 28, 126, 0.06);
  --shadow-sm:  0 2px 6px rgba(16, 28, 126, 0.06), 0 1px 2px rgba(16, 28, 126, 0.04);
  --shadow-md:  0 8px 20px rgba(16, 28, 126, 0.08), 0 2px 4px rgba(16, 28, 126, 0.04);
  --shadow-lg:  0 20px 44px rgba(16, 28, 126, 0.10), 0 4px 8px rgba(16, 28, 126, 0.04);
  --shadow-xl:  0 40px 80px rgba(16, 28, 126, 0.14);

  /* Elevação em laranja (raro — só CTA focado) */
  --shadow-cta: 0 8px 20px rgba(254, 80, 0, 0.28);

  /* Inner */
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.5),
                  inset 0 -1px 0 rgba(16,28,126,0.06);

  /* =========================================================
     7. MOTION — curvas calmas, sem bounces fofos
     ========================================================= */
  --dur-fast:      120ms;
  --dur-base:      200ms;
  --dur-slow:      360ms;
  --ease-standard: cubic-bezier(0.2, 0.0, 0, 1);
  --ease-emphasis: cubic-bezier(0.2, 0.7, 0.1, 1);
  --ease-exit:     cubic-bezier(0.4, 0.0, 1, 1);

  /* =========================================================
     8. LAYOUT
     ========================================================= */
  --container-sm:  640px;
  --container-md:  880px;
  --container-lg:  1120px;
  --container-xl:  1320px;
  --grid-gutter:   24px;
  --section-y:     96px;
}

/* =========================================================
   SEMANTIC TYPOGRAPHY STYLES
   Use these classes (or copy their declarations) instead of
   re-specifying size/weight/family every time.
   ========================================================= */

html { color-scheme: light; }

body {
  background: var(--surface-canvas);
  color: var(--fg-1);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  font-weight: var(--weight-strong);
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--accent-energy);
}

h1, .h1 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--fs-h1);
  line-height: var(--lh-headline);
  letter-spacing: var(--track-headline);
  color: var(--fg-1);
  margin: 0;
  text-wrap: balance;
}

h2, .h2 {
  font-family: var(--font-display);
  font-weight: var(--weight-title);
  font-size: var(--fs-h2);
  line-height: var(--lh-headline);
  letter-spacing: var(--track-headline);
  color: var(--fg-1);
  margin: 0;
  text-wrap: balance;
}

h3, .h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-title);
  font-size: var(--fs-h3);
  line-height: var(--lh-title);
  letter-spacing: var(--track-title);
  color: var(--fg-1);
  margin: 0;
}

h4, .h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-strong);
  font-size: var(--fs-h4);
  line-height: var(--lh-title);
  letter-spacing: var(--track-title);
  color: var(--fg-1);
  margin: 0;
}

h5, .h5 {
  font-family: var(--font-body);
  font-weight: var(--weight-strong);
  font-size: var(--fs-h5);
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--fg-1);
  margin: 0;
}

h6, .h6 {
  font-family: var(--font-body);
  font-weight: var(--weight-strong);
  font-size: var(--fs-h6);
  line-height: 1.35;
  color: var(--fg-1);
  margin: 0;
}

.display {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--track-display);
  color: var(--fg-1);
}

.editorial {
  font-family: var(--font-editorial);
  font-weight: 500;
  font-style: italic;
  font-size: var(--fs-h3);
  line-height: var(--lh-title);
  letter-spacing: -0.01em;
  color: var(--fg-1);
}

.lede {
  font-family: var(--font-body);
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body);
  color: var(--fg-2);
  font-weight: var(--weight-regular);
}

p, .p {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--fg-2);
  margin: 0 0 var(--space-4);
}

.caption {
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--fg-3);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.94em;
  letter-spacing: -0.01em;
}

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.94em;
  background: var(--surface-inset);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

a {
  color: var(--accent-energy);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color var(--dur-base) var(--ease-standard);
}
a:hover { color: var(--action-primary-hover); }

::selection {
  background: var(--lilac-connect);
  color: var(--blue-core);
}
