/* ==========================================================================
   Tés Design System, v2 (02/11/2026)
   Arquivo único de tokens, componentes e camada global do site tes.design
   (tema Rio, Nuvemshop). Seções 1 a 10: tokens e componentes das páginas
   customizadas. Seção 11: camada global que padroniza o tema inteiro.

   Regras:
   - Seções 1 a 10 usam o prefixo .tes- e não alteram elementos nativos.
   - A seção 11 altera os elementos nativos do tema de propósito.
   - Cores, tamanhos e raios vêm SEMPRE das variáveis abaixo.
   - Mobile primeiro: o que é maior no desktop entra em @media (min-width: 768px).
   - Instalação: static/css/tes-ds.css no tema Rio + <link> no layout.tpl,
     DEPOIS do CSS do tema (a ordem decide quem vence).
   ========================================================================== */

/* 1. TOKENS ---------------------------------------------------------------- */
:root {
  /* Cores */
  --tes-ink: #1B1B1A;          /* títulos, texto de maior ênfase, botão principal */
  --tes-body: #3B3A36;         /* texto corrido */
  --tes-muted: #6E6A62;        /* texto secundário, legendas, rótulos */
  --tes-line: #DDDDDD;         /* bordas e divisórias */
  --tes-surface: #ECE7DE;      /* fundo bege (blocos de destaque, imagens) */
  --tes-surface-soft: #FAFAF8; /* fundo claro de cards e formulários */
  --tes-bg: #FFFFFF;
  --tes-danger: #C8443C;       /* erro e campo obrigatório */

  /* Tipografia */
  --tes-font: "Plus Jakarta Sans", sans-serif;
  --tes-fs-label: 11px;        /* rótulos em caixa alta */
  --tes-fs-ui: 14px;           /* campos, botões, filtros */
  --tes-fs-body: 16px;         /* texto corrido */
  --tes-fs-h4: 20px;
  --tes-fs-h3: clamp(22px, 3.5vw, 28px);
  --tes-fs-h2: clamp(28px, 5vw, 40px);
  --tes-lh-body: 1.6;
  --tes-lh-tight: 1.2;

  /* Forma */
  --tes-radius: 4px;           /* campos, cards, caixas */
  --tes-radius-pill: 999px;    /* filtros, seletores */

  /* Espaçamento (escala de 4) */
  --tes-sp-1: 4px;
  --tes-sp-2: 8px;
  --tes-sp-3: 16px;
  --tes-sp-4: 24px;
  --tes-sp-5: 40px;
  --tes-sp-6: 64px;

  /* Largura de leitura */
  --tes-measure: 720px;
}

/* 2. BASE DE PÁGINA -------------------------------------------------------- */
.tes-page {
  font-family: var(--tes-font);
  font-size: var(--tes-fs-body);
  line-height: var(--tes-lh-body);
  color: var(--tes-body);
}
.tes-page *,
.tes-page *::before,
.tes-page *::after { box-sizing: border-box; }

/* Botões, campos e selects não herdam a fonte por padrão: forçamos aqui */
.tes-page button,
.tes-page input,
.tes-page select,
.tes-page textarea { font-family: inherit; }

/* 3. TIPOGRAFIA ------------------------------------------------------------ */
.tes-h2 {
  font-size: var(--tes-fs-h2);
  font-weight: 400;
  line-height: var(--tes-lh-tight);
  letter-spacing: -0.01em;
  color: var(--tes-ink);
  margin: 0 0 var(--tes-sp-4);
}
.tes-h3 {
  font-size: var(--tes-fs-h3);
  font-weight: 400;
  line-height: var(--tes-lh-tight);
  color: var(--tes-ink);
  margin: var(--tes-sp-5) 0 var(--tes-sp-3);
}
.tes-h4 {
  font-size: var(--tes-fs-h4);
  font-weight: 400;
  line-height: var(--tes-lh-tight);
  color: var(--tes-ink);
  margin: var(--tes-sp-4) 0 var(--tes-sp-2);
}
.tes-text { max-width: var(--tes-measure); margin: 0 0 var(--tes-sp-3); }
.tes-text strong { color: var(--tes-ink); font-weight: 700; }
.tes-label {
  font-size: var(--tes-fs-label);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tes-muted);
}
.tes-caption {
  font-size: var(--tes-fs-ui);
  color: var(--tes-muted);
  line-height: 1.5;
}

