/* =========================================================
   Variables
   ========================================================= */
:root{
  --bg-primary:   #0a0e1a;
  --bg-secondary: #111827;
  --bg-elevated:  #1a2236;
  --accent:       #7dd3fc;       /* softer atmospheric cyan-blue */
  --accent-strong:#60a5fa;       /* used for highlights / italic */
  --accent-2:     #a5b4fc;       /* indigo accent for variety */
  --accent-glow:  rgba(125,211,252,0.18);
  --text-primary:   #e6edf6;
  --text-secondary: #9aa6bd;
  --text-muted:     #4b5871;
  --border: rgba(125,211,252,0.12);
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;
  --pixel: "Press Start 2P", "DotGothic16", monospace;
}

/* =========================================================
   Reset / base
   ========================================================= */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
html{scroll-behavior:smooth;}
body{
  font-family:var(--mono);
  background:var(--bg-primary);
  color:var(--text-primary);
  font-size:0.95rem;
  line-height:1.7;
  overflow-x:hidden;
  position:relative;
  min-height:100vh;
}
a{color:inherit;text-decoration:none;}
img{max-width:100%;display:block;}

/* Skip-to-content for keyboard / screen readers */
.skip-link{
  position:absolute;left:-9999px;top:0;
  background:var(--accent);color:var(--bg-primary);
  padding:.6rem 1rem;font-size:.85rem;
  z-index:99999;
}
.skip-link:focus{left:1rem;top:1rem;}

/* Noise overlay */
body::before{
  content:"";
  position:fixed;inset:0;
  pointer-events:none;
  z-index:1;
  opacity:0.04;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Custom cursor (desktop only via JS) */
.has-custom-cursor,
.has-custom-cursor *{ cursor:none !important; }
.cursor-dot,
.cursor-ring{
  position:fixed;
  top:0;left:0;
  pointer-events:none;
  z-index:9999;
  transform:translate(-50%,-50%);
  will-change:transform;
}
.cursor-dot{
  width:6px;height:6px;
  background:var(--accent);
  border-radius:50%;
  box-shadow:0 0 8px var(--accent);
}
.cursor-ring{
  width:34px;height:34px;
  border:1px solid var(--accent);
  border-radius:50%;
  opacity:.6;
  transition:width .25s ease, height .25s ease, opacity .25s ease, background .25s ease;
}
.cursor-ring.hover{
  width:54px;height:54px;
  background:rgba(59,130,246,0.08);
  opacity:1;
}

/* Video background */
.bg-video{
  position:fixed;inset:0;
  width:100%;height:100%;
  object-fit:cover;
  z-index:0;
  pointer-events:none;
}
.bg-video-overlay{
  position:fixed;inset:0;
  z-index:0;
  pointer-events:none;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(10,14,26,0.55) 0%, rgba(10,14,26,0.92) 70%, rgba(10,14,26,1) 100%),
    linear-gradient(180deg, rgba(10,14,26,0.55) 0%, rgba(10,14,26,0.95) 100%);
  backdrop-filter:blur(3px) saturate(.85);
  -webkit-backdrop-filter:blur(3px) saturate(.85);
}

/* =========================================================
   Navigation
   ========================================================= */
.nav{
  position:fixed;top:0;left:0;right:0;
  z-index:100;
  display:flex;align-items:center;justify-content:space-between;
  padding:1rem 2rem;
  background:rgba(10,14,26,0.6);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  border-bottom:1px solid var(--border);
}
.nav-logo{
  font-family:var(--serif);
  font-size:1.4rem;
  letter-spacing:.02em;
}
.nav-logo span{color:var(--accent);}
.nav-links{display:flex;gap:2rem;list-style:none;}
.nav-links a{
  font-size:.85rem;
  color:var(--text-secondary);
  transition:color .3s ease;
  position:relative;
}
.nav-links a:hover{color:var(--text-primary);}
.nav-links a::after{
  content:"";position:absolute;left:0;bottom:-4px;
  width:0;height:1px;background:var(--accent);
  box-shadow:0 0 8px var(--accent);
  transition:width .3s ease;
}
.nav-links a:hover::after{width:100%;}
.nav-burger{display:none;flex-direction:column;gap:5px;background:none;border:0;cursor:pointer;}
.nav-burger span{display:block;width:24px;height:2px;background:var(--text-primary);transition:.3s;}

