/* Shared base for site, portal and OS. Requires tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--cacau);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, figure, blockquote, ol, ul, dl, dd { margin: 0; }
/* Display type is Playfair 400 everywhere (hierarchy by size, italic and colour — not by browser-default bold). */
h1, h2, h3 { font-weight: 400; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
::selection { background: var(--clay); color: var(--cacau); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 100;
  background: var(--cacau); color: var(--papel); padding: 0.75rem 1rem; text-decoration: none;
  transition: top var(--dur-ui) var(--ease-out);
}
.skip-link:focus { top: 0.75rem; }

/* micro typography */
.label {
  font-family: var(--sans);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: var(--track-micro);
  text-transform: uppercase;
  line-height: 1.4;
}
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
.italic { font-style: italic; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.75rem;
  min-height: 3rem; padding: 0.875rem 1.5rem;
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: var(--step--1); font-weight: 700; letter-spacing: var(--track-label); text-transform: uppercase;
  text-decoration: none; line-height: 1.2;
  background: var(--cacau); color: var(--papel);
  transition: background-color var(--dur-ui) ease, color var(--dur-ui) ease, transform var(--dur-press) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn--light { background: var(--pergaminho); color: var(--cacau); }
.btn--ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn--big { min-height: 3.5rem; padding-inline: 2rem; font-size: var(--step-0); }
.btn--cacau { background: var(--cacau); color: var(--papel); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--laranja-tinta); color: var(--papel); }
  .btn--light:hover { background: var(--papel); color: var(--cacau); }
  .btn--ghost:hover { background: var(--cacau); color: var(--papel); border-color: var(--cacau); }
  .btn--cacau:hover { background: var(--papel); color: var(--cacau); }
}
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 0.6rem; min-height: 2.75rem;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 80% / 0 1px; transition: background-size var(--dur-ui) var(--ease-out);
  font-size: var(--step--1); font-weight: 700; letter-spacing: var(--track-label); text-transform: uppercase;
  text-decoration: none;
}
.link-arrow::after { content: "→"; transition: transform var(--dur-ui) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .link-arrow:hover { background-size: calc(100% - 1.4em) 1px; } .link-arrow:hover::after { transform: translateX(4px); } }

/* forms */
.field { display: grid; gap: 0.5rem; align-content: start; }
.field > label, .field > legend { font-size: var(--step--1); font-weight: 600; letter-spacing: 0.04em; }
.field .hint { font-size: var(--step--1); color: var(--cacau-80); }
.input, .select, .textarea {
  width: 100%; min-height: 3rem; padding: 0.75rem 0.875rem;
  background: var(--branco); color: var(--cacau);
  border: 1px solid var(--cacau-60); border-radius: var(--radius);
}
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--cacau); outline-offset: 1px; border-color: var(--cacau); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--laranja-tinta); border-width: 2px; }
/* underline-only field: 2px cacau baseline (well above 3:1 on papel) */
.input--line { min-height: 3.25rem; padding: 0.5rem 0; background: transparent; border: 0; border-bottom: 2px solid var(--cacau); border-radius: 0; font-size: var(--step-1); }
.input--line:focus-visible { outline: none; border-bottom-color: var(--laranja-tinta); box-shadow: 0 2px 0 0 var(--laranja-tinta); }
.input--line[aria-invalid="true"] { border-bottom-width: 2px; }
.field-error { font-size: var(--step--1); color: var(--laranja-tinta); font-weight: 600; }
.field-error:empty { display: none; }
.check { display: grid; grid-template-columns: 1.5rem 1fr; gap: 0.75rem; align-items: start; min-height: 2.75rem; padding-block: 0.25rem; font-size: var(--step--1); cursor: pointer; }
.check input { width: 1.25rem; height: 1.25rem; margin: 0.15rem 0 0; accent-color: var(--cacau); }

/* preview-only missing data marker */
/* Quieter than real content, but never mistakable for it: hatched corner tag + dotted outline + faint tint.
   The production build still fails on any {{missing:*}}; this is styling for preview only. */
.missing {
  display: inline-flex; align-items: baseline; gap: 0.5em; max-width: 100%;
  padding: 0.12em 0.5em 0.14em 0.35em; border: 1px dotted color-mix(in srgb, currentColor 55%, transparent); border-radius: var(--radius);
  background: color-mix(in srgb, currentColor 6%, transparent); color: inherit;
  font-family: var(--sans); font-size: 0.74rem; font-style: normal; font-weight: 500; letter-spacing: 0.01em;
  line-height: 1.35; text-transform: none; vertical-align: baseline;
}
.missing::before {
  content: "pendente"; flex: none; padding: 0 0.35em;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, currentColor 22%, transparent) 0 2px, transparent 2px 4px);
  font-size: 0.82em; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
