/* ==========================================================================
   Doc Up — Clínica Dentária
   Folha de estilos principal
   1. Fontes (self-hosted)
   2. Tokens de design
   3. Reset e base
   4. Layout e primitivas (container, secção, fio, eyebrow, botões)
   ========================================================================== */

/* ==========================================================================
   1. Fontes — self-hosted (.woff2 locais, sem CDN por conformidade RGPD)
   ========================================================================== */

/* Instrument Sans — display/títulos */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrument-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/instrument-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/instrument-sans-latin-600-normal.woff2') format('woff2');
}

/* Jost — texto corrente e UI */
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/jost-latin-300-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/jost-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/jost-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/jost-latin-600-normal.woff2') format('woff2');
}

/* ==========================================================================
   2. Tokens de design
   ========================================================================== */

:root {
  /* --- Cor (retirada do logótipo) --- */
  --olive:      #505747;  /* base / fundos escuros, cor do fundo do logótipo */
  --olive-deep: #363C2D;  /* títulos, contraste */
  --moss:       #676D59;  /* verde acinzentado, texto secundário sobre creme */
  --gold:       #C6A667;  /* destaque principal: botões, ícones, linhas */
  --gold-deep:  #806635;  /* dourado para texto sobre fundos claros (contraste) */
  --champ:      #DBC79E;  /* champanhe claro: detalhes, texto sobre verde */
  --cream:      #EFEBDF;  /* painéis claros */
  --paper:      #F7F4ED;  /* fundo geral da página */
  --panel:      #FBF9F3;  /* cartões */
  --ink:        #2B2E25;  /* texto corrente */
  --muted:      #696C5D;  /* texto terciário/legendas */
  --line:       #E1DBCB;  /* linhas/hairlines */

  /* Nota: --moss, --muted e --gold-deep foram escurecidos face à paleta
     original (#6E745F, #7C806E, #AD8A47), que não chegava aos 4,5:1 do
     WCAG AA em texto corrente sobre creme. O matiz é o mesmo; os valores
     acima são o mínimo que passa nos três fundos claros da página. */

  /* Linhas sobre fundo escuro */
  --line-dark:  rgba(219, 199, 158, 0.28);

  /* Estado de erro (formulário) — tijolo escuro, 7:1 sobre o creme */
  --error:      #8A3728;

  /* --- Tipografia --- */
  --font-display: 'Instrument Sans', 'Helvetica Neue', Arial, Helvetica, sans-serif;
  --font-ui: 'Jost', 'Helvetica Neue', Arial, Helvetica, sans-serif;

  /* Escala modular (~1.25), fluida entre 360px e 1280px */
  --step--1: clamp(0.82rem, 0.79rem + 0.13vw, 0.89rem);
  --step-0:  clamp(1rem, 0.96rem + 0.18vw, 1.06rem);
  --step-1:  clamp(1.18rem, 1.1rem + 0.35vw, 1.4rem);
  --step-2:  clamp(1.45rem, 1.28rem + 0.75vw, 1.95rem);
  --step-3:  clamp(1.85rem, 1.5rem + 1.5vw, 2.85rem);
  --step-4:  clamp(2rem, 1.49rem + 2.29vw, 3.5rem);
  --step-5:  clamp(2.4rem, 1.5rem + 4.03vw, 4.7rem);

  --tracking-label: 0.2em;

  /* --- Espaçamento --- */
  --space-2xs: 0.375rem;
  --space-xs:  0.625rem;
  --space-sm:  1rem;
  --space-md:  1.5rem;
  --space-lg:  2.25rem;
  --space-xl:  3.5rem;
  --space-2xl: clamp(3.5rem, 2rem + 6vw, 7rem);

  /* --- Layout --- */
  --container: 74rem;      /* 1184px */
  --container-narrow: 46rem;
  --gutter: clamp(1.25rem, 0.6rem + 2.8vw, 3rem);
  --header-h: 5rem;

  /* --- Cantos ---
     O desenho é geométrico: cantos vivos em botões, campos e cartões.
     --radius-soft é o máximo tolerado, e só onde um canto a 0 magoaria. */
  --radius: 0px;
  --radius-soft: 2px;
  --transition: 180ms cubic-bezier(0.33, 0.01, 0.35, 1);
  --focus: 0 0 0 3px var(--paper), 0 0 0 5px var(--gold-deep);
}

