/* ==========================================================
   Adil Slim — Portfolio v2
   Dark theme, one gradient accent, lots of motion
   ========================================================== */

:root {
  --bg: #07070b;
  --bg-2: #0d0d14;
  --card: rgba(255, 255, 255, 0.035);
  --card-hover: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f4f6;
  --soft: #a1a1b0;
  --muted: #6b6b7b;
  --a1: #7c5cff;
  --a2: #22d3ee;
  --grad: linear-gradient(120deg, var(--a1), var(--a2));
  --radius: 20px;
  --max: 1160px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.loading { overflow: hidden; }
a { color: inherit; text-decoration: none; }
b { color: var(--text); font-weight: 600; }
.mono { font-family: "JetBrains Mono", monospace; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
::selection { background: var(--a1); color: #fff; }

.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* subtle film grain over everything */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: opacity .6s var(--ease), visibility .6s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-logo { font-size: 3.4rem; font-weight: 700; letter-spacing: -.04em; display: flex; }
.loader-logo span { display: inline-block; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop .7s var(--ease) both; }
.loader-logo span:nth-child(2) { animation-delay: .12s; }
.loader-bar { width: 140px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 100%; background: var(--grad); transform-origin: left; animation: load 1s var(--ease) both; }
@keyframes pop { from { transform: translateY(40px) rotate(8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes load { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Cursor glow & progress ---------- */
.cursor-glow {
  position: fixed; top: 0; left: 0; width: 420px; height: 420px; border-radius: 50%;
  pointer-events: none; z-index: 0; opacity: 0;
  background: radial-gradient(circle, rgba(124, 92, 255, .16), transparent 65%);
  transform: translate(-50%, -50%); transition: opacity .4s;
}
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; background: var(--grad); transform-origin: left; transform: scaleX(0); z-index: 60; }

/* ---------- Nav ---------- */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 50; transition: background .3s, border-color .3s, backdrop-filter .3s; border-bottom: 1px solid transparent; }
.nav.scrolled { background: rgba(7, 7, 11, .72); backdrop-filter: blur(14px); border-color: var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo { font-weight: 700; font-size: 1.2rem; letter-spacing: -.02em; }
.logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a { font-size: .95rem; color: var(--soft); position: relative; transition: color .2s; }
.nav-links a .mono { font-size: .7rem; color: var(--a2); margin-right: 4px; }
.nav-links a:not(.nav-cta)::after { content: ""; position: absolute; left: 0; bottom: -6px; height: 1px; width: 100%; background: var(--grad); transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease); }
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-cta { padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line); color: var(--text) !important; transition: border-color .2s, background .2s !important; }
.nav-cta:hover { border-color: var(--a1); background: rgba(124, 92, 255, .12); }
.menu-btn { display: none; background: none; border: 0; width: 34px; height: 34px; cursor: pointer; position: relative; z-index: 60; }
.menu-btn span { position: absolute; left: 5px; right: 5px; height: 2px; background: var(--text); transition: transform .3s var(--ease), top .3s; }
.menu-btn span:first-child { top: 12px; }
.menu-btn span:last-child { top: 20px; }
.menu-btn[aria-expanded="true"] span:first-child { top: 16px; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] span:last-child { top: 16px; transform: rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; overflow: hidden; }
#heroCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .45; pointer-events: none; }
.orb-1 { width: 520px; height: 520px; background: var(--a1); top: -160px; right: -120px; animation: float 14s ease-in-out infinite; }
.orb-2 { width: 420px; height: 420px; background: var(--a2); bottom: -200px; left: -140px; opacity: .25; animation: float 18s ease-in-out infinite reverse; }
@keyframes float { 50% { transform: translate(-60px, 50px) scale(1.1); } }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 180px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }

.hero-content { position: relative; z-index: 2; padding-top: 72px; }
.hero-tag { display: inline-flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--soft); padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.03); backdrop-filter: blur(6px); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: pulse 2s infinite; display: inline-block; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

.hero-title { font-size: clamp(3.6rem, 13vw, 9.5rem); font-weight: 700; letter-spacing: -.055em; line-height: .92; margin: 26px 0 22px; }
.hero-title .line { display: block; overflow: hidden; padding-bottom: .06em; }
.hero-title .char { display: inline-block; transform: translateY(110%); transition: transform 1s var(--ease); }
.hero-title.in .char { transform: none; }
.hero-title .gradient-text .char { background: var(--grad); background-size: 400% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; }

.hero-role { font-size: clamp(1rem, 2.4vw, 1.3rem); color: var(--a2); min-height: 1.7em; }
.caret { animation: blink 1s steps(1) infinite; color: var(--a1); }
@keyframes blink { 50% { opacity: 0; } }
.hero-lead { max-width: 580px; color: var(--soft); font-size: clamp(1.02rem, 1.8vw, 1.18rem); margin: 18px 0 34px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.hero .fade-up { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.hero .fade-up.in { opacity: 1; transform: none; }

.scroll-hint { position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%); z-index: 3; width: 26px; height: 42px; border: 1.5px solid var(--muted); border-radius: 20px; }
.scroll-hint span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--text); animation: wheel 1.8s infinite; }
@keyframes wheel { 0% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(14px); } }

