/* Talha Islam — portfolio styles
   Light "living portrait" theme: soft porcelain sections, enormous condensed
   navy capitals, electric-blue → cyan gradient accents, one warm-cream
   contrast section for services. */

:root {
  --bg: #f7faff;
  --bg-2: #edf3fb;
  --card: #ffffff;
  --card-line: #d9e4f2;
  --ink: #0f2040;
  --text: #1c2b47;
  --muted: #55617a;
  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --cyan: #06b6d4;
  --grad: linear-gradient(92deg, #2563eb 0%, #06b6d4 100%);
  --cream: #fbf3e2;
  --cream-ink: #14213d;
  --cream-muted: #5f5a4c;
  --radius: 16px;
  --font-display: "Anton", "Arial Narrow", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

::selection { background: rgba(37, 99, 235, 0.22); }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- scroll progress ---------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 80;
  background: transparent;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---------- slim top nav ---------- */

.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(15, 32, 64, 0.09);
}
.nav-brand {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.nav-list {
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-list::-webkit-scrollbar { display: none; }
.nav-link {
  display: block;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 999px;
  transition: color 0.25s ease, background 0.25s ease;
}
.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--blue); background: rgba(37, 99, 235, 0.10); }

/* ---------- shared ---------- */

.section {
  padding: 110px 24px;
  scroll-margin-top: 60px;
  position: relative;
}
.section-inner { max-width: 1120px; margin: 0 auto; }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6.5vw, 76px);
  line-height: 1;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 54px;
}
.grad-title {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.mega-title {
  font-family: var(--font-display);
  font-size: clamp(52px, 9vw, 120px);
  line-height: 0.95;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  margin: 0;
  color: var(--ink);
}

.btn-blue {
  display: inline-block;
  padding: 14px 34px;
  border-radius: 999px;
  background: linear-gradient(180deg, #60a5fa, var(--blue-deep));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.btn-blue:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(37, 99, 235, 0.45);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: 120px 24px 64px;
  background:
    radial-gradient(ellipse 60% 45% at 50% 0%, rgba(6, 182, 212, 0.14), transparent 70%),
    radial-gradient(ellipse 45% 35% at 85% 90%, rgba(37, 99, 235, 0.12), transparent 70%),
    var(--bg);
  scroll-margin-top: 60px;
  overflow: hidden;
}
.hero-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(72vh, 620px);
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(56px, 12.5vw, 176px);
  line-height: 0.95;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  color: var(--ink);
  margin: 0;
  position: relative;
  z-index: 1;
  text-shadow: 0 0 80px rgba(6, 182, 212, 0.22);
}
.hero-avatar {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(330px, 60vw);
  text-align: center;
}
.hero-avatar canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 26px;
  cursor: pointer;
  /* Talha's fix (24 Nov): the picture stays centred over the headline but
     slightly transparent, so the letters of "HI, I'M TALHA" behind it show
     through and stay readable. Opacity is on the picture only — the hint
     text and the click/gaze behaviour are unaffected. */
  opacity: 0.8;
  border: 1px solid rgba(15, 32, 64, 0.10);
  box-shadow: 0 30px 60px rgba(15, 32, 64, 0.20), 0 0 60px rgba(37, 99, 235, 0.25), 0 0 120px rgba(6, 182, 212, 0.20);
}
.hero-avatar .avatar-fallback {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 26px;
  object-fit: cover;
  opacity: 0.8; /* same slight transparency as the canvas (see above) */
  border: 1px solid rgba(15, 32, 64, 0.10);
  box-shadow: 0 30px 60px rgba(15, 32, 64, 0.20), 0 0 60px rgba(37, 99, 235, 0.22);
}
.hero-avatar .avatar-fallback[hidden] { display: none; }
.avatar-hint {
  margin: 12px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.hero-bottom {
  max-width: 1120px;
  margin: 8px auto 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.hero-tagline {
  margin: 0;
  max-width: 36ch;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2.4px;
  line-height: 1.9;
  text-transform: uppercase;
  color: #31405f;
}
.hero-role {
  max-width: 1120px;
  margin: 34px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(15, 32, 64, 0.10);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

/* ---------- about ---------- */

.about { background: var(--bg-2); overflow: hidden; }
.about .section-inner { text-align: center; position: relative; z-index: 1; }
.about-text {
  max-width: 62ch;
  margin: 36px auto 0;
  font-size: 17px;
  line-height: 1.75;
  color: #33415e;
}
.about-photo {
  display: block;
  width: 148px;
  height: 148px;
  object-fit: cover;
  object-position: 50% 18%;
  margin: 40px auto 0;
  border-radius: 22px;
  padding: 3px;
  background: var(--grad);
  box-shadow: 0 18px 44px rgba(15, 32, 64, 0.20);
}
.availability {
  margin: 22px 0 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue-deep);
}
.avail-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
.about .btn-blue { margin: 0 auto; }

/* floating glossy doodles */
.doodle {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  filter: drop-shadow(0 14px 24px rgba(15, 32, 64, 0.20));
  animation: floaty 7s ease-in-out infinite alternate;
}
.doodle-moon { width: 92px; top: 56px; left: 4%; animation-duration: 8s; }
.doodle-smiley { width: 84px; bottom: 64px; left: 6%; animation-duration: 6.5s; animation-delay: -2s; }
.doodle-cube { width: 88px; top: 64px; right: 4.5%; animation-duration: 7.5s; animation-delay: -4s; }
.doodle-plane { width: 96px; bottom: 56px; right: 6%; animation-duration: 6s; animation-delay: -1s; }
@keyframes floaty {
  from { transform: translateY(-9px) rotate(-3deg); }
  to { transform: translateY(11px) rotate(3deg); }
}

/* ---------- services (warm cream) ---------- */

.services { background: var(--cream); color: var(--cream-ink); }
.dark-title { color: var(--cream-ink); }
.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 34px;
}
.service-num {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(84px, 9vw, 138px);
  line-height: 0.9;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.service-name {
  margin: 18px 0 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--cream-ink);
}
.service-desc { margin: 8px 0 0; font-size: 14.5px; line-height: 1.65; color: var(--cream-muted); }

/* ---------- cards (projects / publications / skills) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: 0 6px 24px rgba(15, 32, 64, 0.06);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 18px 40px rgba(15, 32, 64, 0.13);
}
.card-title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.4; color: var(--ink); }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--blue); }
.card-text { margin: 8px 0 0; font-size: 14.5px; line-height: 1.65; color: var(--muted); }
.card-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--blue);
  text-decoration: none;
}
.card-link::after { content: " \2192"; }
.card-link:hover { text-decoration: underline; }

/* ---------- entries & timeline ---------- */

.timeline {
  position: relative;
  margin-left: 6px;
  padding-left: 30px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--blue), var(--cyan));
  opacity: 0.6;
}
.entry { margin-bottom: 30px; position: relative; }
.entry:last-child { margin-bottom: 0; }
.timeline .entry::before {
  content: "";
  position: absolute;
  left: -37px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--blue);
}
.entry-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--ink); }
.entry-org { margin: 3px 0 0; font-size: 14px; font-weight: 600; color: #0284c7; }
.entry-note { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.points { margin: 8px 0 0; padding-left: 18px; font-size: 14.5px; color: #33415e; }
.points li { margin: 3px 0; }
.points li::marker { color: var(--blue); }

/* ---------- skills & languages ---------- */

.skill-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.skill-count, .lang-level {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--blue);
  white-space: nowrap;
}
.chips { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: #eef4fd;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: #24334f;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}
.chip:hover {
  border-color: rgba(37, 99, 235, 0.6);
  background: rgba(37, 99, 235, 0.10);
  transform: translateY(-1px);
}
.sub-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 38px);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink);
  text-align: center;
  margin: 56px 0 28px;
}
.lang-track {
  margin-top: 16px;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 32, 64, 0.09);
  overflow: hidden;
}
.lang-fill {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  border-radius: 999px;
  background: var(--grad);
}