/* ==========================================================================
   3. Reset e base
   ========================================================================== */

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

/* O `display` do browser para [hidden] é fraco e qualquer classe nossa com
   display o anula. Aqui garantimos que esconder é mesmo esconder. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  font-weight: 300;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-display);
  /* 500 em todos os níveis: numa grotesca, o 600 lê-se pesado em corpo grande.
     A hierarquia faz-se pelo tamanho, não pelo peso. */
  font-weight: 500;
  line-height: 1.1;
  /* Uma sans pede algum aperto, mas pouco: os h3/h4 são pequenos e o excesso
     fecha os espaços entre palavras antes de fechar os espaços entre letras. */
  letter-spacing: -0.01em;
  color: var(--olive-deep);
  text-wrap: balance;
}

h1 { font-size: var(--step-5); font-weight: 500; }
h2 { font-size: var(--step-4); font-weight: 500; }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { margin: 0 0 var(--space-sm); max-width: 68ch; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--gold-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--transition);
}
a:hover { color: var(--olive-deep); }

img, svg, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol { margin: 0 0 var(--space-sm); padding-left: 1.2em; }

strong { font-weight: 500; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-lg) 0;
}

/* Foco visível e consistente em toda a página */
:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 3px;
  border-radius: var(--radius-soft);
}

::selection {
  background: var(--champ);
  color: var(--olive-deep);
}

/* --- Utilitários de acessibilidade --- */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 0; left: 50%;
  transform: translate(-50%, -110%);
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  color: var(--olive-deep);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  text-decoration: none;
  border: 1px solid var(--gold);
  border-top: 0;
  border-radius: var(--radius);
  transition: transform var(--transition);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* ==========================================================================
   4. Layout e primitivas
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-narrow); }

/* Secções: ritmo vertical único, definido num só sítio para evitar
   especificidades a cancelarem-se entre si. */
.section { padding-block: var(--space-2xl); }

/* Variantes de fundo */
.section--paper { background-color: var(--paper); }
.section--cream { background-color: var(--cream); }

.section--olive {
  background-color: var(--olive);
  color: var(--cream);
}
.section--olive h1,
.section--olive h2,
.section--olive h3,
.section--olive h4 { color: var(--paper); }
/* :not(.btn) — senao esta regra vence .btn--primary e estraga o contraste */
.section--olive a:not(.btn) { color: var(--champ); }
.section--olive a:not(.btn):hover { color: #fff; }

/* Cabeçalho de secção */
.section__head { margin-bottom: var(--space-xl); }
.section__head p { color: var(--moss); font-size: var(--step-1); font-weight: 300; }
.section--olive .section__head p { color: var(--champ); }

/* Eyebrow / label — Jost, maiúsculas, tracking largo */
.eyebrow {
  display: block;
  margin-bottom: var(--space-xs);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--gold-deep);
}
.section--olive .eyebrow { color: var(--champ); }

/* O fio — a primitiva estrutural da página (eco do traço do logótipo) */
.rule {
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--line);
}
.rule--gold { background: var(--gold); }
.rule--short { width: 3.5rem; }
.section--olive .rule { background: var(--line-dark); }

/* --- Botões --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.95em 1.9em;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition),
              border-color var(--transition);
}

.btn--primary {
  background-color: var(--gold);
  border-color: var(--gold);
  color: var(--olive-deep);
}
.btn--primary:hover,
.btn--primary:focus-visible {
  background-color: var(--champ);
  border-color: var(--champ);
  color: var(--olive-deep);
}

.btn--ghost {
  background-color: transparent;
  border-color: currentColor;
  color: var(--olive-deep);
}
.btn--ghost:hover,
.btn--ghost:focus-visible {
  background-color: var(--olive-deep);
  border-color: var(--olive-deep);
  color: var(--paper);
}

.section--olive .btn--ghost { color: var(--champ); }
.section--olive .btn--ghost:hover,
.section--olive .btn--ghost:focus-visible {
  background-color: var(--champ);
  border-color: var(--champ);
  color: var(--olive-deep);
}

.btn[disabled],
.btn[aria-disabled='true'] { opacity: 0.6; cursor: not-allowed; }

/* ==========================================================================
   Movimento reduzido — respeitado globalmente
   ========================================================================== */

