/* ============================================================
   JUNAID BIN ABDUL RAZZAQ — Personal Website
   Design Direction: Refined Editorial Minimalism
   ============================================================ */

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

/* --- LIGHT MODE TOKENS --- */
:root,
[data-theme="light"] {
  --bg:            #F8F9FB;
  --bg-alt:        #FFFFFF;
  --navy:          #0B132B;
  --accent:        #2563EB;
  --text:          #1E293B;
  --text-muted:    #64748B;
  --text-subtle:   #94A3B8;
  --border:        #E2E8F0;
  --border-soft:   #F1F5F9;
  --card-bg:       #FFFFFF;
  --metric-bg:     rgba(37, 99, 235, 0.05);
  --metric-border: rgba(37, 99, 235, 0.12);
  --tag-bg:        rgba(37, 99, 235, 0.06);
  --tag-border:    rgba(37, 99, 235, 0.15);
  --toggle-bg:     #E2E8F0;
  --toggle-hover:  #CBD5E1;
  --contact-bg:    var(--navy);
  --contact-text:  #FFFFFF;
  --contact-muted: rgba(255,255,255,0.6);
  --contact-label: rgba(255,255,255,0.45);
  --contact-link-border: rgba(255,255,255,0.2);
  --contact-link-hover:  var(--accent);
  --footer-bg:     var(--navy);
  --footer-text:   rgba(255,255,255,0.35);
  --footer-border: rgba(255,255,255,0.08);
  --shadow-card:   0 8px 24px rgba(37, 99, 235, 0.08);
}

/* --- DARK MODE TOKENS --- */
[data-theme="dark"] {
  --bg:            #0D1117;
  --bg-alt:        #161B22;
  --navy:          #E2E8F0;
  --accent:        #3B82F6;
  --text:          #CDD9E5;
  --text-muted:    #8B949E;
  --text-subtle:   #6E7681;
  --border:        #21262D;
  --border-soft:   #1C2128;
  --card-bg:       #161B22;
  --metric-bg:     rgba(59, 130, 246, 0.08);
  --metric-border: rgba(59, 130, 246, 0.2);
  --tag-bg:        rgba(59, 130, 246, 0.1);
  --tag-border:    rgba(59, 130, 246, 0.25);
  --toggle-bg:     #21262D;
  --toggle-hover:  #30363D;
  --contact-bg:    #161B22;
  --contact-text:  #E2E8F0;
  --contact-muted: rgba(226,232,240,0.6);
  --contact-label: rgba(226,232,240,0.35);
  --contact-link-border: rgba(226,232,240,0.15);
  --contact-link-hover:  var(--accent);
  --footer-bg:     #0D1117;
  --footer-text:   rgba(226,232,240,0.3);
  --footer-border: rgba(255,255,255,0.05);
  --shadow-card:   0 8px 24px rgba(0, 0, 0, 0.3);
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* --- UTILITY --- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (min-width: 768px) {
  .container { padding: 0 4rem; }
}

.section {
  padding: 6rem 0;
}

@media (min-width: 768px) {
  .section { padding: 8rem 0; }
}

.section__label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.section__heading {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--navy);
  margin-bottom: 2.5rem;
  max-width: 640px;
}

/* --- NAVIGATION --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(248, 249, 251, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.25s ease;
}

[data-theme="dark"] .nav {
  background: rgba(13, 17, 23, 0.9);
}

.nav.scrolled {
  border-bottom-color: var(--border);
}

.nav__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .nav__inner { padding: 0 4rem; }
}

/* --- NAV LOGO — mark + name lockup --- */
.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}

.nav__logo:hover .nav__logo-mark { opacity: 0.82; }
.nav__logo:hover .nav__logo-name  { color: var(--accent); }

