/* 
  basic reset
  this makes sizes less annoying: padding/border stay inside width/height
*/
* {
  box-sizing: border-box;
}

/* 
  one place for neon timing
  audio is around 4.056s, so blink uses the same length
*/
:root {
  --neon-cycle: 4.056s;
}

/* 
  main page look
  monospace fonts = more console / terminal mood
*/
body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: #020307;
  color: white;
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 0;
}

/*
  before START we do not let the user scroll into the site
  js removes this class after the door starts opening
*/
body.is-start-locked {
  overflow: hidden;
}

/* Apple-ish sci-fi header */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: 100%;
  height: 3.2rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid rgba(102, 229, 255, 0.1);
  background: rgba(2, 3, 7, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.header-logo {
  width: 1.7rem;
  height: 1.7rem;
  display: block;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 1rem rgba(102, 229, 255, 0.25);
}

.header-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.header-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 3vw, 2.5rem);
}

.header-nav a {
  color: rgba(231, 247, 255, 0.78);
  font-size: 0.78rem;
  text-decoration: none;
  transition:
    color 0.2s ease,
    text-shadow 0.2s ease;
}

.header-nav a:hover {
  color: #e7f7ff;
  text-shadow:
    0 0 0.55rem rgba(102, 229, 255, 0.75),
    0 0 1.4rem rgba(102, 229, 255, 0.25);
}

/* Start door screen */

/*
  this is the first thing people see
  the 3d door is just a background, button stays as normal html
*/
.start-gate {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #020307;
}

#door-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.start-panel {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 1.25rem;
  justify-items: center;
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}

.start-button {
  min-width: 11rem;
  min-height: 3.25rem;
  padding: 0.75rem 2rem;
  border: 1px solid rgba(102, 229, 255, 0.75);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(102, 229, 255, 0.16), rgba(4, 14, 22, 0.82));
  color: #e7f7ff;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-shadow:
    0 0 0.45rem rgba(102, 229, 255, 0.85),
    0 0 1.4rem rgba(102, 229, 255, 0.35);
  box-shadow:
    0 0 1rem rgba(102, 229, 255, 0.28),
    inset 0 0 1.4rem rgba(102, 229, 255, 0.12);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.start-button:hover {
  transform: translateY(-0.12rem) scale(1.03);
  border-color: rgba(102, 229, 255, 1);
  box-shadow:
    0 0 1.4rem rgba(102, 229, 255, 0.55),
    0 0 3rem rgba(102, 229, 255, 0.2),
    inset 0 0 1.5rem rgba(102, 229, 255, 0.18);
}

.start-gate::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 22%, rgba(2, 3, 7, 0.7) 70%),
    linear-gradient(180deg, rgba(2, 3, 7, 0.1), rgba(2, 3, 7, 0.75));
  pointer-events: none;
  transition: opacity 0.65s ease;
}

.start-gate.is-opening .start-panel {
  opacity: 0;
  transform: translateY(1rem) scale(0.96);
}

.start-gate.is-opening::after {
  opacity: 0;
}

/* Opening rock scene, rebuilt clean */

.rock-intro {
  position: relative;
  height: 360vh;
  background: #020307;
}

.rock-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #020307;
}

#rock-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  background: #020307;
}

.rock-title {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  text-align: center;
  pointer-events: none;
  opacity: var(--rock-title-opacity, 0);
  transform: translateY(var(--rock-title-y, 10rem)) scale(var(--rock-title-scale, 0.94));
  filter: blur(var(--rock-title-blur, 0.35rem));
}

/* Неоновая надпись RE:LINK */

/* 
  first screen
  100vh = full browser height
  grid + place-items is the lazy clean way to center things
*/
.hero {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 58%, rgba(102, 229, 255, 0.16), transparent 22rem),
    radial-gradient(circle at 22% 38%, rgba(154, 88, 255, 0.11), transparent 20rem),
    #020307;
}

.hero::before,
.hero::after {
  content: '';
  position: absolute;
  inset: -10%;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(231, 247, 255, 0.9) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(102, 229, 255, 0.55) 0 1px, transparent 1.2px);
  background-position:
    0 0,
    3rem 4rem;
  background-size:
    7.5rem 7.5rem,
    11rem 11rem;
  opacity: 0.42;
  animation: star-drift 36s linear infinite;
}

.hero::after {
  opacity: 0.22;
  filter: blur(0.6px);
  background-size:
    13rem 13rem,
    17rem 17rem;
  animation-duration: 58s;
}

/* 
  wrapper for the hero text
  keeps label, logo, loading text together as one group
*/
.hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1rem;
  justify-items: center;
  opacity: var(--hero-reveal-opacity, 0);
  transform: translateY(var(--hero-reveal-y, 8rem));
  transition:
    opacity 0.08s linear,
    transform 0.08s linear;
}

