@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
  color-scheme: dark;
  --phosphor: #76e36f;
  --phosphor-hot: #9afb8f;
  --phosphor-dim: #36733a;
  --amber: #d49438;
  font-family: "Share Tech Mono", "Courier New", monospace;
  background: #020302;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-width: 1024px;
  min-height: 576px;
  margin: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at center,#11140f 0%,#050605 48%,#000 100%);
}

button,
a { font: inherit; -webkit-tap-highlight-color: transparent; }

button { color: inherit; }

.contacts-page {
  display: grid;
  min-height: 100dvh;
  place-items: center;
}

.contacts-console {
  position: relative;
  width: min(100vw,calc(100dvh * 1.7768331562));
  height: min(100dvh,calc(100vw / 1.7768331562));
  aspect-ratio: 1672 / 941;
  overflow: hidden;
  isolation: isolate;
  user-select: none;
  background: #030403;
  box-shadow: 0 24px 70px #000;
}

.contacts-console__art {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  pointer-events: none;
}

.contacts-console__art--mobile,
.dial-source--mobile { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.console-nav {
  position: absolute;
  z-index: 40;
  top: 2.3%;
  left: 11.8%;
  width: 73.2%;
  height: 5.65%;
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: .65%;
}

.console-nav__item {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: hidden;
  color: transparent;
  text-decoration: none;
  border: 0;
  border-radius: 3px;
  outline: 0;
  background-color: #030403;
  background-image:
    linear-gradient(rgba(1,3,1,.48),rgba(0,0,0,.58)),
    url('../assets/ui/nav-button-analog.webp');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 112% 172%;
  filter: drop-shadow(0 5px 4px rgba(0,0,0,.84));
  transition: transform 70ms ease,filter 90ms linear;
}

.console-nav__item::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 9.5%;
  top: 50%;
  width: 5.3%;
  aspect-ratio: 1;
  border: 1px solid #171a16;
  border-radius: 50%;
  background: #090b08;
  box-shadow: inset 0 2px 4px #000,0 1px rgba(191,188,166,.08);
  transform: translate(-50%,-50%);
}

.console-nav__item::after {
  content: attr(data-label);
  position: absolute;
  z-index: 3;
  inset: 18% 5% 22% 16%;
  display: grid;
  place-items: center;
  color: #98968b;
  font-size: clamp(8px,.69vw,13px);
  letter-spacing: .16em;
  line-height: 1;
  text-shadow: 0 1px 1px #000;
}

.console-nav__item:hover::before,
.console-nav__item:focus-visible::before,
.console-nav__item.is-active::before {
  background: #79ee6b;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.42),0 0 4px #62e95a,0 0 10px rgba(84,231,76,.62);
}

