/*====================
Fonts
====================*/

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/jetbrains-mono/jetbrains-mono.woff2') format('woff2');
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/space-grotesk/space-grotesk-700.woff2') format('woff2');
}

/*====================
Reset & Variables
====================*/

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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --border: #222;
  --text: #e5e5e5;
  --text-secondary: #888;
  --accent: #00ffb2;
  --accent-hover: #33ffc4;
}

html { scroll-behavior: smooth; scrollbar-gutter: stable; scroll-padding-top: 80px; }

body {
  font-family: 'JetBrains Mono', 'Inter', -apple-system, BlinkMacSystemFont, monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

/*====================
Scroll Progress
====================*/

.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; z-index: 200;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

/*====================
Navigation
====================*/

nav {
  position: fixed; top: 0; width: 100%; z-index: 100;
  background: rgba(10,10,10,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

nav .inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px clamp(16px, 4vw, 24px);
  gap: 16px;
}

nav .logo { font-weight: 600; font-size: 1.1rem; color: var(--text); font-family: 'Space Grotesk', sans-serif; }

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

nav .links a {
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 400;
  position: relative;
}

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

nav .links a:hover { color: var(--text); }
nav .links a:hover::after { width: 100%; }
nav .links a.active { color: var(--text); }
nav .links a.active::after { width: 100%; transition: none; }

/*====================
Hero
====================*/

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex; flex-direction: column;
  justify-content: center; padding-top: 80px;
  position: relative;
  overflow: hidden;
}

.hero > .fade-in {
  position: relative;
  z-index: 1;
}

.hero-bg {
  position: absolute; top: 50%; left: 50%;
  width: 600px; height: 600px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(0,255,178,0.06) 0%, transparent 70%);
  pointer-events: none;
  animation: pulse-glow 6s ease-in-out infinite;
}

.home-projects-ghost {
  position: absolute;
  inset: 84px clamp(16px, 5vw, 64px) 40px auto;
  width: min(46vw, 520px);
  z-index: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(70px, 11vw);
  gap: 14px;
  opacity: 0.11;
  pointer-events: none;
  mask-image: linear-gradient(90deg, transparent 0%, #000 18%, #000 78%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 18%, #000 78%, transparent 100%);
}

.home-projects-ghost::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: radial-gradient(circle at 35% 50%, transparent 0%, rgba(10,10,10,0.74) 74%);
}

.home-projects-ghost img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  filter: grayscale(1) contrast(1.1);
}

.home-projects-ghost img:nth-child(1) {
  grid-column: 2 / span 3;
  grid-row: 1 / span 2;
}

.home-projects-ghost img:nth-child(2) {
  grid-column: 5 / span 2;
  grid-row: 1 / span 2;
}

.home-projects-ghost img:nth-child(3) {
  grid-column: 1 / span 2;
  grid-row: 3 / span 2;
}

.home-projects-ghost img:nth-child(4) {
  grid-column: 3 / span 2;
  grid-row: 3 / span 2;
}

.home-projects-ghost img:nth-child(5) {
  grid-column: 5 / span 2;
  grid-row: 3 / span 2;
}

@keyframes pulse-glow {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

.hero .label {
  color: var(--accent); font-size: 0.875rem; font-weight: 500;
  margin-bottom: 16px; letter-spacing: 0.05em; text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 700;
  line-height: 1.1; margin-bottom: 20px; letter-spacing: -0.02em;
  font-family: 'Space Grotesk', sans-serif;
}

.hero h1 .gradient {
  background: linear-gradient(135deg, var(--accent), #00cc8e);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  display: inline-block;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hero .subtitle {
  font-size: 1.125rem; color: var(--text-secondary);
  max-width: 540px; margin-bottom: 32px; min-height: 1.8em;
}

.typing-cursor {
  display: inline-block; width: 2px; height: 1.1em;
  background: var(--accent); margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/*====================
Buttons
====================*/

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 8px; font-size: 0.875rem; font-weight: 500;
  transition: all 0.25s ease; border: none; cursor: pointer;
}

.btn-primary {
  background: var(--accent); color: #0a0a0a;
  box-shadow: 0 0 0 0 rgba(0,255,178,0);
}

.btn-primary:hover {
  background: var(--accent-hover); color: #0a0a0a;
  box-shadow: 0 0 20px rgba(0,255,178,0.25);
  transform: translateY(-1px);
}

.btn-outline { border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-secondary); color: var(--text); transform: translateY(-1px); }
.btn-group { display: flex; gap: 12px; flex-wrap: wrap; }

/*====================
Section Defaults
====================*/

section { max-width: 1100px; margin: 0 auto; padding: clamp(64px, 10vw, 100px) clamp(16px, 4vw, 24px); }

.section-label {
  color: var(--accent); font-size: 0.8rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px;
}

section h2 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 600; margin-bottom: clamp(32px, 5vw, 48px); letter-spacing: -0.01em; }