@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;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   5. Cabeçalho e navegação
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background-color: var(--paper);
  border-bottom: 1px solid var(--line);
  color: var(--olive-deep);
  transition: background-color var(--transition), border-color var(--transition),
              color var(--transition);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: var(--header-h);
}

/* Sobre o hero o cabeçalho toma o mesmo verde: lê-se como uma continuação
   do hero, mas é opaco — o conteúdo que passa por baixo não o atravessa.
   Passado o hero, volta ao fundo claro. Sem JS fica sempre claro. */
.site-header--onhero {
  background-color: var(--olive);
  border-bottom-color: transparent;
  color: var(--cream);
}
.site-header--onhero .btn--ghost { color: var(--champ); }

/* --- Marca --- */

/* O logótipo horizontal existe em duas versões, cada uma com o fundo já
   na cor da superfície onde assenta (#F7F4ED e #505747): sobre o verde
   entra a versão escura, sobre o claro a versão clara. */
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand__logo {
  display: block;
  height: 3.25rem;
  width: auto;
}

.brand__logo--dark { display: none; }

.site-header--onhero .brand__logo--light { display: none; }
.site-header--onhero .brand__logo--dark { display: block; }

@media (max-width: 26rem) {
  .brand__logo { height: 2.4rem; }
}

/* --- Navegação --- */

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1.1rem, 2.1vw, 2.1rem);
}

.nav__list {
  display: flex;
  align-items: center;
  gap: clamp(1.1rem, 2.1vw, 2.1rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__link {
  position: relative;
  display: inline-block;
  padding-block: 0.45rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 400;
  color: inherit;
  text-decoration: none;
}

/* O fio dourado — mesma linguagem do traço do logótipo */
.nav__link::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background-color: var(--gold);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform var(--transition);
}
.nav__link:hover::after,
.nav__link:focus-visible::after,
.nav__link[aria-current='true']::after {
  transform: scaleX(1);
  transform-origin: left center;
}
.nav__link[aria-current='true'] { font-weight: 500; }

.nav__cta { padding: 0.8em 1.4em; }

/* --- Botão de menu (mobile) --- */

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.2rem;
  background: none;
  border: 0;
  color: inherit;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  cursor: pointer;
}

.nav-toggle__bars {
  position: relative;
  width: 1.4rem;
  height: 0.6rem;
}
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background-color: currentColor;
  transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle__bars::before { top: 0; }
.nav-toggle__bars::after { bottom: 0; }

.nav-toggle[aria-expanded='true'] .nav-toggle__bars::before {
  transform: translateY(0.3rem) rotate(45deg);
}
.nav-toggle[aria-expanded='true'] .nav-toggle__bars::after {
  transform: translateY(-0.3rem) rotate(-45deg);
}

/* --- Layout mobile do menu --- */

@media (max-width: 62rem) {
  .nav-toggle { display: inline-flex; }

  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    display: grid;
    gap: 0;
    padding: var(--space-xs) var(--gutter) var(--space-lg);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    background-color: var(--olive);
    color: var(--cream);
    border-top: 1px solid var(--line-dark);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: opacity var(--transition), transform var(--transition),
                visibility var(--transition);
  }
  .nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav__list { display: grid; gap: 0; }
  .nav__list li + li { border-top: 1px solid var(--line-dark); }

  .nav__link {
    display: block;
    padding-block: 0.95rem;
    font-size: 1.05rem;
  }
  .nav__link::after { display: none; }
  .nav__link[aria-current='true'] { color: var(--champ); }

  .nav__cta {
    justify-self: start;
    margin-top: var(--space-md);
  }

  /* Com o menu aberto o cabeçalho acompanha o painel */
  .site-header.is-menu-open {
    background-color: var(--olive);
    border-bottom-color: transparent;
    color: var(--cream);
  }
  .site-header.is-menu-open .brand__logo--light { display: none; }
  .site-header.is-menu-open .brand__logo--dark { display: block; }

  /* Sem JS o menu não se abre: fica sempre visível, em linha. */
  html:not(.js) .nav-toggle { display: none; }
  html:not(.js) .nav {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    max-height: none;
    background: none;
    color: inherit;
    border-top: 0;
    padding: 0 0 var(--space-sm);
    grid-auto-flow: column;
    justify-content: start;
    gap: var(--space-md);
    overflow: visible;
  }
  html:not(.js) .site-header__inner { flex-wrap: wrap; padding-block: 0.75rem; }
  html:not(.js) .nav__list {
    grid-auto-flow: column;
    gap: var(--space-md);
  }
  html:not(.js) .nav__list li + li { border-top: 0; }
  html:not(.js) .nav__link { padding-block: 0.3rem; font-size: 0.9rem; }
}

