/* ═══════════════════════════════════════════════════════
   LA RATA — Base Styles
   Reset, body, global elements, utilities.
   ═══════════════════════════════════════════════════════ */

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

html, body, h1, h2, h3, h4, h5, h6,
p, figure, blockquote, ul, ol, li, dd {
  margin: 0;
  padding: 0;
}

[hidden] { display: none !important; }

ul, ol { list-style: none; }
img { max-width: 100%; display: block; height: auto; }
a { color: inherit; }
button, input, textarea, select { font-family: inherit; color: inherit; font-size: inherit; }
button { background: none; border: 0; cursor: pointer; }
input, textarea { background: none; border: 0; outline: none; }
strong, b { font-weight: 700; }

/* ── Body ── */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
  overflow-x: hidden;
  min-height: 100dvh;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Ambient background lighting ── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at top, rgba(255, 255, 255, 0.03), transparent 70%);
  pointer-events: none;
  z-index: -1;
}


/* ── Grain overlay ── */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px;
  mix-blend-mode: overlay;
}

/* ── Skip link ── */
.skip {
  position: absolute;
  left: var(--space-md);
  top: -60px;
  z-index: var(--z-skip);
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: var(--space-sm) var(--space-md);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: top var(--dur-normal) var(--ease-out);
}
.skip:focus {
  top: var(--space-md);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Container ── */
.wrap {
  width: min(var(--container), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}
.wrap--narrow {
  width: min(var(--container-narrow), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}
.wrap--tight {
  width: min(var(--container-tight), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}

/* ── Typography utilities ── */
.display {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.heading {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
}

.kicker {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--accent);
}

.lead {
  color: var(--text-secondary);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  max-width: 50ch;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0;
}

/* ── Section spacing ── */
.section {
  padding-block: var(--space-3xl);
}

.section + .section {
  border-top: 1px solid var(--border);
}

/* ── Scroll reveal animations ── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-entrance) var(--ease-out),
              transform var(--dur-entrance) var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
.reveal-delay-1 { transition-delay: 80ms; }
.reveal-delay-2 { transition-delay: 160ms; }
.reveal-delay-3 { transition-delay: 240ms; }
.reveal-delay-4 { transition-delay: 320ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ── Selection ── */
::selection {
  background: rgba(255, 255, 255, 0.20);
  color: #fff;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--surface-elevated);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--surface-hover); }

/* ── Focus visible ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── Responsive text ── */
@media (max-width: 768px) {
  .section {
    padding-block: var(--space-2xl);
  }
}
