/* ============================================================
   Alireza Salemi — site styles
   ============================================================ */

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --bg-soft: #f2eee8;
  --bg-header: rgba(250, 248, 245, 0.9);
  --text: #231f1c;
  --text-2: #4d4640;
  --text-3: #6b635c;
  --border: #e8e2da;
  --border-strong: #d7cfc4;
  --accent: #c8361a;        /* red-orange: headings, paper titles, links */
  --accent-hover: #9e2a13;  /* deeper, toward UMass maroon */
  --accent-soft: #fdeee9;
  --lava: #ff3621;          /* decorative only (too light for text) */
  --target: #fdf3ee;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 760px;
  --gutter: 24px;
  --radius: 10px;
  color-scheme: light;
}

/* ---------- base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

img { max-width: 100%; display: block; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 30%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color .15s, color .15s;
}
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

/* UI links that should never be underlined */
.brand, .site-nav a, .contact a, .pill, .more, .skip-link,
.pub-title a, .dl-body h3 a, .role a { text-decoration: none; }

h1, h2, h3 { margin: 0; color: var(--text); letter-spacing: -0.015em; }
p { margin: 0; }

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

.icon { width: 16px; height: 16px; flex: none; }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 14px;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  z-index: 100;
}
.skip-link:focus { top: 12px; text-decoration: none; color: var(--bg); }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-header);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--lava); flex: none; }
.brand:hover { color: var(--text); text-decoration: none; }

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  font-size: 14px;
}
.site-nav a {
  color: var(--text-2);
  padding: 6px 9px;
  border-radius: 6px;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 500; background: var(--accent-soft); }

/* ---------- main / footer ---------- */

main { padding-top: 56px; padding-bottom: 72px; min-height: calc(100vh - 160px); }

.site-footer { border-top: 1px solid var(--border); color: var(--text-3); font-size: 13.5px; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 24px;
  padding-bottom: 40px;
}

/* ---------- home: intro ---------- */

.intro {
  display: grid;
  grid-template-columns: 152px 1fr;
  gap: 32px;
  align-items: center;
}

.portrait {
  width: 152px;
  height: 152px;
  object-fit: cover;
  object-position: 50% 32%;
  border-radius: 50%;
  background: var(--bg-soft);
}

.intro h1 {
  font-size: 2.35rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.role { margin-top: 8px; font-size: 1.05rem; color: var(--text-2); }
.role a { color: inherit; font-weight: 500; }
.role a:hover { color: var(--accent); }
.honors { margin-top: 2px; font-size: 0.925rem; color: var(--text-3); }

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.contact a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color .15s, color .15s, background-color .15s;
}
.contact a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.contact .icon { width: 15px; height: 15px; }

.prose p + p { margin-top: 1em; }

.bio { margin-top: 40px; font-size: 1.025rem; line-height: 1.75; color: var(--text-2); }

/* ---------- sections ---------- */

.section { margin-top: 56px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.section-head h2, .section-title { font-size: 1.15rem; font-weight: 600; color: var(--accent); }
.section-title { padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }

.more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.more .icon { width: 14px; height: 14px; transition: transform .15s; }
.more:hover { text-decoration: none; }
.more:hover .icon { transform: translateX(2px); }

/* research areas */
.areas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 40px;
  padding-top: 20px;
}
.area h3 { font-size: 1rem; font-weight: 600; }
.area p { margin-top: 4px; font-size: 0.925rem; color: var(--text-2); line-height: 1.6; }
.area .area-papers { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; font-weight: 500; }

/* ---------- page heads ---------- */

.page-head { margin-bottom: 8px; }
.page-head h1 { font-size: 2rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.025em; }
.page-head .lede { margin-top: 10px; color: var(--text-2); max-width: 64ch; }
.page-head + .section { margin-top: 40px; }
.page-head + .dated { margin-top: 32px; }

/* ---------- dated lists (news, talks, awards, experience) ---------- */

