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

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --border: #1e1e1e;
  --border-light: #2a2a2a;
  --text: #e8e6e1;
  --muted: #5a5a5a;
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.08);
  --mono: 'DM Mono', monospace;
  --sans: 'Syne', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Grain 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='1'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
}

/* ─── NAV ─── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-logo {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s;
}

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

/* Mobile Menu Toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1000;
  color: var(--accent);
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
}

/* Mobile Nav Overlay */
.mobile-nav {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 48px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  transform: translateY(-20px);
}

.mobile-nav.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mobile-nav a {
  font-family: var(--mono);
  font-size: 24px;
  color: var(--text);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ─── HERO ─── */
#hero {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 0 48px;
  padding-top: 100px;
  position: relative;
  overflow: hidden;
}

.hero-bg-text {
  position: absolute;
  bottom: -20px;
  right: -20px;
  font-family: var(--sans);
  font-size: clamp(120px, 18vw, 280px);
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.04);
  line-height: 1;
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 900px;
}

.hero-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  line-height: 1.4;
}

.hero-label::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--accent);
}

h1 {
  font-family: var(--sans);
  font-size: clamp(52px, 8vw, 120px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin-bottom: 36px;
}

h1 .line-muted {
  color: var(--muted);
}

.hero-desc {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  max-width: 460px;
  line-height: 1.8;
  margin-bottom: 48px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #0a0a0a;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 28px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: #e0e0e0;
  transform: translateY(-1px);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-light);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 28px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-ghost:hover {
  border-color: var(--text);
  color: var(--text);
}

.hero-bottom {
  padding: 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
}

.hero-contacts {
  display: flex;
  gap: 32px;
}

.hero-contacts a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.hero-contacts a:hover {
  color: var(--accent);
}

.scroll-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.scroll-arrow {
  display: inline-block;
}

/* ─── SECTIONS ─── */
section {
  padding: 120px 48px;
  border-top: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 72px;
}

.section-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.section-title {
  font-family: var(--sans);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ─── STACK ─── */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
}

.stack-cell {
  background: var(--bg);
  padding: 28px 24px;
  transition: background 0.2s;
}

.stack-cell:hover {
  background: var(--surface);
}

.stack-category {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.stack-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stack-item {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
}

/* ─── PROJECTS ─── */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}

.project-card {
  background: var(--bg);
  padding: 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition: background 0.3s;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-card:hover {
  background: var(--surface);
}

.project-index {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.project-name {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.project-desc {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border-light);
  padding: 4px 10px;
  letter-spacing: 0.04em;
}

.project-links {
  display: flex;
  gap: 20px;
  margin-top: 8px;
}

.project-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
}

.project-link:hover {
  opacity: 0.7;
}

.project-link svg {
  width: 12px;
  height: 12px;
}

/* ─── CONTACT ─── */
#contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.contact-left {
  padding: 120px 48px;
  border-right: 1px solid var(--border);
}

.contact-right {
  padding: 120px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}

.contact-item {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.contact-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.contact-value {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

a.contact-value:hover {
  color: var(--accent);
}

.contact-big {
  font-family: var(--sans);
  font-size: clamp(42px, 6vw, 80px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 0.95;
  margin-bottom: 32px;
}

.contact-big span {
  color: var(--accent);
}

.contact-sub {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
  max-width: 360px;
}

/* ─── FOOTER ─── */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

footer span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

footer a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--accent);
}

.project-preview {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  border: 1px solid var(--border-light);
  position: relative;
  margin-bottom: 8px;
}

.project-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform 0.6s ease;
  filter: brightness(0.85);
}

.project-card:hover .project-preview img {
  transform: scale(1.03);
  filter: brightness(1);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  nav {
    padding: 16px 24px;
  }

  .nav-links {
    display: none;
  }

  #hero {
    padding: 0 24px;
    padding-top: 80px;
  }

  section {
    padding: 80px 24px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    padding: 32px 24px;
  }

  #contact {
    grid-template-columns: 1fr;
  }

  .contact-left {
    padding: 80px 24px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .contact-right {
    padding: 80px 24px;
  }

  .hero-bg-text {
    font-size: 80px;
    bottom: 10px;
    right: 10px;
  }

  .stack-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .btn-primary,
  .btn-ghost {
    justify-content: center;
    width: 100%;
  }

  .hero-bottom {
    flex-direction: column;
    gap: 24px;
    align-items: flex-start;
  }

  .hero-contacts {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .hero-contacts a {
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
    display: block;
    width: 100%;
  }

  .nav-toggle {
    display: block;
  }

  .contact-big {
    font-size: 42px;
    margin-bottom: 24px;
  }

  h1 {
    font-size: clamp(32px, 12vw, 42px);
    word-break: break-word;
    hyphens: auto;
  }

  .hero-desc {
    font-size: 13px;
    max-width: 100%;
  }

  .section-header {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 48px;
  }

  /* Fix long email overflow */
  .hero-contacts a {
    word-break: break-all;
    font-size: 11px;
    padding: 10px 14px;
  }

  .hero-label {
    font-size: 11px;
  }

  nav {
    padding: 12px 20px;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  nav {
    padding: 10px 14px;
  }

  #hero,
  section,
  .contact-left,
  .contact-right,
  footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .contact-big {
    font-size: 32px;
  }

  .nav-logo {
    font-size: 11px;
  }

  h1 {
    font-size: 34px;
  }

  .hero-label::before {
    width: 16px;
  }

  .hero-label {
    gap: 8px;
  }
}