@media (max-width: 34rem) {
  html:not(.js) .nav,
  html:not(.js) .nav__list { grid-auto-flow: row; gap: 0.35rem; }
}

/* ==========================================================================
   6. Hero
   ========================================================================== */

.hero {
  padding-top: calc(var(--header-h) + clamp(2.5rem, 7vw, 5.5rem));
  padding-bottom: clamp(2rem, 4vw, 3.25rem);
  overflow: hidden;
}

.hero__inner {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero__copy { max-width: 34rem; }

.hero__title {
  font-size: var(--step-5);
  font-weight: 500;
  line-height: 1.06;
  /* Aos 4,7rem o aperto nota-se muito mais do que em corpo pequeno; acima
     de -0.02em o "seu sorriso" começa a colar-se. */
  letter-spacing: -0.018em;
  color: var(--paper);
  margin-bottom: 0;
}

.hero__stroke {
  display: block;
  width: 5.5rem;
  height: 1px;
  margin: clamp(1.4rem, 3vw, 2rem) 0;
  background-color: var(--gold);
  transform-origin: left center;
  animation: hero-stroke 900ms cubic-bezier(0.22, 0.7, 0.3, 1) 250ms both;
}

@keyframes hero-stroke {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.hero__lead {
  max-width: 38ch;
  font-size: var(--step-1);
  font-weight: 300;
  line-height: 1.6;
  color: var(--champ);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: clamp(1.75rem, 3.5vw, 2.5rem);
}

/* --- Palco da peça 3D -----------------------------------------------------
   A caixa tem proporção fixa: o espaço está reservado antes de qualquer coisa
   carregar, por isso nada salta quando o canvas entra (nem quando não entra). */

.hero3d {
  position: relative;
  width: 100%;
  max-width: 11rem;
  margin-inline: auto;
  aspect-ratio: 5 / 6;
}

.hero3d__linha,
.hero3d__tela {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero3d__linha {
  overflow: visible;
  transition: opacity 700ms cubic-bezier(0.22, 0.7, 0.3, 1);
}

/* --- A linha do dente desenha-se sozinha -----------------------------------
   O traço é o do logótipo, extraído de assets/logo.png. Os caminhos levam
   pathLength="1", por isso o tracejado conta em frações do percurso e não é
   preciso medir comprimentos em JavaScript.

   O estado de repouso é a linha JÁ desenhada (stroke-dashoffset: 0). A animação
   só recua até ao início, com fill-mode backwards. Assim, se as animações não
   correrem — browser antigo, movimento reduzido — vê-se o desenho completo em
   vez de um espaço vazio. */

.hero3d__traco {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: hero-traco 1700ms cubic-bezier(0.62, 0.02, 0.32, 1) 220ms backwards;
}

/* O pequeno remate do topo entra no fim, quando o traço principal lá chega. */
.hero3d__traco--remate {
  animation-duration: 260ms;
  animation-delay: 1800ms;
  animation-timing-function: ease-out;
}

@keyframes hero-traco {
  from { stroke-dashoffset: 1; }
}

/* Brilho dourado: um segmento curto que percorre a linha de tempos a tempos.
   É o único dourado da peça e passa depressa — a marca respira, não pisca. */
.hero3d__brilho {
  stroke-dasharray: 0.09 0.91;
  stroke-dashoffset: 1;
  opacity: 0;
  animation: hero-brilho 9s ease-in-out 2700ms infinite;
}

@keyframes hero-brilho {
  0%   { stroke-dashoffset: 1;    opacity: 0; }
  4%   { opacity: 0.85; }
  24%  { opacity: 0.85; }
  30%  { stroke-dashoffset: 0;    opacity: 0; }
  100% { stroke-dashoffset: 0;    opacity: 0; }
}

.hero3d__tela {
  opacity: 0;
  /* O canvas é só para ver: o scroll e o toque atravessam-no. */
  pointer-events: none;
  transition: opacity 700ms cubic-bezier(0.22, 0.7, 0.3, 1);
}

/* Só depois do primeiro frame desenhado é que o 3D toma o lugar da linha. */
.hero3d--activo .hero3d__linha { opacity: 0; }
.hero3d--activo .hero3d__tela  { opacity: 1; }

/* Movimento reduzido: a linha aparece feita, sem desenho e sem brilho. */
@media (prefers-reduced-motion: reduce) {
  .hero3d__linha,
  .hero3d__tela { transition: none; }
  .hero3d__traco { animation: none; stroke-dashoffset: 0; }
  .hero3d__brilho { display: none; }
}

/* Factos rápidos — o fio como separador */
.hero__facts {
  display: grid;
  gap: 0;
  margin: clamp(2.75rem, 6vw, 4.5rem) 0 0;
  padding-top: var(--space-xs);
  border-top: 1px solid var(--line-dark);
}

.hero__fact { padding-block: var(--space-sm); }
.hero__fact + .hero__fact { border-top: 1px solid var(--line-dark); }

.hero__fact dt {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--champ);
  margin-bottom: 0.3rem;
}

.hero__fact dd {
  margin: 0;
  font-size: var(--step-0);
  font-weight: 300;
  color: var(--cream);
}
.hero__fact dd a { text-decoration: none; border-bottom: 1px solid transparent; }
.hero__fact dd a:hover { border-bottom-color: currentColor; }

@media (min-width: 48rem) {
  .hero__facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero__fact + .hero__fact {
    border-top: 0;
    border-left: 1px solid var(--line-dark);
    padding-left: clamp(1.5rem, 3vw, 2.75rem);
  }
}

@media (min-width: 56rem) {
  .hero__inner { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
  .hero3d { max-width: 24rem; margin-left: auto; margin-right: 0; }
}

/* Em ecrãs pequenos a marca surge antes do título */
@media (max-width: 55.99rem) {
  .hero__copy { order: 2; }
  .hero__mark { order: 1; }
}

/* ==========================================================================
   7. Serviços — grelha desenhada a fio, sem caixas nem sombras
   ========================================================================== */

/* As linhas internas são o fundo do contentor a aparecer nos gaps de 1px.
   Não há moldura exterior: só se veem os fios entre os serviços. */
.services {
  --svc-pad: clamp(1.25rem, 2.5vw, 2.25rem);
  display: grid;
  gap: 1px;
  background-color: var(--line);
}

/* Numa coluna não há padding lateral: o texto alinha com o cabeçalho da secção. */
.service {
  background-color: var(--paper);
  padding: clamp(1.75rem, 3vw, 2.5rem) 0;
}

.service__rule {
  display: block;
  width: 2.25rem;
  height: 1px;
  margin-bottom: var(--space-md);
  background-color: var(--gold);
}

.service__name {
  margin-bottom: var(--space-2xs);
  font-size: var(--step-2);
  font-weight: 600;
}

.service p {
  margin: 0;
  color: var(--moss);
  max-width: 34ch;
}

/* Duas colunas: padding interior em todos, retirado nas margens exteriores.
   `:nth-child(n)` serve para repor o padding com a MESMA especificidade das
   regras seguintes — assim a ordem no ficheiro decide, sem surpresas. */
@media (min-width: 40rem) {
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .services > .service:nth-child(n) { padding-inline: var(--svc-pad); }
  .services > .service:nth-child(2n + 1) { padding-left: 0; }
  .services > .service:nth-child(2n) { padding-right: 0; }
}

@media (min-width: 62rem) {
  .services { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .services > .service:nth-child(n) { padding-inline: var(--svc-pad); }
  .services > .service:nth-child(3n + 1) { padding-left: 0; }
  .services > .service:nth-child(3n) { padding-right: 0; }
}

/* ==========================================================================
   8. Porquê Doc Up — intro à esquerda, pilares à direita
   ========================================================================== */

.reasons {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4.5rem);
}

.reasons__intro h2 { margin-bottom: var(--space-md); }

.reasons__intro p {
  color: var(--moss);
  font-size: var(--step-1);
  max-width: 32ch;
}

.reason { padding-block: clamp(1.5rem, 3vw, 2.25rem); }
.reason:first-child { padding-top: 0; }
.reason:last-child { padding-bottom: 0; }
.reason + .reason { border-top: 1px solid var(--line); }

.reason h3 {
  margin-bottom: var(--space-2xs);
  font-size: var(--step-2);
}

.reason p {
  margin: 0;
  color: var(--moss);
  max-width: 46ch;
}

@media (min-width: 56rem) {
  .reasons { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
  .reasons__intro {
    position: sticky;
    top: calc(var(--header-h) + 2.5rem);
    align-self: start;
  }
}

/* ==========================================================================
   9. Como marcar — os três passos ligados por um fio contínuo
   ========================================================================== */

.steps {
  position: relative;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* O fio que liga os passos (eco do traço único do logótipo).
   Os algarismos têm fundo verde e interrompem-no. */
.steps::before {
  content: '';
  position: absolute;
  top: 1.1rem;
  bottom: 0.9rem;
  left: 0.9rem;
  width: 1px;
  background-color: var(--line-dark);
}

.step {
  position: relative;
  padding: 0 0 clamp(2rem, 4vw, 2.75rem) clamp(3rem, 6vw, 4rem);
}
.step:last-child { padding-bottom: 0; }

.step__number {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 1.8rem;
  /* Sem padding vertical o centro do algarismo cai exatamente sobre o fio. */
  padding-block: 0;
  background-color: var(--olive);
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  color: var(--gold); /* 3,2:1 sobre o verde — passa AA a este tamanho */
}

.step__title {
  margin-bottom: var(--space-2xs);
  font-size: var(--step-2);
}

.step p {
  margin: 0;
  color: var(--champ);
  max-width: 44ch;
}

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

  /* Na horizontal o fio atravessa os três passos */
  .steps::before {
    top: 1.1rem;
    bottom: auto;
    left: 0;
    right: 0;
    width: auto;
    height: 1px;
  }

  .step { padding: 3.25rem clamp(1.5rem, 3vw, 2.5rem) 0 0; }

  .step__number {
    width: auto;
    padding-block: 0;
    padding-right: 0.9rem;
    text-align: left;
  }
}

/* --- Aviso "pedido ≠ confirmação" --- */

.notice {
  margin: clamp(2.5rem, 5vw, 3.5rem) 0 0;
  padding: var(--space-md) 0 var(--space-md) var(--space-md);
  border-left: 2px solid var(--gold);
  max-width: 56ch;
  font-size: var(--step-0);
}

.notice strong {
  font-weight: 500;
  color: var(--olive-deep);
}

.notice--onolive { color: var(--cream); }
.notice--onolive strong { color: var(--paper); }

/* ==========================================================================
   10. Pedido de marcação
   ========================================================================== */

.request {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4.5rem);
}

.request__intro h2 { margin-bottom: var(--space-md); }
.request__intro > p { color: var(--moss); max-width: 34ch; }

.request__intro .notice { margin-top: var(--space-lg); }

.request__phone {
  margin-top: var(--space-lg);
  font-size: var(--step-0);
  color: var(--moss);
}
.request__phone a {
  display: inline-block;
  font-size: var(--step-1);
  color: var(--olive-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--gold);
}
.request__phone a:hover { border-bottom-color: var(--olive-deep); }

/* O único painel da página: é aqui que a conversa acontece. */
.request__panel {
  background-color: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3.5vw, 2.75rem);
}

@media (min-width: 56rem) {
  .request { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
  .request__intro {
    position: sticky;
    top: calc(var(--header-h) + 2.5rem);
    align-self: start;
  }
}

/* --- Campos --- */

.form { display: grid; gap: var(--space-md); }

.field { display: grid; }

.field-row { display: grid; gap: var(--space-md); }
@media (min-width: 34rem) {
  .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.field label {
  font-family: var(--font-ui);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--olive-deep);
  margin-bottom: 0.3rem;
}

.field__optional {
  font-weight: 300;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.6rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background-color: transparent;
  font-family: var(--font-ui);
  font-size: var(--step-0);
  font-weight: 300;
  color: var(--ink);
  transition: border-color var(--transition);
}

.field textarea {
  padding-top: 0.4rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 5.5rem;
}

.field input:hover,
.field select:hover,
.field textarea:hover { border-bottom-color: var(--moss); }

.field input:focus,
.field select:focus,
.field textarea:focus { border-bottom-color: var(--gold-deep); }

.field input::placeholder,
.field textarea::placeholder { color: var(--muted); }

/* Seta do select desenhada em SVG inline (nada é pedido ao exterior) */
.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 1.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23AD8A47' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.25rem center;
  cursor: pointer;
}
.field select:invalid { color: var(--muted); }

/* Campos de data: o ícone nativo em tom de marca */
.field input[type='datetime-local']::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
}
.field input[type='datetime-local']::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* --- Consentimento --- */

.field--check {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0 0.7rem;
  margin-top: var(--space-2xs);
}

.field--check input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.25rem 0 0;
  padding: 0;
  border: 0;
  accent-color: var(--gold-deep);
  cursor: pointer;
}