/* small text above the logo */
.upper-label {
  margin: 0;
  color: #66e5ff;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* 
  base title style
  clamp keeps it big, but not insane on small/huge screens
*/
h1 {
  letter-spacing: 0.12em;
  margin: 0;
  font-size: clamp(4rem, 11vw, 9rem);
  line-height: 0.85;
}

/* 
  glow for the whole RE:LINK
  several text-shadows = fake neon light
*/
.logo-title {
  color: #e7f7ff;
  text-shadow:
    0 0 0.35rem rgba(102, 229, 255, 0.95),
    0 0 1.2rem rgba(102, 229, 255, 0.65),
    0 0 3rem rgba(102, 229, 255, 0.38);
}

/* 
  colon does not blink at first
  js adds .is-neon-running after scroll/touch, together with audio
*/
.blink-colon {
  opacity: 1;
}

/* active blinking state, only for ":" */
.blink-colon.is-neon-running {
  animation: colon-flicker var(--neon-cycle) infinite;
}

/* text under the logo */
.tagline {
  margin: 0;
  color: #a8b5c5;
  font-size: 1rem;
}

/* 
  loading dots
  important: only spans inside .loading-text, so ":" span is not touched
*/
.loading-text span {
  animation: loading-dot 1.2s infinite;
  opacity: 0.2;
}

/* first dot starts right away */
.loading-text span:nth-child(1) {
  animation-delay: 0s;
}

/* second dot starts a bit later */
.loading-text span:nth-child(2) {
  animation-delay: 0.2s;
}

/* third dot starts after that */
.loading-text span:nth-child(3) {
  animation-delay: 0.4s;
}

/* 
  dot is mostly dim, then briefly bright
*/
@keyframes loading-dot {
  0%,
  80%,
  100% {
    opacity: 0.2;
  }

  40% {
    opacity: 1;
  }
}

@keyframes star-drift {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(-7.5rem, 4rem, 0);
  }
}

@keyframes star-drift-soft {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(-4rem, 2.4rem, 0);
  }
}

@keyframes warning-glitch {
  0%,
  7%,
  12%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }

  8% {
    opacity: 0.72;
    transform: translateY(0.08rem);
  }

  10% {
    opacity: 1;
    transform: translateY(-0.05rem);
  }

  58% {
    opacity: 0.9;
  }

  60% {
    opacity: 0.45;
  }

  62% {
    opacity: 1;
  }
}

@keyframes warning-split-cyan {
  0%,
  7%,
  12%,
  58%,
  64%,
  100% {
    opacity: 0;
  }

  8%,
  10%,
  60%,
  62% {
    opacity: 0.44;
  }
}

@keyframes warning-split-red {
  0%,
  7%,
  12%,
  58%,
  64%,
  100% {
    opacity: 0;
  }

  8%,
  10%,
  60%,
  62% {
    opacity: 0.5;
  }
}

@keyframes head-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-0.9rem);
  }
}

/* 
  broken neon effect for ":"
  most of the time it is bright
  at 20/24/55% it dips, like a sign losing contact
*/
@keyframes colon-flicker {
  5%,
  18%,
  22%,
  25%,
  53%,
  57%,
  100% {
    opacity: 1;
    text-shadow:
      0 0 0.35rem rgba(102, 229, 255, 0.95),
      0 0 1.2rem rgba(102, 229, 255, 0.65),
      0 0 3rem rgba(102, 229, 255, 0.38);
  }

  20%,
  24%,
  55% {
    opacity: 0.55;
    text-shadow:
      0 0 0.15rem rgba(102, 229, 255, 0.45),
      0 0 0.5rem rgba(102, 229, 255, 0.25);
  }
}

/* Video section */

/*
  full-screen video block
  it goes between the hero and character carousel
*/
.video-section {
  height: 240vh;
  background: #020307;
}

.relink-video {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  display: block;
  object-fit: cover;
}

/* Каруселька с персонажами */

/* 
  second block
  later: 3d platform on top, character thumbnails at bottom
*/
.character-section {
  min-height: 120vh;
  display: grid;
  grid-template-rows: 1fr auto;
  background:
    radial-gradient(circle at 18% 45%, rgba(255, 54, 108, 0.12), transparent 22rem),
    radial-gradient(circle at 82% 42%, rgba(58, 126, 255, 0.16), transparent 24rem),
    radial-gradient(circle at 50% 35%, rgba(102, 229, 255, 0.12), transparent 24rem),
    #020307;
}

/* 
  three.js area
  canvas lives here
*/
.character-stage {
  position: relative;
  min-height: 86vh;
  overflow: hidden;
}

