@import url("../assets/fonts/fonts.css");

/* =========================================================
   Tio Dani — "Represa ao entardecer"
   Tokens, base, e o gradiente de luz que esfria ao rolar.
   Mobile-first.
   ========================================================= */

:root {
  /* Paleta */
  --verde-fundo: #0b2623;
  --verde-raso: #123f3a;
  --areia: #f2e7d0;
  --sol: #e7a83a;
  --brasa: #ec6b3b;
  --buganvilia: #c13e6b;
  --agua: #5fa8a0;

  --areia-70: rgba(242, 231, 208, 0.7);
  --areia-45: rgba(242, 231, 208, 0.45);
  --areia-15: rgba(242, 231, 208, 0.15);

  /* Fundo dirigido pelo scroll — verde (topo) → brasa (fim).
     O JS interpola estes valores conforme a rolagem. */
  --luz-a: #1e6157; /* topo do degradê no início da página (verde-teal) */
  --luz-b: #103a34; /* base do degradê no início da página (verde fundo) */

  /* Fontes */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", monospace;

  /* Ritmo */
  --wrap: min(1120px, 92vw);
  --wrap-narrow: min(680px, 90vw);
  --radius: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--areia);
  background-color: var(--verde-fundo);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* O gradiente único: um dia inteiro na represa.
   Ancorado ao documento inteiro — topo quente (meio-dia),
   base profunda (anoitecer). Rolar = a luz esfria. */
#luz {
  position: fixed;
  inset: 0;
  z-index: -2;
  /* As cores mudam conforme o scroll (ver main.js).
     A transição suaviza o passo entre um frame de scroll e outro. */
  background: linear-gradient(180deg, var(--luz-a) 0%, var(--luz-b) 100%);
  transition: background 0.25s linear;
}

img,
video { max-width: 100%; display: block; }

a { color: inherit; }

::selection { background: var(--brasa); color: #fff; }

/* ---------- Tipografia ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.02;
  margin: 0;
  font-optical-sizing: auto;
}

.eyebrow,
.stamp {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sol);
}

.section-title {
  font-size: clamp(2rem, 5.5vw, 3.5rem);
  font-weight: 700;
  color: var(--areia);
}

.breath {
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.35;
  color: var(--areia-70);
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

/* ---------- Layout de seção ---------- */
.section {
  position: relative;
  padding: clamp(4.5rem, 12vw, 9rem) 0;
}
.wrap { width: var(--wrap); margin-inline: auto; }
.wrap-narrow { width: var(--wrap-narrow); margin-inline: auto; }

/* ---------- Tratamento de foto ---------- */
/* moldura de areia + calor + grão sutil, para unificar fotos de celular */
.photo {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--verde-raso);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.75);
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--areia-15);
  border-radius: var(--radius);
  /* filtro quente sutil */
  background: rgba(231, 168, 58, 0.06);
  mix-blend-mode: overlay;
}

/* grão global, discreto, por cima de tudo */
.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

/* ---------- Reveal ao rolar ---------- */
.reveal {
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
/* só esconde quando há JS para revelar (sem JS, tudo aparece) */
.js .reveal:not(.in) {
  opacity: 0;
  transform: translateY(16px);
}
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }

/* ---------- Foco visível ---------- */
:focus-visible {
  outline: 2px solid var(--sol);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Header / wordmark ---------- */
.masthead {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  transition: background 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
}
.masthead.docked {
  background: rgba(11, 38, 35, 0.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--areia-15);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--areia);
  text-decoration: none;
}
.wordmark .sun-mark {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, var(--sol), var(--brasa));
  box-shadow: 0 0 14px rgba(231, 168, 58, 0.7);
  flex: none;
}
.nav {
  display: none;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav a { color: var(--areia-70); text-decoration: none; transition: color 0.2s; }
.nav a:hover { color: var(--sol); }

@media (min-width: 820px) {
  .nav { display: inline-flex; }
}

/* ---------- Skip link ---------- */
.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 60;
  background: var(--sol);
  color: var(--verde-fundo);
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

/* Reduced motion: nada de animação, só o conteúdo */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
