/* ==========================================================================
   joaoadolfo.pt — folha de estilos única
   Tipos: Cormorant Garamond (títulos) + Karla (texto), alojados em /assets/fonts.
   ========================================================================== */

/* ---------- Fontes (variáveis, self-hosted, subconjunto latino; licença SIL OFL) ---------- */
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-var.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-italic-var.woff2") format("woff2");
  font-weight: 300 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("../fonts/karla-var.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("../fonts/karla-italic-var.woff2") format("woff2");
  font-weight: 200 800; font-style: italic; font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --cream: #f6f3ec;
  --paper: #faf9f5;
  --sage: #e5e9db;
  --sage-line: #bcc8b0;
  --sage-ink: #4f6147;
  --burgundy: #7b2a31;
  --burgundy-dark: #5f1f25;
  --ink: #1e1715;
  --ink-soft: #3b3532;
  --on-burgundy: #fbf7f0;
  --on-burgundy-soft: #f1e1db;
  --on-burgundy-eyebrow: #cfceba;

  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --sans: "Karla", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --container: 1160px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(4.5rem, 8.4vw, 7.5rem);
  --header-h: 108px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}
@media (min-width: 900px) {
  html { scroll-padding-top: var(--header-h); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  color: inherit;
}

p { margin: 0; }

a { color: inherit; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--burgundy);
  outline-offset: 3px;
}

.container {
  width: min(var(--container), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -100px;
  z-index: 100;
  padding: .75rem 1rem;
  background: var(--burgundy);
  color: var(--on-burgundy);
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

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

/* ---------- Elementos tipográficos ---------- */
.eyebrow {
  margin: 0 0 1.25rem;
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--sage-ink);
}

.h1 {
  font-size: clamp(2.75rem, 1.5rem + 4.4vw, 5.2rem);
  line-height: 1.1;
}

.h2 {
  max-width: 780px;
  font-size: clamp(2.25rem, 1.4rem + 2.4vw, 3.5rem);
  line-height: 1.12;
}

.h2--md {
  font-size: clamp(2rem, 1.3rem + 2.1vw, 3.25rem);
  line-height: 1.1;
}

.text-link {
  color: var(--burgundy);
  text-decoration: underline;
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
}
.text-link:hover { color: var(--burgundy-dark); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 17px 30px;
  border: 1px solid transparent;
  border-radius: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .03em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn--primary {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: var(--on-burgundy);
}
.btn--primary:hover { background: var(--burgundy-dark); border-color: var(--burgundy-dark); }
.btn--outline {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.btn--outline:hover { background: var(--ink); color: var(--cream); }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Cabeçalho ---------- */
.site-header {
  background: var(--cream);
}
@media (min-width: 900px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: var(--header-h);
  padding-block: 22px;
}

.brand { display: inline-block; flex: none; line-height: 0; }
.brand img { width: 77px; height: auto; }

.main-nav ul {
  display: flex;
  gap: 2.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.main-nav a {
  font-size: 1.0625rem;
  line-height: 1.4;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.main-nav a:hover { color: var(--burgundy); }
.main-nav a[aria-current="page"] { color: var(--burgundy); }

/* Telemóvel/tablet: logo + botão numa linha, menu numa segunda linha com scroll */
@media (max-width: 899px) {
  .header-inner {
    flex-wrap: wrap;
    min-height: 0;
    padding-block: 14px 0;
    row-gap: .5rem;
  }
  .brand img { width: 60px; }
  .header-inner .btn { padding: 12px 20px; font-size: .9375rem; }
  .main-nav {
    order: 3;
    flex: 1 0 100%;
    margin-inline: calc(-1 * var(--gutter));
    border-top: 1px solid var(--sage-line);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent);
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav ul {
    gap: 1.5rem;
    padding: .7rem var(--gutter);
    width: max-content;
  }
}

/* ---------- Secções ---------- */
.section { padding-block: var(--section-y); }
.section--compact { padding-block: clamp(3.5rem, 5.3vw, 4.75rem); }
.section--compact .eyebrow { margin-bottom: 1rem; }
.section--paper { background: var(--paper); }
.section--cream { background: var(--cream); }
.section--sage { background: var(--sage); }
.section--burgundy { background: var(--burgundy); color: var(--on-burgundy); }
.section--burgundy .eyebrow { color: var(--on-burgundy-eyebrow); }

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: start;
}
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; column-gap: 72px; }
}

/* ---------- Hero ---------- */
.hero {
  background: var(--cream);
  padding-top: clamp(2rem, 4vw, 3.625rem);
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}

.hero-text { padding-bottom: 0; }
.hero .eyebrow { margin-bottom: 1.5rem; }
.hero .h1 { max-width: 7.2em; }

.hero-lead {
  max-width: 33rem;
  margin-top: 1.6875rem;
  font-size: clamp(1.0625rem, 1rem + .3vw, 1.1875rem);
  line-height: 1.68;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.25rem;
}

.hero-photo {
  justify-self: center;
  width: min(100%, 490px);
  margin: 0;
}
.hero-photo img {
  width: 100%;
  aspect-ratio: 490 / 600;
  object-fit: cover;
  object-position: center top;
  border-radius: 999px 999px 0 0;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 490px);
    column-gap: clamp(2rem, 7vw, 6.875rem);
    align-items: end;
  }
  .hero-text { align-self: start; padding-bottom: 6rem; }
  .hero-photo { justify-self: end; }
}

