/**
 * Base layer — reset, accessibility primitives, typography and layout
 * foundations. Mobile-first. No decorative design here (that comes in the
 * design phase); this file guarantees the page is correct, readable and
 * accessible on every device.
 */

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Anchored sections must clear the fixed header on in-page navigation. */
[id] {
  scroll-margin-top: 6.5rem; /* clears the fixed header (JS refines this live) */
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--color-ink);
  background-color: var(--color-cream);
  min-height: 100vh;
  overflow-x: hidden; /* Never allow horizontal scroll (spec §20). */
}

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

iframe {
  border: 0;
}

/* ---- Typography ---- */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400; /* Fraunces reads elegant at light-regular in display sizes */
  font-optical-sizing: auto;
  line-height: var(--leading-display);
  letter-spacing: -0.012em;
  color: var(--color-forest);
  overflow-wrap: break-word;
  text-wrap: balance; /* avoids lonely last words → less "boxy" headings */
}

h1 {
  font-size: var(--text-hero);
}

h2 {
  font-size: var(--text-title);
}

h3 {
  font-size: var(--text-subtitle);
}

p {
  max-width: var(--container-narrow);
}

address {
  font-style: normal; /* browsers italicise <address> by default */
}

a {
  color: var(--color-terracotta);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--color-ochre);
}

/* Editorial kicker: small caps label above titles (01 — A Pousada) */
.kicker {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-kicker);
  font-weight: 600;
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  color: var(--color-terracotta);
  margin-bottom: var(--space-3);
}

/* ---- Layout primitives ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: var(--space-section);
}

.section--forest {
  background-color: var(--color-forest);
  color: var(--color-on-forest);
}

.section--sand {
  background-color: var(--color-sand);
}

.section--forest h2,
.section--forest h3 {
  color: var(--color-on-forest);
}

/* ---- Accessibility primitives ---- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-3);
  z-index: var(--z-skip-link);
  padding: var(--space-2) var(--space-3);
  background: var(--color-forest);
  color: var(--color-on-forest);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-3);
}

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

:focus-visible {
  outline: 2px solid var(--color-terracotta);
  outline-offset: 3px;
}

/* Adequate touch targets (spec §20/§21). */
a,
button {
  touch-action: manipulation;
}

button,
.button {
  min-height: 44px;
}

/* ---- Buttons (foundation only; refined in design phase) ---- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8em 1.8em;
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: 600;
  letter-spacing: var(--tracking-nav);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-on-forest);
  background-color: var(--color-forest);
  border: 1px solid var(--color-forest);
  transition: background-color var(--duration-fast) var(--ease-out-expo),
    color var(--duration-fast) var(--ease-out-expo);
}

.button:hover {
  background-color: var(--color-forest-deep);
  color: var(--color-on-forest);
}

.button--outline {
  background: transparent;
  color: var(--color-forest);
}

.button--outline:hover {
  background-color: var(--color-forest);
  color: var(--color-on-forest);
}

/* ---- Header / navigation (structural; styled properly in design phase) ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background-color: var(--color-cream);
  border-bottom: var(--hairline);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-3);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  list-style: none;
  padding: 0;
}

.site-nav a {
  font-size: var(--text-small);
  letter-spacing: var(--tracking-nav);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-ink);
}

.site-nav a:hover {
  color: var(--color-terracotta);
}

/* Logo slot: receives the final artwork later; text wordmark until then. */
.logo-slot {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.logo-slot__wordmark {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--color-forest);
  white-space: nowrap;
}

/* Serra Gravada logo (transparent) in the header. Subtle shadow lifts it off
   the hero video / forest bar and reads premium. */
.logo-slot__img {
  display: block;
  height: 72px;
  width: auto;
  filter: drop-shadow(0 1px 5px rgba(0, 0, 0, 0.45));
}

/* ---- Footer ---- */
.site-footer {
  background-color: var(--color-forest-deep);
  color: var(--color-on-forest-muted);
  padding-block: var(--space-5);
  font-size: var(--text-small);
}

.site-footer a {
  color: var(--color-gold);
}

/* ---- Motion safety (spec §21) ---- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
