/* =========================================================
   kef.kefich.ru — тёмный хакерский / киберпанк стиль
   Цвета меняются здесь, в :root, и расходятся по всему сайту.
   ========================================================= */

:root {
  --bg: #05060a;
  --bg-2: #0a0c13;
  --panel: rgba(12, 15, 24, 0.78);
  --line: rgba(0, 255, 156, 0.18);

  --green: #00ff9c;
  --cyan: #00e5ff;
  --pink: #ff2bd6;
  --yellow: #f5ff3b;

  --text: #d7e3f4;
  --muted: #7a879c;

  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --display: "Unbounded", "JetBrains Mono", sans-serif;

  --radius: 4px;
  --maxw: 1120px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 43, 214, 0.10), transparent 55%),
    radial-gradient(ellipse at 90% 30%, rgba(0, 229, 255, 0.08), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}

::selection { background: var(--pink); color: var(--bg); }

a { color: var(--green); text-decoration: none; }

/* ---------- фон ---------- */

#rain {
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: 0.22;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

/* ---------- навигация ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(16px, calc((100vw - var(--maxw)) / 2));
  background: rgba(5, 6, 10, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: 0.5px;
}
.logo .at { color: var(--pink); }

.nav-links { display: flex; gap: 22px; }
.nav-links a {
  color: var(--muted);
  font-size: 14px;
  transition: color 0.2s, text-shadow 0.2s;
}
.nav-links a::before { content: "./"; color: var(--line); }
.nav-links a:hover,
.nav-links a.active {
  color: var(--green);
  text-shadow: 0 0 10px rgba(0, 255, 156, 0.6);
}

.blink { animation: blink 1s steps(1) infinite; color: var(--green); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- общие блоки ---------- */

main { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

.section { padding: 96px 0 24px; }

.section-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(26px, 4vw, 40px);
  margin: 0 0 36px;
  text-transform: lowercase;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.section-title .num {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--pink);
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  align-self: center;
  background: linear-gradient(90deg, var(--line), transparent);
}
.section-sub { color: var(--muted); margin: -20px 0 28px; }

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(4px);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
/* неоновые «уголки» у карточек */
.card::before,
.card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--green);
  pointer-events: none;
}
.card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.card:hover {
  border-color: rgba(0, 255, 156, 0.45);
  box-shadow: 0 0 28px rgba(0, 255, 156, 0.12);
  transform: translateY(-2px);
}

.hl { color: var(--green); }
.hl-pink { color: var(--pink); }
.muted { color: var(--muted); }

/* ---------- кнопки ---------- */

.btn {
  display: inline-block;
  padding: 12px 22px;
  border: 1px solid var(--green);
  color: var(--green);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.btn:hover { background: rgba(0, 255, 156, 0.12); }
.btn-primary { background: var(--green); color: var(--bg); }
.btn-primary:hover { background: var(--cyan); border-color: var(--cyan); color: var(--bg); }
.btn-big { padding: 16px 30px; font-size: 15px; }

/* ---------- первый экран ---------- */

.hero {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 48px;
  padding: 48px 0;
}

.kicker { color: var(--pink); margin: 0 0 12px; font-size: 14px; }

h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(40px, 6.4vw, 76px);
  line-height: 1.02;
  margin: 0 0 20px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 24px rgba(0, 255, 156, 0.35);
}

.role {
  font-size: clamp(17px, 2vw, 21px);
  color: var(--green);
  margin: 0 0 18px;
  min-height: 1.65em;
}
.lead { color: var(--muted); font-size: 17px; max-width: 520px; margin: 0 0 32px; }
.cta { display: flex; flex-wrap: wrap; gap: 14px; }

