/* ============================================================
   Shah Nawaz Haider — Academic Portfolio
   Design goals: academic, readable, timeless, fast.
   No webfonts, no frameworks, no shadows-as-decoration.
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-alt: #f7f6f3;
  --text: #13161b;
  --muted: #454f5a;
  --accent: #0e4d92;
  --accent-dark: #0a3a6e;
  --border: #e3e1dc;
  --border-strong: #cfccc4;
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 70rem;
  --maxw-wide: 76rem;
  --nav-h: 3.75rem;
}

/* ---------- Reset & base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-align: left;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

p { margin: 0 0 1rem; }
ul, ol { margin: 0; padding-left: 1.25rem; }
li { margin-bottom: 0.35rem; }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: #dbe7f5; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container-wide {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-h);
  gap: 1rem;
}

.nav-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  white-space: nowrap;
}
.nav-name:hover { text-decoration: none; color: var(--accent); }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--muted);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  padding: 0.25rem;
}
.icon-link:hover { color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1.1rem;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  text-decoration: none;
}

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

.btn-small {
  padding: 0.3rem 0.8rem;
  font-size: 0.825rem;
}

/* ---------- Hero ---------- */

.hero {
  padding: 3.5rem 0 3rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2.5rem;
  align-items: start;
}

.hero h1 {
  font-size: 2.4rem;
  margin-bottom: 0.35rem;
}

.hero-role {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.hero-affil {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.hero-intro { margin-bottom: 1rem; }

.phd-highlight {
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  background: rgba(14, 77, 146, 0.07);
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 1.08rem;
}

.hero-interests {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.interests-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.hero-social {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  list-style: none;
  padding: 0;
  font-family: var(--sans);
  font-size: 0.9rem;
}

.hero-photo img {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* ---------- Sections ---------- */

.section {
  padding: 3.25rem 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--nav-h) + 0.5rem);
}

.hero { scroll-margin-top: calc(var(--nav-h) + 0.5rem); }

.section-alt { background: var(--bg-alt); }

.section h2 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--text);
  display: inline-block;
}

.section-note {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.subheading {
  font-size: 1.15rem;
  margin-top: 2rem;
}

/* ---------- Justified body text (academic document style) ---------- */

main p, main li {
  text-align: justify;
}

.prose p { max-width: none; }

.epigraph {
  margin: 0 0 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text);
}

/* ---------- Research directions ---------- */

.directions { margin-top: 2rem; }

.directions-title {
  font-size: 1.1rem;
  font-family: var(--sans);
  font-weight: 600;
}

.direction-list {
  padding-left: 1.5rem;
}
.direction-list li {
  margin-bottom: 0.9rem;
  padding-left: 0.25rem;
}

/* ---------- Interest cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
}

.section-alt .card { background: #fff; }

.card h3 {
  font-size: 1.02rem;
  margin-bottom: 0.35rem;
}

.card p {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0;
}

/* ---------- Publications ---------- */

.pub-subheading {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 2rem 0 1rem;
}

.pub-list {
  list-style: none;
  padding: 0;
  counter-reset: pub;
}

.pub {
  counter-increment: pub;
  position: relative;
  padding: 0 0 1.4rem 2.5rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: none; }

.pub::before {
  content: "[" counter(pub) "]";
  position: absolute;
  left: 0;
  top: 0.1rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}

.pub-title {
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }

.pub-authors {
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.pub-venue {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.pub-tags {
  margin-bottom: 0.5rem;
}

.tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-dark);
  background: #eaf1f9;
  border-radius: 3px;
  padding: 0.12rem 0.5rem;
  margin-right: 0.35rem;
}

.pub-desc {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.pub-links {
  font-family: var(--sans);
  font-size: 0.85rem;
  margin: 0;
}
.pub-links a { margin-right: 0.9rem; }
.pub-links a::before { content: "["; color: var(--muted); }
.pub-links a::after { content: "]"; color: var(--muted); }

/* ---------- Projects ---------- */

.project {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.4rem;
}

.project-head {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
  margin-bottom: 0.9rem;
}

.project h3 {
  font-size: 1.12rem;
  margin-bottom: 0.15rem;
}

.project-meta {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.project p { font-size: 0.97rem; }

.project .tech {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.project-links {
  font-family: var(--sans);
  font-size: 0.88rem;
  margin: 0;
}
.project-links a {
  margin-right: 1rem;
  font-weight: 500;
}

/* ---------- Timeline ---------- */

.timeline {
  border-left: 2px solid var(--border-strong);
  padding-left: 1.5rem;
  margin-left: 0.25rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}
.timeline-item:last-child { margin-bottom: 0; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1.5rem - 6px);
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.section-alt .timeline-item::before { border-color: var(--bg-alt); }

.timeline-date {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.1rem;
}

.timeline-item h3 {
  font-size: 1.08rem;
  margin-bottom: 0.1rem;
}

.timeline-sub {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.timeline-item ul {
  font-size: 0.95rem;
}

/* ---------- Awards ---------- */

.award-list {
  list-style: none;
  padding: 0;
}

.award-list li {
  display: flex;
  gap: 1.25rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.award-list li:last-child { border-bottom: none; }

.award-year {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 2.5rem;
  padding-top: 0.15rem;
}

.award-detail {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

.cert-list {
  list-style: none;
  padding: 0;
}

.cert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.9rem 1.25rem;
  margin-bottom: 0.75rem;
}

.cert-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cert-title {
  font-weight: 600;
  color: var(--text);
}
.cert-title:hover { color: var(--accent); }

.cert-meta {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
}

.cert-verify {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Skills ---------- */

.skills-list { margin: 0; }

.skills-row {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.skills-row:last-child { border-bottom: none; }

.skills-row dt {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.skills-row dd {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

/* ---------- Contact ---------- */

.contact-lede {
  font-size: 1.05rem;
}

.contact-email {
  font-size: 1.3rem;
  margin: 1.5rem 0;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-name {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  list-style: none;
  padding: 0;
  margin-bottom: 0.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
}

.footer-copy { margin: 0; font-size: 0.82rem; }

/* ---------- Reveal animation ---------- */

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 56rem) {
  .nav-toggle { display: flex; }

  .nav-menu {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem 1.25rem;
  }

  .nav-menu.open { display: flex; }

  .nav-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .nav-link { font-size: 1rem; }

  .nav-actions { padding-top: 0.5rem; }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .hero-photo { order: -1; }
  .hero-photo img { width: 160px; height: 160px; }

  .card-grid { grid-template-columns: 1fr; }

  .skills-row { grid-template-columns: 1fr; gap: 0.15rem; }

  .pub { padding-left: 2.1rem; }
}

@media (max-width: 34rem) {
  body { font-size: 1rem; }
  .hero h1 { font-size: 1.9rem; }
  .section { padding: 2.5rem 0; }
  .project { padding: 1.1rem 1.1rem; }
  .cert-item { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Print ---------- */

@media print {
  .site-header, .nav-toggle, .hero-actions, .skip-link { display: none; }
  .section, .hero { padding: 1rem 0; }
  .reveal { opacity: 1; transform: none; }
  a { color: var(--text); text-decoration: underline; }
}