.nav__logo-mark {
  display: block;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

/* SVG fill classes — theme-aware */
.logo-bg          { fill: #0B132B; }
.logo-stroke      { fill: #ffffff; }
.logo-stroke-path { stroke: #ffffff; }
.logo-dot         { fill: #2563EB; }

/* In dark mode the mark background stays navy — it acts as its own contained element */
[data-theme="dark"] .logo-bg { fill: #1e2d4d; }

.nav__logo-name {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--navy);
  transition: color 0.2s ease;
}

/* On very small screens show mark only */
@media (max-width: 420px) {
  .nav__logo-name { display: none; }
}

.nav__links {
  display: none;
  list-style: none;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 768px) {
  .nav__links { display: flex; }
}

.nav__links a {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav__links a:hover { color: var(--navy); }

.nav__cta {
  background: var(--text) !important;
  color: var(--bg) !important;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-weight: 500 !important;
  transition: background 0.2s ease !important;
}

[data-theme="dark"] .nav__cta {
  background: var(--accent) !important;
  color: #fff !important;
}

.nav__cta:hover { background: var(--accent) !important; color: #fff !important; }

/* Nav right controls grouping */
.nav__controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- DARK MODE TOGGLE --- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--toggle-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--toggle-hover);
  color: var(--navy);
  border-color: var(--text-subtle);
}

/* Show sun in dark mode, moon in light mode */
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: none; }

/* --- HAMBURGER --- */
.nav__hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

@media (min-width: 768px) { .nav__hamburger { display: none; } }

.nav__hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--navy);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav__hamburger.open span:first-child { transform: translateY(6.5px) rotate(45deg); }
.nav__hamburger.open span:last-child  { transform: translateY(-6.5px) rotate(-45deg); }

/* --- MOBILE MENU --- */
.nav__mobile {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 1.5rem 2rem;
}

.nav__mobile.open { display: block; }

.nav__mobile ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nav__mobile a {
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 400;
  display: block;
  padding: 0.4rem 0;
}

/* --- HERO --- */
.hero {
  padding-top: calc(64px + 6rem);
  padding-bottom: 6rem;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 64px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse at center, rgba(37, 99, 235, 0.07) 0%, transparent 70%);
  pointer-events: none;
}

[data-theme="dark"] .hero::before {
  background: radial-gradient(ellipse at center, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
}

.hero__inner { position: relative; z-index: 1; }

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero__headline {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 400;
  line-height: 1.1;
  color: var(--navy);
  letter-spacing: -0.01em;
  margin-bottom: 2.5rem;
  max-width: 700px;
}

.hero__headline em {
  font-style: italic;
  color: var(--accent);
}

.hero__sub {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  color: var(--text-muted);
  max-width: 580px;
  margin-bottom: 2.5rem;
  line-height: 1.75;
}

.hero__actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn--primary {
  background: var(--text);
  color: var(--bg);
}

[data-theme="dark"] .btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover { background: var(--accent); color: #fff; }

.btn--ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* --- HERO METRICS --- */
.hero__metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  background: var(--metric-bg);
  border: 1px solid var(--metric-border);
  border-radius: 12px;
  padding: 1.25rem 1.75rem;
  margin-bottom: 2rem;
  max-width: 680px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 1.5rem 0.5rem 0;
  flex: 1;
  min-width: 130px;
}

.metric:first-child { padding-left: 0; }

.metric__num {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
}

.metric__label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric__divider {
  width: 1px;
  height: 40px;
  background: var(--metric-border);
  margin-right: 1.5rem;
  flex-shrink: 0;
  align-self: center;
}

@media (max-width: 600px) {
  .metric__divider { display: none; }
  .metric { min-width: 45%; padding: 0.5rem 0; border-bottom: 1px solid var(--metric-border); }
  .metric:last-child { border-bottom: none; }
}

/* --- HERO TAGS --- */
.hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero__tags span {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
}

.hero__rule {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin-top: 6rem;
}

/* --- ABOUT --- */
.about__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .about__grid {
    grid-template-columns: 200px 1fr;
    gap: 4rem;
    align-items: start;
  }
}

.about__prose p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.about__prose p:last-child { margin-bottom: 0; }

/* --- EXPERTISE --- */
.expertise {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.expertise__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) { .expertise__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .expertise__grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="dark"] .card { background: var(--bg); }

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.card__icon {
  color: var(--accent);
  margin-bottom: 1rem;
}

.card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.card__desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* --- IMPACT --- */
.impact__intro {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 580px;
  margin-bottom: 4rem;
  font-style: italic;
}

.impact__list {
  border-top: 1px solid var(--border);
}

.impact__item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
  .impact__item {
    grid-template-columns: 120px 1fr;
    gap: 4rem;
    align-items: start;
  }
}

.impact__meta {
  padding-top: 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.impact__tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--tag-bg);
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
  border: 1px solid var(--tag-border);
}