/* =========================================================
   Layout
   ========================================================= */
main{position:relative;z-index:3;}
section{
  max-width:1200px;
  margin:0 auto;
  padding:8rem 2rem;
}
h1,h2,h3{font-family:var(--serif);font-weight:400;letter-spacing:.01em;line-height:1.1;}
h2{
  font-size:clamp(1.8rem,3vw,2.6rem);
  margin-bottom:2.5rem;
  color:var(--text-primary);
}
h2::before{
  content:"// ";
  font-family:var(--mono);
  color:var(--accent);
  font-size:.7em;
  vertical-align:middle;
}

/* =========================================================
   Hero
   ========================================================= */
.hero{
  min-height:100vh;
  display:grid;
  grid-template-columns:1.4fr .8fr;
  align-items:center;
  gap:3rem;
  position:relative;
  overflow:hidden;
}
.hero-text{display:flex;flex-direction:column;justify-content:center;}
.hero-avatar{
  position:relative;
  aspect-ratio:1/1;
  max-width:340px;
  margin-left:auto;
  border-radius:50%;
  overflow:hidden;
  border:1px solid rgba(125,211,252,0.25);
  box-shadow:
    0 0 0 1px rgba(165,180,252,0.08),
    0 0 60px -10px rgba(125,211,252,0.35),
    0 0 140px -20px rgba(165,180,252,0.25);
  opacity:0;animation:fadeUp 1s .35s forwards, avatarFloat 6s ease-in-out infinite;
}
@keyframes avatarFloat{
  0%,100%{transform:translateY(0);}
  50%   {transform:translateY(-8px);}
}
.hero-avatar img{
  width:100%;height:100%;
  object-fit:cover;
  display:block;
  filter:saturate(.9) contrast(1.05);
}
.hero-avatar::after{
  content:"";
  position:absolute;inset:0;
  background:radial-gradient(circle at 30% 30%, transparent 40%, rgba(10,14,26,0.4) 100%);
}
@media (max-width:900px){
  .hero{grid-template-columns:1fr;}
  .hero-avatar{max-width:220px;margin:0 0 2rem 0;order:-1;}
}
.hero-mesh{
  position:absolute;inset:-20%;
  background:
    radial-gradient(circle at 20% 30%, rgba(59,130,246,0.18), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(99,102,241,0.15), transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(14,116,144,0.12), transparent 50%);
  filter:blur(40px);
  z-index:-1;
  animation:mesh 18s ease-in-out infinite alternate;
}
@keyframes mesh{
  0%   {transform:translate(0,0) scale(1);}
  50%  {transform:translate(3%, -2%) scale(1.05);}
  100% {transform:translate(-2%, 3%) scale(1.1);}
}
.hero-tag{
  font-size:.85rem;
  color:var(--accent);
  margin-bottom:1.5rem;
  opacity:0;animation:fadeUp .8s .1s forwards;
}
.hero h1{
  font-size:clamp(2.5rem,7vw,5.5rem);
  font-family:var(--serif);
  margin-bottom:1.5rem;
  opacity:0;animation:fadeUp .8s .25s forwards;
}
.hero h1 em{
  font-style:italic;
  background:linear-gradient(135deg, var(--accent-strong), var(--accent-2));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
.hero-desc{
  max-width:560px;
  color:var(--text-secondary);
  font-size:1rem;
  opacity:0;animation:fadeUp .8s .4s forwards;
}
.hero-meta{
  margin-top:3rem;
  display:flex;gap:2rem;
  font-size:.8rem;color:var(--text-muted);
  opacity:0;animation:fadeUp .8s .55s forwards;
}
.hero-meta span::before{content:"› ";color:var(--accent);}

@keyframes fadeUp{
  from{opacity:0;transform:translateY(24px);}
  to  {opacity:1;transform:translateY(0);}
}

/* =========================================================
   About
   ========================================================= */
.about-grid{ max-width:680px; }
.about-text p{margin-bottom:1.2rem;color:var(--text-secondary);}
.about-text p:first-child{color:var(--text-primary);font-size:1.05rem;}

/* glow divider */
.divider{
  height:1px;
  background:linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow:0 0 12px var(--accent-glow);
  margin:5rem auto;
  max-width:1200px;
}

/* =========================================================
   Projects
   ========================================================= */
.projects-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(290px,1fr));
  gap:1.5rem;
}
.project-card{
  background:var(--bg-secondary);
  border:1px solid var(--border);
  border-radius:6px;
  overflow:hidden;
  transition:transform .3s ease, border-color .3s ease, box-shadow .3s ease, background .3s ease;
  position:relative;
  display:flex;flex-direction:column;
}
.project-media{
  position:relative;
  aspect-ratio:16/10;
  overflow:hidden;
  background:var(--bg-elevated);
  border-bottom:1px solid var(--border);
}
.project-media img,
.project-media video{
  width:100%;height:100%;
  object-fit:cover;
  display:block;
  transition:transform .6s ease, filter .3s ease;
  filter:saturate(.85);
}
.project-card:hover .project-media img,
.project-card:hover .project-media video{
  transform:scale(1.04);
  filter:saturate(1);
}
.project-media::after{
  content:"";position:absolute;inset:0;
  background:linear-gradient(180deg, transparent 50%, rgba(10,14,26,0.4) 100%);
  pointer-events:none;
}
.project-body{
  padding:1.5rem 1.8rem 1.8rem;
  display:flex;flex-direction:column;flex:1;
}
.project-card:hover{
  transform:translateY(-4px);
  background:var(--bg-elevated);
  border-color:var(--accent);
  box-shadow:0 0 0 1px var(--accent), 0 12px 40px -10px var(--accent-glow);
}
.project-card .num{
  font-size:.75rem;color:var(--text-muted);
  margin-bottom:.8rem;letter-spacing:.1em;
}
.project-card h3{
  font-size:1.4rem;margin-bottom:.6rem;
}
.project-card p{
  color:var(--text-secondary);
  font-size:.88rem;
  flex:1;margin-bottom:1.2rem;
}
.project-tags{
  display:flex;flex-wrap:wrap;gap:.4rem;margin-bottom:1rem;
}
.tag{
  font-size:.7rem;
  padding:.25rem .6rem;
  background:rgba(59,130,246,0.08);
  border:1px solid var(--border);
  border-radius:99px;
  color:var(--text-secondary);
}
.project-link{
  font-size:.78rem;
  color:var(--text-primary);
  display:inline-flex;align-items:center;gap:.55rem;
  padding:.55rem .9rem;
  border:1px solid var(--border);
  border-radius:4px;
  background:rgba(125,211,252,0.04);
  width:fit-content;
  transition:.3s ease;
  letter-spacing:.02em;
}
.project-link svg{width:14px;height:14px;flex-shrink:0;}
.project-link:hover{
  color:var(--bg-primary);
  background:var(--accent);
  border-color:var(--accent);
  box-shadow:0 0 24px -4px var(--accent-glow);
}