/* глитч-эффект заголовка */
.glitch { position: relative; }
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.glitch::before {
  color: var(--pink);
  transform: translate(-3px, 0);
  mix-blend-mode: screen;
  animation: glitch-a 3.2s infinite steps(1);
}
.glitch::after {
  color: var(--cyan);
  transform: translate(3px, 0);
  mix-blend-mode: screen;
  animation: glitch-b 2.7s infinite steps(1);
}
@keyframes glitch-a {
  0%, 88%, 100% { clip-path: inset(100% 0 0 0); }
  89% { clip-path: inset(10% 0 70% 0); transform: translate(-6px, -2px); }
  92% { clip-path: inset(55% 0 20% 0); transform: translate(5px, 1px); }
  95% { clip-path: inset(30% 0 50% 0); transform: translate(-3px, 2px); }
}
@keyframes glitch-b {
  0%, 84%, 100% { clip-path: inset(100% 0 0 0); }
  85% { clip-path: inset(65% 0 10% 0); transform: translate(6px, 1px); }
  90% { clip-path: inset(15% 0 60% 0); transform: translate(-5px, -1px); }
  94% { clip-path: inset(40% 0 35% 0); transform: translate(4px, 0); }
}

/* ---------- терминал ---------- */

.terminal {
  background: rgba(7, 9, 15, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(255, 43, 214, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 50px rgba(0, 255, 156, 0.08);
  overflow: hidden;
  cursor: text;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }
.term-title { margin-left: 8px; color: var(--muted); font-size: 13px; }

.term-body {
  height: 380px;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.55;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
#term-out div { white-space: pre-wrap; word-break: break-word; }
.term-line { display: flex; gap: 10px; align-items: center; }
.prompt { color: var(--green); white-space: nowrap; }
#term-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  caret-color: var(--green);
}
.t-cmd { color: var(--text); }
.t-cmd .prompt { margin-right: 10px; }
.t-dim { color: var(--muted); }
.t-ok { color: var(--green); }
.t-pink { color: var(--pink); }
.t-cyan { color: var(--cyan); }
.t-warn { color: var(--yellow); }

/* ---------- обо мне ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: start;
}
.about-text p { margin: 0 0 18px; font-size: 16.5px; }

.code {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  overflow-x: auto;
  white-space: pre;
}
.c-com { color: var(--muted); }
.c-key { color: var(--cyan); }
.c-str { color: var(--green); }
.c-num { color: var(--yellow); }

/* ---------- навыки ---------- */

.stack-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.stack-card h3 {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 18px;
}
.stack-card .icon { color: var(--green); font-family: var(--mono); margin-right: 6px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: rgba(0, 255, 156, 0.05);
  color: var(--text);
}
.accent-pink::before,
.accent-pink::after { border-color: var(--pink); }
.accent-pink .icon { color: var(--pink); }
.accent-pink .chips li { border-color: rgba(255, 43, 214, 0.3); background: rgba(255, 43, 214, 0.06); }
.accent-cyan::before,
.accent-cyan::after { border-color: var(--cyan); }
.accent-cyan .icon { color: var(--cyan); }
.accent-cyan .chips li { border-color: rgba(0, 229, 255, 0.3); background: rgba(0, 229, 255, 0.06); }

/* ---------- путь ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 28px;
  border-left: 1px solid var(--line);
}
.timeline li { position: relative; padding: 0 0 36px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -34px;
  top: 6px;
  width: 11px;
  height: 11px;
  background: var(--bg);
  border: 2px solid var(--green);
  box-shadow: 0 0 12px var(--green);
  transform: rotate(45deg);
}
.timeline li:nth-child(2)::before { border-color: var(--pink); box-shadow: 0 0 12px var(--pink); }
.timeline li:nth-child(3)::before { border-color: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.when { font-size: 13px; color: var(--pink); text-transform: uppercase; letter-spacing: 1px; }
.timeline h3 { font-family: var(--display); font-size: 19px; font-weight: 700; margin: 4px 0 6px; }
.timeline p { margin: 0; color: var(--muted); max-width: 640px; }

/* ---------- проекты ---------- */

/* главный проект слева во всю высоту, два других справа друг под другом */
.projects-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
}
.project-main { grid-row: span 2; }
.project { overflow: hidden; }
.project-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.project-id { font-size: 12px; color: var(--cyan); text-transform: uppercase; letter-spacing: 1px; }
.project h3 { font-family: var(--display); font-size: 21px; margin: 14px 0 12px; }
.project-main h3 { font-size: clamp(22px, 2.6vw, 28px); }
.project p { color: var(--muted); margin: 0 0 12px; font-size: 14.5px; }
.problem-label { display: block; color: var(--pink); font-size: 12px; margin-bottom: 2px; }
.problem-label.ok { color: var(--green); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 2px 10px;
  border: 1px solid currentColor;
  text-transform: lowercase;
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status-live { color: var(--green); }
.status-live::before { animation: pulse 1.6s ease-in-out infinite; box-shadow: 0 0 8px var(--green); }
.status-wip { color: var(--yellow); }
.status-future { color: var(--pink); }
@keyframes pulse { 50% { opacity: 0.25; } }

.features {
  list-style: none;
  padding: 0;
  margin: 18px 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  font-size: 14px;
}
.features li::before { content: "[+] "; color: var(--green); }
.roles-label { font-size: 12px !important; margin-bottom: 8px !important; }

/* анимированный мост: сообщения бегут в обе стороны */
.bridge { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.node {
  padding: 6px 12px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-weight: 700;
  font-size: 13px;
}
.node-max { border-color: var(--pink); color: var(--pink); }
.wire {
  position: relative;
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.35), rgba(255, 43, 214, 0.35));
}
.wire::before,
.wire::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.wire::before { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: to-right 2.4s linear infinite; }
.wire::after { background: var(--pink); box-shadow: 0 0 10px var(--pink); animation: to-left 2.4s linear infinite 1.2s; }
@keyframes to-right { from { left: 0; } to { left: calc(100% - 8px); } }
@keyframes to-left { from { left: calc(100% - 8px); } to { left: 0; } }

.project-secret { min-height: 190px; }
.redacted { color: var(--text); letter-spacing: -1px; opacity: 0.85; margin-right: 0.35em; }
.stamp {
  position: absolute;
  right: -8px;
  bottom: 22px;
  padding: 4px 14px;
  border: 2px solid var(--pink);
  color: var(--pink);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 3px;
  transform: rotate(-12deg);
  opacity: 0.75;
}

/* ---------- контакты ---------- */

.contact { text-align: left; padding: 36px; }
.contact-cmd { margin: 0; }
.contact-cmd .prompt { margin-right: 10px; }
.contact-reply { margin: 4px 0 20px; color: var(--green); }
.contact-text { color: var(--muted); max-width: 560px; margin: 0 0 28px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 14px; }
.contact-links .btn { text-transform: none; letter-spacing: 0.3px; }

/* ---------- подвал ---------- */

.footer {
  max-width: var(--maxw);
  margin: 80px auto 0;
  padding: 28px 16px 40px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.footer p { margin: 0; }

/* ---------- появление при прокрутке ---------- */

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- телефоны и планшеты ---------- */

@media (max-width: 1100px) {
  .stack-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .projects-grid { grid-template-columns: 1fr; }
  .project-main { grid-row: auto; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 40px; gap: 36px; }
  .about-grid { grid-template-columns: 1fr; }
  .term-body { height: 320px; }
}

@media (max-width: 640px) {
  .nav { flex-direction: column; gap: 6px; padding-top: 10px; padding-bottom: 10px; }
  .nav-links { gap: 14px; flex-wrap: wrap; justify-content: center; }
  .nav-links a::before { content: ""; }
  .stack-grid { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .contact-links .btn { width: 100%; text-align: center; }
  .section { padding-top: 72px; }
  .card { padding: 20px; }
  .contact { padding: 24px; }
  .term-body { font-size: 13px; }
  .code { font-size: 12.5px; }
}

/* для тех, у кого в системе отключены анимации */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
