/* Navid Safahieh — site stylesheet */

:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --ink: #1b1e24;
  --body: #33363d;
  --muted: #6b7280;
  --faint: #9aa0ab;
  --border: rgba(20, 24, 33, 0.1);
  --accent: #2c5282;
  --accent-dark: #1f3a5f;
  --accent-tint: #eaf0f7;
  --pill-text: #24466e;
  --max-width: 72rem;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }

h1, h2, h3 { font-family: var(--serif); color: var(--ink); font-weight: 600; }

/* ---------- Masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.masthead__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.75rem;
}
.masthead__name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--ink);
  text-decoration: none;
}
.masthead__nav { display: flex; gap: 1.75rem; }
.masthead__nav a {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.masthead__nav a:hover { color: var(--ink); }
.masthead__nav a.is-active { color: var(--ink); border-bottom-color: var(--accent); }

.masthead__toggle {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.5rem;
}
.masthead__toggle span,
.masthead__toggle span::before,
.masthead__toggle span::after {
  content: "";
  display: block;
  width: 1.25rem;
  height: 2px;
  background: var(--ink);
  position: relative;
  transition: transform 0.15s ease;
}
.masthead__toggle span::before { position: absolute; top: -6px; }
.masthead__toggle span::after { position: absolute; top: 6px; }

/* ---------- Page shell ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}
.page-title {
  font-size: 1.75rem;
  margin: 0 0 0.35rem;
}
.page-kicker {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 2.25rem;
}

/* ---------- Main + rail two-column layout ---------- */
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19rem;
  gap: 4rem;
  align-items: start;
}
.col-main { min-width: 0; }
.page-single { max-width: 46rem; }
.rail {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-top: 0.25rem;
}

.home-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.home-nav a {
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--body);
  text-decoration: none;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.home-nav a:hover { color: var(--accent); }

/* ---------- Hero (home page) ---------- */
.hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2.25rem;
}
.hero__photo {
  width: 240px;
  height: 288px;
  border-radius: 40px 40px 8px 8px;
  overflow: hidden;
  background: var(--accent-tint);
}
.hero__photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: left center; }
.hero__name { font-size: 2.25rem; line-height: 1.15; margin: 0 0 0.6rem; }
.hero__tagline { font-size: 1.15rem; color: var(--muted); margin: 0; line-height: 1.5; }