/* ---------- contact ---------- */

.contact { background: var(--bg-2); }
.contact .section-inner { text-align: center; }
.contact-sub {
  max-width: 56ch;
  margin: 30px auto 0;
  font-size: 15.5px;
  color: var(--muted);
}
.contacts {
  list-style: none;
  margin: 38px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(15, 32, 64, 0.06);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.contact-pill:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.6);
  transform: translateY(-1px);
}
.icon { display: inline-flex; align-items: center; flex: none; }
.icon svg { width: 16px; height: 16px; display: block; }
.actions { margin-top: 38px; }
.actions button {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(15, 32, 64, 0.35);
  border-radius: 999px;
  padding: 12px 28px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.actions button:hover { border-color: var(--blue); background: rgba(37, 99, 235, 0.08); }

/* ---------- footer ---------- */

.footer {
  padding: 26px 24px 34px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid rgba(15, 32, 64, 0.09);
}
.footer p { margin: 0; }

/* ---------- scroll reveal (only when JS enables .anim) ---------- */
/* Content is fully visible by default: script.js adds .anim only when
   IntersectionObserver is available, so a no-JS / failed-JS visit can never
   leave anything hidden. Siblings stagger via the --d custom property,
   which script.js assigns per item; .settled (added once an item's reveal
   finishes) clears the delay so hover transitions stay snappy. */

.anim .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.7s ease var(--d, 0s),
    transform 0.75s cubic-bezier(0.22, 0.61, 0.36, 1) var(--d, 0s);
}
.anim .reveal.in {
  opacity: 1;
  transform: none;
}
.anim .reveal.settled { transition-delay: 0s; }