/* ---------- Buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 14px 26px; border-radius: 999px; font-weight: 600; font-size: .98rem; transition: transform .25s var(--ease), box-shadow .3s, background .3s, border-color .3s; will-change: transform; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 40px -10px rgba(124, 92, 255, .7); }
.btn-primary:hover { box-shadow: 0 16px 50px -10px rgba(34, 211, 238, .7); }
.btn-ghost { border: 1px solid var(--line); background: rgba(255,255,255,.03); backdrop-filter: blur(6px); }
.btn-ghost:hover { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.07); }
.btn-lg { padding: 18px 32px; font-size: 1.05rem; }

/* ---------- Marquee ---------- */
.marquee { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 22px 0; overflow: hidden; background: var(--bg-2); }
.marquee-track { display: flex; gap: 34px; width: max-content; animation: marquee 32s linear infinite; font-size: clamp(1.2rem, 2.5vw, 1.7rem); font-weight: 600; letter-spacing: -.02em; }
.marquee-track span { color: var(--soft); white-space: nowrap; }
.marquee-track i { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { position: relative; padding: 130px 0; }
.eyebrow { color: var(--a2); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 16px; }
.section-title { font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 700; letter-spacing: -.045em; line-height: 1.02; margin-bottom: 60px; max-width: 800px; }

.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 60px; align-items: start; }
.about-text p { color: var(--soft); font-size: 1.12rem; margin-bottom: 20px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 36px; }
.stat { border-top: 1px solid var(--line); padding-top: 16px; }
.stat strong { display: block; font-size: 2.8rem; font-weight: 700; letter-spacing: -.04em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .88rem; }

.code-card { background: linear-gradient(180deg, #11111a, #0b0b12); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8), 0 0 0 1px rgba(124,92,255,.06); }
.code-top { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.02); }
.code-top i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.code-top i:nth-child(2) { background: #febc2e; }
.code-top i:nth-child(3) { background: #28c840; }
.code-top span { margin-left: 10px; color: var(--muted); font-size: .8rem; }
.code-card pre { padding: 24px 22px; font-size: .9rem; line-height: 1.85; min-height: 330px; white-space: pre-wrap; color: #d4d4de; }
.tk-k { color: #c792ea; } .tk-v { color: #82aaff; } .tk-s { color: #c3e88d; } .tk-p { color: #89ddff; } .tk-c { color: var(--muted); font-style: italic; }

/* ---------- Bento skills ---------- */
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.bento-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; overflow: hidden; transition: background .3s, border-color .3s; transform-style: preserve-3d; }
.bento-card.big { grid-row: span 2; display: flex; flex-direction: column; justify-content: flex-end; min-height: 380px; background: radial-gradient(120% 80% at 100% 0%, rgba(124,92,255,.18), transparent 60%), var(--card); }

.bento-card:hover { background: var(--card-hover); border-color: rgba(255,255,255,.14); }
.bento-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: .95rem; font-weight: 500; margin-bottom: 22px; background: rgba(124,92,255,.12); color: var(--a2); border: 1px solid rgba(124,92,255,.25); }
.bento-card.big .bento-icon { width: 70px; height: 70px; font-size: 1.3rem; margin-bottom: auto; }
.bento-card h3 { font-size: 1.35rem; letter-spacing: -.02em; margin-bottom: 10px; }
.bento-card p { color: var(--soft); font-size: .98rem; margin-bottom: 18px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-size: .78rem; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--soft); background: rgba(255,255,255,.02); font-family: "JetBrains Mono", monospace; }

/* spotlight that follows the mouse inside cards */
.tilt::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(124,92,255,.14), transparent 45%); }
.tilt:hover::before { opacity: 1; }

