/* katentropy — coming soon */

@font-face {
  font-family: "Unbounded";
  src: url("fonts/unbounded-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("fonts/martian-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #07080a;
  --ink: #ece8e1;
  --ink-2: rgb(236 232 225 / 0.74);
  --ink-3: rgb(236 232 225 / 0.46);
  --line: rgb(236 232 225 / 0.16);
  --accent: #ff5b1f;
  --cold: #bcd2f5;
  --pad: clamp(20px, 4vw, 60px);
  --meter: 19rem;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --display: "Unbounded", "Avenir Next", "Helvetica Neue", sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

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

html,
body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  cursor: crosshair;
}

::selection {
  background: var(--accent);
  color: #000;
}

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

/* ---------- фон: поле частиц, затемнение, зерно, уголки ---------- */

#field {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* фронт упорядочивания: кольцо вне холста, чтобы не оставляло следа в шлейфах */
.scan {
  position: fixed;
  top: 0;
  left: 0;
  border: 1px solid rgb(255 91 31 / 0.6);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(130% 100% at 62% 38%, transparent 45%, rgb(3 4 5 / 0.6) 100%),
    linear-gradient(to top, rgb(7 8 10 / 0.92) 0%, rgb(7 8 10 / 0.55) 26%, transparent 52%);
}

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

.frame i {
  position: fixed;
  width: 14px;
  height: 14px;
  border: 0 solid var(--line);
  pointer-events: none;
}
.frame i:nth-child(1) {
  top: calc(var(--pad) * 0.45);
  left: calc(var(--pad) * 0.45);
  border-width: 1px 0 0 1px;
}
.frame i:nth-child(2) {
  top: calc(var(--pad) * 0.45);
  right: calc(var(--pad) * 0.45);
  border-width: 1px 1px 0 0;
}
.frame i:nth-child(3) {
  bottom: calc(var(--pad) * 0.45);
  left: calc(var(--pad) * 0.45);
  border-width: 0 0 1px 1px;
}
.frame i:nth-child(4) {
  right: calc(var(--pad) * 0.45);
  bottom: calc(var(--pad) * 0.45);
  border-width: 0 1px 1px 0;
}

/* ---------- приборная строка ---------- */

.hud {
  position: fixed;
  top: var(--pad);
  right: var(--pad);
  left: var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  font: 400 11px/1.8 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  pointer-events: none;
}
.hud p {
  margin: 0;
}
.hud__row {
  display: flex;
  justify-content: space-between;
  gap: 1.4em;
}
.hud__row b {
  font-weight: 400;
  color: var(--ink);
}
.hud__block--left .hud__row {
  justify-content: flex-start;
}
.hud__block--right {
  width: var(--meter);
}
.hud__state {
  justify-content: flex-end;
  color: var(--ink-2);
  white-space: nowrap;
}
.meter {
  height: 2px;
  margin: 0.5em 0 0.55em;
  overflow: hidden;
  background: var(--line);
}
.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cold), var(--ink) 55%, var(--accent)) 0 0 / var(--meter) 100% no-repeat;
  transition: width 0.3s linear;
}

/* ---------- логотип и надпись ---------- */

.hero {
  position: fixed;
  bottom: calc(var(--pad) + 2.75rem);
  left: var(--pad);
  max-width: calc(100vw - 2 * var(--pad));
}

.lockup {
  display: flex;
  align-items: center;
  gap: 0.3em;
  font-size: clamp(2.4rem, 8vw, 6.4rem);
}