/* 4. CARD, CAIXA DE ATENÇÃO, TABELA --------------------------------------- */
.tes-card {
  background: var(--tes-surface-soft);
  border: 1px solid var(--tes-line);
  border-radius: var(--tes-radius);
  padding: var(--tes-sp-4);
}
.tes-card--surface { background: var(--tes-surface); border-color: transparent; }

.tes-callout {
  background: var(--tes-surface-soft);
  border: 1px solid var(--tes-line);
  border-left: 3px solid var(--tes-ink);
  border-radius: var(--tes-radius);
  padding: var(--tes-sp-3) var(--tes-sp-4);
  font-size: var(--tes-fs-ui);
}
.tes-callout .tes-label { display: block; margin-bottom: var(--tes-sp-1); }
.tes-callout--danger { border-left-color: var(--tes-danger); }

.tes-table { width: 100%; border-collapse: collapse; font-size: var(--tes-fs-ui); }
.tes-table th {
  text-align: left;
  font-size: var(--tes-fs-label);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tes-muted);
}
.tes-table th,
.tes-table td { padding: var(--tes-sp-2) var(--tes-sp-3); border-bottom: 1px solid var(--tes-line); }

/* 5. BOTÕES ---------------------------------------------------------------- */
.tes-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--tes-sp-2);
  padding: 10px 20px;
  font-size: var(--tes-fs-ui);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tes-bg);
  background: var(--tes-ink);
  border: 1px solid var(--tes-ink);
  border-radius: var(--tes-radius);
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s ease;
}
.tes-btn:hover { opacity: .85; }
.tes-btn:focus-visible { outline: 2px solid var(--tes-ink); outline-offset: 2px; }
.tes-btn--ghost { background: transparent; color: var(--tes-ink); }
.tes-btn[disabled] { opacity: .4; cursor: not-allowed; }

/* Botão quadrado de quantidade (+ / -) */
.tes-qty-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--tes-fs-body);
  color: var(--tes-ink);
  background: var(--tes-bg);
  border: 1px solid var(--tes-line);
  border-radius: var(--tes-radius);
  cursor: pointer;
}

/* 6. FILTROS / SELETORES EM PÍLULA ---------------------------------------- */
.tes-pills { display: flex; flex-wrap: wrap; gap: var(--tes-sp-2); }
.tes-pill {
  padding: 6px 14px;
  font-size: var(--tes-fs-ui);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tes-body);
  background: transparent;
  border: 1px solid var(--tes-line);
  border-radius: var(--tes-radius-pill);
  cursor: pointer;
}
.tes-pill:hover { border-color: var(--tes-ink); }
.tes-pill.is-active,
.tes-pill[aria-pressed="true"] {
  background: var(--tes-ink);
  border-color: var(--tes-ink);
  color: var(--tes-bg);
  font-weight: 600;
}

/* 7. CAMPOS DE FORMULÁRIO -------------------------------------------------- */
.tes-field { display: flex; flex-direction: column; gap: var(--tes-sp-1); margin-bottom: var(--tes-sp-3); }
.tes-field > label { font-size: var(--tes-fs-label); color: var(--tes-muted); }
.tes-input,
.tes-select,
.tes-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: var(--tes-fs-ui);
  color: var(--tes-ink);
  background: var(--tes-bg);
  border: 1px solid var(--tes-line);
  border-radius: var(--tes-radius);
}
.tes-input:focus,
.tes-select:focus,
.tes-textarea:focus { outline: none; border-color: var(--tes-ink); }
.tes-field.is-invalid .tes-input,
.tes-field.is-invalid .tes-select,
.tes-field.is-invalid .tes-textarea { border-color: var(--tes-danger); }
.tes-field.is-invalid > label { color: var(--tes-danger); }

/* 8. MENU LATERAL "SEÇÕES" (padrão dos filtros das páginas de produto) ----- */
.tes-sidenav { font-size: var(--tes-fs-ui); }
.tes-sidenav__title { margin: 0 0 var(--tes-sp-3); color: var(--tes-ink); }
.tes-sidenav a {
  display: block;
  padding: var(--tes-sp-1) 0;
  color: var(--tes-muted);
  text-decoration: none;
}
.tes-sidenav a:hover { color: var(--tes-ink); }
.tes-sidenav a.is-active { color: var(--tes-ink); font-weight: 600; }