.social-icons {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
}
.social-icons a {
  display: flex;
  opacity: 0.9;
  transition: opacity 0.15s ease;
}
.social-icons a:hover { opacity: 1; }
.social-icons svg { width: 1.4rem; height: 1.4rem; fill: currentColor; }
.social-icons .linkedin { color: #0a66c2; }
.social-icons .youtube { color: #ff0000; }
.social-icons .github { color: #181717; }
.social-icons .scholar { color: #4285f4; }

.hero__email { font-size: 0.9375rem; color: var(--muted); margin: 0.6rem 0 0; }

.about p { font-size: 1.0625rem; line-height: 1.75; color: var(--body); margin: 0 0 1rem; }
.about p:last-child { margin-bottom: 0; }

.about-wrap { max-width: 42rem; }
.about-group { margin-top: 2.5rem; }
.about-group:first-child { margin-top: 0; }

.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.tile-grid--stack { grid-template-columns: 1fr; }
.tile {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.tile__trigger {
  display: block;
  width: 100%;
  padding: 1rem 1.25rem;
  background: none;
  border: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  text-align: left;
}
.tile__trigger:hover { background: var(--accent-tint); }
.tile__title {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
}
.tile__body { padding: 0 1.25rem 1.25rem; }
.tile__image { aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; margin: 0 0 1rem; background: var(--accent-tint); }
.tile__image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile__body p { font-size: 0.9375rem; line-height: 1.7; color: var(--body); margin: 0 0 0.85rem; }
.tile__body p:last-child { margin-bottom: 0; }

.linkrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  font-size: 0.9375rem;
}
.linkrow a { color: var(--accent); }

hr.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ---------- Subheads / eyebrow ---------- */
.subhead {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.subhead:first-child { margin-top: 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.section-head:first-child { margin-top: 0; }
.section-head h2 { font-size: 1.0625rem; font-weight: 600; margin: 0; }
.section-head .t-award { margin-top: 0; flex-shrink: 0; }
.eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0 0 0.5em;
}

/* ---------- Featured paper (JMP) ---------- */
.featured {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.6rem;
  margin: 1.5rem 0 2rem;
}
.paper-title { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; margin: 0.2rem 0 0.5rem; color: var(--ink); }
.paper-authors { font-size: 0.8125rem; color: var(--muted); margin: 0 0 0.5rem; }
.paper-finding { color: var(--body); font-size: 0.95rem; line-height: 1.65; margin: 0; }

.reslinks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  font-size: 0.85rem;
}
.reslinks li { margin: 0; }
.reslinks .note { color: var(--muted); font-style: italic; }

/* ---------- Playground game embed ---------- */
.game-embed {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.game-embed iframe {
  display: block;
  width: 100%;
  height: 1300px;
  border: 0;
  transition: height 0.2s ease;
}
.game-embed__note {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0.75rem 0 2rem;
}

/* ---------- Paper list ---------- */
.paperlist { list-style: none; margin: 0; padding: 0; }
.paperlist > li { padding: 1.4rem 0; border-top: 1px solid var(--border); }
.paperlist > li:last-child { border-bottom: 1px solid var(--border); }

/* ---------- Teaching list ---------- */
.t-list { margin: 0 0 2rem; padding: 0; list-style: none; }
.t-item {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.t-item:last-child { border-bottom: 1px solid var(--border); }
.t-course { font-weight: 500; color: var(--ink); font-size: 0.95rem; }
.t-course .muted-inline { font-weight: 400; color: var(--muted); }
.t-role { font-size: 0.875rem; color: var(--muted); margin-top: 0.15rem; }
.t-right { text-align: right; white-space: nowrap; }
.t-date { font-size: 0.875rem; color: var(--ink); }
.t-inst { font-size: 0.8125rem; color: var(--muted); }
.t-award { display: inline-block; margin-top: 0.35rem; font-size: 0.75rem; color: var(--accent); background: var(--accent-tint); padding: 0.15rem 0.55rem; border-radius: 999px; }

/* ---------- CV cards ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin: 1.5rem 0 2rem; }
.card {
  padding: 1.5rem 1.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.card__title { font-family: var(--serif); font-weight: 600; font-size: 1.0625rem; margin: 0 0 0.3rem; color: var(--ink); }
.card__meta { font-size: 0.8125rem; color: var(--muted); margin: 0 0 0.8rem; }
.card__cta { font-size: 0.875rem; }

/* ---------- Reference grid ---------- */
.ref-group-label { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 2rem 0 0.75rem; }
.ref-group-label:first-of-type { margin-top: 0; }
.ref-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ref-card { padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.ref-name { font-weight: 600; color: var(--ink); font-size: 0.95rem; }
.ref-role { font-size: 0.8125rem; color: var(--muted); line-height: 1.5; margin: 0.2rem 0 0.4rem; }
.ref-email { font-size: 0.8125rem; color: var(--muted); }
.ref-badge {
  display: inline-block;
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.4rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
  font-size: 0.8125rem;
  color: var(--faint);
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .page-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .rail { border-top: 1px solid var(--border); padding-top: 2rem; }
}

@media (max-width: 640px) {
  .masthead__nav { display: none; gap: 1.25rem; }
  .masthead__nav.is-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 3.75rem;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem 1.25rem;
    gap: 0.9rem;
  }
  .masthead { position: relative; }
  .masthead__toggle { display: block; }

  .hero { grid-template-columns: 1fr; text-align: left; }
  .hero__photo { width: 198px; height: 238px; }

  .cards { grid-template-columns: 1fr; }
  .ref-grid { grid-template-columns: 1fr; }
  .t-item { flex-direction: column; }
  .t-right { text-align: left; white-space: normal; }
  .tile-grid { grid-template-columns: 1fr; }
}