/* =========================================================
   Skills
   ========================================================= */
.skills-list{
  display:flex;flex-wrap:wrap;gap:.6rem;
}
.skill{
  padding:.6rem 1.1rem;
  border:1px solid var(--border);
  border-radius:4px;
  font-size:.85rem;
  color:var(--text-secondary);
  background:var(--bg-secondary);
  transition:.3s ease;
  cursor:default;
}
.skill:hover{
  color:var(--text-primary);
  border-color:var(--accent);
  background:var(--bg-elevated);
  box-shadow:0 0 16px -4px var(--accent-glow);
  transform:translateY(-2px);
}

/* =========================================================
   Contact
   ========================================================= */
.contact-list{
  list-style:none;display:flex;flex-direction:column;gap:1rem;
  margin-top:2rem;
}
.contact-list a{
  display:inline-flex;align-items:center;gap:.8rem;
  font-size:1.1rem;
  color:var(--text-primary);
  position:relative;
  padding:.4rem 0;
  width:fit-content;
}
.contact-list a span.icon{
  width:1.2rem;height:1.2rem;
  display:inline-flex;align-items:center;justify-content:center;
  color:var(--accent);
}
.contact-list a::after{
  content:"";position:absolute;left:0;bottom:0;
  width:0;height:1px;background:var(--accent);
  box-shadow:0 0 12px var(--accent);
  transition:width .4s ease;
}
.contact-list a:hover::after{width:100%;}
.contact-list a:hover{color:var(--accent);}