/* 9. CARROSSEL / GALERIA COM LEGENDA -------------------------------------- */
.tes-gallery { background: var(--tes-surface); border-radius: var(--tes-radius); overflow: hidden; }
.tes-gallery__stage img { display: block; width: 100%; height: auto; }
.tes-gallery__caption { padding: var(--tes-sp-3); color: var(--tes-body); font-size: var(--tes-fs-ui); }
.tes-gallery__thumbs { display: flex; gap: var(--tes-sp-2); padding: 0 var(--tes-sp-3) var(--tes-sp-3); }
.tes-gallery__thumb {
  width: 56px; height: 56px; padding: 0;
  background: var(--tes-bg);
  border: 1px solid transparent;
  border-radius: var(--tes-radius);
  cursor: pointer;
  overflow: hidden;
}
.tes-gallery__thumb.is-active { border-color: var(--tes-ink); }
.tes-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }

/* 10. LAYOUT --------------------------------------------------------------- */
.tes-layout { display: block; }
@media (min-width: 768px) {
  .tes-layout--with-sidenav {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: var(--tes-sp-6);
  }
  .tes-sidenav--sticky { position: sticky; top: var(--tes-sp-5); align-self: start; }
}

/* 11. CAMADA GLOBAL (tema inteiro) ---------------------------------------- */
/* Escala por papel:
   leitura 16px (descrição do produto, guia, políticas)
   interface 14px (corpo base, cards, campos)
   botões 12px em caixa alta, rótulos 11px em caixa alta, migalhas 12px. */

/* 11.1 Variáveis do tema Nuvemshop remapeadas para os tokens da marca.
   Troca o azul padrão (#2980B9) e o cinza azulado (#7F8C8D) herdados do tema.
   As variações de opacidade do tema são fixas em hexadecimal, por isso
   precisam ser reescritas junto. */
:root {
  --main-foreground: #1B1B1A;
  --main-foreground-opacity-05: #1B1B1A0D;
  --main-foreground-opacity-08: #1B1B1A14;
  --main-foreground-opacity-10: #1B1B1A1A;
  --main-foreground-opacity-20: #1B1B1A33;
  --main-foreground-opacity-30: #1B1B1A4D;
  --main-foreground-opacity-40: #1B1B1A66;
  --main-foreground-opacity-50: #1B1B1A80;
  --main-foreground-opacity-60: #1B1B1A99;
  --main-foreground-opacity-80: #1B1B1ACC;
  --main-foreground-opacity-90: #1B1B1AE6;
  --button-background: #1B1B1A;
  --button-foreground: #FFFFFF;
  --accent-color: #6E6A62;
  --accent-color-opacity-20: #6E6A6233;
  --label-foreground: #6E6A62;
  --header-foreground: #1B1B1A;
  --header-foreground-opacity-20: #1B1B1A33;
  --header-foreground-opacity-30: #1B1B1A4D;
  --footer-foreground: #1B1B1A;
  --footer-foreground-opacity-20: #1B1B1A33;
  --footer-foreground-opacity-30: #1B1B1A4D;
  --newsletter-foreground: #1B1B1A;
  --newsletter-foreground-opacity-80: #1B1B1ACC;
}

/* 11.2 Texto base e elementos nativos (classes reais do tema Rio) */
body { font-size: var(--tes-fs-ui); }
.breadcrumbs .crumb { font-size: 12px; }
.form-label {
  font-size: var(--tes-fs-label);
  letter-spacing: 0.08em;
  color: var(--tes-muted);
}
.form-control {
  font-size: var(--tes-fs-ui);
  border: 1px solid var(--tes-line);
  border-radius: var(--tes-radius);
}
.btn {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: var(--tes-radius);
}

/* 11.3 Listagem e produto */
.item-name { font-size: var(--tes-fs-ui); line-height: 1.4; }
/* preço discreto: sempre menor que o nome do produto (lista 14 > 12, página 18 > 14) */
.item-price,
.js-price-display.item-price,
.item-price .js-price-display { font-size: 12px; font-weight: 400; }
.js-price-display { font-size: var(--tes-fs-ui); font-weight: 400; }
.user-content {
  font-size: var(--tes-fs-body);
  line-height: var(--tes-lh-body);
  color: var(--tes-body);
}

/* 11.4 Rodapé */
footer a,
footer p { font-size: 13px; }
footer .subtitle { font-size: var(--tes-fs-label); letter-spacing: 0.1em; }
