/* ==========================================================================
   Alliance Automação Industrial — site institucional
   Fonte da verdade: specs/design.md. Tokens §4.3 · Tipografia §5 · Ritmo §6
   · Componentes §7. Não altere valores aqui sem alterar o design.md antes.
   ========================================================================== */

/* ---------- Fontes (hospedadas localmente, sem CDN) ---------- */
@font-face {
  font-family: "Instrument Serif";
  src: url("../assets/fonts/instrument-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../assets/fonts/instrument-serif-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens (design.md §4.3) ---------- */
:root {
  --base: #f3f3f3;
  --base-alt: #e9e9e9;
  --tinta: #1a1a1a;
  --tinta-suave: #686868;
  --escuro: #1b1b1b;
  --sobre-escuro: #f3f3f3;
  --marca: #13a11d;
  --acento: #0e7d16;
  --acento-hover: #0b6a12;
  --linha: #dadada;

  --font-display: "Instrument Serif", "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --container: 1560px;
  --gutter: clamp(20px, 4vw, 40px);
  --sec: clamp(72px, 11vw, 168px); /* respiro vertical entre seções, §6 */
  --header-h: 96px;
  --radius: 8px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--base);
  color: var(--tinta);
  font-family: var(--font-sans);
  font-size: clamp(16px, 0.6vw + 10px, 20px);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
img, picture { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; border-radius: 2px; }
.on-dark :focus-visible, .hero :focus-visible, .site-header :focus-visible { outline-color: var(--sobre-escuro); }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--sobre-escuro); color: var(--tinta);
  padding: 10px 16px; border-radius: 999px; font-weight: 500; text-decoration: none;
}
.skip-link:focus { top: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--sec); }

/* ---------- Tipografia (design.md §5) ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.08;
  text-wrap: balance;
}
.h-hero { font-size: clamp(60px, 10.6vw, 148px); line-height: 1.02; }
.h-section { font-size: clamp(44px, 4.4vw, 84px); }
.h-stat { font-size: clamp(56px, 8.4vw, 120px); line-height: 1.02; }
.eyebrow {
  font-size: clamp(14px, 0.6vw + 8px, 20px); font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.14em; line-height: 1.4; color: var(--tinta);
}
.lead { font-size: clamp(18px, 0.8vw + 11px, 24px); max-width: 60ch; }
.small { font-size: 14px; line-height: 1.55; }
.muted { color: var(--tinta-suave); }
.center { text-align: center; margin-inline: auto; }

/* ---------- Botões (design.md §7) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 15px 30px; border: 0; border-radius: 999px;
  font-size: 15px; font-weight: 500; line-height: 1.2; text-decoration: none;
  cursor: pointer; transition: background-color 0.2s ease;
}
.btn--primary { background: var(--acento); color: #fff; }
.btn--primary:hover { background: var(--acento-hover); }
.btn--dark { background: var(--escuro); color: var(--sobre-escuro); }
.btn--dark:hover { background: #333333; }
.btn--sm { padding: 11px 22px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- Header (§3 seção 1): slim, transparente sobre o hero ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--header-h);
  color: var(--sobre-escuro);
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
}
.site-header.is-scrolled { background: rgba(27, 27, 27, 0.9); backdrop-filter: blur(10px); }
/* Véu escuro atrás do topo: o cabeçalho continua transparente, mas o logo e o menu ganham contraste
   sobre as partes claras da foto. Some quando o cabeçalho ganha fundo sólido ao rolar. */