/* ---------- Consultório ---------- */
.section-intro {
  max-width: 40rem;
  margin-top: 1rem;
}

.photo-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 78%;
  gap: 1rem;
  margin-top: 3rem;
  margin-inline: calc(-1 * var(--gutter));
  padding-inline: var(--gutter);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}
.photo-grid::-webkit-scrollbar { display: none; }
.photo-grid > * { scroll-snap-align: start; }
@media (min-width: 640px) {
  .photo-grid {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-inline: 0;
    padding-inline: 0;
    overflow: visible;
  }
}

.photo {
  margin: 0;
  aspect-ratio: 365 / 460;
  overflow: hidden;
  background: var(--sage);
}
.photo img { width: 100%; height: 100%; object-fit: cover; }

.photo--placeholder {
  display: grid;
  place-items: center;
  padding: 1rem;
  border: 1px dashed var(--sage-ink);
  font-size: .75rem;
  letter-spacing: .08em;
  text-align: center;
  color: var(--sage-ink);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  margin: 3.5rem 0 0;
  padding-top: 2.25rem;
  border-top: 1px solid var(--sage-line);
}
@media (min-width: 640px) {
  .info-grid { grid-template-columns: repeat(3, 1fr); gap: 40px; }
}
.info-grid dt {
  margin-bottom: .625rem;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--sage-ink);
}
.info-grid dd { margin: 0; }

/* ---------- Grelhas de cartões (Áreas, Arte) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem 28px;
  margin: 3.375rem 0 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); row-gap: 3rem; }
}

.card {
  padding-top: 1.625rem;
  border-top: 1px solid var(--burgundy);
}
.card h3 {
  margin-bottom: .5rem;
  font-size: clamp(1.45rem, 1.2rem + .7vw, 1.75rem);
  font-weight: 600;
  line-height: 1.2;
}
.card p {
  font-size: 1rem;
  line-height: 1.62;
  color: var(--ink-soft);
}

.section--burgundy .card { padding-top: 1.5rem; border-top-color: var(--sage-line); }
.section--burgundy .card h3 { font-size: clamp(1.5rem, 1.25rem + .8vw, 1.875rem); font-weight: 500; color: var(--on-burgundy); }
.section--burgundy .card p { font-size: 1.0625rem; color: var(--on-burgundy-soft); }

/* ---------- Abordagem ---------- */
.prose-block p + p { margin-top: 1.15rem; }

/* ---------- Credenciais ---------- */
.statement {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.6rem, 1.2rem + 1.3vw, 2.25rem);
  line-height: 1.1;
}
.cred-detail { line-height: 1.55; }
@media (min-width: 900px) {
  .cred-detail { padding-top: .8rem; }
}
.cred-detail .text-link { display: inline-block; margin-top: 1.1rem; font-weight: 500; }

/* ---------- Contacto ---------- */
.contact-intro { max-width: 23rem; margin-top: 1.3rem; }

.contact-list {
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}
.contact-list li + li { margin-top: .35rem; }
.contact-list a { text-underline-offset: .2em; }
.contact-list a:hover { color: var(--burgundy); }

.contact-form { display: grid; gap: 1.15rem; }