/* headings: a gentler rise with a slight scale for a premium feel */
.anim .reveal-title { transform: translateY(16px) scale(0.965); }
.anim .reveal-title.in { transform: none; }

/* hero: above-the-fold pieces glide in on page load, staggered by --d */
.anim .reveal-load {
  opacity: 0;
  animation: load-in 0.85s cubic-bezier(0.22, 0.61, 0.36, 1) var(--d, 0s) forwards;
}
@keyframes load-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

.anim .lang-fill { width: 0; }
.anim .card.in .lang-fill {
  width: var(--w, 0%);
  transition: width 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .services-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .section { padding: 72px 20px; }
  .topnav { padding: 10px 14px; gap: 12px; }
  .nav-brand { font-size: 11px; letter-spacing: 2px; }
  .nav-link { padding: 5px 8px; font-size: 11px; letter-spacing: 1.4px; }
  .hero { padding: 104px 16px 48px; }
  /* On narrow screens the centred avatar would hide most of the one-line
     headline, so the stage stacks: headline on top, avatar below it. */
  .hero-stage { min-height: 0; flex-direction: column; }
  .hero-title { font-size: clamp(46px, 14vw, 60px); }
  .hero-avatar {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: min(215px, 58vw);
    margin-top: 16px;
  }
  .hero-bottom { flex-direction: column; align-items: center; text-align: center; gap: 20px; }
  .hero-tagline { max-width: 44ch; }
  .card-grid { grid-template-columns: 1fr; }
  .doodle-moon { width: 56px; top: 26px; left: 3%; }
  .doodle-smiley { width: 52px; bottom: 30px; left: 4%; }
  .doodle-cube { width: 54px; top: 30px; right: 3%; }
  .doodle-plane { width: 58px; bottom: 28px; right: 4%; }
  .about-text { font-size: 16px; }
}
@media (max-width: 520px) {
  .services-grid { grid-template-columns: 1fr; }
  .service { text-align: center; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim .reveal { opacity: 1; transform: none; }
  .anim .reveal-load { opacity: 1; animation: none; }
  .anim .card.in .lang-fill, .anim .lang-fill { width: var(--w, 0%); }
}

/* ---------- print (clean light CV) ---------- */

@media print {
  body { background: #fff; color: #14141c; }
  .no-print, .topnav, .progress, .hero-avatar, .doodle, .actions { display: none !important; }
  .hero, .about, .contact { background: #fff; padding: 10px 6px; overflow: visible; }
  .hero-stage { min-height: 0; display: block; }
  .hero-title {
    font-size: 34px;
    white-space: normal;
    color: #14141c;
    text-shadow: none;
    text-align: left;
  }
  .hero-bottom { display: block; margin-top: 6px; }
  .hero-tagline { color: #333; }
  .btn-blue {
    background: none;
    color: #14141c;
    box-shadow: none;
    padding: 0;
    letter-spacing: 0.4px;
  }
  .hero-role { color: #555; border-top-color: #ccc; text-align: left; margin-top: 14px; }
  .section { padding: 16px 6px 0; }
  .mega-title, .section-title, .sub-title { color: #14141c; font-size: 26px; text-align: left; margin-bottom: 14px; }
  .grad-title, .grad-text {
    background: none;
    -webkit-text-fill-color: #14141c;
    color: #14141c;
  }
  .about .section-inner, .contact .section-inner { text-align: left; }
  .about-text, .contact-sub { color: #222; margin-left: 0; }
  .about-photo { display: none; }
  .availability { color: #14141c; }
  .avail-dot { animation: none; box-shadow: none; }
  .services { background: #fff; }
  .service-num {
    background: none;
    -webkit-text-fill-color: #14141c;
    color: #14141c;
    font-size: 40px;
  }
  .services-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .card {
    background: #fff;
    border-color: #ccc;
    box-shadow: none;
    break-inside: avoid;
  }
  .card-title, .card-title a, .entry-title { color: #14141c; }
  .card-text, .points, .entry-note { color: #333; }
  .entry-org { color: #333; }
  .chip { background: #fff; border-color: #bbb; color: #14141c; }
  .lang-track { background: #e5e5e5; }
  .lang-fill { background: #888; width: var(--w, 0%) !important; }
  .contact-pill { border-color: #bbb; background: none; color: #14141c; }
  .contacts { justify-content: flex-start; }
  .footer { color: #555; border-top-color: #ccc; text-align: left; padding-left: 6px; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .reveal-load { opacity: 1 !important; animation: none !important; }
  a { color: #14141c !important; text-decoration: none !important; }
}
