/* ═══════════════════════════════════════════════
   VOID — Portfolio Styles
   Monochrome · Glitch · Cinematic
   ═══════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
  --bg: #0A0A0A;
  --surface: #111111;
  --surface2: #1A1A1A;
  --border: #222222;
  --text: #F5F5F5;
  --text2: #888888;
  --text3: #555555;
  --accent: #FFFFFF;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.6;
}

/* Custom cursor only on desktop */
@media (pointer: fine) {
  body { cursor: none; }
}

@media (pointer: coarse) {
  #cursor { display: none !important; }
  .btn, a, button { cursor: pointer; }
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--text); color: var(--bg); }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Cursor ───────────────────────────────────── */
#cursor {
  position: fixed; z-index: 9999; pointer-events: none;
  width: 32px; height: 32px; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  mix-blend-mode: difference;
  transition: width 0.3s, height 0.3s;
}
#cursor span { font-size: 12px; color: #fff; opacity: 0.8; }
#cursor.hovering { width: 56px; height: 56px; }
#cursor.hovering span { font-size: 18px; }

/* ── Noise Overlay ────────────────────────────── */
#noise-canvas {
  position: fixed; inset: 0; z-index: 100;
  pointer-events: none; opacity: 0.035;
  mix-blend-mode: overlay;
}

/* ── Scanlines ────────────────────────────────── */
#scanlines {
  position: fixed; inset: 0; z-index: 99;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,0.008) 2px,
    rgba(255,255,255,0.008) 4px
  );
}

/* ── 3D Container ─────────────────────────────── */
#three-container {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
}

/* ── Mute Toggle ──────────────────────────────── */
#mute-toggle {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  width: 48px; height: 48px; border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-size: 10px; font-family: inherit; letter-spacing: 1px;
  transition: all 0.2s;
  backdrop-filter: blur(12px);
}
#mute-toggle:hover { border-color: var(--text3); color: var(--text); }

/* ── Nav ──────────────────────────────────────── */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 40px;
  background: linear-gradient(180deg, rgba(10,10,10,0.95) 0%, transparent 100%);
}
.nav-logo { font-size: 20px; font-weight: 800; letter-spacing: 4px; color: var(--text); }
.nav-links { display: flex; gap: 32px; }
.nav-links a {
  font-size: 12px; font-weight: 500; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text3);
  transition: color 0.3s; position: relative;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 1px;
  background: var(--text); transition: width 0.3s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active::after { width: 100%; }

#nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: none; padding: 4px; }
@media (pointer: fine) { #nav-toggle { cursor: none; } }
#nav-toggle span { display: block; width: 24px; height: 1px; background: var(--text); transition: 0.3s; }

/* ── Glitch Transition ────────────────────────── */
#glitch-overlay {
  position: fixed; inset: 0; z-index: 300;
  pointer-events: none;
  display: flex; flex-direction: column;
  opacity: 0;
}
.glitch-bar {
  flex: 1; background: var(--bg);
  transform: scaleX(0); transition: none;
}
#glitch-overlay.active { opacity: 1; }
#glitch-overlay.active .glitch-bar {
  animation: glitchBarIn 0.6s cubic-bezier(0.87, 0, 0.13, 1) forwards;
  animation-delay: calc(var(--i) * 0.04s);
}
#glitch-overlay.out .glitch-bar {
  animation: glitchBarOut 0.4s cubic-bezier(0.87, 0, 0.13, 1) forwards;
  animation-delay: calc(var(--i) * 0.03s);
}
@keyframes glitchBarIn {
  0% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}
@keyframes glitchBarOut {
  0% { transform: scaleX(1); }
  100% { transform: scaleX(0); }
}

/* ── Pages ────────────────────────────────────── */
#main {
  position: relative; z-index: 1;
  min-height: 100vh;
}
.page {
  display: none;
  min-height: 100vh;
  padding: 120px 40px 60px;
  max-width: 1200px;
  margin: 0 auto;
}
.page.active { display: block; animation: pageIn 0.8s ease; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header { margin-bottom: 60px; }
.section-title {
  font-size: clamp(36px, 6vw, 80px);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 0.95;
  margin-bottom: 16px;
  position: relative;
}
.section-desc { font-size: 16px; color: var(--text2); max-width: 500px; line-height: 1.7; }

/* ── Home / Hero ──────────────────────────────── */
.hero {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 80vh; position: relative;
}
.hero-glitch-text { position: relative; display: inline-block; }
.glitch-title {
  font-size: clamp(48px, 10vw, 120px);
  font-weight: 900;
  letter-spacing: -4px;
  line-height: 0.9;
  color: var(--text);
  position: relative;
}
.glitch-title::before, .glitch-title::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  opacity: 0;
}
.glitch-title:hover::before {
  animation: glitchShift 0.3s infinite;
  color: rgba(255,255,255,0.3);
  clip-path: inset(20% 0 60% 0);
}
.glitch-title:hover::after {
  animation: glitchShift 0.3s infinite reverse;
  color: rgba(255,255,255,0.15);
  clip-path: inset(60% 0 20% 0);
  animation-delay: 0.1s;
}
@keyframes glitchShift {
  0% { transform: translate(0); opacity: 0.8; }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, -2px); }
  80% { transform: translate(1px, 2px); }
  100% { transform: translate(0); opacity: 0.8; }
}

