/* ============================================================
   A.R.M. Fahim — Portfolio
   Modern dark theme with light-mode toggle
   ============================================================ */

:root {
  --bg:        #0b0d12;
  --bg-alt:    #11141b;
  --surface:   #161a23;
  --surface-2: #1d2230;
  --border:    #262c3a;
  --text:      #e7ebf3;
  --text-dim:  #9aa4b8;
  --text-mute: #6b7488;
  --brand:     #6366f1;
  --brand-2:   #8b5cf6;
  --accent:    #22d3ee;
  --brand-soft:rgba(99,102,241,0.14);
  --shadow:    0 20px 50px -20px rgba(0,0,0,0.6);
  --radius:    16px;
  --maxw:      1120px;
  --ease:      cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --bg:        #f6f7fb;
  --bg-alt:    #eef0f7;
  --surface:   #ffffff;
  --surface-2: #f2f4fa;
  --border:    #e2e6f0;
  --text:      #12151d;
  --text-dim:  #4a5265;
  --text-mute: #7b8398;
  --brand-soft:rgba(99,102,241,0.10);
  --shadow:    0 20px 45px -22px rgba(30,40,90,0.25);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .4s var(--ease), color .4s var(--ease);
}

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

a { color: inherit; text-decoration: none; }
strong { color: var(--text); font-weight: 600; }

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  z-index: 200; transition: width .1s linear;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.nav__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.nav__brand-mark { font-family: 'JetBrains Mono', monospace; color: var(--brand); font-weight: 600; }
.nav__links { display: flex; gap: 30px; }
.nav__links a { color: var(--text-dim); font-weight: 500; font-size: .95rem; position: relative; transition: color .2s; }
.nav__links a::after {
  content: ''; position: absolute; left: 0; bottom: -6px; width: 0; height: 2px;
  background: var(--brand); transition: width .25s var(--ease);
}
.nav__links a:hover, .nav__links a.active { color: var(--text); }
.nav__links a.active::after { width: 100%; }
.nav__actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}
.theme-toggle:hover { transform: translateY(-2px); border-color: var(--brand); }
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.nav__burger { display: none; flex-direction: column; gap: 5px; width: 40px; height: 40px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer;
  align-items: center; justify-content: center; }
.nav__burger span { width: 18px; height: 2px; background: var(--text); transition: .3s var(--ease); }
.nav__burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger.open span:nth-child(2) { opacity: 0; }
.nav__burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 12px; font-weight: 600; font-size: .95rem;
  cursor: pointer; border: 1px solid transparent; transition: transform .2s var(--ease), box-shadow .2s, background .2s, border-color .2s;
}
.btn--lg { padding: 15px 28px; font-size: 1rem; }
.btn--primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 10px 24px -10px var(--brand); }
.btn--primary:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -10px var(--brand); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { transform: translateY(-3px); border-color: var(--brand); }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100vh; display: flex; align-items: center; padding: 120px 0 60px; overflow: hidden; }
.hero__bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(600px 400px at 15% 20%, var(--brand-soft), transparent 60%),
    radial-gradient(500px 500px at 85% 80%, rgba(34,211,238,0.10), transparent 60%);
}
.hero__inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.1fr .9fr; gap: 60px; align-items: center; }
.hero__eyebrow { color: var(--brand); font-family: 'JetBrains Mono', monospace; font-weight: 500; letter-spacing: .5px; margin-bottom: 10px; }
.hero__name { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 800; line-height: 1.05; letter-spacing: -1.5px; }
.hero__name::after { content: '.'; color: var(--brand); }
.hero__role { font-size: clamp(1.15rem, 2.6vw, 1.7rem); font-weight: 600; margin: 14px 0 22px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.type-static { color: var(--text); }
.type-dynamic { color: var(--accent); font-family: 'JetBrains Mono', monospace; font-size: .9em; border-right: 2px solid var(--accent); padding-right: 4px; }
.hero__desc { color: var(--text-dim); font-size: 1.08rem; max-width: 540px; margin-bottom: 30px; }
.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 28px; }
.hero__socials { display: flex; gap: 14px; }
.hero__socials a {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  transition: transform .2s, color .2s, border-color .2s;
}
.hero__socials a:hover { transform: translateY(-3px); color: var(--brand); border-color: var(--brand); }

