/* ── Reset & Tokens ─────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --c0: #d4e9f2;   /* светлый фон */
  --c1: #b8d4e3;   /* секции */
  --c2: #9dc0d4;   /* тёмные секции */
  --c3: #7aaec5;   /* самый тёмный */
  --ink: #1a2f3a;  /* основной текст — насыщенный тёмный */
  --muted: #3a5a6a;/* вторичный текст */
  --accent: #2d6a82;
  --white: #f0f7fb;
  --ease: cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--c1);
  color: var(--ink);
  font-weight: 300;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Side Nav — плавающие точки ─────────────────────────── */
.sidenav {
  position: fixed;
  right: 1.6rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(45, 106, 130, .35);
  border: 1.5px solid rgba(45, 106, 130, .5);
  transition: background .3s var(--ease), transform .3s var(--ease), border-color .3s var(--ease);
}

.dot:hover,
.dot.active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.4);
}

/* На тёмных секциях точки светлее */
.sidenav.on-dark .dot {
  background: rgba(255,255,255,.35);
  border-color: rgba(255,255,255,.6);
}
.sidenav.on-dark .dot:hover,
.sidenav.on-dark .dot.active {
  background: #fff;
  border-color: #fff;
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(160deg, #cce4ef 0%, #aecfdf 55%, #93bdd0 100%);
}

/* Изображение — обычный absolute, не fixed.
   Параллакс только через transform в JS */
.hero-bg {
  position: absolute;
  inset: -15% 0;
  background: url('rei.png') center/cover no-repeat;
  opacity: .55;
  will-change: transform;
}

.hero-body {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 1.5rem;
}

/* Надпись над именем */
.hero-label {
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
  /* opacity управляется reveal-анимацией, не задаём здесь */
}

.hero-body h1 {
  font-size: clamp(3.2rem, 9vw, 6rem);
  font-weight: 300;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: .04em;
  margin-bottom: 1.2rem;
}

.hero-body h1 .reveal {
  display: block;
}
.sub {
  font-size: 1.05rem;
  color: var(--muted);
  letter-spacing: .06em;
  line-height: 1.7;
  margin-bottom: 2.4rem;
}

.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn-solid, .btn-ghost {
  text-decoration: none;
  font-size: .85rem;
  letter-spacing: .1em;
  padding: .75rem 1.9rem;
  border-radius: 99px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}

.btn-solid {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(61,125,148,.3);
}
.btn-solid:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(61,125,148,.38);
}

.btn-ghost {
  background: rgba(240,247,251,.5);
  color: var(--accent);
  border: 1px solid rgba(61,125,148,.3);
}
.btn-ghost:hover {
  background: rgba(240,247,251,.8);
  transform: translateY(-2px);
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}
.scroll-line {
  width: 1px; height: 48px;
  background: linear-gradient(to bottom, transparent, var(--accent), transparent);
  animation: scrollDrop 2.2s ease-in-out infinite;
}
@keyframes scrollDrop {
  0%   { opacity: 0; transform: translateY(-12px); }
  50%  { opacity: .7; }
  100% { opacity: 0; transform: translateY(12px); }
}

/* ── Reveal ──────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: revealUp .6s var(--ease) forwards;
}

.hero-label.reveal        { animation-delay: .05s; }
h1 .reveal                { animation-delay: .15s; }
.sub.reveal               { animation-delay: .3s; }
.hero-btns.reveal         { animation-delay: .44s; }

@keyframes revealUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Sections ───────────────────────────────────────────── */
.section,
.section--light,
.section--dark {
  position: relative;
  padding: 8rem 0;
}