.field { display: grid; gap: .6rem; }
.field label {
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--sage-ink);
}
.field input,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--sage-line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  transition: border-color .2s ease;
}
.field textarea { height: 114px; min-height: 96px; resize: vertical; }
.field input:hover,
.field textarea:hover { border-color: var(--sage-ink); }
.field input:focus,
.field textarea:focus { border-color: var(--sage-ink); }

/* armadilha anti-spam: invisível para pessoas */
.hp {
  position: absolute !important;
  left: -10000px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}
.form-note {
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--sage-ink);
  max-width: 19rem;
}
.form-status:empty { display: none; }
.form-status {
  padding: .9rem 1rem;
  border-left: 3px solid var(--sage-ink);
  background: var(--sage);
  font-size: .9375rem;
  line-height: 1.6;
}
.form-status.is-error {
  border-left-color: var(--burgundy);
  background: #f3e3e1;
}

/* ---------- Rodapé ---------- */
.site-footer {
  background: var(--cream);
  border-top: 1px solid var(--sage-line);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 40px;
  font-size: .875rem;
  color: var(--sage-ink);
}
.footer-inner .brand img { width: 58px; }
.footer-inner a { color: inherit; text-decoration: none; }
.footer-inner a:hover { color: var(--burgundy); text-decoration: underline; }

/* ---------- Artigos (lista) ---------- */
.page-head { background: var(--cream); padding-block: clamp(3rem, 6vw, 5rem) clamp(2.5rem, 5vw, 4rem); }
.page-head .h2 { max-width: 16em; }
.page-head p.lead { max-width: 36rem; margin-top: 1.25rem; color: var(--ink-soft); }

.article-list { margin: 0; padding: 0; list-style: none; }
.article-item {
  display: grid;
  gap: .6rem;
  padding-block: 2rem;
  border-top: 1px solid var(--burgundy);
}
.article-item:last-child { border-bottom: 1px solid var(--sage-line); }
.article-item .meta {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sage-ink);
}
.article-item h2 {
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.25rem);
  line-height: 1.15;
  max-width: 24em;
}
.article-item h2 a { text-decoration: none; }
.article-item h2 a:hover { color: var(--burgundy); }
.article-item p { max-width: 44rem; color: var(--ink-soft); font-size: .9375rem; }

/* ---------- Artigo ---------- */
.article { padding-block: clamp(3rem, 6vw, 5rem) var(--section-y); }
.article-header { max-width: 46rem; }
.article-header .h1 { font-size: clamp(2.25rem, 1.4rem + 2.6vw, 3.75rem); line-height: 1.1; max-width: none; }
.article-meta {
  margin-top: 1.5rem;
  font-size: .9375rem;
  color: var(--ink-soft);
}
.article-meta strong { font-weight: 600; color: var(--ink); }

.prose {
  max-width: 44rem;
  margin-top: 3rem;
  font-size: 1.0625rem;
  line-height: 1.8;
}
.prose > * + * { margin-top: 1.1em; }
.prose h2 {
  margin-top: 2.2em;
  font-size: clamp(1.6rem, 1.3rem + .9vw, 2.1rem);
  line-height: 1.2;
}
.prose h3, .prose h4 {
  margin-top: 1.8em;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.25;
}
.prose a { color: var(--burgundy); text-underline-offset: .2em; }
.prose figure { margin: 2.5rem 0; }
.prose figcaption {
  margin-top: .75rem;
  font-size: .875rem;
  font-style: italic;
  color: var(--sage-ink);
}
.prose ul { padding-left: 1.2rem; }
.prose li + li { margin-top: .5em; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
  line-height: 1.5;
}
.prose th, .prose td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--sage-line);
  text-align: left;
  vertical-align: top;
}
.prose th { font-weight: 600; }
.table-wrap { overflow-x: auto; }

.back-link {
  display: inline-block;
  margin-top: 3rem;
  font-size: .9375rem;
}

/* ---------- Página simples (404, resposta do formulário) ---------- */
.simple-page {
  min-height: 60vh;
  display: grid;
  align-content: center;
  padding-block: var(--section-y);
}
.simple-page .h2 { margin-bottom: 1.25rem; }
.simple-page p + p { margin-top: 1rem; }
.simple-page .btn { margin-top: 1.5rem; }