/* ---------- Featured project ---------- */
.feature { display: grid; grid-template-columns: 1fr 1.1fr; gap: 50px; align-items: center; padding: 34px; border-radius: 28px; border: 1px solid var(--line); background: radial-gradient(100% 100% at 0% 0%, rgba(34,211,238,.08), transparent 55%), var(--card); margin-bottom: 26px; }
.feature-media { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: #0b0b12; aspect-ratio: 1 / 1; }
#snakeDemo { width: 100%; height: 100%; display: block; }
.live-pill { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 8px; font-size: .72rem; padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.6); border: 1px solid var(--line); backdrop-filter: blur(6px); }
.feature-kicker { color: var(--a2); font-size: .8rem; margin-bottom: 10px; }
.feature h3 { font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -.04em; margin-bottom: 14px; }
.feature p { color: var(--soft); font-size: 1.05rem; }
.feature-list { list-style: none; margin: 20px 0 30px; display: grid; gap: 10px; }
.feature-list li { color: var(--soft); padding-left: 26px; position: relative; }
.feature-list li::before { content: "→"; position: absolute; left: 0; color: var(--a2); }
.feature code { font-family: "JetBrains Mono", monospace; font-size: .85em; color: var(--a2); background: rgba(34,211,238,.08); padding: 2px 6px; border-radius: 6px; }
.feature-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.project { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 28px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); transition: background .3s, border-color .3s; transform-style: preserve-3d; }
.project:hover { background: var(--card-hover); border-color: rgba(255,255,255,.14); }
.project.next { border-style: dashed; background: transparent; }
.project-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .78rem; color: var(--muted); }
.tag { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.project h3 { font-size: 1.3rem; letter-spacing: -.02em; }
.project p { color: var(--soft); font-size: .95rem; }
.project-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.arrow-link { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-size: 1.1rem; transition: background .3s, transform .3s var(--ease), border-color .3s; }
.arrow-link:hover { background: var(--grad); border-color: transparent; transform: rotate(45deg); }
.metrics { margin-top: auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px; }
.metrics div { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.metrics strong { display: block; font-size: 1.5rem; letter-spacing: -.03em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.metrics span { font-size: .74rem; color: var(--muted); }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 40px; max-width: 760px; }
.timeline-line { position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.timeline-line i { display: block; width: 100%; height: 100%; background: var(--grad); transform-origin: top; transform: scaleY(0); }
.t-item { position: relative; padding-bottom: 48px; }
.t-item::before { content: ""; position: absolute; left: -40px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--a1); box-shadow: 0 0 0 5px rgba(124,92,255,.12); }
.t-year { color: var(--a2); font-size: .82rem; }
.t-item h3 { font-size: 1.35rem; letter-spacing: -.02em; margin: 6px 0; }
.t-item p { color: var(--soft); }

/* ---------- Contact ---------- */
.contact { text-align: center; overflow: hidden; }
.contact::before { content: ""; position: absolute; left: 50%; top: 55%; width: 800px; height: 500px; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(124,92,255,.22), transparent); pointer-events: none; }
.contact .eyebrow { position: relative; }
.contact-title { position: relative; font-size: clamp(3rem, 11vw, 8rem); font-weight: 700; letter-spacing: -.055em; line-height: .95; margin-bottom: 28px; }
.contact-lead { position: relative; color: var(--soft); font-size: 1.15rem; max-width: 560px; margin: 0 auto 40px; }
.contact-actions { position: relative; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 30px 0; color: var(--muted); font-size: .88rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.to-top { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--text); transition: background .3s, transform .3s var(--ease); }
.to-top:hover { background: var(--grad); transform: translateY(-4px); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .about-grid, .feature { grid-template-columns: 1fr; }
  .bento { grid-template-columns: 1fr 1fr; }
  .bento-card.big { grid-row: auto; grid-column: span 2; min-height: 300px; }
  .bento-card.learning { grid-column: span 2; }
  .project-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .menu-btn { display: block; }
  .nav-links {
    position: fixed; inset: 0; flex-direction: column; justify-content: center; gap: 28px;
    background: rgba(7,7,11,.96); backdrop-filter: blur(16px);
    opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s;
  }
  .nav-links.open { opacity: 1; visibility: visible; }
  .nav-links a { font-size: 1.6rem; color: var(--text); }
  .section { padding: 90px 0; }
  .section-title { margin-bottom: 40px; }
  .bento, .project-grid { grid-template-columns: 1fr; }
  .bento-card.big, .bento-card.learning { grid-column: auto; }
  .stat-row { gap: 10px; }
  .stat strong { font-size: 2.1rem; }
  .feature { padding: 18px; gap: 26px; }
  .cursor-glow { display: none; }
  .footer-inner { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .hero .fade-up { opacity: 1; transform: none; }
  .hero-title .char { transform: none; }
}
