/* ============================================
   MODERN CSS RESET — 2025
   Inspirado en Andy Bell + Josh Comeau + custom
   ============================================ */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  scroll-padding-top: 100px; /* compensa nav sticky */
}

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

body {
  min-height: 100dvh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: var(--lh-normal);
  font-family: var(--font-body);
  font-size: var(--fs-body-m);
  color: var(--color-text);
  background-color: var(--color-cream);
  overflow-x: clip;
}

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

img { font-style: italic; } /* alt text estilizado si la img falla */

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  user-select: none;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  text-wrap: pretty;
}

h1, h2, h3 { text-wrap: balance; }

ul, ol { list-style: none; }

a {
  color: inherit;
  text-decoration: none;
}

/* Focus accesible — outline brand */
:focus-visible {
  outline: 3px solid var(--color-coffee);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Selección de texto */
::selection {
  background-color: var(--color-primary);
  color: var(--color-cream-off);
}

/* Visually hidden — para texto solo-screen-reader */
.visually-hidden,
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Skip link accesibilidad */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: var(--z-modal);
  padding: 0.75rem 1.25rem;
  background: var(--color-primary);
  color: var(--color-cream-off);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-soft);
  transition: top var(--dur-mid) var(--ease-out);
}
.skip-link:focus-visible { top: 1rem; }

/* Scroll progress bar (sticky top) */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  background: transparent;
  z-index: var(--z-modal);
  pointer-events: none;
}
.scroll-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--color-coffee), var(--color-coffee-light));
  transform-origin: left center;
  /* Scroll-driven animation moderna (Chrome/Edge 115+, Safari 26+) */
  animation: scroll-fill linear;
  animation-timeline: scroll(root);
  transform: scaleX(0);
}
@keyframes scroll-fill {
  to { transform: scaleX(1); }
}
/* Fallback con JS para navegadores sin scroll-timeline */
@supports not (animation-timeline: scroll()) {
  .scroll-progress::after {
    animation: none;
    width: var(--scroll-progress, 0%);
    transform: none;
    transition: width 50ms linear;
  }
}
