/* ==========================================================================
   Saeed Razavi · academic homepage
   A single, simple stylesheet: tokens, base, intro, sections, publications,
   rows, footer, responsive.
   ========================================================================== */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #ffffff;
  --tint: #f6f8fa;
  --border: #e3e6ea;
  --text: #1f2328;
  --muted: #4d5560;
  --subtle: #656d76;
  --link: #0b57d0;
  --link-hover: #0842a0;
  --accent-line: linear-gradient(90deg, #0b57d0, #7c3aed 55%, #0d9488);
  --hero-bg: #f4f6fa;

  /* Grows a little on large monitors so the page does not float in empty space. */
  --page: clamp(1200px, 70vw, 1360px);
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 10px;
}

/* Base
   ========================================================================== */

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 10;
  height: 3px;
  background: var(--accent-line);
}

h1,
h2,
h3,
p,
ul,
ol,
pre {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 0.18em;
}

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

/* Links inside running text get a quiet underline so they don't rely on color alone. */
.intro__text > p:not(.links) a,
.news a,
.pub__authors a,
.row__meta a,
.footer a {
  text-decoration: underline;
  text-decoration-color: rgb(11 87 208 / 0.35);
  text-decoration-thickness: 1px;
}

.intro__text > p:not(.links) a:hover,
.news a:hover,
.pub__authors a:hover,
.row__meta a:hover,
.footer a:hover {
  text-decoration-color: currentColor;
}

strong {
  font-weight: 600;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  background: var(--text);
  color: #ffffff;
}

.skip-link:focus {
  top: 12px;
}

.container {
  max-width: var(--page);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* Intro: on a softly tinted band with two faint glows and a fading dot grid
   ========================================================================== */

.hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(48px, 8vw, 88px) clamp(44px, 6vw, 72px);
  border-bottom: 1px solid var(--border);
  background: radial-gradient(42rem 26rem at 6% -20%, rgb(11 87 208 / 0.1), transparent 70%),
    radial-gradient(38rem 24rem at 92% -10%, rgb(124 58 237 / 0.09), transparent 70%), var(--hero-bg);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgb(31 35 40 / 0.11) 1px, transparent 1.3px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000 10%, transparent 95%);
  mask-image: linear-gradient(to bottom, #000 10%, transparent 95%);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: clamp(32px, 6vw, 80px);
}

