:root {
  --ink: #e5e8e7;
  --ink-soft: #9aa0a1;
  --ink-faint: #6f7678;
  --cold: #05080a;
  --warm: #b27945;
  --serif: "Didot", "Bodoni 72", "Hoefler Text", Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: #000;
  color: var(--ink);
  overflow: hidden;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { font: inherit; }

#teaser {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
}

/* Stacked layers: walker (bottom) -> snake -> world -> grade -> title (top). */
.layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  object-fit: cover;
  object-position: center;
}

#walker {
  z-index: 0;
  opacity: 0;
  filter: saturate(0.82) contrast(1.06) brightness(0.92);
  transition: opacity 0.9s ease;
}

#snake {
  z-index: 1;
  opacity: 0;
  filter: saturate(0.84) contrast(1.04) brightness(0.96);
  transition: opacity 0.9s ease;
}

#world {
  z-index: 2;
  opacity: 0;
  filter: saturate(0.88) contrast(1.06) brightness(0.86);
  transform: scale(1.012);
  transition: opacity 1.2s ease, transform 7s cubic-bezier(0.16, 1, 0.3, 1);
}

#world.show {
  opacity: 1;
  transform: scale(1);
}

#walker.show,
#snake.show { opacity: 1; }

#vignette {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.34), transparent 30%, rgba(0, 0, 0, 0.56) 100%),
    radial-gradient(120% 100% at 50% 44%, transparent 40%, rgba(0, 0, 0, 0.8) 100%);
}

#grain {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

#title {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(64px, 11vh, 132px));
  width: min(880px, calc(100vw - 96px));
  text-align: center;
  pointer-events: none;
  opacity: 0;
  filter: blur(7px);
  transform: translate(-50%, 14px);
  transition: opacity 2.6s ease, filter 2.6s ease, transform 2.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#title.show {
  opacity: 1;
  filter: blur(0);
  transform: translate(-50%, 0);
}

#title h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 4.8vw, 66px);
  line-height: 1;
  letter-spacing: 0.31em;
  padding-left: 0.31em;
  margin: 0;
  color: rgba(233, 236, 235, 0.9);
}

#title .title-line {
  margin: 16px 0 0;
  color: rgba(178, 185, 186, 0.74);
  font-size: clamp(10px, 1.2vw, 12px);
  letter-spacing: 0.38em;
  text-transform: uppercase;
}

#title .title-note {
  margin: 20px 0 0;
  color: rgba(150, 158, 159, 0.6);
  font-size: clamp(9px, 1vw, 11px);
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

#title .title-mail {
  display: inline-block;
  margin-top: 11px;
  pointer-events: auto;
  color: rgba(214, 222, 222, 0.78);
  font-size: clamp(11px, 1.1vw, 13px);
  letter-spacing: 0.08em;
  text-decoration: none;
  border-bottom: 1px solid rgba(190, 202, 202, 0.22);
}

#title .title-mail:hover,
#title .title-mail:focus-visible {
  color: rgba(236, 241, 241, 0.95);
  border-bottom-color: rgba(214, 222, 222, 0.5);
  outline: 0;
}

#sound-toggle {
  position: fixed;
  z-index: 6;
  top: calc(env(safe-area-inset-top, 0px) + clamp(16px, 2.4vh, 26px));
  right: calc(env(safe-area-inset-right, 0px) + clamp(12px, 1.8vw, 24px));
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 10px 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: rgba(178, 185, 186, 0.5);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.6s ease 0.4s, color 0.6s ease;
}

#sound-toggle[hidden] {
  display: none;
}

#sound-toggle.ready {
  opacity: 1;
  pointer-events: auto;
}

#sound-toggle:hover,
#sound-toggle:focus-visible {
  color: rgba(220, 226, 226, 0.86);
  outline: 0;
}

#sound-toggle[aria-pressed="true"] {
  color: rgba(220, 226, 226, 0.9);
}

.sound-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(178, 185, 186, 0.42);
  box-shadow: 0 0 0 0 rgba(178, 121, 69, 0);
  transition: background 0.7s ease, box-shadow 0.7s ease;
}

#sound-toggle[aria-pressed="true"] .sound-dot {
  background: var(--warm);
  box-shadow: 0 0 8px 1px rgba(178, 121, 69, 0.5);
}

@media (max-width: 700px) and (orientation: portrait) {
  /* On phones the subject must stay readable while the frame crops. */
  #walker,
  #snake { object-position: 50% 42%; }

  #world { object-position: 50% 38%; }

  #grain { opacity: 0.03; }

  #title {
    width: calc(100vw - 34px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(48px, 9vh, 96px));
  }

  #title h1 {
    font-size: clamp(25px, 7.6vw, 34px);
    letter-spacing: 0.24em;
    padding-left: 0.24em;
    white-space: nowrap;
  }

  #title .title-line {
    margin-top: 15px;
    font-size: 10px;
    letter-spacing: 0.26em;
  }

  #title .title-note {
    margin-top: 17px;
    font-size: 9px;
    letter-spacing: 0.2em;
  }

  #title .title-mail {
    margin-top: 12px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* No motion: skip the clips, land straight on the world + title. */
  #walker,
  #snake { display: none; }

  #world {
    opacity: 1;
    transform: none;
    transition: none;
  }

  #title {
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%, 0);
    transition: opacity 0.6s ease;
  }
}
