/* ===========================================================
   AI Engineer Portfolio — Design System
   Author build style: senior frontend engineer
   =========================================================== */

:root {
  --bg: #0a0b14;
  --bg-soft: #11131f;
  --bg-card: #151827;
  --bg-card-hover: #1b1f33;
  --border: #232842;
  --border-soft: #1c2138;
  --text: #e7e9f3;
  --text-dim: #a3a9c2;
  --text-faint: #6f7592;
  --brand: #7c5cff;
  --brand-2: #22d3ee;
  --brand-3: #f472b6;
  --accent-grad: linear-gradient(120deg, #7c5cff 0%, #22d3ee 100%);
  --accent-grad-soft: linear-gradient(120deg, rgba(124,92,255,.14), rgba(34,211,238,.14));
  --ok: #34d399;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .7);
  --radius: 16px;
  --maxw: 1140px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient background glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px circle at 12% -5%, rgba(124, 92, 255, .18), transparent 45%),
    radial-gradient(700px circle at 95% 8%, rgba(34, 211, 238, .12), transparent 45%),
    radial-gradient(800px circle at 60% 110%, rgba(244, 114, 182, .08), transparent 45%);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Typography ---------- */
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
.h-grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand-2);
  margin-bottom: 16px;
}
.lead { color: var(--text-dim); font-size: 1.08rem; max-width: 660px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 11, 20, .72);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 1.05rem; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent-grad);
  display: grid; place-items: center;
  font-weight: 800; color: #fff; font-size: 15px;
  box-shadow: 0 6px 18px -6px rgba(124, 92, 255, .8);
}
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  padding: 8px 14px; border-radius: 9px; font-size: .95rem;
  color: var(--text-dim); transition: .18s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg-card); }
.nav-cta {
  background: var(--accent-grad); color: #fff !important;
  font-weight: 600; box-shadow: 0 8px 22px -10px rgba(124, 92, 255, .9);
}
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 26px; cursor: pointer; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 24px; border-radius: 11px; font-weight: 600; font-size: .98rem;
  cursor: pointer; border: 1px solid transparent; transition: .2s; white-space: nowrap;
}
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 12px 30px -12px rgba(124, 92, 255, .9); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 38px -14px rgba(124, 92, 255, 1); }
.btn-ghost { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-card-hover); border-color: var(--brand); }

/* ---------- Sections ---------- */
section { padding: 88px 0; }
.section-head { max-width: 720px; margin-bottom: 48px; }
.section-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin-bottom: 14px; }

/* ---------- Hero ---------- */
.hero { padding: 90px 0 70px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(2.4rem, 5.2vw, 4rem); margin-bottom: 22px; }
.hero .lead { font-size: 1.18rem; margin-bottom: 32px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 38px; }
.hero-stats { display: flex; gap: 38px; flex-wrap: wrap; }
.hero-stats .stat .num { font-size: 1.9rem; font-weight: 800; }
.hero-stats .stat .lbl { font-size: .85rem; color: var(--text-faint); }

.badge-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 15px; border-radius: 999px;
  background: var(--accent-grad-soft); border: 1px solid var(--border);
  font-size: .82rem; color: var(--text-dim); margin-bottom: 26px;
}
.badge-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(52,211,153,.18); }