.intro__name {
  margin-bottom: 1.1rem;
  font-size: clamp(2.1rem, 4.6vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.intro__role {
  margin-top: 0.35rem;
  margin-bottom: 1.4rem;
  font-size: 1.05rem;
  color: var(--subtle);
}

.intro__text > p + p {
  margin-top: 0.9rem;
}

.interests {
  margin-top: 1.2rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--link);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgb(255 255 255 / 0.8);
}

.interests__title {
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}

.interests li {
  position: relative;
  padding-left: 1rem;
}

.interests li::before {
  content: "";
  position: absolute;
  top: 0.68em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--link);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin-top: 1.4rem;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.links svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.pub__links a + a::before {
  content: "/";
  display: inline-block;
  margin-inline: 0.55em;
  color: #b4bac1;
  text-decoration: none;
}

.intro__photo img {
  width: 260px;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  /* White ring so the photo stands out from the tinted band. */
  box-shadow: 0 0 0 6px #ffffff, 0 0 0 7px var(--border), 0 20px 40px -20px rgb(31 35 40 / 0.45);
}

/* Sections
   ========================================================================== */

.section {
  margin-top: clamp(44px, 7vw, 64px);
}

.section__title {
  margin-bottom: 1.1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

/* News */

.news {
  display: grid;
  gap: 0.55rem;
}

.news li {
  display: grid;
  grid-template-columns: 5.25rem 1.4rem minmax(0, 1fr);
  gap: 0.6rem;
}

.new {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--link);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
  vertical-align: 0.12em;
  color: #ffffff;
}

/* 🔥 new position · 🎉 paper accepted · 📄 paper released */
.news__icon {
  font-size: 1.05rem;
  line-height: 1.6;
  text-align: center;
}

.news__date {
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.85;
  color: var(--subtle);
}

/* Publications
   ========================================================================== */

.pubs {
  display: grid;
  gap: 1rem;
}

.pub {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 2rem;
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  scroll-margin-top: 1.5rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.pub:hover {
  border-color: #cfd5db;
  box-shadow: 0 14px 32px -18px rgb(31 35 40 / 0.35);
  transform: translateY(-2px);
}

.pub:target {
  border-color: var(--link);
}

.pub__fig {
  position: relative;
  align-self: start;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

/* Figures are shown whole, centred on white. */
.pub__fig img,
.pub__fig video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

/* A second view of the paper (method animation or results) fades in on hover. */
.pub__alt {
  opacity: 0;
  transition: opacity 0.35s ease;
}

@media (hover: hover) {
  .pub:hover .pub__alt {
    opacity: 1;
  }
}

.pub__title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

.pub__authors {
  margin-top: 0.45rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.pub__authors strong {
  color: var(--text);
}

.pub__venue {
  margin-bottom: 0.5rem;
  line-height: 1;
}

.venue {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.venue--arxiv {
  background: #fdecec;
  color: #a4161a;
}

.venue--neurips {
  background: #efe9fb;
  color: #5b2a9a;
}

.venue--eccv {
  background: #e3f3f1;
  color: #0f6b62;
}

.pub__links {
  margin-top: 0.45rem;
  font-size: 0.95rem;
}

.pub__summary {
  margin-top: 0.7rem;
  font-size: 0.93rem;
  color: var(--muted);
}

/* BibTeX panel (inserted by JS) */

.bib {
  position: relative;
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--tint);
}

.bib pre {
  overflow-x: auto;
  padding: 0.85rem 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre;
}

.bib__copy {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
}

.bib__copy:hover {
  color: var(--text);
}

/* Experience, education, teaching
   ========================================================================== */

.rows {
  display: grid;
  gap: 1.25rem;
}

.row__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1rem;
}

.row__title {
  font-weight: 600;
}

.row__date {
  flex: none;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--subtle);
}

.row__meta {
  font-size: 0.93rem;
  color: var(--subtle);
}

.row__text {
  margin-top: 0.3rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.ta {
  display: grid;
  gap: 0.4rem;
  margin-top: 1.5rem;
}

.ta li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.ta strong {
  color: var(--text);
  font-weight: 500;
}

/* Footer
   ========================================================================== */

.footer {
  max-width: var(--page);
  margin: clamp(56px, 9vw, 88px) auto 0;
  padding: 1.5rem var(--gutter) 2.5rem;
  font-size: 0.85rem;
  text-align: center;
  color: var(--subtle);
}

/* Responsive
   ========================================================================== */

@media (max-width: 1000px) {
  .pub {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 820px) {
  .intro {
    grid-template-columns: minmax(0, 1fr) 200px;
  }

  .intro__photo img {
    width: 200px;
  }

  .pub {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1.25rem;
  }
}

@media (max-width: 680px) {
  .intro {
    grid-template-columns: 1fr;
  }

  .intro__photo {
    order: -1;
  }

  .intro__photo img {
    width: 132px;
  }

  .pub {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .pub__fig {
    aspect-ratio: 16 / 9;
  }

  .news li {
    grid-template-columns: 4.6rem 1.3rem minmax(0, 1fr);
    gap: 0.45rem;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .intro__text > *,
  .intro__photo {
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .intro__text > :nth-child(2) {
    animation-delay: 60ms;
  }

  .intro__text > :nth-child(3) {
    animation-delay: 120ms;
  }

  .intro__text > :nth-child(4) {
    animation-delay: 180ms;
  }

  .intro__text > :nth-child(5) {
    animation-delay: 240ms;
  }

  .intro__text > :nth-child(6) {
    animation-delay: 300ms;
  }

  .intro__photo {
    animation-delay: 150ms;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .skip-link,
  body::before,
  .hero::before {
    display: none;
  }

  .hero {
    background: none;
  }

  .pub {
    break-inside: avoid;
  }

  a {
    color: inherit;
  }
}
