/* Layout: one quiet 720px column, Nandi-style: intro, work grouped by research theme, full list, background.
   Colors: light is warm paper with a deep teal accent; dark is charcoal with a soft green accent.
   Follows the system setting unless the visitor picks one with the header toggle (data-theme on <html>). */
:root {
  --bg: #faf8f4;
  --surface: #f0ece5;
  --line: #e0dad0;
  --fg: #1d1c1a;
  --muted: #6b665e;
  --accent: #0e6b66;
  --accent-ink: #ffffff;
  --tag: #e8e2d8;
  --wash: rgba(14,107,102,0.07);
  --underline: rgba(14,107,102,0.45);
  --underline-soft: rgba(14,107,102,0.35);
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151515; --surface: #1f1f1f; --line: #2f2f2f; --fg: #ececec; --muted: #9b9b9b; --tag: #272727;
    --accent: #8fd0a8; --accent-ink: #1d1c1a; --wash: rgba(143,208,168,0.09);
    --underline: rgba(143,208,168,0.45); --underline-soft: rgba(143,208,168,0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151515; --surface: #1f1f1f; --line: #2f2f2f; --fg: #ececec; --muted: #9b9b9b; --tag: #272727;
  --accent: #8fd0a8; --accent-ink: #1d1c1a; --wash: rgba(143,208,168,0.09);
  --underline: rgba(143,208,168,0.45); --underline-soft: rgba(143,208,168,0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
img { max-width: 100%; }
[hidden]:not([hidden=until-found i]) { display: none !important; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--underline); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.wrap { max-width: 720px; margin: 0 auto; }

.brand { font-weight: 700; text-decoration: none; white-space: nowrap; }

main { display: flex; flex-direction: column; gap: 64px; padding-block: 48px 40px; }
h1 { font-size: clamp(30px, 5vw, 38px); line-height: 1.15; margin: 0 0 14px; letter-spacing: -0.01em; }
h2 { font-size: 24px; margin: 0 0 20px; letter-spacing: -0.005em; text-wrap: balance; }
h3 { font-size: 18px; margin: 0; text-wrap: balance; }
p { margin: 0; }

.intro { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.intro-text { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.photo {
  width: 200px; aspect-ratio: 1 / 1.15; max-width: 100%; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center;
}
img.photo { display: block; height: auto; object-fit: cover; }
.photo span { font-size: 40px; font-weight: 300; letter-spacing: 0.06em; color: var(--muted); }
.looking { font-size: 18px; line-height: 1.45; font-weight: 700; text-wrap: pretty; }
.looking em { font-style: normal; color: var(--accent); }
.links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 15px; color: var(--muted); }
.links span { user-select: all; }


.lede { font-size: clamp(22px, 3.4vw, 26px); line-height: 1.25; font-weight: 700; margin: 0 0 36px; text-wrap: balance; }
.lede em { font-style: normal; color: var(--accent); }
.theme { display: flex; flex-direction: column; gap: 8px; }
.theme + .theme { margin-top: 44px; }
.theme > p { color: var(--muted); max-width: 62ch; }
.projects { display: flex; flex-direction: column; gap: 26px; margin-top: 18px; }
.project { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.project > div { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.media {
  width: 200px; max-width: 100%; aspect-ratio: 16 / 9; border-radius: 6px; border: 1px dashed var(--line);
  background: repeating-linear-gradient(135deg, var(--surface) 0 10px, var(--tag) 10px 20px);
  display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 8px;
}
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.pill { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--fg) 35%, transparent); color: var(--fg); }
.project p { font-size: 15px; }

.pubs { display: flex; flex-direction: column; gap: 18px; }
.pub { display: grid; grid-template-columns: 44px 1fr; gap: 12px; font-size: 15px; }
.pub .tag { font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 2px; }
.pub .t { font-weight: 700; display: block; }
.pub .a { color: var(--muted); display: block; }
.pub .a b { color: var(--fg); }
.pub .v { color: var(--muted); font-size: 14px; }
.note { color: var(--muted); font-size: 13px; margin-top: 6px; }

.bg { display: flex; flex-direction: column; gap: 16px; }
.bg-row { display: grid; grid-template-columns: 140px 1fr; gap: 20px; font-size: 15px; }
.bg-row .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.bg-row .sub { color: var(--muted); display: block; }
#awards .year-start:not(:first-child) { margin-top: 10px; }
@media (max-width: 600px) { #awards .bg-row:not(.year-start) .when { display: none; } }

footer { border-top: 1px solid var(--line); padding-block: 22px 40px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
footer .contact { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 0; }
footer .contact > span + span::before { content: "·"; margin: 0 10px; }
@media (max-width: 600px) {
  footer .contact { flex-direction: column; }
  footer .contact > span + span::before { content: none; }
}

.lede { margin: 0 0 36px; text-wrap: balance; }
.flip-verb { background: none; border: 0; padding: 0; margin: 0; font: inherit; line-height: inherit; color: var(--accent); cursor: pointer; vertical-align: baseline; }
.flip-verb:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.verb-roll { display: inline-grid; vertical-align: baseline; transition: width .6s cubic-bezier(.2,.7,.2,1); overflow: hidden; clip-path: inset(0 -0.2em -0.3em); line-height: inherit; }
.verb-roll .w { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.18em; text-decoration-color: var(--accent); }
.verb-roll > span { grid-area: 1 / 1; white-space: nowrap; justify-self: start; }
.roll-in { animation: rollIn .6s cubic-bezier(.2,.7,.2,1) both; }
.roll-out { animation: rollOut .6s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rollIn { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: none; } }
@keyframes rollOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-100%); } }
.project { padding: 10px 12px; margin: -10px -12px; border-radius: 8px; scroll-margin-top: 90px;
  background-image: linear-gradient(90deg, var(--wash), var(--wash)); background-repeat: no-repeat; background-size: 0 100%;
  transition: background-size .6s cubic-bezier(.2,.7,.2,1), box-shadow .3s; }
.project.is-on { background-size: 100% 100%; box-shadow: inset 3px 0 0 var(--accent); }
.project.is-on h3 { color: var(--accent); }
.project.is-on .media { border-color: var(--accent); border-style: solid; }
.verb-tag { display: none; }
.project.is-on .verb-tag { display: inline-block; margin-left: 10px; vertical-align: 2px; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); animation: tagIn .5s cubic-bezier(.2,.7,.2,1) both; }
@keyframes tagIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .roll-in, .roll-out, .project.is-on .verb-tag { animation: none; }
  .roll-out { display: none; }
  .verb-roll, .project { transition: none; }
}

@media (max-width: 600px) {
  .intro { grid-template-columns: 1fr; }
  .photo { width: 168px; }
  .project { grid-template-columns: 1fr; }
  .media { width: 100%; }
  .bg-row { grid-template-columns: 1fr; gap: 2px 0; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
html { scroll-behavior: smooth; }
section { scroll-margin-top: 80px; }

/* Linked work cards: the whole card is a link to the project page. */
a.project { color: inherit; text-decoration: none; }
a.project:hover h3 { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a.project:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumb { width: 200px; max-width: 100%; aspect-ratio: 16 / 9; border-radius: 6px; border: 1px solid var(--line); background: #fff; overflow: hidden; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.project.is-on .thumb { border-color: var(--accent); }
.pub-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; margin-top: 2px; }
.pub .t a { text-decoration-color: var(--underline-soft); }

/* Project pages */
.crumb { font-size: 14px; color: var(--muted); }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--fg); }
.paper { display: flex; flex-direction: column; gap: 22px; padding-block: 36px 40px; }
.paper h1 { font-size: clamp(26px, 4.4vw, 34px); margin: 0; text-wrap: balance; }
.paper .tags { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 14px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.authors { color: var(--muted); }
.authors b { color: var(--fg); }
.authors .eq { font-size: 13px; display: block; margin-top: 2px; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { font-size: 14px; font-weight: 700; text-decoration: none; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; font-family: inherit; line-height: 1.4; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.hero { margin: 0; border-radius: 8px; border: 1px solid var(--line); background: #fff; overflow: hidden; }
.hero img { display: block; width: 100%; height: auto; }
.hero.tall img { max-height: 460px; width: auto; margin: 0 auto; }
.hero.empty { aspect-ratio: 16 / 7; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 16px;
  background: repeating-linear-gradient(135deg, var(--surface) 0 10px, var(--tag) 10px 20px); border-style: dashed; }
.paper h2 { font-size: 20px; margin: 18px 0 0; }
.videos { display: grid; gap: 20px; }
.video { display: flex; flex-direction: column; gap: 8px; }
.video span { font-size: 14px; color: var(--muted); }
.frame { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--surface); }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cite { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.cite pre { margin: 0; width: 100%; overflow-x: auto; padding: 14px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font: 12.5px/1.55 var(--mono); color: var(--fg); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border-top: 1px solid var(--line); padding-top: 22px; margin-top: 10px; }
.pager a { text-decoration: none; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); min-width: 0; }
.pager a:hover { border-color: var(--accent); }
.pager small { color: var(--muted); font-size: 13px; }
.pager b { overflow-wrap: anywhere; }
.pager .next { text-align: right; grid-column: 2; }
@media (max-width: 600px) {
  .thumb { width: 100%; }
  .paper { padding-block: 24px 32px; gap: 18px; }
}
.project > .thumb { display: block; }
@media (max-width: 600px) {
  .brand { white-space: nowrap; }
}
.btn.placeholder { border-style: dashed; color: var(--muted); background: transparent; cursor: default; font-weight: 400; }
.btn.placeholder:hover { border-color: var(--line); color: var(--muted); }
.frame.empty { display: grid; place-items: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line);
  background: repeating-linear-gradient(135deg, var(--surface) 0 10px, var(--tag) 10px 20px); }

/* Light/dark toggle in the header */
.theme-toggle { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--fg); border-color: var(--muted); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}
@media (max-width: 600px) { .theme-toggle { width: 28px; height: 28px; } }
/* Name in Persian: IBM Plex Sans Arabic Light, subset to just the letters of the name (assets/fonts, OFL licensed) */
@font-face { font-family: "Name Persian"; src: url("/assets/fonts/plex-arabic-light-name.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
.brand .sep { display: inline-block; width: 1px; height: 0.95em; background: var(--line); margin: 0 2px 0 10px; vertical-align: -0.12em; }
.brand .native { font-family: "Name Persian", "SF Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif; font-weight: 300; color: var(--muted); margin-left: 10px; unicode-bidi: isolate; }

/* PHINIX page: credits under borrowed media, a smaller figure, and self-hosted video */
.credit { font-size: 12px; color: var(--muted); margin-top: -14px; }
.hero.small { max-width: 360px; }
.frame video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }

/* Collaborating organizations on each project card, from the papers' author affiliations */
.with { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.with span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 2px 8px 2px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.with img { width: 18px; height: 18px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; }

/* Site navigation: sticky sidebar on wide screens, slide-in menu below 1000px (like Nandi's) */
.shell { max-width: 720px; margin: 0 auto; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.menu-btn, .menu-close { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: none; color: var(--fg); cursor: pointer; flex: none; }
.menu-btn svg, .menu-close svg { width: 20px; height: 20px; }
.menu-btn:focus-visible, .menu-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(320px, 86vw); overflow-y: auto; background: var(--bg); border-right: 1px solid var(--line);
  padding: 16px 20px 32px; display: flex; flex-direction: column; gap: 24px;
  transform: translateX(-102%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
.sidebar.open { transform: none; visibility: visible; transition: transform .25s ease; }
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.45); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.side-head .brand { font-size: 17px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 15px; }
.side-nav a:hover { color: var(--fg); background: var(--surface); }
.side-nav a.active, .side-nav a[aria-current="page"] { color: var(--fg); font-weight: 700; }
.side-projects { list-style: none; margin: 2px 0 6px 12px; padding: 0 0 0 8px; border-left: 1px solid var(--line); }
.side-projects a { font-size: 14px; padding: 4px 10px; }
.side-links { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 15px; padding: 0 10px; }
.side-email { flex-basis: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; font-size: 13.5px; margin-bottom: 4px; }
/* Phone menu: taller tap targets for the contact links */
@media (max-width: 999px) {
  .side-email { gap: 0; }
  .side-email a, .side-links > a { padding-block: 5px; }
}
.sidebar .theme-toggle { margin-left: 10px; }
section, .project { scroll-margin-top: 84px; }
@media (min-width: 1000px) {
  .shell { max-width: 1160px; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 64px; }
  .topbar, .menu-close, .scrim { display: none; }
  .sidebar { position: sticky; top: 0; height: 100vh; width: auto; transform: none; visibility: visible; transition: none; z-index: 1;
    background: none; border-right: 0; padding: 44px 0 32px; }
  .wrap { max-width: 760px; margin: 0; }
  section, .project { scroll-margin-top: 28px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .sidebar.open { transition: none; } }
.with img[src$="/snap.png"] { padding: 0; background: #fffc00; }

/* Intro: text wraps around the photo (no empty column under it), stacked on phones */
.intro { display: block; }
.intro::after { content: ""; display: block; clear: both; }
.intro .photo { float: left; margin: 6px 28px 10px 0; }
.intro-text { display: block; }
.intro-text > h1 { margin-bottom: 0; }
.intro-text > * + * { margin-top: 14px; }
@media (max-width: 600px) {
  .intro .photo { float: none; margin: 0 0 20px; }
}

/* Short laptop screens: tighten the sidebar so it fits without scrolling */
@media (min-width: 1000px) and (max-height: 780px) {
  .sidebar { gap: 18px; }
  .side-nav a { padding-top: 4px; padding-bottom: 4px; }
}

/* Point-cloud companion: a third column on wide screens that reshapes into each project while you scroll Selected work */
.companion { display: none; }
@media (min-width: 1200px) {
  .shell { max-width: 1400px; grid-template-columns: 250px minmax(0, 680px) minmax(280px, 1fr); gap: 56px; }
  .companion { display: flex; flex-direction: column; justify-content: center; position: sticky; top: 0; height: 100vh; opacity: 0; pointer-events: none; }
  .companion canvas { display: block; width: 100%; aspect-ratio: 1 / 1.15; max-height: 72vh; }
  .companion-label { margin: 6px 0 0; min-height: 1.5em; text-align: center; font-size: 13px; color: var(--muted); letter-spacing: 0.02em; }
  .companion-notes { position: absolute; inset: 0; opacity: 0; }
  .companion-notes svg { position: absolute; inset: 0; overflow: visible; }
  .companion-notes line { stroke: var(--fg); stroke-width: 1; opacity: 0.4; }
  .companion-notes circle { fill: var(--accent); }
  .companion-notes span { position: absolute; left: 0; top: 0; max-width: 130px; font-size: 12.5px; line-height: 15px; color: var(--fg); padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--bg) 82%, transparent); }
}