.field--check label {
  margin-bottom: 0;
  font-size: 0.9rem;
  font-weight: 300;
  line-height: 1.55;
  color: var(--moss);
  cursor: pointer;
}
.field--check label a { color: var(--gold-deep); }

.field--check .field__error { grid-column: 1 / -1; }

/* --- Ajudas e erros --- */

.field__hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.field__error {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--error);
}

.field input[aria-invalid='true'],
.field select[aria-invalid='true'],
.field textarea[aria-invalid='true'] { border-bottom-color: var(--error); }

/* --- Ações --- */

.form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
  margin-top: var(--space-xs);
}

.form__disclaimer {
  margin: 0;
  max-width: 28ch;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.spinner {
  display: none;
  width: 0.9em;
  height: 0.9em;
  border: 1px solid currentColor;
  border-top-color: transparent;
  /* Exceção consciente: isto é um disco a girar, não um canto arredondado. */
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.form.is-sending .spinner { display: inline-block; }
.form.is-sending .form__submit { pointer-events: none; opacity: 0.65; }

/* --- Estado do envio --- */

.form__status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--error);
}
.form__status:empty { display: none; }

/* --- Confirmação --- */

.form__done-rule {
  display: block;
  width: 3.5rem;
  height: 1px;
  margin-bottom: var(--space-md);
  background-color: var(--gold);
}

