/* =====================================================================
   Muhammad Murtaza Tantry — academic homepage
   Custom lightweight theme (no framework, no build step)
   ===================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #f7f6f3;
  --bg-alt: #efede7;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --text: #1c1b19;
  --text-soft: #565248;
  --text-mute: #8a8478;
  --border: #e4e0d7;
  --accent: #b0472a;      /* terracotta */
  --accent-2: #2f6d5f;    /* deep teal */
  --accent-soft: rgba(176, 71, 42, 0.10);
  --ring: rgba(176, 71, 42, 0.35);
  --shadow-sm: 0 1px 2px rgba(28, 27, 25, 0.06), 0 2px 8px rgba(28, 27, 25, 0.05);
  --shadow-md: 0 8px 30px rgba(28, 27, 25, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

html[data-theme="dark"] {
  --bg: #14130f;
  --bg-alt: #1b1a15;
  --surface: #1f1d18;
  --surface-2: #242119;
  --text: #f0ede4;
  --text-soft: #c3bdae;
  --text-mute: #8f897b;
  --border: #322e26;
  --accent: #e07a54;
  --accent-2: #58b39d;
  --accent-soft: rgba(224, 122, 84, 0.14);
  --ring: rgba(224, 122, 84, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(160%) blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background-color .3s ease;
}
.nav.is-scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.nav__inner {
  max-width: var(--maxw); margin: 0 auto; padding: .7rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.nav__brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 600; }
.nav__brand:hover { text-decoration: none; }
.nav__mark {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  background: var(--accent); color: #fff; border-radius: 9px;
  font-family: var(--font-display); font-size: .82rem; letter-spacing: .02em;
}
.nav__name { font-size: .95rem; white-space: nowrap; }
.nav__links { display: flex; gap: .35rem; margin-left: auto; }
.nav__links a {
  color: var(--text-soft); font-size: .93rem; font-weight: 500;
  padding: .45rem .7rem; border-radius: 8px; transition: color .2s, background-color .2s;
}
.nav__links a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.nav__actions { display: flex; align-items: center; gap: .4rem; }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  border-radius: 10px; cursor: pointer; transition: color .2s, border-color .2s, background-color .2s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--ring); }
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }
.nav__burger { display: none; }

/* ---------- Layout helpers ---------- */
.section {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3.5rem, 7vw, 6rem) 1.5rem;
}
.section--alt {
  max-width: none; background: var(--bg-alt);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.section--alt > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.section__head { margin-bottom: 2.5rem; }
.section__kicker {
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .05em;
  color: var(--accent); text-transform: uppercase; display: block; margin-bottom: .5rem;
}
.section__title { font-family: var(--font-display); font-size: clamp(1.9rem, 4vw, 2.6rem); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero__glow {
  position: absolute; inset: -30% 30% auto -10%; height: 620px;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  filter: blur(20px); pointer-events: none; z-index: 0;
}
.hero__inner {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) 1.5rem clamp(2.5rem, 5vw, 4rem);
  display: grid; grid-template-columns: 1.3fr .9fr; gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.hero__eyebrow {
  font-family: var(--font-mono); font-size: .85rem; color: var(--accent-2);
  letter-spacing: .04em; margin-bottom: 1rem;
}
.hero__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.1rem, 6.5vw, 4.6rem); letter-spacing: -0.02em; margin-bottom: 1.3rem;
  overflow-wrap: break-word; hyphens: auto;
}
.hero__lead { font-size: clamp(1.05rem, 2vw, 1.22rem); color: var(--text-soft); max-width: 44ch; }
.hero__lead strong { color: var(--text); font-weight: 600; }
.hero__meta { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.6rem 0 1.8rem; }
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft);
  padding: .4rem .8rem; border-radius: 999px; font-size: .85rem; box-shadow: var(--shadow-sm);
}
.chip svg { color: var(--accent); }
.hero__cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1.8rem; }

