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

:root {
  --bg: #0a0a0a;
  --fg: #f0ede8;
  --muted: #555;
  --accent: #c8ff00;
  --card: #111;
  --border: #1e1e1e;
  --mono: 'DM Mono', monospace;
  --sans: 'Syne', sans-serif;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  cursor: none;
  width: 100%;
}

/* ── CUSTOM CURSOR ── */
#cursor {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease, width 0.2s ease, height 0.2s ease;
  mix-blend-mode: difference;
}
#cursor.hovering {
  width: 32px;
  height: 32px;
}

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

/* ── LAYOUT ── */
.container {
  max-width: 860px;
  width: 100%;
  margin-inline: auto;
  padding: 0 32px;
}

/* ── NAV ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
  box-sizing: border-box;
  width: 100%;
}
nav.scrolled {
  background: rgba(10, 10, 10, 0.95);
  border-color: var(--border);
  backdrop-filter: blur(12px);
}
.nav-logo {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: -0.5px;
}
.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s;
  cursor: none;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.nav-links a:hover,
.nav-links a.active { color: var(--fg); }
.nav-links a.active::after,
.nav-links a:hover::after { width: 100%; }

/* ── HERO ── */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 80px;
  position: relative;
}
.hero-inner { width: 100%; }

.hero-tag {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.2s forwards;
}
.hero-name {
  font-family: var(--sans);
  font-size: clamp(56px, 10vw, 120px);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -4px;
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.4s forwards;
}
.hero-name span { color: var(--accent); }

.hero-desc {
  max-width: 480px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.6s forwards;
}
.hero-cta {
  display: inline-flex;
  gap: 16px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.8s forwards;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: 1px solid var(--border);
  color: var(--fg);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  cursor: none;
}
.btn:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn.primary:hover { background: #b8ef00; border-color: #b8ef00; }

/* ── HERO SCROLL (now a link) ── */
.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding-left: 32px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: 0;
  animation: fadeUp 0.8s ease 1s forwards;
  transition: color 0.2s;
  cursor: none;
}
.hero-scroll:hover { color: var(--accent); }
.scroll-line {
  width: 40px;
  height: 1px;
  background: var(--muted);
  animation: expandLine 1.5s ease 1.5s both;
  transform-origin: left;
  transform: scaleX(0);
  transition: background 0.2s;
}
.hero-scroll:hover .scroll-line { background: var(--accent); }

/* ── SECTION BASE ── */
section { padding: 120px 0; }

.section-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 48px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.section-label::after {
  content: '';
  flex: 1;
  max-width: 60px;
  height: 1px;
  background: var(--accent);
}
.section-title {
  font-family: var(--sans);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.05;
  margin-bottom: 24px;
}

/* ── ABOUT ── */
#about .about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}
.about-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 2;
}
.about-text p + p { margin-top: 16px; }
.about-text strong { color: var(--fg); }

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.stat {
  padding: 24px;
  border: 1px solid var(--border);
  background: var(--card);
}
.stat-num {
  font-family: var(--sans);
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 4px;
  transition: transform 0.2s;
}
.stat:hover .stat-num { transform: scale(1.05); }
.stat-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── LANGUAGES ── */
#languages .lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 2px;
}
.lang-card {
  padding: 28px 24px;
  border: 1px solid var(--border);
  background: var(--card);
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
  cursor: none;
}
.lang-card::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--accent);
  width: 0;
  transition: width 0.3s ease;
}
.lang-card:hover::before { width: 100%; }
.lang-card:hover { border-color: #333; transform: translateY(-2px); }

/* FA icons in lang cards */
.lang-icon {
  font-size: 26px;
  margin-bottom: 14px;
  display: block;
  color: var(--muted);
  transition: color 0.2s;
}
.lang-card:hover .lang-icon { color: var(--accent); }

.lang-name {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* ── WORKS / REPOS ── */
#works .repos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2px;
}
.repo-card {
  padding: 28px;
  border: 1px solid var(--border);
  background: var(--card);
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s, transform 0.2s;
  cursor: none;
  position: relative;
  overflow: hidden;
}
.repo-card::after {
  content: '↗';
  position: absolute;
  top: 20px; right: 20px;
  color: var(--muted);
  font-size: 18px;
  transition: color 0.2s, transform 0.2s;
}
.repo-card:hover { border-color: #333; transform: translateY(-3px); }
.repo-card:hover::after { color: var(--accent); transform: translate(2px, -2px); }

.repo-name {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  padding-right: 32px;
}
.repo-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}
.repo-meta {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
  align-items: center;
}
.repo-lang {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lang-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.repo-stars {
  display: flex;
  align-items: center;
  gap: 5px;
}
.repo-stars i { color: var(--accent); font-size: 10px; }
.repo-fork {
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.5;
}

.repos-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 48px 24px;
  font-size: 12px;
  letter-spacing: 0.1em;
}
.repos-fallback {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 16px 24px;
  font-size: 11px;
  letter-spacing: 0.05em;
}
.repos-fallback a {
  color: var(--accent);
  text-decoration: none;
}
.repos-fallback a:hover { text-decoration: underline; }

.loading-dots::after {
  content: '...';
  animation: dots 1.2s infinite;
}

/* ── CONTACT ── */
.contact-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
}
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: color 0.2s;
  cursor: none;
}
.contact-link:hover { color: var(--accent); }
.contact-link-icon { width: 16px; text-align: center; }
.contact-link-arrow { margin-left: auto; transition: transform 0.2s; }
.contact-link:hover .contact-link-arrow { transform: translateX(4px); }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes expandLine { to { transform: scaleX(1); } }
@keyframes dots {
  0%,  20% { content: '.'; }
  40%, 60% { content: '..'; }
  80%,100% { content: '...'; }
}

