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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: #0a0a0a;
  color: #ebebeb;
  min-height: 100vh;
  overflow-x: hidden;
}

video#bg-video,
video#bg-video-rev,
video#bg-video-b,
video#bg-video-b-rev {
  display: none;
}

canvas#rain,
canvas#ascii {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

canvas#ascii {
  display: none;
}

canvas#ascii.active {
  display: block;
  pointer-events: auto;
}

.spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    circle 300px at 50% 50%,
    rgba(235, 235, 235, 0.04) 0%,
    transparent 70%
  );
  transition: opacity 0.4s ease;
  opacity: 0;
}

.spotlight.active {
  opacity: 1;
}

main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}

.hero {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}

.hero.visible {
  opacity: 1;
  transform: translateY(0);
}

h1 {
  font-size: clamp(3.5rem, 8vw, 8rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #ebebeb;
}

/* ── Tagline ── */

.tagline-wrapper {
  margin-top: 1.5rem;
}

.tagline {
  display: inline-block;
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 300;
  color: #ebebeb;
  letter-spacing: 0;
  cursor: pointer;
  position: relative;
  transition: opacity 0.4s ease, color 0.3s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tagline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: #ebebeb;
  transition: width 0.3s ease;
}

.tagline:hover::after {
  width: 100%;
}

.tagline.bio-open {
  color: rgba(235, 235, 235, 0.85);
}

/* ── Bio panel ── */

.bio-panel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease,
              margin-top 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.bio-panel.open {
  max-height: 160px;
  opacity: 1;
  margin-top: 1.25rem;
}

.bio-text {
  font-size: clamp(0.85rem, 1.8vw, 1.05rem);
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: 0;
  color: rgba(235, 235, 235, 0.85);
  max-width: 48ch;
  margin: 0 auto;
}

/* ── Socials ── */

.socials {
  display: flex;
  gap: 2rem;
  margin-top: 4rem;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 1.2s ease 0.3s, transform 1.2s ease 0.3s;
}

.socials.visible {
  opacity: 1;
  transform: translateY(0);
}

.social-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #ebebeb;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 400;
  padding: 0.5rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
}

.social-link:hover {
  border-bottom-color: rgba(235, 235, 235, 0.4);
}

.social-link svg {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.social-link:hover svg {
  opacity: 1;
}

/* ── Status line ── */

.status-line {
  position: absolute;
  bottom: 4rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1.2s ease 0.8s, transform 1.2s ease 0.8s;
}

.status-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.status-text {
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: rgba(235, 235, 235, 0.35);
  transition: opacity 0.6s ease;
  text-shadow: 0 0 12px rgba(235, 235, 235, 0.08);
}

.status-text.fading {
  opacity: 0;
}

/* ── Footer ── */

footer {
  position: absolute;
  bottom: 2rem;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 1.2s ease 0.6s, transform 1.2s ease 0.6s;
}

footer.visible {
  opacity: 1;
  transform: translateY(0);
}

footer p {
  font-size: 0.75rem;
  font-weight: 300;
  color: rgba(235, 235, 235, 0.3);
}

/* ── Video controls ── */

.video-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  opacity: 0.75;
  transition: opacity 0.3s ease;
}

.video-controls:hover {
  opacity: 1;
}

.video-controls-label {
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(235, 235, 235, 0.85);
  letter-spacing: 0.03em;
  user-select: none;
}

.video-opacity-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 3px;
  background: rgba(235, 235, 235, 0.45);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}

.video-opacity-slider::-webkit-slider-runnable-track {
  height: 3px;
  background: rgba(235, 235, 235, 0.45);
  border-radius: 2px;
}

.video-opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(235, 235, 235, 0.9);
  margin-top: -5px;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.video-opacity-slider::-webkit-slider-thumb:hover {
  background: rgba(235, 235, 235, 1);
  box-shadow: 0 0 10px rgba(235, 235, 235, 0.3);
}

.video-opacity-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: rgba(235, 235, 235, 0.9);
  cursor: pointer;
}

/* ── Play / Pause button ── */