.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .75rem 1.3rem; border-radius: 11px; font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; cursor: pointer; transition: transform .15s ease, box-shadow .2s, background-color .2s, border-color .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { box-shadow: var(--shadow-md); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--ring); color: var(--accent); }

.hero__socials { display: flex; gap: .6rem; list-style: none; }
.hero__socials a {
  display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); transition: color .2s, border-color .2s, transform .15s;
}
.hero__socials a:hover { color: var(--accent); border-color: var(--ring); transform: translateY(-2px); }

.hero__portrait { display: flex; flex-direction: column; align-items: center; gap: 1.2rem; }
.portrait-frame {
  position: relative; border-radius: 22px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
  max-width: 320px; width: 100%; aspect-ratio: 4 / 5; background: var(--surface-2);
}
.portrait-frame::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(176,71,42,.16));
  pointer-events: none;
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }
.portrait-frame--mono {
  display: grid; place-content: center; gap: .5rem; text-align: center;
  background:
    radial-gradient(120% 120% at 20% 15%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 55%),
    linear-gradient(145deg, var(--surface-2), var(--surface));
}
.portrait-frame--mono::after {
  background: linear-gradient(180deg, transparent 60%, rgba(47,109,95,.14));
}
.monogram {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(3.2rem, 9vw, 4.6rem);
  letter-spacing: .04em; color: var(--accent); line-height: 1;
}
.monogram__sub {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-mute);
}
.id-card {
  width: 100%; max-width: 320px; margin: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .9rem 1.1rem; display: grid; gap: .5rem; box-shadow: var(--shadow-sm);
}
.id-card div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.id-card dt { font-size: .78rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: .03em; }
.id-card dd { margin: 0; font-family: var(--font-mono); font-size: .82rem; color: var(--text); }

/* ---------- About ---------- */
.about { max-width: 68ch; }
.about__lede p { font-size: 1.1rem; color: var(--text-soft); }
.about__lede strong { color: var(--text); }

/* ---------- Cards (research interests) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.2rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem 1.5rem; box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--ring); }
.card__icon {
  width: 48px; height: 48px; display: grid; place-items: center; font-size: 1.5rem;
  background: var(--accent-soft); border-radius: 12px; margin-bottom: 1rem;
}
.card h3 { font-size: 1.12rem; margin: 0; }
.card p { color: var(--text-soft); font-size: .95rem; margin: 0; }

/* ---------- Publications ---------- */
.pub-group {
  font-family: var(--font-display); font-size: 1.4rem; margin: 2.4rem 0 1.2rem;
  padding-bottom: .5rem; border-bottom: 2px solid var(--border);
}
.pub-group:first-of-type { margin-top: 0; }
.pub-list { list-style: none; counter-reset: pub; display: grid; gap: 1rem; }
.pub {
  display: grid; grid-template-columns: 90px 1fr; gap: 1.2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem 1.5rem; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .2s, border-color .2s;
}
.pub:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--ring); }
.pub__year {
  font-family: var(--font-mono); font-size: .95rem; font-weight: 500; color: var(--accent);
  display: flex; flex-direction: column; gap: .5rem; align-items: flex-start;
}
.pub__badge {
  font-family: var(--font-sans); font-size: .68rem; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 14%, transparent);
  padding: .18rem .5rem; border-radius: 999px;
}
.pub__title { font-weight: 600; font-size: 1.05rem; margin-bottom: .4rem; color: var(--text); }
.pub__authors { margin: 0 0 .25rem; color: var(--text-soft); font-size: .93rem; }
.pub__authors strong { color: var(--accent); }
.pub__venue { margin: 0; color: var(--text-mute); font-size: .9rem; }

