/* === Drupalizando — atmosphere.css ===
   Calm-water mood: drifting light in the hero, faint caustics, a wave edge,
   and fine grain on light sections. Animates transform only.
   The navbar's accessibility rules (focus ring, hover underline, hit area, scroll padding) live in style.css. */

:root {
  --water-teal: rgba(45, 190, 210, 0.30);
  --water-blue: rgba(6, 120, 190, 0.38);
  --k-pools: 0.22;   /* parallax speed vs scroll (see parallax.js) */
  --k-ripple: 0.42;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.2 0 0 0 0 0.3 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Hero --- */
#hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
#hero > .container { position: relative; z-index: 2; }

/* Drifting light pools */
#hero::before {
  content: "";
  position: absolute;
  inset: -35% -20% -20% -20%;
  z-index: 0;
  translate: 0 calc(var(--py, 0) * var(--k-pools) * 1px);
  pointer-events: none;
  background:
    radial-gradient(ellipse 30% 26% at 22% 28%, var(--water-blue), transparent 68%),
    radial-gradient(ellipse 28% 24% at 78% 62%, var(--water-teal), transparent 68%),
    radial-gradient(ellipse 24% 20% at 52% 90%, rgba(6, 120, 190, 0.30), transparent 68%);
}

/* Faint caustic ripples */
#hero::after {
  content: "";
  position: absolute;
  inset: -50% -5% -5% -5%;
  z-index: 1;
  translate: 0 calc(var(--py, 0) * var(--k-ripple) * 1px);
  pointer-events: none;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='640'%3E%3Cfilter id='c' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.018' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 3 -1.2'/%3E%3C/filter%3E%3Crect width='640' height='640' filter='url(%23c)'/%3E%3C/svg%3E");
  background-size: 640px 640px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
}

/* Wave edge into the next section */
.wave-divider {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 72px;
  z-index: 2;
  pointer-events: none;
  display: block;
  fill: var(--bg-light);
}

/* Keep subtitle at AA contrast over the light pools */
#hero .hero-sub { color: rgba(255, 255, 255, 0.72); }

/* --- Navbar: whitens gradually as it meets the hero text ---
   assets/js/navbar-ramp.js sets --nav-t (0..1, S-curve), --nav-c (0..1, white -> cream) and .nav-dark (text flips at 0.5) on scroll.
   The dark fade is gone by the flip (t = 0.5) so it never fights the dark text.
   Starts as a 10% white veil over a dark fade, reaches solid white (--nav-t = 1), then --nav-c shifts it gradually to cream (= style.css --cream #fff7ec). */
.navbar.nav-ramp {
  --nav-t: 0;
  --nav-c: 0; /* 0 = white, 1 = cream #fff7ec (255, 247, 236), sampled from the water-ripple reference */
  background:
    linear-gradient(to bottom, rgba(9, 18, 36, calc(0.55 * max(0, 1 - 2 * var(--nav-t)))), rgba(9, 18, 36, 0)),
    rgba(255, calc(255 - 8 * var(--nav-c)), calc(255 - 19 * var(--nav-c)), calc(0.1 + 0.9 * var(--nav-t)));
  box-shadow: 0 1px 12px rgba(0, 0, 0, calc(0.1 * var(--nav-t)));
  transition: none;
}
/* No colour/filter transitions: they would fade the text through grey right at the flip. */
.navbar.nav-ramp .nav-logo img {
  filter: brightness(0) invert(1) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.55));
  transition: none;
}
.navbar.nav-ramp .nav-links a:not(.btn) {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: none;
}
.navbar.nav-ramp.nav-dark .nav-logo img { filter: none; }
.navbar.nav-ramp.nav-dark .nav-links a:not(.btn) {
  color: var(--ink-mid);
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.6);
}

/* Hover colours for the ramped bar. The underline, focus ring, hit area and scroll padding live in style.css
   (they apply to every page's navbar and are not decorative). */
.navbar.nav-ramp .nav-links a:not(.btn):hover { color: var(--white); }
.navbar.nav-ramp.nav-dark .nav-links a:not(.btn):hover { color: var(--link-hover); }