.site-header::before {
  content: ""; position: absolute; inset: 0 0 -56px 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(27, 27, 27, 0.86) 0%, rgba(27, 27, 27, 0.6) 55%, rgba(27, 27, 27, 0) 100%);
  transition: opacity 0.3s ease;
}
.site-header.is-scrolled::before, .site-header.nav-open::before { opacity: 0; }
.site-header__inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: block; flex: none; }
.brand img { width: clamp(176px, 16vw, 240px); height: auto; filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.55)); }
.nav { margin-inline: auto; }
.nav__list { display: flex; gap: clamp(20px, 3vw, 40px); }
.nav a { font-size: 16px; font-weight: 500; text-decoration: none; opacity: 0.88; padding-block: 8px; }
.nav a:hover { opacity: 1; }
.site-header__cta { flex: none; padding: 17px 34px; font-size: 16px; }
.nav-toggle {
  display: none; margin-left: auto; width: 44px; height: 44px; border: 0; background: transparent;
  cursor: pointer; border-radius: 999px; align-items: center; justify-content: center;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 20px; height: 2px; background: currentColor; position: relative; transition: transform 0.2s ease, background-color 0.2s ease;
}
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 900px) {
  :root { --header-h: 76px; }
  .brand img { width: 168px; }
  .nav-toggle { display: inline-flex; }
  .site-header__cta { display: none; }
  .nav {
    position: absolute; inset: var(--header-h) 0 auto 0; margin: 0;
    background: var(--escuro); padding: 12px var(--gutter) 28px;
    display: none; border-top: 1px solid rgba(243, 243, 243, 0.12);
  }
  .nav.is-open { display: block; }
  .nav__list { flex-direction: column; gap: 0; }
  .nav a { display: block; padding: 16px 0; font-size: 17px; border-bottom: 1px solid rgba(243, 243, 243, 0.1); }
  .nav .btn { margin-top: 20px; width: 100%; border-bottom: 0; }
  .site-header.nav-open { background: var(--escuro); }
}
@media (min-width: 901px) { .nav__cta-mobile { display: none; } }

/* ---------- Hero (§3 seção 2) ---------- */
.hero {
  position: relative; isolation: isolate; color: var(--sobre-escuro);
  min-height: max(640px, 100svh); display: flex; align-items: flex-start; justify-content: center;
  background: var(--escuro); overflow: hidden;
}
.hero__media, .hero__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to bottom, rgba(27, 27, 27, 0.5) 0%, rgba(27, 27, 27, 0.3) 45%, rgba(27, 27, 27, 0.55) 100%);
}
.hero__content {
  padding: clamp(128px, 24vh, 240px) var(--gutter) 96px;
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 26px; max-width: 1320px;
}
.hero__sub { font-size: clamp(19px, 1.4vw + 12px, 28px); max-width: 38ch; color: rgba(243, 243, 243, 0.92); text-wrap: balance; }
.hero .btn { margin-top: 16px; padding: clamp(18px, 1.6vw, 22px) clamp(36px, 3.4vw, 52px); font-size: clamp(17px, 1.4vw, 20px); }

/* ---------- Proposta de valor (§3 seção 3) ---------- */
.value { text-align: center; }
.value .display { max-width: 22ch; margin-inline: auto; }
.value .lead { margin: 28px auto 36px; }

/* ---------- Soluções: carrossel (§3 seção 4, §7) ---------- */
.solutions__head { margin-bottom: clamp(36px, 5vw, 64px); }
.solutions__head .eyebrow { margin-bottom: 18px; }
.carousel__track {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-inline: max(var(--gutter), calc((100% - var(--container)) / 2));
  scroll-padding-inline: max(var(--gutter), calc((100% - var(--container)) / 2));
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.carousel__track::-webkit-scrollbar { display: none; }
.card {
  position: relative; flex: none; width: clamp(300px, 30vw, 520px); aspect-ratio: 4 / 3;
  border-radius: var(--radius); overflow: hidden; scroll-snap-align: start; background: var(--escuro);
}
.card picture, .card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(14, 14, 13, 0.86) 0%, rgba(14, 14, 13, 0.4) 34%, rgba(14, 14, 13, 0) 58%);
}
.card__title {
  position: absolute; left: 26px; right: 26px; bottom: 24px; z-index: 1;
  color: #fff; font-size: clamp(20px, 1.4vw + 10px, 30px); font-weight: 500; line-height: 1.22;
  font-family: var(--font-sans); letter-spacing: -0.01em; max-width: 14em;
}
.carousel__nav { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.carousel__nav[hidden] { display: none; }
/* Telas largas: os 5 cards cabem, ficam lado a lado e centralizados (sem sangrar) */
@media (min-width: 1700px) {
  .carousel__track { padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); justify-content: center; }
  .card { width: calc((100% - 64px) / 5); max-width: 560px; }
}
.arrow {
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--tinta); background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.arrow:hover:not(:disabled) { background: var(--tinta); color: var(--base); }
.arrow:disabled { opacity: 0.3; cursor: default; }
.arrow svg { width: 22px; height: 22px; }