.section       { background: #e8f4f9; }
.section--light { background: linear-gradient(180deg, #f0f8fc 0%, #e2f0f8 100%); }
.section--dark  { background: linear-gradient(180deg, #8ab8cc 0%, #7aaec5 100%); }

/* ── Диагональные срезы ─────────────────────────────────── */
/* Правило: каждый срез рисуется на нижней границе секции
   цветом СЛЕДУЮЩЕЙ секции, чтобы не было наложений       */

/* Hero → About: скос вправо, цвет about (#f0f8fc) */
.hero::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 72px;
  background: linear-gradient(to bottom right, transparent 49.5%, #f0f8fc 50%);
  z-index: 3;
  pointer-events: none;
}

/* About → Projects: скос влево, цвет projects (#e8f4f9) */
.section--light::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 64px;
  background: linear-gradient(to bottom left, transparent 49.5%, #e8f4f9 50%);
  z-index: 3;
  pointer-events: none;
}

/* Projects → Contacts: скос вправо, цвет contacts (#8ab8cc) */
.section:not(.section--light):not(.section--dark)::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 64px;
  background: linear-gradient(to bottom right, transparent 49.5%, #8ab8cc 50%);
  z-index: 3;
  pointer-events: none;
}

/* Contacts → Footer: скос влево, цвет footer (#7aaec5) */
.section--dark::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 64px;
  background: linear-gradient(to bottom left, transparent 49.5%, var(--c3) 50%);
  z-index: 3;
  pointer-events: none;
}

/* Contacts — текст на синеватом фоне */
.section--dark .section-title,
.section--dark .contact-invite { color: #1a2f3a; }
.section--dark .t-line         { color: #1e3545; }
.section--dark .t-out          { color: #2a4a5a; }
.section--dark .social-link    { color: #1a2f3a; }

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 300;
  letter-spacing: .12em;
  color: var(--ink);
  margin-bottom: 3.5rem;
  text-align: center;
}
.section-title::after {
  content: '';
  display: block;
  width: 40px; height: 1px;
  background: var(--accent);
  margin: 1rem auto 0;
  opacity: .6;
}

/* ── About ──────────────────────────────────────────────── */
.section--light {
  background: linear-gradient(180deg, #cce3ef 0%, #bcd9e6 100%);
}

.wrap--narrow {
  max-width: 720px;
}

.about-body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.about-body p {
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.85;
  font-weight: 400;
}

.about-stack {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .6rem;
}

.about-stack span {
  font-size: .8rem;
  padding: .3rem .9rem;
  border-radius: 99px;
  background: rgba(61,125,148,.1);
  color: var(--accent);
  border: 1px solid rgba(61,125,148,.2);
  letter-spacing: .04em;
}

/* ── Contact invite ─────────────────────────────────────── */
.contact-invite {
  text-align: center;
  font-size: 1rem;
  color: var(--muted);
  margin-top: -.5rem;
  margin-bottom: 3rem;
  font-weight: 300;
}

/* ── Cards Grid ─────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.6rem;
}

/* Никакого backdrop-filter на карточках.
   Глубина — через background + inset shadow */
.card {
  background: rgba(240,247,251,.6);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 16px;
  padding: 2rem;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7),
    0 4px 16px rgba(90,122,138,.1);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  /* opacity стартует с 0, JS IntersectionObserver показывает */
}

.card:hover {
  transform: translateY(-5px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7),
    0 10px 28px rgba(90,122,138,.18);
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: .6rem;
}

.card p {
  font-size: .92rem;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 1.2rem;
}

.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags span {
  font-size: .75rem;
  padding: .25rem .75rem;
  border-radius: 99px;
  background: rgba(61,125,148,.1);
  color: var(--accent);
  border: 1px solid rgba(61,125,148,.2);
}

.card-link {
  display: inline-block;
  margin-top: 1.2rem;
  font-size: .82rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(61,125,148,.3);
  padding-bottom: 1px;
  transition: border-color .25s var(--ease), opacity .25s var(--ease);
}
.card-link:hover { border-color: var(--accent); opacity: .75; }

/* ── Contact ────────────────────────────────────────────── */
/* Ссылки — горизонтально по центру */
.contact-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.social-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  padding: .85rem 2rem;
  border-radius: 12px;
  background: rgba(240,247,251,.45);
  border: 1px solid rgba(255,255,255,.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 8px rgba(90,122,138,.08);
  color: var(--ink);
  font-size: .9rem;
  letter-spacing: .08em;
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
  min-width: 160px;
  justify-content: space-between;
}
.social-link:hover {
  transform: translateY(-3px);
  border-color: rgba(61,125,148,.4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 8px 20px rgba(90,122,138,.18);
}

.arr { color: var(--muted); transition: transform .25s var(--ease), color .25s var(--ease); }
.social-link:hover .arr { transform: translateX(3px); color: var(--accent); }

/* Terminal */
.terminal {
  background: rgba(240,247,251,.45);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 4px 16px rgba(90,122,138,.1);
  font-family: 'Courier New', monospace;
  max-width: 560px;
  margin: 0 auto;
}

.t-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem 1rem;
  background: rgba(180,214,228,.25);
  border-bottom: 1px solid rgba(255,255,255,.25);
  font-size: .75rem;
  color: var(--muted);
}
.t-dots { display: flex; gap: .4rem; }
.t-dots i { display: block; width: 9px; height: 9px; border-radius: 50%; }
.t-dots i:nth-child(1) { background: #ffb3aa; }
.t-dots i:nth-child(2) { background: #ffd49e; }
.t-dots i:nth-child(3) { background: #b2ecdf; }

.t-body { padding: 1.1rem 1.2rem; }

.t-line {
  display: flex;
  gap: .5rem;
  font-size: .82rem;
  margin-bottom: .4rem;
  color: var(--ink);
}
.t-prompt { color: var(--accent); font-weight: 500; }
.t-out { padding-left: 1.2rem; color: var(--muted); }

.t-cursor { color: var(--accent); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  background: var(--c3);
  border-top: 1px solid rgba(255,255,255,.2);
  padding: 1.8rem 0;
}
.footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-year {
  font-size: .85rem;
  color: var(--muted);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 680px) {
  .sidenav { display: none; }

  .hero-btns { flex-direction: column; align-items: center; }
  .btn-solid, .btn-ghost { width: 100%; max-width: 260px; text-align: center; }

  .contact-links { flex-direction: column; align-items: stretch; }
  .grid { grid-template-columns: 1fr; }
}