.form__done h3 {
  font-size: var(--step-3);
  margin-bottom: var(--space-xs);
}

.form__done p {
  margin: 0;
  color: var(--moss);
  max-width: 40ch;
}

/* --- Honeypot: fora do ecrã, mas presente no DOM --- */

.hp {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ==========================================================================
   11. Contactos e mapa
   ========================================================================== */

.contacts {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
}

.contacts__details h2 { margin-bottom: var(--space-lg); }

.contacts__list {
  margin: 0;
  border-top: 1px solid var(--line);
}

.contacts__item {
  display: grid;
  gap: 0.15rem 1.5rem;
  padding-block: var(--space-sm);
  border-bottom: 1px solid var(--line);
}

.contacts__item dt {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--gold-deep);
}

.contacts__item dd {
  margin: 0;
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
}

.contacts__item dd a {
  color: var(--olive-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--gold);
}
.contacts__item dd a:hover { border-bottom-color: var(--olive-deep); }

.contacts__cta { margin-top: var(--space-lg); }

@media (min-width: 34rem) {
  .contacts__item { grid-template-columns: 7rem minmax(0, 1fr); align-items: baseline; }
}

@media (min-width: 56rem) {
  .contacts { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start; }
}

/* --- Mapa: só carrega depois de a pessoa o pedir --- */

