:root {
  color-scheme: dark;
  --bg: #1475c9;
  --ink: #f7f5ea;
  --ink-soft: rgb(247 245 234 / 0.72);
  --ink-faint: rgb(247 245 234 / 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
}

button {
  font: inherit;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 360px;
  overflow: hidden;
  background:
    radial-gradient(circle at 52% 46%, rgb(255 255 255 / 0.035), transparent 38%),
    var(--bg);
  cursor: none;
  user-select: none;
  touch-action: none;
}

.linea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.stroke {
  fill: none;
  stroke: var(--ink);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.main-line {
  transition: filter 120ms linear;
}

.stage[data-mood="furious"] .main-line {
  filter: drop-shadow(0 0 4px rgb(247 245 234 / 0.28));
}

.detail {
  stroke-width: 5;
}

.gesture {
  stroke-width: 4;
  opacity: 0;
  transition: opacity 120ms ease;
}

.gesture.is-visible {
  opacity: 0.72;
}

.intro-draw {
  stroke-dasharray: 2800;
  stroke-dashoffset: 2800;
  animation: draw 2.15s cubic-bezier(0.2, 0.7, 0.25, 1) 250ms forwards;
}

.brand {
  position: absolute;
  top: clamp(18px, 3vw, 36px);
  left: clamp(18px, 3vw, 40px);
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  color: var(--ink);
  letter-spacing: 0.12em;
  opacity: 0;
  animation: fade-in 800ms ease 1.9s forwards;
  pointer-events: none;
}

.brand__title {
  font-weight: 800;
  font-size: clamp(0.92rem, 1.2vw, 1.08rem);
}

.brand__dedication {
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(0.75rem, 1vw, 0.9rem);
  letter-spacing: 0.02em;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: clamp(26px, 6vh, 58px);
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(0.72rem, 1vw, 0.9rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: translateX(-50%);
  opacity: 0;
  animation: hint-in 1s ease 2.3s forwards, hint-out 1s ease 8s forwards;
  pointer-events: none;
}

.sound-toggle {
  position: absolute;
  right: clamp(16px, 2.4vw, 34px);
  bottom: clamp(16px, 2.4vw, 30px);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.72rem;
  border: 1px solid var(--ink-faint);
  border-radius: 999px;
  background: rgb(20 117 201 / 0.15);
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  backdrop-filter: blur(3px);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.sound-toggle:hover,
.sound-toggle:focus-visible {
  color: var(--ink);
  border-color: var(--ink-soft);
  background: rgb(20 117 201 / 0.36);
  outline: none;
}

.sound-toggle__icon {
  font-size: 1rem;
  line-height: 1;
}

.sound-toggle[aria-pressed="true"] .sound-toggle__icon {
  animation: pulse 1.4s ease-in-out infinite;
}

.cursor {
  position: absolute;
  z-index: 4;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: width 100ms ease, height 100ms ease, opacity 200ms ease;
  mix-blend-mode: screen;
}

.stage[data-pointer="active"] .cursor {
  opacity: 0.76;
}

.stage[data-mood="wary"] .cursor,
.stage[data-mood="annoyed"] .cursor,
.stage[data-mood="furious"] .cursor {
  width: 24px;
  height: 24px;
}

.mutter {
  position: absolute;
  z-index: 3;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  font-size: clamp(0.72rem, 1.2vw, 1rem);
  letter-spacing: 0.03em;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-3deg);
  pointer-events: none;
  white-space: nowrap;
}

.mutter.is-visible {
  animation: mutter 820ms ease forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

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

@keyframes hint-in {
  to {
    opacity: 0.64;
  }
}

@keyframes hint-out {
  to {
    opacity: 0;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@keyframes mutter {
  0% {
    opacity: 0;
    transform: translate(-50%, -45%) rotate(-3deg) scale(0.9);
  }
  20% {
    opacity: 0.95;
  }
  72% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -88%) rotate(2deg) scale(1.04);
  }
}

@media (hover: none), (pointer: coarse) {
  .stage {
    cursor: auto;
  }

  .cursor {
    display: none;
  }

  .hint::after {
    content: " · touche";
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-draw,
  .brand,
  .hint {
    animation-duration: 1ms;
    animation-delay: 0ms;
  }

  .sound-toggle[aria-pressed="true"] .sound-toggle__icon {
    animation: none;
  }
}