/* =========================================================
   Footer
   ========================================================= */
footer{
  border-top:1px solid var(--border);
  padding:2rem;
  text-align:center;
  color:var(--text-muted);
  font-size:.78rem;
  position:relative;z-index:3;
}

/* =========================================================
   Scroll-reveal
   ========================================================= */
.reveal{
  opacity:0;
  transform:translateY(30px);
  transition:opacity .8s ease, transform .8s ease;
}
.reveal.in{opacity:1;transform:translateY(0);}

/* =========================================================
   Mascot
   ========================================================= */
.mascot{
  position:fixed;
  right:1.5rem;bottom:1.5rem;
  width:200px;height:220px;
  z-index:50;
  cursor:grab;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
  touch-action:none;
  will-change:transform;
}
.mascot.dragging{ cursor:grabbing; }
.mascot canvas{
  width:100%;height:100%;
  image-rendering:pixelated;
  image-rendering:-moz-crisp-edges;
  display:block;
  pointer-events:none;
}
.mascot-bubble{ display:none; }

.mascot-mute{
  position:fixed;
  right:1.6rem;bottom:calc(220px + 1.6rem);
  width:30px;height:30px;
  background:var(--bg-secondary);
  border:1px solid var(--border);
  border-radius:50%;
  color:var(--text-secondary);
  font-size:14px;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
  z-index:51;
  transition:.25s ease;
}
.mascot-mute:hover{color:var(--accent);border-color:var(--accent);}

/* =========================================================
   Konami / chaos mode
   ========================================================= */
.chaos{
  animation:chaosShake .12s linear infinite;
}
.chaos .hero-mesh{
  filter:hue-rotate(120deg) blur(40px) !important;
}
.chaos::before{
  content:"";
  position:fixed;inset:0;z-index:9998;pointer-events:none;
  background:repeating-linear-gradient(0deg,
    rgba(168,85,247,.06) 0,
    rgba(168,85,247,.06) 2px,
    transparent 2px,
    transparent 6px);
  animation:chaosScan .8s linear infinite;
}
@keyframes chaosShake{
  0%,100%{transform:translate(0,0);}
  25%{transform:translate(-1px,1px);}
  50%{transform:translate(1px,-1px);}
  75%{transform:translate(-1px,-1px);}
}
@keyframes chaosScan{
  from{background-position:0 0;}
  to  {background-position:0 8px;}
}

/* =========================================================
   Responsive
   ========================================================= */
@media (prefers-reduced-motion: reduce){
  .hero-mesh,.bg-video{display:none !important;}
  *{animation-duration:.001ms !important;transition-duration:.001ms !important;}
}
@media (max-width:768px){
  section{padding:5rem 1.25rem;}
  .nav{padding:1rem 1.25rem;}
  .nav-links{
    position:fixed;top:60px;right:0;
    flex-direction:column;
    background:rgba(10,14,26,0.95);
    backdrop-filter:blur(12px);
    padding:2rem;
    gap:1.5rem;
    border-left:1px solid var(--border);
    border-bottom:1px solid var(--border);
    transform:translateX(110%);
    transition:transform .35s ease;
  }
  .nav-links.open{transform:translateX(0);}
  .nav-burger{display:flex;}
  .hero-meta{flex-direction:column;gap:.4rem;}
  .mascot{width:130px;height:150px;right:.6rem;bottom:.6rem;}
  .mascot-mute{bottom:calc(150px + .8rem);right:.7rem;}
}