/*====================
About
====================*/

.about-section {
  display: grid; grid-template-columns: 1fr 2fr; gap: 48px; align-items: center;
}

.about-section img {
  width: 100%; max-width: 280px; aspect-ratio: 4 / 5;
  border-radius: 12px;
  border: 1px solid var(--border); object-fit: cover;
}

.about-section h2 { margin-bottom: 16px; }

.about-section p { color: var(--text-secondary); font-size: 1rem; line-height: 1.7; margin-bottom: 16px; }
.about-section p:last-child { margin-bottom: 0; }

/*====================
Projects Grid
====================*/

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.project-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; transition: all 0.35s ease;
  position: relative;
}

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

.project-card:hover { border-color: #333; transform: translateY(-4px); box-shadow: 0 8px 30px rgba(0,0,0,0.3); }
.project-card:hover::before { transform: scaleX(1); }

.project-card img {
  width: 100%; height: 180px; object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.project-card .card-body { padding: 20px; }

.project-card h3 {
  font-size: 1.05rem; font-weight: 600; margin-bottom: 6px;
}

.project-card p {
  font-size: 0.85rem; color: var(--text-secondary);
}

.project-card a { color: inherit; }
.project-card a:hover { color: inherit; }

/*====================
Project Detail
====================*/

.project-detail {
  max-width: 720px; margin: 0 auto;
  padding: 100px clamp(16px, 4vw, 24px) clamp(64px, 10vw, 100px);
}

.project-detail .back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 24px;
  transition: color 0.2s;
}

.project-detail .back-link:hover { color: var(--accent); }

.project-detail h1 {
  font-size: clamp(1.75rem, 5vw, 2.25rem); font-weight: 700; margin-bottom: 32px; letter-spacing: -0.01em;
}

.project-detail h2 {
  font-size: 1.25rem; font-weight: 600; margin-bottom: 12px; margin-top: 32px;
  color: var(--accent);
}

.project-detail p {
  color: var(--text-secondary); line-height: 1.7; margin-bottom: 16px;
}

.project-detail img,
.project-detail video {
  width: 100%; border-radius: 10px; border: 1px solid var(--border); margin: 16px 0;
}

.project-detail video {
  display: block;
  background: var(--surface);
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 16px 0;
}

.project-detail .project-gallery img {
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  margin: 0;
}

/*====================
Contact
====================*/

.contact-intro { color: var(--text-secondary); margin-bottom: 32px; line-height: 1.7; }

#contact form { display: flex; flex-direction: column; gap: 20px; max-width: 540px; }

#contact label {
  font-size: 0.85rem; font-weight: 500; color: var(--text-secondary);
  margin-bottom: 6px; display: block;
}

#contact input,
#contact textarea {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px; color: var(--text);
  font-family: inherit; font-size: 0.9rem; width: 100%;
  transition: border-color 0.2s;
  outline: none;
}

#contact input:focus,
#contact textarea:focus { border-color: var(--accent); }

#contact textarea { min-height: 120px; resize: vertical; }

#contact .form-group { display: flex; flex-direction: column; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/*====================
Footer
====================*/

footer {
  border-top: 1px solid var(--border); padding: 32px 24px;
  text-align: center; color: var(--text-secondary); font-size: 0.8rem;
}

footer .inner { max-width: 1100px; margin: 0 auto; }

/*====================
Fade-in Animation
====================*/

.fade-in { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.fade-in.visible { opacity: 1; transform: translateY(0); }
.fade-in.stagger-1 { transition-delay: 0.1s; }
.fade-in.stagger-2 { transition-delay: 0.2s; }
.fade-in.stagger-3 { transition-delay: 0.3s; }
.fade-in.stagger-4 { transition-delay: 0.4s; }
.fade-in.stagger-5 { transition-delay: 0.5s; }
.fade-in.stagger-6 { transition-delay: 0.6s; }

/*====================
Media Queries
====================*/

@media (max-width: 640px) {
  nav .links { gap: 14px; }
  nav .links a { font-size: 0.8rem; }
  nav .logo { font-size: 1rem; }
  .about-section { grid-template-columns: 1fr; text-align: center; gap: 32px; }
  .about-section img { margin: 0 auto; }
  .hero-bg { width: 300px; height: 300px; }
  .home-projects-ghost {
    inset: auto 16px 24px 16px;
    width: auto;
    grid-auto-rows: 56px;
    gap: 10px;
    opacity: 0.07;
  }
  .projects-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .project-card img { height: 200px; }
  .project-gallery { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  nav .links { gap: 10px; }
  nav .links a { font-size: 0.75rem; }
}

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