.map {
  position: relative;
  min-height: 20rem;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background-color: var(--panel);
}

.map__placeholder {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-sm);
  height: 100%;
  min-height: 20rem;
  padding: var(--space-lg);
  text-align: center;
}

.map__text {
  margin: 0;
  max-width: 26ch;
  font-size: 0.9rem;
  color: var(--moss);
}

.map__alt { margin: 0; font-size: 0.82rem; }
.map__alt a { color: var(--gold-deep); }

.map iframe {
  width: 100%;
  height: 100%;
  min-height: 24rem;
  border: 0;
}

/* ==========================================================================
   12. Rodapé
   ========================================================================== */

.site-footer {
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
  background-color: var(--olive);
  color: var(--cream);
}

.site-footer__top {
  display: grid;
  gap: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--line-dark);
}

/* O rodapé é sempre verde: só carrega a versão escura. */
.brand--footer .brand__logo { height: 3.4rem; }
.brand--footer .brand__logo--dark { display: block; }

.site-footer nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem clamp(1rem, 2.5vw, 1.75rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer nav a {
  font-size: 0.92rem;
  color: var(--cream);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.site-footer nav a:hover,
.site-footer nav a:focus-visible {
  color: var(--champ);
  border-bottom-color: var(--gold);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-md);
  padding-top: var(--space-md);
  font-size: 0.85rem;
  color: var(--champ);
}

.site-footer__bottom p { margin: 0; }
.site-footer__links a { color: var(--champ); }
.site-footer__links a:hover { color: #fff; }

@media (min-width: 56rem) {
  .site-footer__top {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-xl);
  }
  .site-footer__nav ul { justify-content: center; }
  .site-footer__social ul { justify-content: flex-end; }
}

/* ==========================================================================
   13. Páginas secundárias (política de privacidade, resposta do formulário)
   ========================================================================== */

/* Páginas sem hero: o conteúdo começa abaixo do cabeçalho fixo. */
.page {
  padding-top: calc(var(--header-h) + clamp(2.5rem, 6vw, 4.5rem));
  padding-bottom: var(--space-2xl);
}

.page__head { margin-bottom: var(--space-xl); }
.page__head h1 { font-size: var(--step-4); margin-bottom: var(--space-xs); }

.page__date {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.prose h2 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-xs);
  font-size: var(--step-2);
}
.prose h2:first-child { margin-top: 0; }