/* Hero visual — terminal card */
.term {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.term-bar { display: flex; align-items: center; gap: 7px; padding: 13px 16px; border-bottom: 1px solid var(--border-soft); }
.term-bar i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.term-bar i:nth-child(1){ background:#ff5f56; } .term-bar i:nth-child(2){ background:#ffbd2e; } .term-bar i:nth-child(3){ background:#27c93f; }
.term-bar span { margin-left: 8px; font-size: .8rem; color: var(--text-faint); }
.term-body { padding: 20px; font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: .85rem; line-height: 1.85; }
.term-body .c { color: var(--text-faint); }
.term-body .p { color: var(--brand-2); }
.term-body .g { color: var(--ok); }
.term-body .v { color: var(--brand-3); }
.term-body .w { color: #fbbf24; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; transition: .22s; position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-4px); border-color: var(--brand); background: var(--bg-card-hover); }
.card .ico {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-grad-soft); border: 1px solid var(--border); font-size: 22px; margin-bottom: 18px;
}
.card h3 { font-size: 1.18rem; margin-bottom: 10px; }
.card p { color: var(--text-dim); font-size: .96rem; }

/* ---------- Skill chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  padding: 8px 15px; border-radius: 999px; font-size: .86rem; font-weight: 500;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim);
  transition: .18s;
}
.chip:hover { border-color: var(--brand); color: var(--text); }

/* ---------- Project case study cards ---------- */
.proj {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 34px; transition: .22s; position: relative; overflow: hidden;
}
.proj::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-grad); opacity: 0; transition: .25s;
}
.proj:hover { border-color: var(--brand); transform: translateY(-4px); }
.proj:hover::before { opacity: 1; }
.proj-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.proj-num { font-size: .8rem; font-weight: 700; color: var(--brand-2); letter-spacing: .1em; }
.proj h3 { font-size: 1.4rem; margin-bottom: 8px; }
.proj .tag { font-size: .78rem; padding: 5px 11px; border-radius: 999px; background: var(--accent-grad-soft); border: 1px solid var(--border); color: var(--text-dim); white-space: nowrap; }
.proj .summary { color: var(--text-dim); margin-bottom: 20px; }
.proj h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); margin: 18px 0 10px; }
.feat-list { list-style: none; display: grid; gap: 9px; }
.feat-list li { position: relative; padding-left: 26px; color: var(--text-dim); font-size: .95rem; }
.feat-list li::before {
  content: "▸"; position: absolute; left: 0; top: 0; color: var(--brand-2); font-weight: 700;
}
.proj .stack { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.proj .stack .s { font-size: .78rem; padding: 5px 11px; border-radius: 7px; background: var(--bg-soft); border: 1px solid var(--border-soft); color: var(--text-faint); }

/* ---------- Timeline / process ---------- */
.steps { display: grid; gap: 0; }
.step { display: grid; grid-template-columns: 56px 1fr; gap: 20px; padding-bottom: 34px; position: relative; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 27px; top: 50px; bottom: 0; width: 2px; background: var(--border); }
.step .n { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; background: var(--accent-grad-soft); border: 1px solid var(--border); color: var(--text); }
.step h3 { font-size: 1.15rem; margin-bottom: 6px; }
.step p { color: var(--text-dim); font-size: .96rem; }

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--accent-grad-soft); border: 1px solid var(--border);
  border-radius: 24px; padding: 56px 48px; text-align: center;
}
.cta-band h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); margin-bottom: 14px; }
.cta-band p { color: var(--text-dim); max-width: 560px; margin: 0 auto 28px; }
.cta-band .hero-cta { justify-content: center; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border-soft); padding: 40px 0; color: var(--text-faint); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer a { color: var(--text-dim); }
.footer a:hover { color: var(--text); }

/* ---------- Hero right column (avatar + terminal stacked) ---------- */
.hero-visual { display: flex; flex-direction: column; align-items: center; gap: 22px; width: 100%; }
.hero-visual .avatar-wrap { margin-bottom: 0 !important; }
.hero-visual .term { width: 100%; max-width: 400px; }