/* ---------- Prova (§3 seção 5) ---------- */
.proof { text-align: center; padding-block: calc(var(--sec) * 0.8) var(--sec); }
.proof .display { max-width: 22ch; margin-inline: auto; }
.proof .lead { margin: 28px auto 0; max-width: 52ch; color: var(--tinta-suave); }

/* ---------- Como funciona (§3 seção 6): texto à esquerda, imagem à direita ---------- */
.how__grid { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(40px, 6vw, 112px); align-items: stretch; }
.how__text .eyebrow { margin-bottom: 18px; }
.how__media { margin: 0; border-radius: 12px; overflow: hidden; min-height: 480px; background: var(--escuro); }
.how__media picture { display: block; width: 100%; height: 100%; }
.how__media img { width: 100%; height: 100%; object-fit: cover; object-position: 62% 50%; }
.points { margin-top: clamp(32px, 4vw, 56px); }
.points li { position: relative; padding: 18px 0 18px 30px; border-top: 1px solid var(--linha); font-size: clamp(16px, 0.5vw + 9px, 20px); line-height: 1.5; }
.points li:last-child { border-bottom: 1px solid var(--linha); }
.points li::before {
  content: ""; position: absolute; left: 4px; top: 1.65em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--tinta);
}
@media (max-width: 900px) { .how__grid { grid-template-columns: 1fr; } .how__media { min-height: 0; aspect-ratio: 4 / 3; } }

/* ---------- Segmentos (§3 seção 7) ---------- */
.segments__head { margin-bottom: clamp(36px, 5vw, 72px); }
.segments__head .eyebrow { margin-bottom: 18px; }
.segments__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(40px, 4.5vw, 80px) clamp(20px, 2vw, 32px); }
.segment__img { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; background: var(--escuro); }
.segment__img img { width: 100%; height: 100%; object-fit: cover; }
.segment h3 { font-size: clamp(20px, 1.2vw + 12px, 28px); font-weight: 500; letter-spacing: -0.01em; line-height: 1.25; margin: 22px 0 10px; }
.segment p { font-size: clamp(14px, 0.5vw + 8px, 17px); line-height: 1.6; color: var(--tinta-suave); }
@media (min-width: 961px) { .segment p { min-height: calc(1.6em * 2); } }
@media (max-width: 960px) { .segments__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .segments__grid { grid-template-columns: 1fr; } }

/* ---------- Credibilidade: faixa escura (§3 seção 8) ---------- */
.band { background: var(--escuro); color: var(--sobre-escuro); padding-block: var(--sec); border-radius: 0 0 28px 28px; }
.band .eyebrow { color: rgba(243, 243, 243, 0.82); margin-bottom: clamp(28px, 4vw, 56px); }
.band__grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: stretch; }
.feature { position: relative; border-radius: var(--radius); overflow: hidden; min-height: clamp(420px, 40vw, 680px); }
.feature picture, .feature img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feature::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(14, 14, 13, 0.82) 0%, rgba(14, 14, 13, 0) 55%); }
.feature__title {
  position: absolute; left: clamp(22px, 3vw, 36px); right: clamp(22px, 3vw, 36px); bottom: clamp(24px, 3vw, 48px); z-index: 1;
  font-size: clamp(32px, 3.6vw, 68px); max-width: 16ch;
}
.stack { display: grid; gap: 20px; }
.note-card { background: var(--base); color: var(--tinta); border-radius: var(--radius); padding: clamp(24px, 2.6vw, 44px); }
.note-card h3 { font-size: clamp(20px, 1.3vw + 8px, 30px); font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; margin-bottom: 12px; }
.note-card p { font-size: clamp(16px, 0.6vw + 8px, 20px); line-height: 1.6; }
.note-card .brands { margin-top: 12px; color: var(--tinta-suave); font-size: clamp(15px, 0.5vw + 8px, 19px); }
.note-card .brands strong { color: var(--tinta); font-weight: 500; }
/* faixa de logos: card claro sobre o fundo escuro (§7), logos em tom neutro uniforme */
.logos-card { background: var(--base); border-radius: var(--radius); margin-top: 20px; padding: clamp(32px, 5vw, 72px) clamp(20px, 4vw, 64px); }
.logos { display: grid; grid-template-columns: repeat(8, 1fr); align-items: center; justify-items: center; row-gap: clamp(36px, 5vw, 64px); }
.logos li { grid-column: span 2; width: 100%; display: flex; justify-content: center; }
.logos li:nth-child(5) { grid-column: 2 / span 2; }
.logos img { width: calc(var(--w) * 1.35); max-width: 100%; height: auto; filter: grayscale(1) brightness(0.55); opacity: 0.9; }
@media (min-width: 1280px) { .logos img { width: calc(var(--w) * 1.8); } }
@media (max-width: 700px) {
  .logos { display: flex; flex-wrap: wrap; justify-content: center; gap: 28px 36px; }
  .logos li { width: auto; }
  .logos li:nth-child(5) { grid-column: auto; }
  .logos img { width: calc(var(--w) * 0.9); }
}
@media (max-width: 900px) { .band__grid { grid-template-columns: 1fr; } .feature { min-height: 320px; } }

