/* ═══════════════════════════════════════════
   HUSSEIN JIMMY — Neural Interface
   ═══════════════════════════════════════════ */

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

:root {
  --bg-deep: #06060C;
  --bg-navy: #0A0E1A;
  --navy: #121830;
  --teal: #00A896;
  --teal-glow: rgba(0, 168, 150, 0.3);
  --gold: #FFD700;
  --violet: #7C3AED;
  --cyan: #06D6A0;
  --magenta: #FF006E;
  --text-primary: #E8EAF0;
  --text-muted: #5A6080;
  --text-dim: #2A2F45;
  --glass-bg: rgba(10, 14, 26, 0.6);
  --glass-border: rgba(0, 168, 150, 0.1);
  --font-display: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  --transition-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-mono);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* ── Background Canvas ── */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Particle, Wave + Cursor Trail Canvases ── */
#particles, #waves, #cursor-trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#particles { z-index: 1; }
#waves { z-index: 2; }
#cursor-trail { z-index: 3; }

/* ── Overlays ── */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  opacity: 0.025;
  pointer-events: none;
  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.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 55% at 50% 45%, transparent 30%, rgba(6, 6, 12, 0.65) 100%);
}

/* ── Nav ── */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  padding: 1.25rem 2rem;
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  background: rgba(6, 6, 12, 0.5);
  border-bottom: 1px solid var(--glass-border);
  transition: transform 0.35s var(--transition-smooth), opacity 0.35s var(--transition-smooth);
}

#main-nav.nav-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.nav-link {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 1.5rem;
  border-radius: 4px;
  position: relative;
  transition: color 0.3s var(--transition-smooth), background 0.3s var(--transition-smooth);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 40%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  transition: transform 0.3s var(--transition-smooth);
}

.nav-link:hover, .nav-link:focus-visible {
  color: var(--gold);
  outline: none;
}
.nav-link:hover::after, .nav-link:focus-visible::after {
  transform: translateX(-50%) scaleX(1);
}
.nav-link.active {
  color: var(--teal);
  background: rgba(0, 168, 150, 0.06);
}
.nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* ── Page Container ── */
#page-container {
  position: relative;
  z-index: 6;
  min-height: 100dvh;
  display: block;
  padding-top: 5rem;
  padding-bottom: 5rem;
}

/* ── Pages ── */
.page {
  display: none;
  position: relative;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition: opacity 0.45s var(--transition-smooth), transform 0.45s var(--transition-smooth);
}
.page.active { display: flex; }
.page.visible { opacity: 1; transform: translateY(0) scale(1); }
.page.exiting {
  position: absolute !important;
  top: 5rem;
  left: 0;
  width: 100%;
  opacity: 0;
  transform: translateY(-12px) scale(0.99);
  transition: opacity 0.3s var(--transition-smooth), transform 0.3s var(--transition-smooth);
  pointer-events: none;
}

/* ── Home page: perfect vertical center ── */
#page-home {
  min-height: calc(100dvh - 10rem);
}

/* ── Hero ── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  margin-top: -13.5rem;
  animation: heroEnter 1s var(--transition-smooth) both;
}

@keyframes heroEnter {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Name Canvas ── */
#name-canvas {
  display: block;
  position: relative;
  pointer-events: none;
  margin: 0 auto;
  align-self: center;
  flex-shrink: 0;
  max-width: 100%;
}

.tagline {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: clamp(0.85rem, 1.6vw, 1rem);
  color: var(--text-muted);
  line-height: 1.8;
  margin-top: 0.6rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  animation: heroEnter 1s var(--transition-smooth) 0.15s both;
  letter-spacing: 0.02em;
  text-shadow: 0 0 12px rgba(6, 6, 12, 0.95), 0 0 30px rgba(6, 6, 12, 0.8);
}

#hero-streak {
  display: block;
  margin: 1.2rem auto 0;
  width: 200px;
  height: 3px;
  max-width: 60%;
}

/* ── Section Titles ── */
.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #FFFFFF 0%, #00A896 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: clamp(0.85rem, 1.4vw, 0.95rem);
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 3rem;
  letter-spacing: 0.03em;
}

.content-wrap {
  width: 100%;
  max-width: 960px;
}

/* ── Art Grid ── */
.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  width: 100%;
}

.art-card {
  background: rgba(10, 14, 26, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 15px 35px -15px rgba(0, 0, 0, 0.8),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
  transition: border-color 0.4s var(--transition-smooth), transform 0.4s var(--transition-smooth), box-shadow 0.4s var(--transition-smooth);
  cursor: default;
}

.art-card:hover {
  border-color: rgba(0, 242, 254, 0.35);
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 25px 45px -20px rgba(0, 0, 0, 0.9),
              0 0 25px -5px rgba(0, 242, 254, 0.12),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.art-card .placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 168, 150, 0.08), rgba(124, 58, 237, 0.08));
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.art-card .placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.02) 50%, transparent 70%);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

.art-card h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.art-card p {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Apps Grid ── */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  width: 100%;
}

.app-card {
  background: rgba(10, 14, 26, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1.75rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 15px 35px -15px rgba(0, 0, 0, 0.8),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
  transition: border-color 0.4s var(--transition-smooth), transform 0.4s var(--transition-smooth), box-shadow 0.4s var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.app-card:hover {
  border-color: rgba(143, 0, 255, 0.35);
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 25px 45px -20px rgba(0, 0, 0, 0.9),
              0 0 25px -5px rgba(143, 0, 255, 0.12),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.app-card .app-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.app-card h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.app-card p {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
}

.app-card .tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.app-card .tech-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  background: rgba(0, 168, 150, 0.08);
  color: var(--teal);
  border: 1px solid rgba(0, 168, 150, 0.12);
}

/* ── Footer ── */
#main-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  padding: 1rem 2rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(6, 6, 12, 0.5);
  border-top: 1px solid var(--glass-border);
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copyright {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  #main-nav { padding: 0.75rem 1rem; }
  .nav-link { font-size: 0.65rem; padding: 0.4rem 0.9rem; letter-spacing: 0.1em; }
  #page-container { padding-top: 3.5rem; padding-bottom: 0; }
  .page { padding: 1.5rem 1rem; }
  #main-nav.nav-hidden { transform: none; opacity: 1; pointer-events: auto; }
  .art-grid, .apps-grid { grid-template-columns: 1fr; }
  #main-footer { position: relative; }

  /* Fix name clipping on mobile */
  .hero { margin-top: 0; min-height: calc(100dvh - 7rem); justify-content: center; overflow: visible; width: 100%; }
  #name-canvas { max-width: 100%; width: auto; height: auto; }
  .tagline { padding: 0 1rem; }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .art-grid { grid-template-columns: repeat(2, 1fr); }
  .apps-grid { grid-template-columns: repeat(2, 1fr); }
}

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