/* ---------- Profile photo (hero) ---------- */
.avatar-wrap {
  position: relative; display: grid; place-items: center;
  width: 100%; max-width: 380px; margin-inline: auto;
}
/* Gradient glow ring behind the photo — blends it into the brand palette */
.avatar-wrap::before {
  content: ""; position: absolute; inset: -14px; z-index: 0;
  background: var(--accent-grad); border-radius: 34px;
  filter: blur(36px); opacity: .35;
}
/* Gradient border frame */
.avatar-frame {
  position: relative; z-index: 1; width: 100%; border-radius: 26px;
  padding: 3px; background: var(--accent-grad);
  box-shadow: var(--shadow);
}
.avatar, .avatar-fallback {
  display: block; width: 100%; aspect-ratio: 4/5; border-radius: 23px;
}
.avatar {
  object-fit: cover; object-position: center top;
  /* nudge the warm photo toward the cool theme so it sits in the palette */
  filter: saturate(.92) contrast(1.03) brightness(.98);
}
/* Cool tint + bottom fade so the photo melts into the dark background */
.avatar-frame::after {
  content: ""; position: absolute; inset: 3px; border-radius: 23px; pointer-events: none;
  background:
    linear-gradient(180deg, transparent 55%, rgba(10,11,20,.55) 100%),
    linear-gradient(135deg, rgba(124,92,255,.18), rgba(34,211,238,.12));
  mix-blend-mode: normal;
}
.avatar-fallback {
  display: grid; place-items: center; font-size: 5rem; font-weight: 800; color: #fff;
  background: var(--accent-grad); letter-spacing: -.04em;
}
.avatar-badge {
  position: absolute; z-index: 2; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(10,11,20,.78); backdrop-filter: blur(10px); border: 1px solid var(--border);
  padding: 8px 18px; border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap;
}

/* ---------- Project screenshots ---------- */
.shots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
.shots.single { grid-template-columns: 1fr; }
.shot {
  border-radius: 12px; overflow: hidden; border: 1px solid var(--border); cursor: zoom-in;
  background: var(--bg-soft); transition: .2s; position: relative;
}
.shot img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16/10; transition: .3s; display: block; }
.shot:hover { border-color: var(--brand); }
.shot:hover img { transform: scale(1.04); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(5,6,12,.92); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 32px; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92%; max-height: 92%; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.lightbox .x { position: absolute; top: 22px; right: 28px; font-size: 34px; color: #fff; cursor: pointer; line-height: 1; }

/* ---------- Track switcher (AI / Full-Stack) ---------- */
.track-switch {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 22px;
  background: var(--bg-card); border: 1px solid var(--border); margin-bottom: 22px; max-width: 100%;
}
.track-switch a {
  padding: 7px 16px; border-radius: 999px; font-size: .86rem; font-weight: 600;
  color: var(--text-dim); transition: .18s; white-space: nowrap;
}
.track-switch a:hover { color: var(--text); }
.track-switch a.on { background: var(--accent-grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(124,92,255,.9); }

/* ---------- Trust bar (under hero) ---------- */
.trust-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--border-soft);
}
.trust-bar .t { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--text-dim); }
.trust-bar .t b { color: var(--text); }
.trust-bar .t .ic { color: var(--brand-2); }

/* ---------- Why hire me ---------- */
.why-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.why-list { list-style: none; display: grid; gap: 16px; }
.why-list li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.why-list .ck {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent-grad); color: #fff; font-size: 15px; font-weight: 800;
}
.why-list .tx b { display: block; color: var(--text); margin-bottom: 2px; }
.why-list .tx span { color: var(--text-dim); font-size: .94rem; }
.why-card {
  background: var(--accent-grad-soft); border: 1px solid var(--border); border-radius: 20px; padding: 32px;
}
.why-card h3 { font-size: 1.3rem; margin-bottom: 14px; }
.why-card p { color: var(--text-dim); margin-bottom: 20px; }