.prose p,
.prose li { color: var(--ink); }
.prose ul { padding-left: 1.1em; }
.prose li { margin-bottom: 0.4rem; }
.prose li::marker { color: var(--gold-deep); }

.prose .placeholder {
  padding: 0.1em 0.4em;
  background-color: var(--cream);
  border-bottom: 1px solid var(--gold);
  font-size: 0.95em;
}

/* --- Página de resposta do formulário (submissão sem JavaScript) --- */

.resposta {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--space-lg) var(--gutter);
  background-color: var(--paper);
}

.resposta__caixa {
  width: 100%;
  max-width: 34rem;
  padding: clamp(1.75rem, 4vw, 3rem);
  background-color: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.resposta__marca {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius-soft);
}

.resposta__rule {
  display: block;
  width: 3.5rem;
  height: 1px;
  margin: var(--space-md) 0;
  background-color: var(--gold);
}

.resposta__caixa h1 {
  font-size: var(--step-3);
  margin-bottom: var(--space-xs);
}

.resposta__caixa > p { color: var(--moss); }

.resposta .notice { margin-top: var(--space-md); }
.resposta__tel { margin-top: var(--space-md); }
.resposta__voltar { margin-top: var(--space-lg); }

/* Sem JS o botão do mapa não faz nada: fica só a ligação para o abrir fora. */
html:not(.js) .map__button { display: none; }

.page__back { margin-top: var(--space-xl); }

/* Ajuda partilhada por uma linha de dois campos */
.field__hint--row { margin-top: calc(var(--space-md) * -0.65); }

/* Na coluna estreita da intro o título respira melhor um grau abaixo */
.request__intro h2 { font-size: var(--step-3); }
