
:root {
  --bg-dark: #020a19;
  --text-primary: #d5e0ff;
  --text-muted: rgba(213, 224, 255, 0.6);
  --border-subtle: rgba(213, 224, 255, 0.1);
  --glass-bg: rgba(213, 224, 255, 0.05);
  --font-sans: "Space Grotesk", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --transition: 0.33s linear;
}

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

html {
  scroll-behavior: smooth;
}

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

.loader {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}

.loader--done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__content {
  text-align: center;
}

.loader__square {
  width: 8px;
  height: 8px;
  background: var(--text-primary);
  margin: 0 auto 16px;
  animation: loader-pulse 1s ease-in-out infinite;
}

@keyframes loader-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.loader__percent {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  margin-bottom: 8px;
}

.loader__label {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  z-index: 9999;
  background: transparent;
}

.nav__brand {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--text-primary);
  text-decoration: none;
}

.nav__menu {
  display: flex;
  list-style: none;
  gap: 24px;
}

.nav__link {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-primary);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.nav__link:hover, .nav__link:focus {
  opacity: 1;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.nav__overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav__overlay--open {
  opacity: 1;
  visibility: visible;
}

.nav__overlay-menu {
  list-style: none;
  text-align: center;
}

.nav__overlay-link {
  display: block;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 32px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  text-decoration: none;
  padding: 16px 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.nav__overlay-link:hover, .nav__overlay-link:focus {
  opacity: 1;
}

.section {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 40vh 36px 7rem;
}

.section__content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.section--hero {
  align-items: center;
  padding-top: 0;
  text-align: center;
}

.section--projects, .section--skills, .section--contact {
  text-align: center;
}

.label {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.hero__title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 72px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.0;
  margin-bottom: 24px;
}

.section__title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 48px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.0;
  margin-bottom: 24px;
}

.hero__body, .section__body {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 16px;
  letter-spacing: -0.02em;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 32px;
}

.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-primary);
  text-decoration: none;
  padding: 20px 28px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  transition: background var(--transition), border-color var(--transition);
}

.btn:hover, .btn:focus {
  background: rgba(213, 224, 255, 0.1);
  border-color: rgba(213, 224, 255, 0.3);
}

.reveal {
  overflow: hidden;
}

.reveal__mask {
  transform: translateY(100%);
  transition: transform 0.8s cubic-bezier(0.2, 0, 0, 1);
}

.reveal--visible .reveal__mask {
  transform: translateY(0);
}

.reveal:nth-child(1) .reveal__mask { transition-delay: 0ms; }
.reveal:nth-child(2) .reveal__mask { transition-delay: 100ms; }
.reveal:nth-child(3) .reveal__mask { transition-delay: 200ms; }
.reveal:nth-child(4) .reveal__mask { transition-delay: 300ms; }
.reveal:nth-child(5) .reveal__mask { transition-delay: 400ms; }

.projects__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 48px;
}

.project-card {
  border: 1px solid var(--border-subtle);
  padding: 24px;
  text-align: left;
  transition: border-color var(--transition);
}

.project-card:hover, .project-card:focus-within {
  border-color: rgba(213, 224, 255, 0.3);
}

.project-card__name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.project-card__desc {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card__lang {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.project-card__lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-primary);
}

.project-card__link {
  display: inline-block;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-primary);
  text-decoration: none;
  padding: 12px 20px;
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  transition: background var(--transition), border-color var(--transition);
}

.project-card__link:hover, .project-card__link:focus {
  background: rgba(213, 224, 255, 0.1);
  border-color: rgba(213, 224, 255, 0.3);
}

.skills__groups {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.skill-group {
  text-align: center;
}

.skill-group__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.skill-group__items {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 32px;
  color: var(--text-primary);
  line-height: 1.3;
}

.contact__email {
  display: block;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 24px;
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 16px;
  transition: opacity var(--transition);
}

.contact__email:hover, .contact__email:focus {
  text-decoration: underline;
}

.contact__github {
  display: block;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 16px;
  color: var(--text-primary);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.contact__github:hover, .contact__github:focus {
  opacity: 1;
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: transparent;
}

.footer__progress {
  width: 100%;
  height: 2px;
  background: rgba(213, 224, 255, 0.05);
}

.footer__progress-bar {
  height: 100%;
  background: rgba(213, 224, 255, 0.3);
  width: 0%;
  transition: width 0.1s linear;
}

.footer__content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 40px;
}

.footer__link {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-primary);
  text-decoration: none;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.footer__link:hover, .footer__link:focus {
  opacity: 1;
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal__mask { transform: translateY(0); transition: none; }
  .loader { display: none; }
}

@media (max-width: 767px) {
  .nav { padding: 0 20px; }
  .nav__menu { display: none; }
  .nav__toggle { display: flex; }
  .section { padding: 30vh 36px 7rem; text-align: left; }
  .section--hero { text-align: left; align-items: flex-end; }
  .section--projects, .section--skills, .section--contact { text-align: left; }
  .hero__title { font-size: 48px; }
  .section__title { font-size: 32px; }
  .hero__body, .section__body { margin-left: 0; margin-right: 0; }
  .projects__grid { grid-template-columns: 1fr; }
  .skill-group__items { font-size: 24px; }
  .footer { display: none; }
  .contact__email { font-size: 20px; word-break: break-word; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .projects__grid { grid-template-columns: repeat(2, 1fr); }
}