.hero-sub {
  font-size: 15px; color: var(--text2);
  margin: 24px 0 40px; letter-spacing: 1px;
  max-width: 400px;
}
.hero-cta { display: flex; gap: 16px; }
.hero-scroll-indicator {
  position: absolute; bottom: 40px; left: 0;
  font-size: 11px; letter-spacing: 3px; color: var(--text3);
  animation: bounceY 2s infinite;
}
@keyframes bounceY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 32px; font-size: 12px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  border: 1px solid var(--text);
  background: var(--text); color: var(--bg);
  transition: all 0.3s; position: relative; overflow: hidden;
}
@media (pointer: fine) { .btn { cursor: none; } }
.btn-outline { background: transparent; color: var(--text); }
.btn-outline:hover { background: var(--text); color: var(--bg); }

/* Glitch button */
.glitch-btn { position: relative; }
.glitch-btn span { position: relative; z-index: 2; }
.glitch-btn span:last-child {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; z-index: 1;
}
.glitch-btn:hover span:first-child { opacity: 0; }
.glitch-btn:hover span:last-child { opacity: 1; animation: glitchText 0.3s infinite; }
@keyframes glitchText {
  0% { transform: translate(0); clip-path: inset(0); }
  10% { transform: translate(-2px, 1px); clip-path: inset(30% 0 50% 0); }
  20% { transform: translate(2px, -1px); clip-path: inset(10% 0 70% 0); }
  30% { transform: translate(-1px, 2px); clip-path: inset(60% 0 20% 0); }
  40% { transform: translate(1px, -2px); clip-path: inset(40% 0 40% 0); }
  50% { transform: translate(-2px, 0); clip-path: inset(20% 0 60% 0); }
  60% { transform: translate(0, 1px); clip-path: inset(70% 0 10% 0); }
  70% { transform: translate(1px, -1px); clip-path: inset(50% 0 30% 0); }
  80% { transform: translate(-1px, 0); }
  90% { transform: translate(0, -1px); }
  100% { transform: translate(0); clip-path: inset(0); }
}

/* ── Projects Grid ────────────────────────────── */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 32px; }
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s;
}
@media (pointer: fine) { .project-card { cursor: none; } }
.project-card:hover { border-color: var(--text3); transform: translateY(-4px); }
.project-thumb {
  position: relative; height: 220px; overflow: hidden;
  background: var(--surface2);
  display: block;
}
.project-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(30%) contrast(1.1);
  transition: transform 0.5s ease, filter 0.5s ease;
}
.project-thumb:hover img {
  transform: scale(1.05);
  filter: grayscale(0%) contrast(1.05);
}
.project-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,10,10,0.85);
  opacity: 0; transition: opacity 0.3s; font-size: 13px; letter-spacing: 1px;
}
.project-card:hover .project-overlay { opacity: 1; }
.project-info { padding: 20px; }
.project-info h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.5px; }
.project-meta { display: flex; gap: 16px; font-size: 11px; color: var(--text3); margin-bottom: 10px; }
.project-info p { font-size: 13px; color: var(--text2); line-height: 1.7; margin-bottom: 12px; }
.project-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.project-tags span {
  font-size: 10px; padding: 4px 10px; border-radius: 4px;
  background: var(--surface2); color: var(--text3); letter-spacing: 0.5px;
}

/* ── About ────────────────────────────────────── */
.about-content { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: start; }
.about-text p { font-size: 15px; color: var(--text2); line-height: 1.8; margin-bottom: 16px; }
.about-text strong { color: var(--text); }
.about-skills { margin-top: 32px; display: flex; flex-direction: column; gap: 16px; }
.skill-group h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--text3); margin-bottom: 4px; }
.skill-group span { font-size: 14px; color: var(--text2); }
.about-visual { height: 400px; background: var(--surface); border-radius: 16px; overflow: hidden; position: relative; }
#about-3d-container { width: 100%; height: 100%; }

/* ── Contact ──────────────────────────────────── */
.contact-content { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; }
.contact-form { display: flex; flex-direction: column; gap: 24px; }
.form-group { position: relative; }
.form-group label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 2px;
  color: var(--text3); margin-bottom: 8px; display: block;
}
.form-group input, .form-group textarea {
  width: 100%; background: transparent;
  border: none; outline: none;
  font: inherit; font-size: 15px; color: var(--text);
  padding: 8px 0; resize: vertical;
}
.form-group textarea { min-height: 100px; }
.form-line {
  height: 1px; background: var(--border);
  transition: background 0.3s;
}
.form-group:focus-within .form-line { background: var(--text); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text3); }
.contact-info { display: flex; flex-direction: column; gap: 24px; padding-top: 8px; }
.contact-item { display: flex; flex-direction: column; gap: 4px; }
.contact-label { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--text3); }
.contact-item a, .contact-item span { font-size: 15px; color: var(--text2); transition: color 0.3s; }
.contact-item a:hover { color: var(--text); }

/* ── Footer ───────────────────────────────────── */
#footer {
  position: relative; z-index: 1;
  text-align: center; padding: 40px;
  font-size: 11px; color: var(--text3); letter-spacing: 1px;
  border-top: 1px solid var(--border);
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
  #nav { padding: 16px 20px; }
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); padding: 20px; gap: 16px; }
  #nav-toggle { display: flex; }
  .page { padding: 100px 20px 40px; }
  .about-content, .contact-content { grid-template-columns: 1fr; gap: 32px; }
  .projects-grid { grid-template-columns: 1fr; }
}

/* ── Decode text effect ───────────────────────── */
.decode-text { display: inline-block; }

/* ── Project iframe previews ──────────────────── */
.project-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.project-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.project-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255,255,255,0.04);
  pointer-events: none;
}
.open-demo {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(10,10,10,0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
  backdrop-filter: blur(8px);
  transition: all 0.25s;
}
.open-demo:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
@media (pointer: fine) { .open-demo { cursor: none; } }

/* hide iframe custom cursors on touch */
@media (pointer: coarse) {
  .project-preview iframe { pointer-events: none; }
}
.decode-char { display: inline-block; transition: color 0.1s; }