/*
  text block for the selected character
  sits on the right side of the 3d stage
*/
.character-info {
  position: absolute;
  top: 50%;
  right: clamp(1rem, 7vw, 6rem);
  z-index: 2;
  width: min(26rem, 36vw);
  transform: translateY(-50%);
  pointer-events: none;
}

.character-role {
  margin: 0 0 0.75rem;
  color: #66e5ff;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.character-name {
  margin: 0 0 1rem;
  color: #e7f7ff;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.85;
  text-shadow:
    0 0 0.4rem rgba(102, 229, 255, 0.6),
    0 0 1.6rem rgba(102, 229, 255, 0.28);
}

.character-description {
  margin: 0;
  color: #c1ccd8;
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  line-height: 1.65;
}

/* 
  canvas fills the stage
  display block removes weird tiny gaps
*/
#character-scene {
  width: 100%;
  height: 100%;
  display: block;
}

/* 
  bottom strip with character pics
  later click = switch active character
*/
.character-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 100vw;
  overflow-x: auto;
  padding: 1rem;
  scrollbar-width: none;
}

.character-scroll::-webkit-scrollbar {
  display: none;
}

.character-scroll::before,
.character-scroll::after {
  flex: 0 0 auto;
  content: '';
}

/*
  side arrows for the character strip
  just glowing text, no button box
*/
.character-arrow {
  width: 2.25rem;
  height: 4rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #66e5ff;
  cursor: pointer;
  font: inherit;
  font-size: 2rem;
  line-height: 1;
  text-shadow:
    0 0 0.4rem rgba(102, 229, 255, 0.95),
    0 0 1.2rem rgba(102, 229, 255, 0.55);
  transition:
    transform 0.2s ease,
    color 0.2s ease,
    text-shadow 0.2s ease;
}

.character-arrow:hover {
  color: #e7f7ff;
  transform: scale(1.18);
  text-shadow:
    0 0 0.5rem rgba(102, 229, 255, 1),
    0 0 1.6rem rgba(102, 229, 255, 0.75),
    0 0 3rem rgba(102, 229, 255, 0.35);
}

/* 
  thumbnail button
  button is better than plain img because it will be clickable
*/
.character-image {
  width: 5rem;
  height: 5rem;
  padding: 0.35rem;
  border: 1px solid rgba(102, 229, 255, 0.4);
  border-radius: 0.5rem;
  background: rgba(3, 8, 14, 0.78);
  cursor: pointer;
  box-shadow:
    0 0 0.7rem rgba(102, 229, 255, 0.18),
    inset 0 0 0.8rem rgba(102, 229, 255, 0.08);
  transition:
    width 0.2s ease,
    height 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.character-image:hover,
.character-image.is-active {
  width: 6rem;
  height: 6rem;
  border-color: rgba(102, 229, 255, 0.9);
  box-shadow:
    0 0 1rem rgba(102, 229, 255, 0.55),
    0 0 2.2rem rgba(102, 229, 255, 0.25),
    inset 0 0 1rem rgba(102, 229, 255, 0.16);
}

.character-image:hover {
  transform: translateY(-0.25rem);
}

.character-image.is-active {
  transform: translateY(-0.35rem);
}

/* image fits inside the square without ugly stretching */
.character-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Locations section */

.locations-section {
  position: relative;
  min-height: 220vh;
  background: #020307;
}

.locations-sticky {
  position: sticky;
  top: 0;
  min-height: 100vh;
  overflow: hidden;
  padding: 5.8rem clamp(1rem, 5vw, 5rem) 3rem;
  background:
    radial-gradient(circle at 50% 48%, rgba(102, 229, 255, 0.12), transparent 28rem),
    radial-gradient(circle at 20% 70%, rgba(141, 90, 255, 0.11), transparent 24rem),
    #020307;
}

.locations-heading {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  margin-bottom: 2.5rem;
  text-align: center;
}

.locations-title {
  margin: 0;
  color: #e7f7ff;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.9;
  text-shadow:
    0 0 0.4rem rgba(102, 229, 255, 0.6),
    0 0 1.6rem rgba(102, 229, 255, 0.28);
}

/*
  six floating images
  js moves them from a little pile into this clean collage while scrolling
*/
.locations-list {
  position: relative;
  width: min(100%, 76rem);
  height: min(62vh, 42rem);
  margin: 0 auto;
}

.location-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(12rem, 23vw, 24rem);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid rgba(221, 242, 255, 0.16);
  border-radius: 0.7rem;
  background: rgba(3, 8, 14, 0.78);
  box-shadow:
    0 1.2rem 4rem rgba(0, 0, 0, 0.56),
    0 0 2rem rgba(102, 229, 255, 0.12),
    inset 0 0 1.2rem rgba(102, 229, 255, 0.06);
  will-change: transform, opacity;
}