/* ---------- Testimonials ---------- */
.quotes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.quote {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column; gap: 16px; transition: .2s;
}
.quote:hover { border-color: var(--brand); transform: translateY(-4px); }
.stars { color: #fbbf24; font-size: 1rem; letter-spacing: 2px; }
.quote .body { color: var(--text); font-size: 1rem; line-height: 1.7; flex: 1; }
.quote .who { display: flex; align-items: center; gap: 12px; }
.quote .who .pic {
  width: 44px; height: 44px; border-radius: 50%; background: var(--accent-grad);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 1rem;
}
.quote .who .nm { font-weight: 700; font-size: .95rem; }
.quote .who .rl { font-size: .82rem; color: var(--text-faint); }

@media (max-width: 900px) {
  .why-grid { grid-template-columns: 1fr; }
  .quotes { grid-template-columns: 1fr; }
}

/* ---------- Reveal animation (no-JS safe: only hides when .js is set) ---------- */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Page header (sub pages) ---------- */
.page-head { padding: 72px 0 40px; }
.page-head h1 { font-size: clamp(2.1rem, 4.5vw, 3.2rem); margin-bottom: 16px; }

/* ---------- About specifics ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.metric-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.metric { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 22px; text-align: center; }
.metric .num { font-size: 1.7rem; font-weight: 800; }
.metric .lbl { font-size: .82rem; color: var(--text-faint); }

.contact-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px;
}
.contact-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.contact-row:last-child { border-bottom: 0; }
.contact-row .ico { width: 42px; height: 42px; border-radius: 11px; background: var(--accent-grad-soft); border: 1px solid var(--border); display: grid; place-items: center; font-size: 19px; }
.contact-row .lbl { font-size: .8rem; color: var(--text-faint); }
.contact-row .val { font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid, .about-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .metric-row { grid-template-columns: repeat(2,1fr); }
  .nav-links { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; background: var(--bg-soft); border-bottom: 1px solid var(--border); padding: 14px 24px; gap: 4px; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; }
  .nav-toggle { display: block; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  section { padding: 60px 0; }
  .cta-band { padding: 40px 22px; }
}

/* ===========================================================
   Motion & micro-interactions
   =========================================================== */

/* Hero entrance — staggered fade-up for the text column (skips .reveal items) */
@keyframes heroUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes heroIn { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
.hero-grid > div:first-child > *:not(.reveal) { animation: heroUp .7s cubic-bezier(.2,.7,.2,1) both; }
.hero-grid > div:first-child > *:not(.reveal):nth-child(2) { animation-delay: .06s; }
.hero-grid > div:first-child > *:not(.reveal):nth-child(3) { animation-delay: .12s; }
.hero-grid > div:first-child > *:not(.reveal):nth-child(4) { animation-delay: .18s; }
.hero-grid > div:first-child > *:not(.reveal):nth-child(5) { animation-delay: .24s; }
.hero-grid > div:first-child > *:not(.reveal):nth-child(6) { animation-delay: .30s; }
.hero-grid > div:first-child > *:not(.reveal):nth-child(7) { animation-delay: .36s; }
.hero-grid > div:first-child > *:not(.reveal):nth-child(8) { animation-delay: .42s; }
.hero-visual { animation: heroIn .9s cubic-bezier(.2,.7,.2,1) .25s both; }

/* Animated gradient text shimmer */
.h-grad { background-size: 220% auto; animation: shimmer 7s linear infinite; }
@keyframes shimmer { to { background-position: 220% center; } }

/* Avatar glow gently pulsing */
.avatar-wrap::before { animation: glowPulse 4.5s ease-in-out infinite; }
@keyframes glowPulse { 0%, 100% { opacity: .3; } 50% { opacity: .55; } }

/* Terminal blinking cursor */
.term-body::after { content: "▋"; color: var(--brand-2); animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Primary button shine sweep on hover */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -130%; width: 55%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.28), transparent);
  transform: skewX(-20deg); pointer-events: none;
}
.btn-primary:hover::after { animation: shine .75s ease; }
@keyframes shine { to { left: 150%; } }

/* Nav link underline grow */
.nav-links a:not(.nav-cta) { position: relative; }
.nav-links a:not(.nav-cta)::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 5px; height: 2px;
  background: var(--accent-grad); border-radius: 2px; transform: scaleX(0); transform-origin: left;
  transition: transform .25s ease;
}
.nav-links a:not(.nav-cta):hover::after, .nav-links a.active::after { transform: scaleX(1); }

/* Smoother, springier card/proj/quote hover */
.card, .proj, .quote, .chip, .btn, .metric { transition: transform .25s cubic-bezier(.2,.7,.2,1), border-color .25s ease, background .25s ease, box-shadow .25s ease; }
.card:hover, .quote:hover { box-shadow: 0 18px 40px -22px rgba(124,92,255,.55); }
.metric:hover { transform: translateY(-3px); border-color: var(--brand); }

/* Badge availability dot pulse (ring) */
.badge-pill .dot { animation: dotPulse 2s ease-out infinite; }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.5); } 70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