.mark {
  flex: none;
  width: 0.74em;
  height: 0.74em;
  margin: 0;
  font-size: inherit; /* кнопка сама не наследует размер шрифта */
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.mark__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.mark circle {
  fill: currentColor;
  transform: translate(var(--dx, 0), var(--dy, 0));
  transition: transform 0.9s var(--ease);
}
.mark .hot {
  fill: var(--accent);
}
.mark:hover circle,
.mark:focus-visible circle {
  transform: none;
}
.mark:focus-visible {
  outline: 1px dashed var(--accent);
  outline-offset: 0.12em;
}

/* Смещения точек знака — генерирует scripts/build-assets.mjs */
/* mark:start */
.mark .d0 { --dx: 2.17px; --dy: -3.57px; }
.mark .d1 { --dx: 4.31px; --dy: -3.56px; }
.mark .d2 { --dx: -6.75px; --dy: 0.36px; }
.mark .d3 { --dx: 5.78px; --dy: -1.22px; }
.mark .d4 { --dx: -1.97px; --dy: 6.68px; }
.mark .d5 { --dx: -4.27px; --dy: 0.62px; }
.mark .d6 { --dx: 2.92px; --dy: -2px; }
.mark .d7 { --dx: -1.37px; --dy: -3.27px; }
.mark .d8 { --dx: -3.51px; --dy: 2.3px; }
.mark .d9 { --dx: 3.15px; --dy: 0.49px; }
.mark .d10 { --dx: -1.84px; --dy: -1.64px; }
.mark .d11 { --dx: 0.76px; --dy: -1.66px; }
.mark .d12 { --dx: -0.13px; --dy: 2.35px; }
.mark .d13 { --dx: -1.98px; --dy: 0.25px; }
.mark .d14 { --dx: -0.47px; --dy: -1.95px; }
.mark .d15 { --dx: -0.37px; --dy: 0.59px; }
.mark .d16 { --dx: -0.66px; --dy: 0.03px; }
.mark .d17 { --dx: -0.92px; --dy: -0.07px; }
.mark .d18 { --dx: 0.5px; --dy: 0.32px; }
.mark .d19 { --dx: -0.08px; --dy: 0.81px; }
.mark .d20 { --dx: 0px; --dy: 0px; }
.mark .d21 { --dx: 0px; --dy: 0px; }
.mark .d22 { --dx: 0px; --dy: 0px; }
.mark .d23 { --dx: 0px; --dy: 0px; }
.mark .d24 { --dx: 0px; --dy: 0px; }
/* mark:end */

.wordmark {
  margin: 0;
  font: 500 1em/1 var(--display);
  letter-spacing: -0.035em;
  white-space: nowrap;
}
.ch {
  display: inline-block;
}
.ch--e {
  color: var(--accent);
}

.tagline {
  margin: 0.55em 0 0;
  font-size: clamp(1.3rem, 2.3vw, 2.2rem);
  line-height: 1.15;
  color: var(--ink-2);
}
.order {
  position: relative;
  color: var(--ink);
}
.order::after {
  position: absolute;
  right: 0;
  bottom: 0.02em;
  left: 0;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  content: "";
}
.chaos {
  font-style: italic;
  color: var(--ink);
  white-space: nowrap;
}
.chaos span {
  display: inline-block;
}

.soon {
  position: fixed;
  right: var(--pad);
  bottom: var(--pad);
  display: flex;
  align-items: center;
  gap: 0.9em;
  margin: 0;
  font: 400 13px/1 var(--mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.soon__led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 2px var(--accent);
}
.soon__dots {
  letter-spacing: 0.08em;
}
.soon__dots i {
  font-style: normal;
}

/* ---------- движение: только если оно не отключено в системе ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* буквы собираются из хаоса в слово */
  .ch {
    animation: settle 1.6s var(--ease) both;
    animation-delay: var(--d, 0s);
  }
  .ch:nth-child(1) { --x: -0.38em; --y: 0.62em; --r: -28deg; --d: 0.2s; }
  .ch:nth-child(2) { --x: 0.22em; --y: -0.7em; --r: 34deg; --d: 0.48s; }
  .ch:nth-child(3) { --x: -0.15em; --y: 0.48em; --r: 18deg; --d: 0.34s; }
  .ch:nth-child(4) { --x: 0.55em; --y: -0.85em; --r: -46deg; --d: 0.8s; }
  .ch:nth-child(5) { --x: -0.3em; --y: -0.36em; --r: -16deg; --d: 0.42s; }
  .ch:nth-child(6) { --x: 0.18em; --y: 0.74em; --r: 40deg; --d: 0.26s; }
  .ch:nth-child(7) { --x: -0.46em; --y: -0.52em; --r: -22deg; --d: 0.58s; }
  .ch:nth-child(8) { --x: 0.34em; --y: 0.4em; --r: 26deg; --d: 0.38s; }
  .ch:nth-child(9) { --x: -0.22em; --y: -0.66em; --r: -38deg; --d: 0.64s; }
  .ch:nth-child(10) { --x: 0.48em; --y: 0.58em; --r: 30deg; --d: 0.5s; }
  .ch--e {
    animation: settle 1.6s var(--ease) both, ember 2.4s ease-out both;
    animation-delay: var(--d), calc(var(--d) + 1s);
  }

  .mark {
    animation: rise 1.1s var(--ease) 0.05s both;
  }
  .tagline {
    animation: rise 1.2s var(--ease) 1.3s both;
  }
  .order::after {
    transform: scaleX(0);
    animation: draw 1s var(--ease) 2.3s forwards;
  }
  .chaos span {
    animation: jitter 2.6s steps(1, end) infinite;
  }
  .chaos span:nth-child(2) { animation-duration: 2.1s; animation-delay: -0.6s; }
  .chaos span:nth-child(3) { animation-duration: 3.1s; animation-delay: -1.4s; }
  .chaos span:nth-child(4) { animation-duration: 2.4s; animation-delay: -0.9s; }
  .chaos span:nth-child(5) { animation-duration: 1.9s; animation-delay: -1.7s; }

  .frame {
    animation: fade 1.6s ease 0.4s both;
  }
  .hud {
    animation: fade 1.2s ease 1.7s both;
  }
  .soon {
    animation: fade 1.2s ease 2s both;
  }
  .soon__led {
    animation: pulse 2.4s ease-in-out infinite;
  }
  .soon__dots i {
    animation: blink 1.6s steps(1, end) infinite;
  }
  .soon__dots i:nth-child(2) { animation-delay: 0.2s; }
  .soon__dots i:nth-child(3) { animation-delay: 0.4s; }
}

@keyframes settle {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg));
  }
  55% {
    opacity: 1;
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}
@keyframes ember {
  from { text-shadow: 0 0 0.35em rgb(255 91 31 / 0.9); }
  to { text-shadow: 0 0 0 rgb(255 91 31 / 0); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes draw {
  to { transform: scaleX(1); }
}
@keyframes jitter {
  0% { transform: none; }
  25% { transform: translate(0.03em, -0.05em) rotate(4deg); }
  50% { transform: translate(-0.03em, 0.03em) rotate(-5deg); }
  75% { transform: translate(0.02em, 0.04em) rotate(3deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes blink {
  0% { opacity: 0.15; }
  40% { opacity: 1; }
}

/* ---------- узкие экраны ---------- */

@media (max-width: 720px) {
  .hud__block--left {
    display: none;
  }
  .hud__block--right {
    --meter: calc(100vw - 2 * var(--pad));
    width: 100%;
  }
  .hud__state {
    justify-content: flex-start;
  }
  .hero {
    bottom: calc(var(--pad) + 2.6rem);
  }
  .soon {
    right: auto;
    left: var(--pad);
    font-size: 12px;
    letter-spacing: 0.24em;
  }
}