.dated { list-style: none; margin: 0; padding: 0; }
.dated > li {
  display: grid;
  grid-template-columns: 152px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.dated > li:last-child { border-bottom: 0; }
.dated .date {
  font-size: 14px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.dl-body h3 { font-size: 1rem; font-weight: 600; line-height: 1.45; }
.dl-body h3 a { color: var(--accent); }
.dl-body h3 a:hover { color: var(--accent-hover); text-decoration: underline; }
.dl-body .org { color: var(--text-2); font-size: 0.95rem; }
.dl-body .note { color: var(--text-3); font-size: 0.875rem; margin-top: 2px; }
.dl-body p:not(.org):not(.note) { margin-top: 6px; color: var(--text-2); font-size: 0.95rem; }
.dl-body h3 + p:not(.org):not(.note) { margin-top: 4px; }

.dated.news > li { padding: 12px 0; }
.dated.news .dl-body { color: var(--text-2); font-size: 0.975rem; }
.dated.news strong { color: var(--text); font-weight: 600; }

/* tag lists (service) */
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 16px 0 0; }
.tags li {
  font-size: 13.5px;
  color: var(--text-2);
  padding: 4px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ---------- publications ---------- */

.pubs { list-style: none; margin: 0; padding: 0; }

.pub {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: 0; }
.pub:target { background: var(--target); box-shadow: 0 0 0 12px var(--target); border-radius: 2px; }

.pub-title { font-size: 1rem; font-weight: 600; line-height: 1.45; letter-spacing: -0.01em; }
.pub-title a { color: var(--accent); }
.pub-title a:hover { color: var(--accent-hover); text-decoration: underline; }

.pub-authors { margin-top: 4px; font-size: 0.9rem; color: var(--text-2); line-height: 1.55; }
.pub-authors .me { color: var(--text); font-weight: 600; }

.pub-venue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 4px;
  font-size: 0.875rem;
  color: var(--text-3);
  font-style: italic;
}

.badge {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 8px;
  border-radius: 999px;
}

.pub-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-2);
  background: var(--surface);
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s;
}
.pill:hover { color: var(--accent); border-color: var(--accent); }
.pill-toggle::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s;
}
.pill-toggle[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.pill-toggle[aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }

.pub-summary {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.925rem;
  color: var(--text-2);
  line-height: 1.65;
}
.js .pub-summary:not(.open) { display: none; }

.kws { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.kw {
  font: inherit;
  font-size: 12px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
  cursor: pointer;
}
.kw:hover { color: var(--accent); border-color: var(--accent); }

/* search + filters */
.pub-tools { display: none; margin-top: 32px; }
.js .pub-tools { display: block; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-3);
  cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search .icon { width: 18px; height: 18px; }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search kbd {
  font: inherit;
  font-size: 12px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 7px;
  line-height: 20px;
}
.search:focus-within kbd { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s;
}
.chip span { color: var(--text-3); font-weight: 400; margin-left: 2px; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { color: #ffffff; background: var(--accent); border-color: var(--accent); }
.chip[aria-pressed="true"] span { color: inherit; opacity: .7; }

.pub-count { margin-top: 16px; font-size: 13.5px; color: var(--text-3); }

.year-group { margin-top: 36px; }
.year {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.year::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.empty { margin-top: 40px; color: var(--text-2); }
.link-button {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  html { scroll-padding-top: 116px; }

  .header-inner {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: "brand" "nav";
    height: auto;
    gap: 0;
    padding-top: 10px;
  }
  .brand { grid-area: brand; }
  .site-nav {
    grid-area: nav;
    margin: 6px calc(-1 * var(--gutter)) 0;
    padding: 0 calc(var(--gutter) - 9px) 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }

  main { padding-top: 36px; }

  .intro { grid-template-columns: 1fr; gap: 20px; }
  .portrait { width: 112px; height: 112px; }
  .intro h1 { font-size: 2rem; }

  .areas { grid-template-columns: 1fr; gap: 22px; }

  .dated > li { grid-template-columns: 1fr; gap: 2px; }
  .page-head h1 { font-size: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media print {
  .site-header, .pub-tools, .pub-actions, .site-footer { display: none !important; }
  .js .pub-summary:not(.open) { display: block; }
  main { padding: 0; }
  a { color: inherit; }
}