.impact__stat {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.02em;
}

.impact__stat-label {
  font-size: 0.7rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  line-height: 1.3;
}

.impact__body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.impact__body p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 0.5rem;
}

.impact__body p:last-child { margin-bottom: 0; }

.impact__body strong {
  font-weight: 600;
  color: var(--text);
}

/* --- EXPERIENCE --- */
.experience {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.experience__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .experience__grid {
    grid-template-columns: 200px 1fr;
    gap: 4rem;
    align-items: start;
  }
}

.timeline {
  border-top: 1px solid var(--border);
}

.timeline__item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 640px) {
  .timeline__item {
    grid-template-columns: 180px 1fr;
    gap: 2.5rem;
    align-items: start;
  }
}

.timeline__company {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
  margin-bottom: 0.2rem;
}

.timeline__period {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.15rem;
}

.timeline__location {
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-bottom: 0.5rem;
}

.timeline__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
}

.timeline__role {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.75rem;
}

.timeline__right p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.timeline__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
}

.timeline__stack li {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

/* --- EDUCATION --- */
.education__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .education__grid {
    grid-template-columns: 200px 1fr;
    gap: 4rem;
    align-items: start;
  }
}

.education__card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2rem;
  background: var(--bg-alt);
}

@media (min-width: 640px) {
  .education__card {
    grid-template-columns: 180px 1fr;
    gap: 2.5rem;
    align-items: start;
  }
}

.education__institution {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.2rem;
}

.education__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.6rem;
}

.education__degree {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.education__abbr {
  font-weight: 400;
  color: var(--text-muted);
}

.education__right p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.75;
}

/* --- PHILOSOPHY --- */
.philosophy__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) { .philosophy__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .philosophy__grid { grid-template-columns: repeat(3, 1fr); } }

.principle {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  transition: border-color 0.2s ease;
}

.principle:hover { border-color: var(--accent); }

.principle p {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.2rem;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.principle footer {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  font-style: normal;
}

/* --- CONTACT --- */
.contact {
  background: var(--contact-bg);
}

.contact .section__label { color: var(--contact-label); }
.contact .section__heading { color: var(--contact-text); }

.contact__sub {
  font-size: 1rem;
  color: var(--contact-muted);
  max-width: 520px;
  margin-bottom: 2.5rem;
  line-height: 1.75;
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.contact__link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--contact-text);
  text-decoration: none;
  border: 1px solid var(--contact-link-border);
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.05);
}

.contact__link:hover {
  background: var(--contact-link-hover);
  border-color: var(--contact-link-hover);
}

/* --- FOOTER --- */
.footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--footer-border);
  padding: 2.5rem 0;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-start;
}

@media (min-width: 640px) {
  .footer__inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.footer span {
  font-size: 0.8rem;
  color: var(--footer-text);
}

/* --- FOOTER LOGO lockup --- */
.footer__logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.footer__logo:hover { opacity: 0.75; }

.footer__logo span {
  font-size: 0.8rem;
  color: var(--footer-text);
}

.footer__logo-mark {
  flex-shrink: 0;
  display: block;
}

/* --- ACCESSIBILITY --- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* --- SELECTION --- */
::selection {
  background: rgba(37, 99, 235, 0.15);
  color: var(--navy);
}

/* --- SCROLL OFFSET --- */
[id] { scroll-margin-top: 80px; }

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
