:root {
  --abyss: #05070a;
  --deep: #081110;
  --mangrove: #0f2019;
  --scale: #2f6f54;
  --glow: #7fd0a8;
  --ember: #b8672c;
  --ash: #8ea79a;
  --bone: #e8e4da;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  background-color: var(--abyss);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html {
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

/* Bernúncia — the coils moving in the dark */
.beast {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 85% 65% at 50% 56%, #10221b 0%, transparent 62%),
    radial-gradient(ellipse 55% 45% at 18% 18%, rgba(47, 111, 84, 0.16) 0%, transparent 58%),
    radial-gradient(ellipse 50% 40% at 84% 82%, rgba(184, 103, 44, 0.12) 0%, transparent 55%),
    linear-gradient(180deg, #030507 0%, var(--abyss) 26%, var(--deep) 62%, var(--mangrove) 100%);
}

/* The breath from the throat — slow, warm, never quite resolving */
.beast__breath {
  position: absolute;
  left: 50%;
  top: 54%;
  width: min(120vw, 62rem);
  aspect-ratio: 1.6 / 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(184, 103, 44, 0.22) 0%, rgba(184, 103, 44, 0.07) 38%, transparent 70%),
    radial-gradient(ellipse 60% 60% at center, rgba(127, 208, 168, 0.1) 0%, transparent 68%);
  filter: blur(28px);
  opacity: 0.85;
}

.beast__coils {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  opacity: 0.9;
  mask-image: radial-gradient(ellipse 78% 70% at 50% 50%, rgba(0, 0, 0, 0.95) 22%, rgba(0, 0, 0, 0.45) 62%, transparent 92%);
  -webkit-mask-image: radial-gradient(ellipse 78% 70% at 50% 50%, rgba(0, 0, 0, 0.95) 22%, rgba(0, 0, 0, 0.45) 62%, transparent 92%);
}

/* Dashes read as scales sliding along the body. Dash and gap stay close in
   length: widen the gap and the strokes stop reading as a ridged body and
   start reading as a string of beads, which gets worse the wider the screen.
   --slide is a whole number of dash periods so the loop does not jump. */
.beast__coil {
  fill: none;
  stroke-linecap: round;
  opacity: 0;
}

.beast__coil--a { stroke-width: 30; stroke-dasharray: 14 10; --slide: -480px; }
.beast__coil--b { stroke-width: 22; stroke-dasharray: 10 8;  --slide: -450px; }
.beast__coil--c { stroke-width: 34; stroke-dasharray: 16 11; --slide: -540px; }
.beast__coil--d { stroke-width: 18; stroke-dasharray: 9 7;   --slide: -480px; }

.beast__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(142, 167, 154, 0.07) 0%,
    rgba(142, 167, 154, 0.03) 30%,
    transparent 62%
  );
}

.beast__grain {
  position: absolute;
  inset: 0;
  opacity: 0.2;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

.beast__vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 66% 56% at 50% 50%, transparent 18%, rgba(2, 4, 6, 0.8) 100%),
    linear-gradient(to bottom, rgba(2, 4, 6, 0.5) 0%, transparent 24%, transparent 68%, rgba(2, 4, 6, 0.38) 100%);
}

/* Wordmark */
.wordmark {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 1.25rem 1.5rem;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--ash);
  text-align: center;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wordmark__text {
  display: block;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(2.75rem, 11vw, 7.5rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 0.95;
  color: var(--bone);
  white-space: nowrap;
  text-shadow:
    0 0 40px rgba(127, 208, 168, 0.16),
    0 0 90px rgba(184, 103, 44, 0.12);
}

@media (max-width: 640px) {
  .wordmark {
    padding: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .beast__coils {
    opacity: 0.6;
  }

  .beast__coil {
    opacity: 0.7;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .beast__body {
    animation: body-sway 26s ease-in-out infinite;
    transform-origin: 50% 50%;
  }

  .beast__coil {
    animation-name: scales-slide, coil-surface;
    animation-timing-function: linear, ease-in-out;
    animation-iteration-count: infinite, infinite;
  }

  .beast__coil--a { animation-duration: 14s, 19s; animation-delay: 0s, 0s; }
  .beast__coil--b { animation-duration: 19s, 23s; animation-delay: -4s, -3s; }
  .beast__coil--c { animation-duration: 11s, 17s; animation-delay: -7s, -6s; }
  .beast__coil--d { animation-duration: 23s, 29s; animation-delay: -2s, -9s; }

  .beast__breath {
    animation: breathe 11s ease-in-out infinite;
  }

  .wordmark {
    opacity: 0;
    animation: fade-in 2.4s ease-out 0.6s forwards;
  }
}

@keyframes scales-slide {
  to { stroke-dashoffset: var(--slide); }
}

/* Each coil surfaces out of the dark and sinks back — never fully visible at once */
@keyframes coil-surface {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 0.85; }
}

@keyframes body-sway {
  0%, 100% { transform: translate3d(0, 0, 0) scale3d(1, 1, 1); }
  33% { transform: translate3d(-1.5%, 1.2%, 0) scale3d(1.04, 1.02, 1); }
  66% { transform: translate3d(1.8%, -1%, 0) scale3d(1.02, 1.05, 1); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.55; transform: translate(-50%, -50%) scale(0.94); }
  50% { opacity: 0.95; transform: translate(-50%, -50%) scale(1.06); }
}

@keyframes fade-in {
  to { opacity: 1; }
}

/* Mobile / touch: SVG displacement filters look blocky — use CSS blur instead */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .beast__body {
    filter: blur(5px);
    -webkit-filter: blur(5px);
  }

  .beast__coils {
    inset: -10%;
    width: 120%;
    height: 120%;
    opacity: 0.75;
  }

  .beast__coil--d {
    display: none;
  }

  .beast__breath {
    filter: blur(36px);
  }

  .beast__grain {
    opacity: 0.08;
    mix-blend-mode: soft-light;
  }
}