/* ---------- Contato + footer (§3 seção 9) ---------- */
.site-footer { background: var(--escuro); color: var(--sobre-escuro); margin-top: -28px; padding-top: calc(var(--sec) * 0.8 + 28px); }
.contact { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(48px, 7vw, 128px); align-items: start; }
.contact .eyebrow { color: rgba(243, 243, 243, 0.82); margin-bottom: 18px; }
.contact__lead { margin-top: 28px; font-size: clamp(18px, 0.8vw + 11px, 24px); color: rgba(243, 243, 243, 0.84); max-width: 38ch; }
.contact__lead a { color: var(--sobre-escuro); }
.contact__address {
  margin-top: 44px; padding-top: 28px; border-top: 1px solid rgba(243, 243, 243, 0.16);
  font-style: normal; font-size: clamp(16px, 0.5vw + 9px, 20px); line-height: 1.75; color: rgba(243, 243, 243, 0.88);
}
.form { display: grid; gap: 32px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.field { display: grid; gap: 8px; }
.field label { font-size: clamp(14px, 0.4vw + 8px, 17px); font-weight: 500; color: rgba(243, 243, 243, 0.84); }
.field input, .field textarea {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid rgba(243, 243, 243, 0.42);
  padding: 14px 0; border-radius: 0; font-size: clamp(17px, 0.5vw + 10px, 22px); color: var(--sobre-escuro);
}
.field textarea { resize: vertical; min-height: 170px; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--sobre-escuro); box-shadow: 0 1px 0 var(--sobre-escuro); }
.form .btn { justify-self: start; padding: 18px 40px; font-size: 17px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__status { font-size: 15px; color: rgba(243, 243, 243, 0.84); min-height: 1.4em; margin-top: -12px; }
.cols { margin-top: clamp(72px, 9vw, 136px); padding-top: 44px; border-top: 1px solid rgba(243, 243, 243, 0.14); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 32px 48px; }
.cols__nav { display: flex; flex-wrap: wrap; gap: 14px clamp(24px, 3vw, 48px); }
.cols__nav a { font-size: clamp(15px, 0.4vw + 9px, 18px); color: rgba(243, 243, 243, 0.88); text-decoration: none; }
.cols__nav a:hover { text-decoration: underline; }
.cols .brand img { width: clamp(220px, 20vw, 320px); max-width: 100%; }
.legal { margin-top: 48px; padding-block: 24px; border-top: 1px solid rgba(243, 243, 243, 0.14); font-size: 12px; color: rgba(243, 243, 243, 0.62); }
@media (max-width: 900px) { .contact { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .form__row { grid-template-columns: 1fr; } }

/* ---------- Movimento (design.md §10: só fade-in suave) ---------- */
.js [data-reveal] { opacity: 0; transition: opacity 0.9s ease; }
.js [data-reveal].is-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transition: none; }
  * { transition-duration: 0.01ms !important; }
}