.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(6px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  position: relative;
  transform: translateY(16px);
  transition: transform 0.25s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--fg); }
.modal-title {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 28px;
  color: var(--fg);
}
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border: 1px solid var(--border);
  color: var(--fg);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  cursor: none;
}
.modal-btn:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.modal-btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.modal-btn.primary:hover { background: #b8ef00; border-color: #b8ef00; }

/* ── NAV MENU BTN (mobile only) ── */
.nav-menu-btn { display: none; }

/* ── NAV DRAWER (mobile only) ── */
.nav-drawer { display: none; }

/* ── RESPONSIVE ── */

/* Hide custom cursor on touch devices */
@media (hover: none) {
  #cursor { display: none; }
  body { cursor: auto; }
  a, button, .btn, .contact-link, .repo-card, .lang-card,
  .modal-btn, .modal-close, .hero-scroll, .nav-menu-btn { cursor: pointer; }
}

/* Tablet */
@media (max-width: 860px) {
  #works .repos-grid {
    grid-template-columns: 1fr;
  }
  #languages .lang-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}

/* Mobile */
@media (max-width: 680px) {
  .container { padding: 0 18px; }

  /* Nav */
  nav { padding: 16px 18px; width: 100%; }
  .nav-links { display: none; }

  /* Hamburger */
  .nav-menu-btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    background: none;
    border: none;
  }
  .nav-menu-btn span {
    display: block;
    width: 22px;
    height: 1px;
    background: var(--fg);
    transition: transform 0.3s, opacity 0.3s;
  }

  /* Mobile drawer */
  .nav-drawer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg);
    z-index: 99;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 32px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .nav-drawer.open {
    opacity: 1;
    pointer-events: all;
  }
  .nav-drawer a {
    font-family: var(--sans);
    font-size: 32px;
    font-weight: 700;
    color: var(--fg);
    text-decoration: none;
    letter-spacing: -1px;
    transition: color 0.2s;
    cursor: pointer;
  }
  .nav-drawer a:hover { color: var(--accent); }

  /* Hero */
  #hero { padding-top: 100px; text-align: center; }
  .hero-inner { display: flex; flex-direction: column; align-items: center; width: 100%; }
  .hero-name { font-size: clamp(20px, 8.5vw, 56px); letter-spacing: -1px; width: 100%; text-align: center; white-space: nowrap; }
  .hero-tag { text-align: center; }
  .hero-desc { text-align: center; max-width: 100%; }
  .hero-cta { flex-direction: column; width: 100%; align-items: center; }
  .btn { text-align: center; width: 100%; max-width: 320px; justify-content: center; }
  .hero-scroll { padding-left: 0; justify-content: center; }
  .scroll-line { display: none; }

  /* Sections */
  section { padding: 80px 0; text-align: center; }
  .section-label { justify-content: center; }
  .section-label::after { display: none; }

  /* About */
  #about .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .about-text { text-align: center; }
  .about-stats { grid-template-columns: 1fr 1fr; }

  /* Stack */
  #languages .lang-grid {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    margin: 0;
  }
  .lang-card { text-align: center; }
  .lang-icon { display: block; margin: 0 auto 12px; }

  /* Works */
  #works .repos-grid {
    grid-template-columns: 1fr;
    width: 100%;
    margin: 0;
  }
  .repo-card { text-align: left; }
  .repo-meta { justify-content: flex-start; }
  .repos-loading { padding: 40px 16px; }

  /* About stats */
  .about-stats {
    width: 100%;
    margin: 0;
  }

  /* Contact */
  .contact-inner { flex-direction: column; align-items: center; gap: 32px; text-align: center; }
  .contact-links { align-items: center; }
  .contact-link-arrow { margin-left: 8px; }

  /* Footer */
  footer { flex-direction: column; gap: 8px; text-align: center; }

  /* Modal */
  .modal { padding: 28px 20px; margin: 0 16px; }
}