/* ---------- Timeline (education) ---------- */
.timeline { list-style: none; position: relative; padding-left: 1.8rem; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border);
}
.timeline__item { position: relative; padding-bottom: 2rem; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: ""; position: absolute; left: -1.8rem; top: 6px; width: 14px; height: 14px;
  background: var(--accent); border-radius: 50%; border: 3px solid var(--bg-alt); box-shadow: 0 0 0 1px var(--accent);
}
.timeline__date { font-family: var(--font-mono); font-size: .85rem; color: var(--accent-2); margin-bottom: .3rem; }
.timeline__content h3 { font-size: 1.2rem; }
.timeline__org { color: var(--text); font-weight: 500; margin: .2rem 0 .4rem; }
.timeline__desc { color: var(--text-soft); font-size: .95rem; margin: 0; }

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.2rem; }
.skills__group {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; box-shadow: var(--shadow-sm);
}
.skills__group h3 {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute);
  margin-bottom: 1rem; font-weight: 600;
}
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; }
.tags li {
  background: var(--accent-soft); color: var(--accent); font-size: .88rem; font-weight: 500;
  padding: .35rem .8rem; border-radius: 8px;
}
html[data-theme="dark"] .tags li { color: var(--text); }

/* ---------- More grid (awards/talks/workshops/refs) ---------- */
.more-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem 1.7rem; box-shadow: var(--shadow-sm);
}
.panel__title { display: flex; align-items: center; gap: .6rem; font-size: 1.2rem; margin-bottom: 1.1rem; }
.panel__ico {
  display: grid; place-items: center; width: 38px; height: 38px; font-size: 1.1rem;
  background: var(--accent-soft); border-radius: 10px; flex: none;
}
.lined { list-style: none; display: grid; gap: 1rem; }
.lined li {
  color: var(--text-soft); font-size: .96rem; padding-left: 1rem; position: relative; line-height: 1.55;
}
.lined li::before {
  content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px;
  background: var(--accent); border-radius: 50%;
}
.lined strong { color: var(--text); }
.lined__year {
  display: inline-block; font-family: var(--font-mono); font-size: .78rem; color: var(--accent-2);
  border: 1px solid var(--border); border-radius: 6px; padding: .05rem .4rem; margin-right: .5rem;
}

/* ---------- Contact ---------- */
.contact { padding-top: 0; }
.contact__card {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  color: #fff; border-radius: calc(var(--radius) + 6px);
  padding: clamp(2.5rem, 6vw, 4rem); text-align: center; box-shadow: var(--shadow-md);
}
.contact__card h2 { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: .8rem; }
.contact__card p { color: rgba(255,255,255,.9); max-width: 52ch; margin: 0 auto 1.8rem; font-size: 1.05rem; }
.contact__actions { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; }
.contact__card .btn--primary { background: #fff; color: var(--accent); }
.contact__card .btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.contact__card .btn--ghost:hover { color: #fff; border-color: #fff; background: rgba(255,255,255,.12); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-alt); }
.footer__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 2.5rem 1.5rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; justify-content: space-between;
}
.footer__inner p { margin: 0; color: var(--text-soft); font-size: .92rem; }
.footer__links { list-style: none; display: flex; gap: 1.2rem; }
.footer__links a { color: var(--text-soft); font-size: .92rem; }
.footer__links a:hover { color: var(--accent); }
.footer__note { width: 100%; color: var(--text-mute); font-size: .82rem; border-top: 1px solid var(--border); padding-top: 1rem; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 1.4rem; bottom: 1.4rem; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--accent); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .25s, transform .25s, visibility .25s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }

/* ---------- Scroll reveal ---------- */
.section, .hero__text, .hero__portrait { }
[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
[data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .btn:hover, .card:hover, .pub:hover, .hero__socials a:hover { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__portrait { order: -1; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .portrait-frame { max-width: 200px; }
  .id-card { flex: 1; min-width: 220px; }
  .about { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav__links { display: none; }
  .nav__burger { display: grid; }
  .nav.is-open .nav__links {
    display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: .6rem 1rem 1rem;
    box-shadow: var(--shadow-md);
  }
  .nav.is-open .nav__links a { padding: .7rem .6rem; }
  .nav__name { display: none; }
  .pub { grid-template-columns: 1fr; gap: .5rem; }
  .pub__year { flex-direction: row; align-items: center; }
  .hero__portrait { flex-direction: column; }
  .portrait-frame { max-width: 260px; }
}
