/* --- Design tokens --- */
:root {
  --bg: #0a0a0b;
  --bg-elevated: #121214;
  --bg-card: #161618;
  --text: #e4e4e7;
  --text-muted: #71717a;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-subtle: rgba(245, 158, 11, 0.15);
  --border: #27272a;
  --font-sans: 'Syne', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 8px;
  --radius-lg: 16px;
  --header-h: 72px;
  --container: min(1120px, calc(100vw - 2rem));
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* --- Reset & base --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1rem;
}

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 1.5rem;
  background: rgba(10, 10, 11, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  z-index: 100;
  transition: border-color 0.3s var(--ease-out);
}
.header.scrolled { border-bottom-color: var(--border); }

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo:hover { color: var(--accent); }

.nav {
  display: flex;
  gap: 2rem;
}
.nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
}
.nav a:hover { color: var(--accent); }

.menu-btn {
  display: none;
  flex-direction: column;
  gap: 6px;
}
.menu-btn span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.3s var(--ease-out), opacity 0.3s;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.btn-primary {
  background: var(--accent);
  color: #0a0a0b;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.btn-ghost {
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  border-color: var(--text-muted);
}
.btn-large { padding: 1rem 2rem; font-size: 1rem; }

/* --- Hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--header-h) + 3rem) 1.5rem 4rem;
  position: relative;
}
.hero-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 0.2s forwards;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 1.25rem;
  max-width: 14ch;
}
.hero-title .line {
  display: block;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) forwards;
}
.hero-title .line:nth-child(1) { animation-delay: 0.35s; }
.hero-title .line:nth-child(2) { animation-delay: 0.5s; }
.hero-title .line:nth-child(3) { animation-delay: 0.65s; }
.hero-title .accent { color: var(--accent); }
.hero-desc {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 42ch;
  margin: 0 0 2rem;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 0.8s forwards;
}
.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 1s forwards;
}
.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 1.2s forwards;
}
.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--text-muted), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.5; transform: scaleY(0.8); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* --- Section common --- */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 0.75rem;
}

/* --- About --- */
.about {
  padding: 6rem 0;
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}
.about-title {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0;
}
.about-content p {
  margin: 0 0 1rem;
  color: var(--text-muted);
}
.about-content p:last-child { margin-bottom: 0; }

@media (max-width: 768px) {
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
}

/* --- Skills --- */
.skills {
  padding: 4rem 0;
  background: var(--bg-elevated);
}
.skills-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
}
.skills-list li {
  font-size: 1.1rem;
  color: var(--text-muted);
  position: relative;
  padding-left: 0;
}
.skills-list li::before {
  content: '→';
  color: var(--accent);
  margin-right: 0.5rem;
}

/* --- Work --- */
.work {
  padding: 6rem 0;
}
.work-title {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  margin: 0 0 2.5rem;
}
.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.work-card {
  position: relative;
  display: block;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.3s, transform 0.3s var(--ease-out), box-shadow 0.3s;
}
.work-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}
.work-card-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-subtle) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.work-card:hover .work-card-bg { opacity: 1; }
.work-card-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  position: relative;
}
.work-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  position: relative;
}
.work-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  position: relative;
}
.work-more {
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: gap 0.2s;
}
.work-more:hover { gap: 0.5rem; }

@media (max-width: 900px) {
  .work-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .work-grid { grid-template-columns: 1fr; }
}

/* --- CTA --- */
.cta {
  padding: 6rem 0;
  background: var(--bg-elevated);
  text-align: center;
}
.cta-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  margin: 0 0 1.5rem;
}

/* --- Footer --- */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-copy { font-size: 0.9rem; color: var(--text-muted); }
.footer-links {
  display: flex;
  gap: 1.5rem;
}
.footer-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--accent); }

/* --- Page layout (works, contact) --- */
.page-main { padding-top: var(--header-h); }
.page-hero, .contact-hero {
  padding: 4rem 0 3rem;
}
.page-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}
.page-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 50ch;
  margin: 0;
}

/* --- Projects list --- */
.projects-list { padding-bottom: 4rem; }
.project-card {
  border-bottom: 1px solid var(--border);
}
.project-card-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 2rem;
  align-items: center;
  padding: 2.5rem 0;
  transition: background 0.2s;
}
.project-card-link:hover { background: var(--bg-elevated); }
.project-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  min-width: 2ch;
}
.project-info h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}
.project-info p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.project-tags {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.project-visual { width: 120px; }
.project-placeholder {
  aspect-ratio: 16/10;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

@media (max-width: 768px) {
  .project-card-link {
    grid-template-columns: auto 1fr;
    gap: 1rem;
  }
  .project-visual { display: none; }
}

/* --- Contact --- */
.contact-content {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 4rem;
  padding-bottom: 4rem;
  align-items: start;
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 480px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); opacity: 0.7; }
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 120px; }

.contact-info { position: sticky; top: calc(var(--header-h) + 2rem); }
.contact-block { margin-bottom: 2rem; }
.contact-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 0.5rem;
}
.contact-block a {
  color: var(--text);
  transition: color 0.2s;
}
.contact-block a:hover { color: var(--accent); }
.contact-social {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

@media (max-width: 768px) {
  .contact-content { grid-template-columns: 1fr; }
  .contact-info { position: static; }
}

/* --- Mobile nav --- */
@media (max-width: 640px) {
  .nav { display: none; }
  .menu-btn { display: flex; }
  .nav.open {
    display: flex;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    background: var(--bg);
    font-size: 1.5rem;
  }
  .menu-btn.open span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .menu-btn.open span:nth-child(2) { opacity: 0; }
  .menu-btn.open span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }
}

/* --- Reduce motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
