:root {
  --black: #0A0E17;
  --black-light: #0f1420;
  --cyan: #00D4FF;
  --purple: #7B2FBE;
  --frost: #E0F7FA;
  --frost-muted: #E0F7FAaa;
  --frost-dim: #E0F7FA44;
  --gradient: linear-gradient(135deg, var(--cyan), var(--purple));
  --border: #1e293b;
  --border-subtle: rgba(224,247,250,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--black);
  color: var(--frost);
  font-family: 'Chakra Petch', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--cyan);
  color: var(--black);
}

/* Focus styles for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.project:focus-visible {
  border-color: rgba(0,212,255,0.15);
  transform: translateY(-2px);
}

.project:focus-visible::before {
  opacity: 1;
}

/* Noise overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 2;
}

/* Grid background */
.grid-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(var(--frost-dim) 1px, transparent 1px),
    linear-gradient(90deg, var(--frost-dim) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
  contain: strict;
}

/* Glow effects */
.glow-cyan {
  position: fixed;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,212,255,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  contain: strict;
}
.glow-purple {
  position: fixed;
  bottom: -200px; left: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(123,47,190,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  contain: strict;
}

/* Layout */
.container {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero */
.hero {
  padding: 100px 0 48px;
  text-align: center;
}

.hero .avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 24px;
  border: 2px solid var(--border);
  background: var(--black-light);
  opacity: 0;
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.2s;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.hero .avatar:hover {
  border-color: rgba(0,212,255,0.3);
  box-shadow: 0 0 20px rgba(0,212,255,0.1);
}

.hero h1 {
  font-family: 'Orbitron', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: 2px;
  margin-bottom: 12px;
  opacity: 0;
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.4s;
}

.hero .tagline {
  font-family: 'Chakra Petch', system-ui, -apple-system, sans-serif;
  font-size: 1.15rem;
  color: var(--frost-muted);
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.6s;
}

.hero .location {
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', monospace;
  font-size: 0.8rem;
  color: var(--cyan);
  letter-spacing: 2px;
  opacity: 0;
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.8s;
}

.scroll-hint {
  display: block;
  margin: 12px auto 0;
  width: 44px;
  height: 44px;
  padding: 10px;
  opacity: 0;
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards 1s, scrollPulse 2.5s ease-in-out infinite 1.6s;
  color: var(--frost-dim);
  text-decoration: none;
  transition: color 0.2s ease;
}

.scroll-hint:hover {
  color: var(--frost-muted);
}

.scroll-hint svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

/* ASCII decorative elements */
.ascii-header {
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', monospace;
  font-size: 0.65rem;
  color: var(--frost-dim);
  letter-spacing: 1px;
  margin-bottom: 16px;
  overflow: hidden;
  white-space: nowrap;
}

.ascii-header + .projects-grid + .ascii-header {
  margin-top: 32px;
}

.ascii-divider {
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', monospace;
  font-size: 0.6rem;
  color: var(--frost-dim);
  text-align: center;
  padding: 24px 0;
  letter-spacing: 2px;
  overflow: hidden;
  white-space: nowrap;
}

/* Section labels */
.section-label {
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Orbitron', system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

/* About */
section {
  padding: 48px 0;
}

.about p {
  font-size: 1.05rem;
  color: var(--frost-muted);
  line-height: 1.8;
  max-width: 640px;
  margin-bottom: 16px;
}

.about .highlight {
  color: var(--frost);
  font-weight: 600;
}

.about a {
  color: var(--cyan);
  text-decoration: none;
  background-image: linear-gradient(var(--cyan), var(--cyan));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.about a:hover {
  background-size: 100% 1px;
}

/* Info block (NFO style) */
.info-block {
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', monospace;
  font-size: 0.8rem;
  color: var(--frost-muted);
  background: var(--black-light);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px 24px;
  margin-top: 24px;
  line-height: 1.8;
  overflow-wrap: break-word;
  word-break: break-word;
}

.info-block .key {
  color: var(--frost-muted);
}

.info-block .val {
  color: var(--frost);
}

.info-block .cursor {
  display: inline-block;
  width: 7px;
  height: 1.1em;
  background: var(--cyan);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Projects */
.projects-grid {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.project {
  background: var(--black-light);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.3s ease, transform 0.3s ease;
  display: block;
  position: relative;
  overflow: hidden;
}

.project::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.3s;
}

.project:hover::before { opacity: 1; }

.project:hover {
  border-color: rgba(0,212,255,0.15);
  transform: translateY(-2px);
}

.project:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

.project-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.project-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--black-light);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.project:hover .project-icon {
  transform: scale(1.08);
}

.project-name {
  font-family: 'Orbitron', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  min-width: 0;
  overflow-wrap: break-word;
  flex: 1;
}

.project-tag {
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', monospace;
  font-size: 0.65rem;
  background: rgba(0,212,255,0.1);
  color: var(--cyan);
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.project-tag--dev {
  background: rgba(123,47,190,0.15);
  color: #b57aed;
}

.project-desc {
  font-size: 0.9rem;
  color: var(--frost-muted);
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Contact */
.contact-intro {
  color: var(--frost-muted);
  font-size: 1rem;
  margin-bottom: 8px;
  line-height: 1.7;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.contact-link {
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', monospace;
  font-size: 0.8rem;
  color: var(--frost);
  text-decoration: none;
  padding: 12px 20px;
  background: var(--black-light);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.contact-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.contact-link:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0,212,255,0.03);
}

.contact-link:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

.contact-link:hover svg {
  transform: translateX(2px);
}

/* Footer */
footer {
  padding: 48px 0 32px;
  border-top: 1px solid rgba(224,247,250,0.05);
  margin-top: 48px;
  text-align: center;
}

footer pre {
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', monospace;
  font-size: 0.6rem;
  color: var(--frost-dim);
  letter-spacing: 1px;
  margin-bottom: 16px;
  line-height: 1.4;
}

footer p {
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', monospace;
  font-size: 0.65rem;
  color: var(--frost-muted);
  letter-spacing: 1px;
  overflow-wrap: break-word;
}

footer a {
  color: var(--cyan);
  text-decoration: none;
  background-image: linear-gradient(var(--cyan), var(--cyan));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

footer a:hover {
  background-size: 100% 1px;
}

/* Divider */
.divider {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.divider hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(224,247,250,0.08), transparent);
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered card reveals — grid container fades in, cards stagger */
.projects-grid.reveal {
  transform: none;
}

.projects-grid.reveal .project {
  opacity: 0;
  transform: translateY(16px);
}

.projects-grid.reveal.visible .project {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}

.projects-grid.reveal.visible .project:nth-child(2) { transition-delay: 0.1s; }
.projects-grid.reveal.visible .project:nth-child(3) { transition-delay: 0.1s; }
.projects-grid.reveal.visible .project:nth-child(4) { transition-delay: 0.2s; }

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

  .reveal {
    opacity: 1;
    transform: none;
  }

  .scroll-hint {
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards 1s;
  }
}

/* Responsive */
@media (min-width: 641px) {
  .projects-grid--multi {
    grid-template-columns: repeat(2, 1fr);
  }

  .project--featured {
    border-color: rgba(0,212,255,0.1);
  }

  .project--featured::before {
    opacity: 0.5;
  }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }

  .hero { padding: 72px 0 32px; }
  .hero .avatar { width: 100px; height: 100px; }

  .ascii-header, .ascii-divider { display: none; }

  .contact-links { flex-direction: column; }
  .contact-link { justify-content: center; }

  .info-block { font-size: 0.7rem; padding: 16px; }

  body::before { display: none; }
  .grid-bg { display: none; }
}
