/* CosmoMatch · промо 05 — CRT-терминал: люминофор, скан-линии, ASCII-небо */

:root {
  --ground: #060A08;
  --ink: #8AF0A8;
  --accent: #FFD166;
  --secondary: #4ECDC4;
  --glow: #173322;
}

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

html { overflow-x: hidden; }

body {
  background: var(--ground);
  color: var(--ink);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: none;
}

/* ---------- слой CRT ---------- */

.crt {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(120% 90% at 50% 8%, rgba(23, 51, 34, 0.55), rgba(6, 10, 8, 0) 60%),
    var(--ground);
}

.crt::after { /* лёгкое свечение всего экрана */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 140px rgba(138, 240, 168, 0.08);
}

.crt__scan {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.26) 0px,
    rgba(0, 0, 0, 0.26) 1px,
    rgba(0, 0, 0, 0) 1px,
    rgba(0, 0, 0, 0) 3px
  );
  animation: scan-flicker 4.2s steps(8, end) infinite;
}

@keyframes scan-flicker {
  0%, 91% { opacity: 0.85; }
  93% { opacity: 0.65; }
  95% { opacity: 0.92; }
  97% { opacity: 0.7; }
  100% { opacity: 0.85; }
}

.crt__vignette {
  position: fixed;
  inset: 0;
  z-index: 31;
  pointer-events: none;
  background: radial-gradient(115% 105% at 50% 45%, rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, 0.55) 100%);
  border-radius: 24px;
}

/* ---------- ASCII-звёзды ---------- */

.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.starfield span {
  position: absolute;
  color: var(--ink);
  opacity: 0.22;
  font-size: 12px;
  animation: twinkle 3.6s ease-in-out infinite;
}

.starfield span:nth-child(3n) { color: var(--secondary); }
.starfield span:nth-child(5n) { color: var(--accent); opacity: 0.16; }

@keyframes twinkle {
  0%, 100% { opacity: 0.08; }
  45% { opacity: 0.34; }
  60% { opacity: 0.14; }
}

/* ---------- каркас окна ---------- */

.frame {
  position: relative;
  z-index: 10;
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(14px, 3vw, 30px) clamp(14px, 4vw, 36px) 44px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--ink);
  padding: 10px 14px;
  background: rgba(23, 51, 34, 0.28);
}

.logo { display: flex; align-items: center; gap: 12px; min-width: 0; }

.logo__mark { width: 40px; height: 40px; color: var(--ink); flex: none; }

.logo__asterisk { stroke: var(--accent); }

.wordmark {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 5px;
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.top__num {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--secondary);
  white-space: nowrap;
}

/* мигающий курсор */
.cursor {
  display: inline-block;
  width: 0.58em;
  height: 1.08em;
  background: var(--ink);
  margin-left: 3px;
  animation: cursor-blink 1.05s steps(2, start) infinite;
}

@keyframes cursor-blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

/* ---------- терминал ---------- */

.term {
  border: 1px solid var(--ink);
  border-top: none;
  background: rgba(7, 13, 9, 0.86);
  padding: 0 clamp(12px, 3vw, 28px) clamp(18px, 4vw, 34px);
}

.win {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--ink);
  padding: 8px 0;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.win__dots { display: inline-flex; gap: 6px; }

.win__dots i {
  width: 9px;
  height: 9px;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.win__title { color: var(--secondary); }
.win__size { color: rgba(138, 240, 168, 0.6); white-space: nowrap; }

.screen { padding-top: clamp(14px, 3vh, 26px); }

.line { overflow-wrap: anywhere; }

.prompt { color: var(--accent); white-space: nowrap; }

.line--cmd { font-size: 15px; }

.headline {
  margin-top: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: clamp(1.15rem, 3.6vw, 2rem);
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-shadow: 0 0 10px rgba(138, 240, 168, 0.35);
}

.line--sub {
  margin-top: 16px;
  max-width: 62ch;
  color: rgba(234, 240, 235, 0.88);
}

.out { margin-top: 22px; }

/* до готовности печати строки скрыты только с JS (см. app.js), без JS — видны */
.term.typing .out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.term.typing .out.in { opacity: 1; transform: none; }

.line--ls { color: var(--secondary); font-size: 13px; }

/* ---------- таблица ./ ---------- */

.table { margin-top: 10px; border-top: 1px solid var(--glow); }

.trow {
  display: grid;
  grid-template-columns: minmax(0, 11ch) minmax(0, 16ch) minmax(0, 1fr);
  gap: 12px;
  padding: 8px 2px;
  border-bottom: 1px solid rgba(23, 51, 34, 0.9);
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.trow:hover { background: rgba(23, 51, 34, 0.55); }

.trow__perm { color: rgba(138, 240, 168, 0.55); }
.trow__name { color: var(--secondary); font-weight: 700; }
.trow__desc { color: var(--ink); overflow-wrap: anywhere; }

/* ---------- ASCII-карта ---------- */

.ascii-wheel {
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(9px, 2.6vw, 13px);
  line-height: 1.45;
  color: rgba(138, 240, 168, 0.9);
  overflow-x: auto;
  white-space: pre;
}

.num { animation: num-blink 2.8s steps(1, end) infinite; color: var(--accent); }

.ascii-wheel .num:nth-of-type(2n) { animation-delay: 0.4s; }
.ascii-wheel .num:nth-of-type(3n) { animation-delay: 0.9s; }
.ascii-wheel .num:nth-of-type(4n) { animation-delay: 1.5s; }

@keyframes num-blink {
  0%, 100% { opacity: 1; }
  48% { opacity: 1; }
  50% { opacity: 0.25; }
  54% { opacity: 1; }
  70% { opacity: 0.5; }
  74% { opacity: 1; }
}

/* ---------- цитата / note ---------- */

.quote { margin-top: 26px; }

.line--comment { color: rgba(78, 205, 196, 0.85); }

.note { margin-top: 14px; }

/* ---------- CTA-команда ---------- */

.cta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
  border: 1px solid var(--ink);
  padding: 12px 18px;
  background: rgba(23, 51, 34, 0.35);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.cta:hover, .cta:focus-visible {
  background: rgba(23, 51, 34, 0.75);
  box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(255, 209, 102, 0.25);
  text-shadow: 2px 0 rgba(255, 60, 90, 0.55), -2px 0 rgba(60, 220, 255, 0.55);
}

.cursor--cta { width: 0.5em; height: 1em; background: var(--accent); }

/* хроматический сдвиг на hover для строк */
.table .trow:hover .trow__name,
.wordmark:hover {
  text-shadow: 1.5px 0 rgba(255, 60, 90, 0.6), -1.5px 0 rgba(60, 220, 255, 0.6);
}

/* ---------- футер ---------- */

.foot {
  margin-top: 28px;
  border-top: 1px solid var(--ink);
  padding-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.foot__exit { color: rgba(138, 240, 168, 0.75); }

.promo-nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }

.promo-nav a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--secondary);
  padding-bottom: 1px;
  transition: color 0.2s ease;
}

.promo-nav a:hover { color: var(--accent); }

.logo__mark--mini { width: 26px; height: 26px; color: var(--ink); display: inline-block; }

.logo--mono { filter: grayscale(1) contrast(1.2); }

/* ---------- escape hatch ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .crt__scan { animation: none; opacity: 0.85; }
  .starfield span { opacity: 0.2; }
  .cursor { opacity: 1; }
  .term.typing .out { opacity: 1; transform: none; }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .trow { grid-template-columns: 1fr; gap: 2px; }
  .trow__perm { display: none; }
  .top { flex-wrap: wrap; }
}