/* Anchor jumps: style.css adds 88px of scroll padding for the fixed bar; this cancels 64px of it so sections land
   close to where they used to. */
html:has(.navbar) section[id] { scroll-margin-top: -64px; }

/* Light speckle instead of dark speckle on the dark sections. */
:root[data-theme="dark"] { --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.8 0 0 0 0 0.86 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* --- Dark theme: the ramp ends in the dark navy bar instead of white/cream, the text never flips to dark ink,
   and the grain switches to a light speckle. --- */
:root[data-theme="dark"] .navbar.nav-ramp {
  background:
    linear-gradient(to bottom, rgba(9, 18, 36, calc(0.55 * max(0, 1 - 2 * var(--nav-t)))), rgba(9, 18, 36, 0)),
    rgba(17, 26, 42, calc(0.1 + 0.9 * var(--nav-t)));
  box-shadow: 0 1px 12px rgba(0, 0, 0, calc(0.4 * var(--nav-t)));
}
:root[data-theme="dark"] .navbar.nav-ramp.nav-dark .nav-logo img {
  filter: brightness(0) invert(1) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.55));
}
:root[data-theme="dark"] .navbar.nav-ramp.nav-dark .nav-links a:not(.btn) { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.navbar.nav-ramp .theme-toggle { color: rgba(255, 255, 255, 0.92); }
.navbar.nav-ramp.nav-dark .theme-toggle { color: var(--ink-mid); }

/* --- Fine grain on light sections --- */
#cursos,
#sobre,
#faq {
  background-image: var(--grain);
  background-size: 180px 180px;
}

/* Fade the grain in under the wave so the hand-off from the flat wave fill is seamless
   (gradient tracks --bg-light). */
#cursos {
  background-image:
    linear-gradient(to bottom, var(--bg-light), transparent 140px),
    var(--grain);
  background-size: auto, 180px 180px;
}

/* --- Motion (opt-in) --- */
@media (prefers-reduced-motion: no-preference) {
  #hero::before, #hero::after { will-change: transform; }
  #hero::before { animation: water-drift 26s ease-in-out infinite alternate; }
  #hero::after  { animation: water-sway 34s ease-in-out infinite alternate; }
  #hero.is-offscreen::before, #hero.is-offscreen::after { animation-play-state: paused; }
}
@keyframes water-drift {
  0%   { transform: translate3d(-9%, -6%, 0) scale(1); }
  50%  { transform: translate3d(8%, 5%, 0) scale(1.14); }
  100% { transform: translate3d(-3%, 9%, 0) scale(1.05); }
}
@keyframes water-sway {
  from { transform: translate3d(2%, 0, 0) scale(1.1); }
  to   { transform: translate3d(-2%, 3%, 0) scale(1.1); }
}

/* --- Small screens: lighter --- */
@media (max-width: 640px) {
  :root { --k-pools: 0.12; --k-ripple: 0.22; }
  #hero::before { inset: -20% -10% -10% -10%; }
  #hero::after { opacity: 0.05; }
  .wave-divider { height: 44px; }
}

/* --- Print (hero + navbar; the footer and the shared print rules live in style.css, which every page loads) ---
   Browsers drop dark backgrounds when printing, so the white-on-navy hero would print white-on-white. Print it
   dark-on-white and drop every decorative layer. */
@media print {
  #hero, .navbar.nav-ramp { background: #fff !important; box-shadow: none !important; }
  .navbar { position: static !important; }
  #hero { min-height: 0; padding: 24px 0; }
  #hero :not(.btn), .navbar.nav-ramp .nav-links a:not(.btn) { color: #1a1f2e !important; text-shadow: none !important; }
  #hero .btn-ghost { color: #1a1f2e !important; border-color: #1a1f2e !important; }
  .navbar.nav-ramp .nav-logo img { filter: none !important; }
  #hero::before, #hero::after, .wave-divider, .hero-apps { display: none !important; }
  #cursos, #sobre, #faq { background-image: none !important; }
}