.location-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 34%),
    linear-gradient(180deg, transparent 58%, rgba(2, 3, 7, 0.34));
  pointer-events: none;
}

.location-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.location-card:nth-child(3) {
  width: clamp(16rem, 34vw, 34rem);
  z-index: 3;
}

.location-card:nth-child(1),
.location-card:nth-child(2) {
  z-index: 2;
}

.location-card:nth-child(4),
.location-card:nth-child(5),
.location-card:nth-child(6) {
  z-index: 1;
}

/* Credits / links section */

/* final section */
.credits-section {
  min-height: 100vh;
  display: grid;
  align-content: end;
  justify-items: center;
  padding: 5rem 1rem 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(102, 229, 255, 0.12), transparent 22rem),
    #020307;
  text-align: center;
}

/*
  final warning above the broken head
  red here is intentional: it feels like a dangerous system boot, not a normal cyan UI
*/
.credits-warning {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 0.28rem;
  justify-items: center;
  margin-bottom: 0.7rem;
  color: #ff4d64;
  text-transform: uppercase;
  animation: warning-glitch 3.8s infinite;
}

.warning-kicker,
.warning-note {
  margin: 0;
  color: rgba(255, 151, 164, 0.76);
  font-size: 0.64rem;
  letter-spacing: 0.24em;
}

.warning-title {
  position: relative;
  margin: 0;
  color: #ffe6ea;
  font-size: clamp(1.45rem, 4.6vw, 3.8rem);
  line-height: 0.92;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 0.25rem rgba(255, 77, 100, 0.95),
    0 0 1.2rem rgba(255, 30, 68, 0.58),
    0 0 3rem rgba(255, 30, 68, 0.28);
}

.warning-title::before,
.warning-title::after {
  content: 'RECONNECTION START';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.warning-title::before {
  color: #66e5ff;
  transform: translate(-0.08rem, 0);
  animation: warning-split-cyan 3.8s infinite;
}

.warning-title::after {
  color: #ff2048;
  transform: translate(0.08rem, 0);
  animation: warning-split-red 3.8s infinite;
}

.credits-head-wrap {
  position: relative;
  z-index: 2;
  margin-bottom: 1.4rem;
  animation: head-float 4.8s ease-in-out infinite;
  filter:
    drop-shadow(0 0 1rem rgba(102, 229, 255, 0.45))
    drop-shadow(0 0 3rem rgba(102, 229, 255, 0.18));
  will-change: transform;
}

.credits-head {
  width: min(21rem, 66vw);
  display: block;
}

.site-footer {
  position: relative;
  z-index: 2;
  width: min(100%, 72rem);
  padding: 2.25rem 1.25rem;
  border-top: 1px solid rgba(102, 229, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(3, 8, 14, 0.9), rgba(2, 3, 7, 0.98));
  box-shadow: 0 -1rem 3rem rgba(0, 0, 0, 0.45);
}

.footer-credit,
.footer-copy {
  margin: 0;
  color: #a8b5c5;
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer-credit {
  color: #e7f7ff;
}

.footer-socials {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

.social-icon {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(102, 229, 255, 0.45);
  border-radius: 999px;
  color: #e7f7ff;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  background: rgba(3, 8, 14, 0.78);
  box-shadow:
    0 0 0.8rem rgba(102, 229, 255, 0.18),
    inset 0 0 0.8rem rgba(102, 229, 255, 0.08);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.social-icon:hover {
  transform: translateY(-0.2rem);
  border-color: rgba(102, 229, 255, 0.9);
  box-shadow:
    0 0 1rem rgba(102, 229, 255, 0.5),
    0 0 2.4rem rgba(102, 229, 255, 0.18),
    inset 0 0 1rem rgba(102, 229, 255, 0.14);
}

@media (max-width: 760px) {
  .site-header {
    grid-template-columns: auto 1fr;
    gap: 1rem;
    height: 3.4rem;
  }

  .header-nav {
    justify-content: flex-end;
    gap: 0.75rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .header-nav::-webkit-scrollbar {
    display: none;
  }

  .header-nav a {
    flex: 0 0 auto;
    font-size: 0.72rem;
  }

  .character-info {
    top: 1.5rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    transform: none;
    text-align: right;
  }

  .character-name {
    font-size: clamp(2.4rem, 15vw, 4.5rem);
  }

  .character-description {
    max-width: 19rem;
    margin-left: auto;
    font-size: 0.9rem;
  }

  .locations-list {
    height: 68vh;
  }

  .credits-head {
    width: min(16rem, 70vw);
  }

  .site-footer {
    padding: 2rem 1rem;
  }
}