.console-nav__item:hover::after,
.console-nav__item:focus-visible::after { color: #c5c7b9; }
.console-nav__item.is-active::after { color: #79d66b; }

.console-nav__item:active {
  background-image:
    linear-gradient(rgba(1,3,1,.48),rgba(0,0,0,.58)),
    url('../assets/ui/nav-button-analog-pressed.webp');
  transform: scale(.985);
  filter: brightness(.78) drop-shadow(0 2px 2px #000);
}

.contact-crt {
  position: absolute;
  z-index: 12;
  top: 12.55%;
  left: 3.15%;
  width: 59.55%;
  height: 63.35%;
  overflow: hidden;
  border-radius: 9% / 13%;
  color: var(--phosphor);
  background:
    radial-gradient(ellipse at 50% 45%,rgba(19,43,24,.5),rgba(2,11,5,.96) 72%),
    #020703;
  box-shadow: inset 0 0 34px #000,inset 0 0 9px rgba(102,229,100,.12);
  text-shadow: 0 0 7px rgba(91,244,84,.42);
}

.contact-crt::before,
.contact-crt::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.contact-crt::before {
  z-index: 8;
  background:
    linear-gradient(90deg,rgba(255,0,0,.018),rgba(0,255,0,.012),rgba(0,64,255,.018)),
    repeating-linear-gradient(0deg,rgba(0,0,0,.18) 0 1px,rgba(123,255,122,.018) 1px 3px);
  mix-blend-mode: screen;
}

.contact-crt::after {
  z-index: 9;
  background: linear-gradient(180deg,transparent 0 69%,rgba(174,255,172,.12) 72%,rgba(0,0,0,.52) 74%,transparent 77%);
  opacity: .55;
  animation: crt-roll 7.5s linear infinite;
}

.contact-crt__content {
  position: absolute;
  inset: 8.5% 8.5% 7%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.contact-crt__eyebrow {
  margin: 0;
  font-size: clamp(9px,1.03vw,20px);
  letter-spacing: .25em;
}

.contact-crt__status {
  margin: 8.2% 0 1.6%;
  min-height: 1.2em;
  color: #92d58d;
  font-size: clamp(25px,3.25vw,60px);
  font-weight: 600;
  letter-spacing: .12em;
  line-height: 1;
}

.contact-crt__rule {
  width: 49%;
  height: 2px;
  background: linear-gradient(90deg,transparent,var(--phosphor-dim),transparent);
}

.contact-crt__stages {
  display: grid;
  gap: .38em;
  margin: 4.3% 0 0;
  padding: 0;
  list-style: none;
  color: #365f38;
  text-align: center;
  font-size: clamp(8px,.93vw,17px);
  letter-spacing: .19em;
}

.contact-crt__stages li { transition: color 160ms ease,filter 160ms ease; }
.contact-crt__stages li.is-active { color: var(--phosphor-hot); filter: brightness(1.25); }
.contact-crt__stages li.is-complete { color: #63b45f; }
.contact-crt.is-open .contact-crt__stages,
.contact-crt.is-open .contact-crt__channel { opacity:0; visibility:hidden; }

.contact-crt__channel {
  width: 44%;
  min-height: 9.5%;
  margin-top: 3.5%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(100,196,98,.28);
  color: #79c375;
  font-size: clamp(10px,1.15vw,21px);
  letter-spacing: .16em;
  transition: color 180ms ease,border-color 180ms ease,box-shadow 180ms ease;
}

.contact-crt.is-open .contact-crt__channel {
  color: var(--phosphor-hot);
  border-color: rgba(128,244,116,.62);
  box-shadow: inset 0 0 12px rgba(91,240,85,.08),0 0 8px rgba(91,240,85,.08);
}

.contact-crt__result {
  position: absolute;
  z-index:5;
  top: 45%;
  width: 76%;
  min-height: 31%;
  padding: 2.4% 5%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .42em;
  background: rgba(1,10,3,.985);
  border-block: 1px solid rgba(99,214,94,.3);
  box-shadow:0 0 24px rgba(0,0,0,.48);
}

.contact-crt__result[hidden] { display: none; }
.contact-crt__result small {
  color:#59925a;
  font-size:clamp(7px,.68vw,12px);
  letter-spacing:.2em;
}
.contact-crt__result strong { font-size:clamp(15px,1.82vw,34px); letter-spacing:.12em; }
.contact-crt__result p {
  margin:0;
  color:#72b66f;
  font-size:clamp(8px,.78vw,14px);
  letter-spacing:.12em;
  text-align:center;
}
.contact-crt__result span { color:#416d43; font-size:clamp(7px,.62vw,11px); letter-spacing:.17em; }

.contact-crt__hint {
  position: absolute;
  bottom: 1.5%;
  margin: 0;
  color: #315a34;
  font-size: clamp(7px,.66vw,12px);
  letter-spacing: .15em;
}

.contact-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8.5%;
  height: 11%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85%;
  opacity: .65;
  overflow: hidden;
}

.contact-wave::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(92,214,88,.42);
}

.contact-wave i {
  z-index: 1;
  width: 1px;
  height: calc(6% + var(--signal,0) * 1%);
  min-height: 4px;
  max-height: 88%;
  background: var(--phosphor);
  transform: scaleY(.3);
  transition: transform 120ms linear;
}

.contact-crt.is-calling .contact-wave i { animation: wave-pulse 520ms ease-in-out infinite alternate; }
.contact-wave i:nth-child(3n) { animation-delay:-160ms !important; }
.contact-wave i:nth-child(4n) { animation-delay:-310ms !important; }

.dial-deck {
  position: absolute;
  z-index: 23;
  top: 14.88%;
  left: 67.38%;
  width: 25.73%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: visible;
}

.rotary-dial {
  position: relative;
  z-index: 5;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  cursor: grab;
  outline: none;
  touch-action: none;
  background: transparent;
}

.rotary-dial:focus-visible { box-shadow:0 0 0 2px rgba(117,221,105,.48),0 0 14px rgba(94,225,85,.17); }
.rotary-dial.is-dragging { cursor: grabbing; }

.dial-rotor {
  position: absolute;
  z-index: 22;
  top:14.88%;
  left:67.38%;
  width:25.73%;
  aspect-ratio:1;
  pointer-events:none;
  overflow:visible;
}

.dial-rotor__image {
  will-change: transform;
}

.rotary-dial:not(.is-dragging) + .dial-channels { transition:transform 920ms cubic-bezier(.15,.7,.18,1); }

.dial-channels {
  position: absolute;
  z-index: 25;
  inset: 24%;
  pointer-events: none;
  border-radius:50%;
  overflow:hidden;
  background:transparent;
}

.dial-channel {
  position: absolute;
  inset:0;
  pointer-events: auto;
  cursor: pointer;
  padding:0;
  color:transparent;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: clamp(8px,.72vw,13px);
  letter-spacing: .08em;
  text-shadow:none;
}

.dial-channel:hover,
.dial-channel:focus-visible { outline:0; }
.dial-channel--telegram { clip-path:polygon(50% 50%,0 0,100% 0); }
.dial-channel--vk { clip-path:polygon(50% 50%,0 0,0 100%,50% 100%); }
.dial-channel--youtube { clip-path:polygon(50% 50%,100% 0,100% 100%,50% 100%); }

.pulse-counter {
  position: absolute;
  z-index: 24;
  top: 68.15%;
  left: 67.25%;
  width: 5.9%;
  height: 5.85%;
  display: grid;
  place-items: center;
  color: #b6ad98;
  background: rgba(3,4,3,.9);
  font-size: clamp(9px,1.15vw,20px);
  letter-spacing: .16em;
  text-shadow: 0 1px #000;
}

.call-lamps { display:none; position:absolute; z-index:25; inset:0; pointer-events:none; }
.call-lamp {
  position:absolute;
  top:69.9%;
  width:.88%;
  aspect-ratio:1;
  border-radius:50%;
  background:#080a08;
  box-shadow:inset 0 2px 3px #000;
  transition:background 120ms ease,box-shadow 120ms ease;
}
.call-lamp--dial { left:78.2%; }
.call-lamp--link { left:85.55%; }
.call-lamp--open { left:92.55%; }
.call-lamp--dial.is-on { background:#ee3f2d; box-shadow:inset 0 1px #ffd2c8,0 0 7px #e32c1c; }
.call-lamp--link.is-on { background:#e6aa45; box-shadow:inset 0 1px #fff1bc,0 0 7px #d78c26; }
.call-lamp--open.is-on { background:#70e768; box-shadow:inset 0 1px #e2ffd9,0 0 8px #4ce547; }

.signal-meter {
  position:absolute;
  z-index:26;
  left:79.25%;
  top:82.25%;
  width:15.25%;
  height:11.4%;
  overflow:hidden;
  pointer-events:none;
}
.signal-meter i {
  position:absolute;
  left:50%;
  bottom:-31%;
  width:2px;
  height:126%;
  background:#160b06;
  box-shadow:0 0 1px rgba(0,0,0,.8);
  transform:rotate(var(--needle-angle,-30deg));
  transform-origin:50% 100%;
  transition:transform 250ms ease-out;
}

.contact-controls { position:absolute; z-index:30; inset:0; pointer-events:none; }
.console-button {
  position:absolute;
  pointer-events:auto;
  cursor:pointer;
  padding:0;
  color:transparent;
  border:0;
  outline:0;
  border-radius:3px;
  background:transparent;
}

.console-button::before,
.console-button__cap {
  position:absolute;
  inset:0;
  border-radius:3px;
  pointer-events:none;
}

.console-button::before {
  content:"";
  z-index:1;
  background:#040504;
  box-shadow:inset 0 9px 12px rgba(0,0,0,.94),inset 0 -1px rgba(214,201,169,.05);
}

.console-button__cap {
  z-index:2;
  background-image:url('../assets/ui/contacts-rotary-approved.png');
  background-repeat:no-repeat;
  transform:scale(1);
  transform-origin:center;
  transition:transform 180ms cubic-bezier(.2,.78,.25,1),filter 150ms ease,box-shadow 180ms ease;
}

.console-button:hover .console-button__cap,
.console-button:focus-visible .console-button__cap { filter:brightness(1.04); }
.console-button:focus-visible::before { box-shadow:inset 0 9px 12px #000,inset 0 0 0 1px rgba(210,198,166,.28); }
.console-button:active .console-button__cap,
.console-button.is-pressed .console-button__cap {
  transform:scale(.955);
  filter:brightness(.68) contrast(.95);
  box-shadow:0 0 0 1px rgba(0,0,0,.78);
}

.console-button--reset { left:3.45%; top:82.35%; width:14.9%; height:11.1%; }
.console-button--hold { left:20.35%; top:82.35%; width:14.5%; height:11.1%; }
.console-button--redial { left:37.65%; top:82.35%; width:13.25%; height:11.1%; }
.console-button--connect { left:53.4%; top:82.35%; width:23.1%; height:11.1%; }

.console-button--reset .console-button__cap { background-size:671.14% 900.9%; background-position:4.06% 92.63%; }
.console-button--hold .console-button__cap { background-size:689.66% 900.9%; background-position:23.79% 92.63%; }
.console-button--redial .console-button__cap { background-size:754.72% 900.9%; background-position:43.4% 92.63%; }
.console-button--connect .console-button__cap { background-size:432.9% 900.9%; background-position:69.71% 92.63%; }

.contacts-console.is-holding .contact-crt__status { animation:hold-blink 1s steps(1) infinite; }

@keyframes crt-roll { from { transform:translateY(-80%); } to { transform:translateY(80%); } }
@keyframes wave-pulse { from { transform:scaleY(.18); } to { transform:scaleY(var(--wave-scale,1)); } }
@keyframes hold-blink { 50% { opacity:.32; } }

@media (max-width: 700px) and (orientation: portrait) {
  html,
  body {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  .contacts-page { min-height: 100svh; }

  .contacts-console {
    width: 100vw;
    height: 100svh;
    aspect-ratio: auto;
    box-shadow: none;
  }

  .contacts-console__art--desktop,
  .dial-source--desktop { display: none; }

  .contacts-console__art--mobile,
  .dial-source--mobile { display: block; }

  .console-home {
    top: 4.25%;
    left: 17.65%;
    width: 31.75%;
    height: 3.85%;
    color: transparent;
  }

  .console-home i { opacity: 0; }

  .console-nav {
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
  }

  .console-nav__item {
    position: absolute;
    width: 31.75%;
    height: 3.85%;
    overflow: visible;
    background: transparent;
    filter: none;
    transform: none;
    box-shadow: none;
    pointer-events: auto;
  }

  .console-nav__item:nth-child(1) { top: 4.25%; left: 50.7%; }
  .console-nav__item:nth-child(2) { top: 8.55%; left: 17.65%; }
  .console-nav__item:nth-child(3) { top: 8.55%; left: 50.7%; }
  .console-nav__item:nth-child(4) { top: 12.75%; left: 17.65%; width: 64.8%; }

  .console-nav__item::after { content: none; }
  .console-nav__item::before {
    left: 8.5%;
    width: 4.3%;
    opacity: 0;
  }

  .console-nav__item:hover::before,
  .console-nav__item:focus-visible::before,
  .console-nav__item.is-active::before { opacity: .95; }

  .console-nav__item:active {
    transform: scale(.988);
    background: rgba(0,0,0,.2);
    filter: brightness(.8);
  }

  .contact-crt {
    top: 16.45%;
    left: 11.55%;
    width: 76.95%;
    height: 27.95%;
    border-radius: 10% / 12%;
  }

  .contact-crt__content { inset: 8% 7% 5%; }
  .contact-crt__eyebrow { font-size: clamp(7px,2.45vw,13px); }
  .contact-crt__status {
    margin: 7% 0 1.5%;
    font-size: clamp(24px,7.3vw,40px);
    letter-spacing: .08em;
  }
  .contact-crt__rule { width: 68%; }
  .contact-crt__stages {
    gap: .26em;
    margin-top: 4%;
    font-size: clamp(7px,2.15vw,11px);
  }
  .contact-crt__channel {
    width: 54%;
    min-height: 8%;
    margin-top: 2.4%;
    font-size: clamp(8px,2.6vw,14px);
  }
  .contact-crt__result {
    top: 43%;
    width: 84%;
    min-height: 34%;
  }
  .contact-crt__result small { font-size: clamp(6px,1.85vw,10px); }
  .contact-crt__result strong { font-size: clamp(13px,4.3vw,23px); }
  .contact-crt__result p { font-size: clamp(6px,1.9vw,10px); }
  .contact-crt__result span { font-size: clamp(6px,1.6vw,9px); }
  .contact-crt__hint { bottom: 0; font-size: clamp(5px,1.55vw,8px); }
  .contact-wave { bottom: 4%; height: 10%; }

  .dial-deck,
  .dial-rotor {
    top: 45.7%;
    left: 15.15%;
    width: 69.7%;
    height: 39.25%;
    aspect-ratio: auto;
  }

  .rotary-dial {
    height: 100%;
    aspect-ratio: auto;
  }

  .dial-channels { inset: 26%; }
  .rotary-dial:focus-visible { box-shadow: none; }

  .pulse-counter,
  .call-lamps { display: none; }

  .signal-meter {
    left: 66.2%;
    top: 88.5%;
    width: 21.1%;
    height: 7.25%;
  }

  .signal-meter i {
    left: 51%;
    bottom: -42%;
    height: 136%;
  }

  .console-button::before {
    background: transparent;
    box-shadow: none;
  }

  .console-button__cap {
    background: transparent;
    box-shadow: none;
  }

  .console-button:active .console-button__cap,
  .console-button.is-pressed .console-button__cap {
    background: rgba(0,0,0,.2);
    box-shadow: inset 0 5px 9px rgba(0,0,0,.76);
    filter: brightness(.72);
  }

  .console-button--reset { left: 12.3%; top: 88.65%; width: 8.9%; height: 7.35%; }
  .console-button--hold { left: 22.1%; top: 88.65%; width: 8.9%; height: 7.35%; }
  .console-button--redial { left: 31.9%; top: 88.65%; width: 8.9%; height: 7.35%; }
  .console-button--connect { left: 42.5%; top: 88.35%; width: 22.6%; height: 8%; }
}

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after {
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    scroll-behavior:auto !important;
  }
}
