/* ===========================
   FILE: styles/base.css
   =========================== */
/* Reset + base tipográfica */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  hanging-punctuation: first last;
}
html:focus-within {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-1);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg);
}

/* Mídias são responsivas por padrão */
img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-inline-size: 100%;
}
picture {
  display: block;
}
img {
  height: auto;
}

/* Links (alto contraste) */
a,
a:visited {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  color: var(--link-hover);
  text-decoration: none;
}
a:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--shadow-focus);
  border-radius: 0.25rem;
}

/* Form controls base */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
}
button {
  cursor: pointer;
}
:where(button, input, select, textarea):focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--shadow-focus);
}
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-1);
}
legend {
  padding: 0 0.5rem;
}

/* Âncoras com header sticky */
[id] {
  scroll-margin-top: calc(var(--header-h, 72px) + 0.75rem);
}
:focus-visible {
  outline-offset: 2px;
}
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: var(--space-6);
}

/* Container */
.container {
  inline-size: min(100% - var(--space-6), var(--container, 72rem));
  margin-inline: auto;
}
.container--narrow {
  max-inline-size: 42rem;
}
@media (min-width: 48rem) {
  .container--narrow {
    max-inline-size: 44rem;
  }
}
@media (min-width: 64rem) {
  .container--narrow {
    max-inline-size: 50rem;
  }
}
@media (min-width: 90rem) {
  .container--narrow {
    max-inline-size: 54rem;
  }
}

/* Headings */
h1,
h2,
h3 {
  line-height: var(--lh-tight);
  margin: 0 0 var(--space-3);
}
h1 {
  font-size: var(--fs-5);
}
h2 {
  font-size: var(--fs-4);
}
h3 {
  font-size: var(--fs-3);
}

/* Utilitários mínimos */
.stack > * + * {
  margin-block-start: var(--space-4);
}
.center {
  display: grid;
  place-items: center;
}
.shadow-1 {
  box-shadow: var(--shadow-1);
}
.shadow-2 {
  box-shadow: var(--shadow-2);
}
.bg-surface {
  background: var(--surface);
}

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

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  transform: translateY(-150%);
  background: var(--brand-900);
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-2);
  z-index: 1000;
  text-decoration: none;
}
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Botões base */
.btn {
  --_bg: var(--brand);
  --_fg: var(--brand-contrast);
  border: 0;
  border-radius: var(--radius-2);
  background: var(--_bg);
  color: var(--_fg);
  padding: 0.65rem 1rem;
  font-weight: var(--weight-bold);
  box-shadow: var(--shadow-1);
  transition: transform 0.06s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-1);
}
.btn:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--shadow-focus);
}
.btn--accent {
  --_bg: var(--accent);
  --_fg: var(--accent-contrast);
}
.btn--ghost {
  --_bg: transparent;
  --_fg: var(--brand);
  color: var(--_fg);
  border: 1px solid var(--brand-700);
  background: transparent;
}
.btn--full {
  inline-size: 100%;
}

/* Transições globais (respeita reduce-motion) */
* {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