.video-playpause {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(235, 235, 235, 0.18);
  border-radius: 50%;
  background: rgba(15, 15, 15, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(235, 235, 235, 0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.video-playpause.visible {
  opacity: 1;
  pointer-events: auto;
}

.video-playpause:hover {
  background: rgba(25, 25, 25, 0.7);
  color: rgba(235, 235, 235, 0.85);
  border-color: rgba(235, 235, 235, 0.35);
}

.video-playpause svg {
  display: none;
}

.video-playpause.playing .icon-pause {
  display: block;
}

.video-playpause:not(.playing) .icon-play {
  display: block;
}

/* ── Settings panel ── */

.settings-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 4.75rem;
  z-index: 10;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(235, 235, 235, 0.18);
  border-radius: 50%;
  background: rgba(15, 15, 15, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(235, 235, 235, 0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.settings-toggle.visible {
  opacity: 1;
  pointer-events: auto;
}

.settings-toggle:hover {
  background: rgba(25, 25, 25, 0.7);
  color: rgba(235, 235, 235, 0.85);
  border-color: rgba(235, 235, 235, 0.35);
}

.settings-toggle svg {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-toggle.active svg {
  transform: rotate(60deg);
}

.settings-panel {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  z-index: 11;
  display: flex;
  flex-direction: row-reverse;
  gap: 1.25rem;
  padding: 0.85rem 1.1rem 0.75rem;
  border: 1px solid rgba(235, 235, 235, 0.14);
  border-radius: 10px;
  background: rgba(15, 15, 15, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.settings-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 56px;
}

.settings-row + .settings-row {
  padding-right: 1.25rem;
  border-right: 1px solid rgba(235, 235, 235, 0.08);
}

.settings-label {
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(235, 235, 235, 0.8);
  letter-spacing: 0.02em;
  user-select: none;
  white-space: nowrap;
}

.settings-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 56px;
  height: 3px;
  background: rgba(235, 235, 235, 0.25);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}

.settings-slider::-webkit-slider-runnable-track {
  height: 3px;
  background: rgba(235, 235, 235, 0.25);
  border-radius: 2px;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(235, 235, 235, 0.9);
  margin-top: -5px;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.settings-slider::-webkit-slider-thumb:hover {
  background: rgba(235, 235, 235, 1);
  box-shadow: 0 0 10px rgba(235, 235, 235, 0.3);
}

.settings-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: rgba(235, 235, 235, 0.9);
  cursor: pointer;
}

.settings-value {
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(235, 235, 235, 0.55);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-align: center;
  user-select: none;
}

/* ── Mobile tap ripple ── */

.ripple-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

.ripple-ring {
  position: absolute;
  border: 1px solid rgba(235, 235, 235, 0.35);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-expand 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes ripple-expand {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
    transform: translate(-50%, -50%) scale(0);
  }
  100% {
    width: 160px;
    height: 160px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ── Key legend ── */

.key-legend {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 10;
  font-size: 0.7rem;
  font-weight: 300;
  color: rgba(235, 235, 235, 0.4);
  letter-spacing: 0.03em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.key-legend.open {
  opacity: 1;
  transform: translateY(0);
}

.key-legend kbd {
  display: inline-block;
  font-family: 'Space Grotesk', monospace;
  font-size: 0.65rem;
  padding: 2px 5px;
  border: 1px solid rgba(235, 235, 235, 0.2);
  border-radius: 3px;
  background: rgba(235, 235, 235, 0.06);
}

@media (max-width: 600px) {
  main {
    padding: 1.5rem;
  }

  .socials {
    gap: 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .social-link {
    flex-shrink: 0;
  }

  .social-link span {
    display: none;
  }

  .social-link svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }

  .video-playpause {
    bottom: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
  }

  .settings-toggle {
    bottom: 1rem;
    right: 3.75rem;
    width: 36px;
    height: 36px;
  }

  .settings-panel {
    bottom: 4rem;
    right: 1rem;
    gap: 1rem;
    padding: 0.7rem 0.9rem 0.65rem;
  }

  .settings-slider {
    width: 48px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  main {
    justify-content: flex-start;
    padding: 0.75rem;
    min-height: 100vh;
  }

  h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }

  .tagline {
    font-size: clamp(0.75rem, 2vw, 1rem);
  }

  .tagline-wrapper {
    margin-top: 0.3rem;
  }

  .socials {
    margin-top: 0.75rem;
    gap: 1.25rem;
  }

  .social-link {
    font-size: 0.85rem;
  }

  .video-controls {
    margin-top: 0.5rem;
  }

  .status-line {
    bottom: 1.5rem;
  }

  footer {
    bottom: 0.5rem;
  }

  .video-playpause {
    bottom: 0.5rem;
    right: 0.5rem;
    width: 32px;
    height: 32px;
  }

  .settings-toggle {
    bottom: 0.5rem;
    right: 2.75rem;
    width: 32px;
    height: 32px;
  }

  .settings-panel {
    bottom: 3.25rem;
    right: 0.5rem;
    gap: 1rem;
    padding: 0.65rem 0.85rem 0.6rem;
  }

  .settings-slider {
    width: 48px;
  }

  .key-legend {
    bottom: 0.5rem;
    left: 0.5rem;
    font-size: 0.6rem;
  }
}