/* Code card */
.hero__card { display: flex; justify-content: center; }
.code-card {
  width: 100%; max-width: 420px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
  transform: perspective(1000px) rotateY(-6deg) rotateX(3deg);
  transition: transform .4s var(--ease);
}
.code-card:hover { transform: perspective(1000px) rotateY(0) rotateX(0); }
.code-card__bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot--red { background: #ff5f57; } .dot--yellow { background: #febc2e; } .dot--green { background: #28c840; }
.code-card__file { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: .8rem; color: var(--text-mute); }
.code-card__body { padding: 22px 20px; font-family: 'JetBrains Mono', monospace; font-size: .82rem; line-height: 1.85; overflow-x: auto; }
.code-card__body .k { color: #c084fc; }
.code-card__body .c { color: #22d3ee; }
.code-card__body .s { color: #86efac; }
.code-card__body .fn { color: #fbbf24; }
.code-card__body .n { color: #f472b6; }

/* Hero profile photo */
.hero__photo {
  position: relative; width: 100%; max-width: 360px; padding: 5px;
  border-radius: 28px;
  background: linear-gradient(150deg, var(--brand), var(--accent));
  box-shadow: 0 30px 60px -28px rgba(0,0,0,.65);
  transition: transform .4s var(--ease);
}
.hero__photo::before {
  content: ''; position: absolute; inset: -14%; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, var(--brand-soft), transparent 70%);
  filter: blur(10px);
}
.hero__photo:hover { transform: translateY(-6px); }
.hero__photo img {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover;
  object-position: 50% 32%; border-radius: 23px;
}
.hero__photo-tag {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 8px 16px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  color: var(--text); background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--border);
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.55);
}
.hero__photo-tag .mono { font-family: 'JetBrains Mono', monospace; color: var(--brand); font-weight: 700; }

.hero__scroll { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); width: 26px; height: 42px; border: 2px solid var(--text-mute); border-radius: 20px; z-index: 1; }
.hero__scroll span { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 4px; height: 8px; border-radius: 4px; background: var(--brand); animation: scrolldot 1.6s infinite; }
@keyframes scrolldot { 0% { opacity: 0; top: 8px; } 40% { opacity: 1; } 80% { opacity: 0; top: 22px; } 100% { opacity: 0; } }

/* ---------- Stats ---------- */
.stats { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.stats__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding: 44px 24px; }
.stat { text-align: center; }
.stat__num { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; background: linear-gradient(135deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat__plus { font-size: 1.8rem; font-weight: 800; color: var(--brand); }
.stat p { color: var(--text-dim); font-size: .92rem; margin-top: 4px; }

/* ---------- Sections ---------- */
.section { padding: 100px 0; }
.section--alt { background: var(--bg-alt); }
.section__head { margin-bottom: 52px; }
.section__tag { font-family: 'JetBrains Mono', monospace; color: var(--brand); font-size: .9rem; font-weight: 500; }
.section__title { font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -1px; margin-top: 8px; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: start; }
.about__text p { color: var(--text-dim); margin-bottom: 18px; font-size: 1.05rem; }
.about__facts { display: grid; gap: 2px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.fact { display: flex; justify-content: space-between; gap: 16px; padding: 16px 20px; background: var(--surface); }
.fact__label { color: var(--text-mute); font-size: .9rem; }
.fact__value { color: var(--text); font-weight: 600; font-size: .92rem; text-align: right; display: flex; align-items: center; gap: 8px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--brand), transparent); }
.tl-item { position: relative; margin-bottom: 30px; }
.tl-item__dot { position: absolute; left: -30px; top: 26px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.tl-item__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px; transition: transform .25s var(--ease), border-color .25s; }
.tl-item__card:hover { transform: translateX(6px); border-color: var(--brand); }
.tl-item__top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.tl-item__top h3 { font-size: 1.2rem; font-weight: 700; }
.tl-item__date { font-family: 'JetBrains Mono', monospace; font-size: .82rem; color: var(--brand); background: var(--brand-soft); padding: 4px 12px; border-radius: 20px; white-space: nowrap; }
.tl-item__org { color: var(--accent); font-weight: 600; margin: 4px 0 14px; }
.tl-item__card ul { list-style: none; display: grid; gap: 8px; }
.tl-item__card li { position: relative; padding-left: 22px; color: var(--text-dim); font-size: .96rem; }
.tl-item__card li::before { content: '▹'; position: absolute; left: 0; color: var(--brand); }

/* ---------- Tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags span { font-family: 'JetBrains Mono', monospace; font-size: .76rem; color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); padding: 4px 11px; border-radius: 8px; }

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.skill-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px; transition: transform .25s var(--ease), border-color .25s; }
.skill-group:hover { transform: translateY(-4px); border-color: var(--brand); }
.skill-group h3 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; margin-bottom: 18px; }
.skill-group__icon { font-size: 1.2rem; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chips span { font-size: .85rem; padding: 7px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); font-weight: 500; transition: color .2s, border-color .2s, transform .2s; }
.chips span:hover { color: var(--text); border-color: var(--brand); transform: translateY(-2px); }

/* ---------- Projects ---------- */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.project { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; position: relative; overflow: hidden; }
.project::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: linear-gradient(90deg, var(--brand), var(--accent)); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.project:hover { transform: translateY(-6px); border-color: var(--brand); box-shadow: var(--shadow); }
.project:hover::before { transform: scaleX(1); }
.project__icon { font-size: 2rem; margin-bottom: 14px; }
.project h3 { font-size: 1.25rem; font-weight: 700; }
.project__role { color: var(--accent); font-weight: 600; font-size: .9rem; margin: 4px 0 12px; }
.project__desc { color: var(--text-dim); font-size: .96rem; margin-bottom: 8px; }

/* ---------- Education ---------- */
.edu { display: flex; gap: 24px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; }
.edu__icon { font-size: 2.6rem; }
.edu__body { flex: 1; }
.edu__body h3 { font-size: 1.2rem; }

/* ---------- Contact ---------- */
.contact { text-align: center; max-width: 640px; margin: 0 auto; }
.contact__lead { color: var(--text-dim); font-size: 1.15rem; margin-bottom: 30px; }
.contact__actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding: 28px 0; }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer p { color: var(--text-mute); font-size: .9rem; }
.footer__top { color: var(--text-dim); font-size: .9rem; font-weight: 500; transition: color .2s; }
.footer__top:hover { color: var(--brand); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; gap: 40px; }
  .hero__card { order: -1; }
  .code-card { transform: none; max-width: 380px; }
  .hero__photo { max-width: 300px; }
  .about { grid-template-columns: 1fr; }
  .skills, .projects { grid-template-columns: 1fr; }
  .stats__grid { grid-template-columns: repeat(2, 1fr); gap: 30px 20px; }
}

@media (max-width: 680px) {
  .nav__links {
    position: fixed; top: 72px; right: 0; left: 0;
    flex-direction: column; gap: 0; background: var(--surface);
    border-bottom: 1px solid var(--border); padding: 10px 24px;
    transform: translateY(-120%); transition: transform .35s var(--ease); z-index: 90;
  }
  .nav__links.open { transform: translateY(0); }
  .nav__links a { padding: 14px 0; border-bottom: 1px solid var(--border); }
  .nav__links a:last-child { border-bottom: none; }
  .nav__burger { display: flex; }
  .section { padding: 72px 0; }
  .edu { flex-direction: column; text-align: center; }
  .tl-item__top { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
