/* ═══════════════════════════════════════════
   Vasily Sahrai — Portfolio
   Editorial design system
   ═══════════════════════════════════════════ */

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

/* ── Tokens ── */
:root {
  --bg: #0a0a0a;
  --fg: #f0ede6;
  --muted: #6b6b6b;
  --accent: #c8ff00;
  --border: rgba(255, 255, 255, 0.08);
  --surface: rgba(255, 255, 255, 0.03);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Grain overlay ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); }

/* ── Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 4vw, 3rem);
}

/* ═══ NAVBAR ═══ */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 clamp(1.5rem, 4vw, 3rem);
  height: 72px;
  display: flex;
  align-items: center;
  transition: background 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
}

#navbar.scrolled {
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2.5rem;
}

.nav-links a {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.3s var(--ease);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-links a:hover::after {
  width: 100%;
}

/* ═══ HERO ═══ */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 clamp(1.5rem, 4vw, 3rem);
  overflow: hidden;
}

.hero-content {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding-top: 72px;
}

.hero-name {
  font-size: clamp(3.5rem, 11vw, 9rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 2rem;
}

.hero-name .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.18em;
  margin-bottom: -0.18em;
}

.hero-name .line-inner {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.9s var(--ease);
}

.hero-name .line-inner.revealed {
  transform: translateY(0);
}

.hero-name .line:nth-child(2) .line-inner {
  transition-delay: 0.12s;
}

.hero-descriptor {
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  color: var(--muted);
  max-width: 540px;
  line-height: 1.7;
  font-weight: 400;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease) 0.5s, transform 0.8s var(--ease) 0.5s;
}

.hero-descriptor.revealed {
  opacity: 1;
  transform: translateY(0);
}

.hero-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s var(--ease) 0.3s, transform 0.6s var(--ease) 0.3s;
}

.hero-label.revealed {
  opacity: 1;
  transform: translateY(0);
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: clamp(1.5rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeIn 0.6s var(--ease) 1.2s forwards;
}

.hero-scroll .scroll-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* ═══ SECTION SHARED ═══ */
.section {
  padding: clamp(5rem, 10vw, 8rem) 0;
  border-top: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: clamp(3rem, 6vw, 5rem);
  flex-wrap: wrap;
  gap: 1rem;
}

.section-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-count {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ── Reveal animation ── */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger:nth-child(1) { transition-delay: 0s; }
.reveal-stagger:nth-child(2) { transition-delay: 0.08s; }
.reveal-stagger:nth-child(3) { transition-delay: 0.16s; }
.reveal-stagger:nth-child(4) { transition-delay: 0.24s; }
.reveal-stagger:nth-child(5) { transition-delay: 0.32s; }
.reveal-stagger:nth-child(6) { transition-delay: 0.4s; }

/* ═══ ABOUT ═══ */
.about-line {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--fg);
  max-width: 60ch;
}

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(3rem, 6vw, 6rem);
  align-items: start;
}

.about-pull {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.about-pull em {
  font-style: normal;
  color: var(--accent);
}

.about-body p {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.about-body p:last-child {
  margin-bottom: 0;
}

.about-detail {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.about-detail-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.about-detail-value {
  font-size: 0.95rem;
  color: var(--fg);
  font-weight: 400;
}

/* ═══ PROJECTS ═══ */
.project-list {
  display: flex;
  flex-direction: column;
}

.project-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2rem;
  padding: clamp(1.5rem, 3vw, 2.5rem) 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  position: relative;
  cursor: pointer;
  transition: background 0.3s var(--ease);
}

.project-row::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--surface);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.project-row:hover::before {
  opacity: 1;
}

.project-row:first-child {
  border-top: 1px solid var(--border);
}

.project-row-left {
  position: relative;
  z-index: 1;
}

.project-name {
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  transition: transform 0.4s var(--ease), color 0.3s var(--ease);
  display: inline-block;
}

.project-row:hover .project-name {
  transform: translateX(1rem);
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 0.5rem;
  transition: transform 0.4s var(--ease);
}

.project-row:hover .project-meta {
  transform: translateX(1rem);
}

.project-desc-short {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 480px;
  line-height: 1.6;
}

.project-tags-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  text-transform: uppercase;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.project-row:hover .project-tag {
  border-color: rgba(200, 255, 0, 0.2);
  color: var(--fg);
}

.project-row-right {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.project-arrow {
  font-size: 1.5rem;
  color: var(--muted);
  transition: color 0.3s var(--ease), transform 0.4s var(--ease);
}

.project-row:hover .project-arrow {
  color: var(--accent);
  transform: translateX(6px);
}

.project-type {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ═══ SKILLS MARQUEE ═══ */
.marquee-wrapper {
  overflow: hidden;
  padding: clamp(2rem, 4vw, 3rem) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 30s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

.marquee-item {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 700;
  color: rgba(240, 237, 230, 0.08);
  white-space: nowrap;
  padding: 0 clamp(1.5rem, 3vw, 3rem);
  letter-spacing: -0.02em;
  transition: color 0.3s var(--ease);
  user-select: none;
}

.marquee-item:hover {
  color: var(--fg);
}

.marquee-logo {
  height: clamp(2rem, 4vw, 3rem);
  width: auto;
  margin: 0 clamp(1.5rem, 3vw, 3rem);
  opacity: 0.25;
  transition: opacity 0.3s var(--ease);
  user-select: none;
  flex-shrink: 0;
  align-self: center;
}

.marquee-logo:hover {
  opacity: 1;
}

.marquee-separator {
  color: var(--accent);
  font-size: clamp(1rem, 2vw, 1.5rem);
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  opacity: 0.3;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ═══ CONTACT ═══ */
.contact-layout {
  text-align: left;
}

.contact-heading {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 3rem;
  color: var(--fg);
}

.contact-heading em {
  font-style: normal;
  color: var(--accent);
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--muted);
  transition: color 0.3s var(--ease);
  width: fit-content;
}

.contact-link:hover {
  color: var(--fg);
}

.contact-link .link-arrow {
  font-size: 0.9em;
  transition: transform 0.3s var(--ease);
  color: var(--accent);
  opacity: 0;
}

.contact-link:hover .link-arrow {
  opacity: 1;
  transform: translateX(4px);
}

/* ═══ FOOTER ═══ */
footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.footer-right {
  display: flex;
  gap: 2rem;
}

.footer-right a {
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.footer-right a:hover {
  color: var(--fg);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .nav-links { display: none; }

  .hero-name {
    font-size: clamp(2.8rem, 14vw, 5rem);
  }

  .about-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .project-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .project-row-right {
    justify-content: flex-start;
  }

  .project-name {
    font-size: clamp(1.4rem, 6vw, 2rem);
  }

  .contact-heading {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }

  .section-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .footer-right {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .project-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .hero-scroll {
    display: none;
  }
}
