/* =========================================================
   Site styles. Colors and fonts live in the variables below;
   change them here and the whole site follows.
   ========================================================= */

:root {
  --text: #1f2328;
  --muted: #5d6670;
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --border: #e3e6ea;
  --accent: #990000;          /* USC cardinal */
  --accent-soft: #f8e9e9;
  --header-bg: #990000;       /* header bar */
  --max-width: 760px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Dark mode: switched on by the toggle in the header (or the device setting) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --text: #e6e8eb;
  --muted: #9aa3ad;
  --bg: #15171a;
  --bg-soft: #1d2024;
  --border: #2d3137;
  --accent: #f08a8a;
  --accent-soft: #3a2224;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 4rem; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

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

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Top navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.nav .container {
  display: flex; align-items: center; gap: 1rem;
  height: 3.25rem;
}
.nav-links {
  display: flex; align-items: center; gap: 1.25rem; margin-left: auto; min-width: 0;
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.theme-toggle {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 2rem; height: 2rem; padding: 0; margin-left: 0.25rem;
  background: transparent; color: #fff; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 50%;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.15); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.nav .brand { font-weight: 650; color: #fff; white-space: nowrap; }
.nav a:not(.brand) { color: rgba(255, 255, 255, 0.82); font-size: 0.95rem; }
.nav a:not(.brand):hover { color: #fff; text-decoration: none; }

/* ---------- Header / intro ---------- */
.intro {
  display: flex; gap: 2rem; align-items: center;
  padding: 3rem 0 1rem;
}
.intro img {
  width: 150px; height: 150px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--border);
}
.intro h1 { margin: 0; font-size: 2rem; line-height: 1.2; letter-spacing: -0.01em; }
.intro .role { margin: 0.25rem 0 0.9rem; color: var(--muted); }

.links { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0; list-style: none; }
.links a {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.75rem;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.9rem; color: var(--text);
}
.links svg { width: 15px; height: 15px; flex-shrink: 0; }
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- Sections ---------- */
section { padding: 1.5rem 0 1rem; }
h2 {
  font-size: 1.3rem; margin: 0 0 1rem;
  padding-bottom: 0.4rem; border-bottom: 1px solid var(--border);
}
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0 0 1rem; }
.nowrap { white-space: nowrap; }
ul { padding-left: 1.25rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2rem; }
.two-col ul { list-style: none; padding: 0; margin: 0; }
.two-col li { margin-bottom: 0.35rem; }
.two-col ul.bullets { list-style: disc; padding-left: 1.25rem; }
.small { font-size: 0.92rem; color: var(--muted); }
.two-col .small { display: block; line-height: 1.4; }

/* Education list with small logos */
.two-col .edu li { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; line-height: 1.4; }
.edu .logo {
  flex: 0 0 auto; width: 48px; height: 48px;
  object-fit: contain; padding: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
}
.edu .logo.full { padding: 0; object-fit: cover; }

/* ---------- News ---------- */
.news { list-style: none; padding: 0; margin: 0; }
.news li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; margin-bottom: 0.6rem; }
.news .date { color: var(--muted); font-size: 0.92rem; padding-top: 0.1rem; }

/* ---------- Publications ---------- */
.pubs { list-style: none; padding: 0; margin: 0; }
.pubs li { margin-bottom: 1.4rem; }
.pubs .title { font-weight: 600; display: block; }
.pubs .authors { display: block; font-size: 0.95rem; }
.pubs .authors b { font-weight: 600; }
.pubs .venue { display: block; font-size: 0.95rem; color: var(--muted); font-style: italic; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.tags a, .tags span {
  font-size: 0.8rem; padding: 0.05rem 0.55rem; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent);
  font-style: normal;
}
.tags span.highlight { background: #fff3d6; color: #8a5a00; }
[data-theme="dark"] .tags span.highlight { background: #3a2f17; color: #f0c56b; }

/* ---------- Experience / Teaching (simple timeline rows) ---------- */
.rows { list-style: none; padding: 0; margin: 0; }
.rows li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0; border-bottom: 1px solid var(--border);
}
.rows li:last-child { border-bottom: 0; }
.rows .what { font-weight: 600; }
.rows .where { display: block; color: var(--muted); font-size: 0.95rem; }
.rows .when { color: var(--muted); font-size: 0.92rem; text-align: right; flex-shrink: 0; }

/* ---------- Projects ---------- */
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.project {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--bg-soft);
}
.project img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block;
  border-bottom: 1px solid var(--border);
}
.project h3 { margin: 0.8rem 0.9rem 0.3rem; font-size: 0.98rem; line-height: 1.35; }
.project p { margin: 0 0.9rem; font-size: 0.88rem; line-height: 1.5; color: var(--muted); }
.project .tags { margin: auto 0.9rem 0.9rem; padding-top: 0.6rem; }
.project > p:last-child { margin-bottom: 1rem; }

/* Experience and teaching rows with a logo on the left */
.logo-rows li { justify-content: flex-start; align-items: center; gap: 1rem; }
.logo-rows .logo {
  flex: 0 0 auto; width: 56px; height: 56px;
  object-fit: contain; padding: 7px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
}
.logo-rows .logo.full { padding: 0; object-fit: cover; }
.logo-rows .body { display: block; min-width: 0; }
.logo-rows .what, .logo-rows .where, .logo-rows .when { display: block; }
.logo-rows .when { text-align: left; }
.teaching .logo { width: 96px; height: auto; aspect-ratio: 16 / 9; padding: 0; object-fit: cover; border: 0; }

/* ---------- Footer ---------- */
footer {
  margin-top: 2rem; padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem; color: var(--muted);
}

/* ---------- Tablet: two projects per row ---------- */
@media (max-width: 800px) {
  .projects { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav .brand { display: none; }
  .nav-links { gap: 0.9rem; margin-left: 0; flex: 1; }
  .nav a:not(.brand) { font-size: 0.88rem; }
  .intro { flex-direction: column; text-align: center; gap: 1rem; padding-top: 2rem; }
  .intro img { width: 120px; height: 120px; }
  .links { justify-content: center; }
  .two-col, .projects { grid-template-columns: 1fr; }
  .news li { grid-template-columns: 1fr; gap: 0; }
  .logo-rows li { align-items: flex-start; gap: 0.9rem; }
  .logo-rows .logo { width: 48px; height: 48px; margin-top: 0.2rem; }
  .teaching .logo { width: 72px; height: auto; }
}

@media print {
  .nav { display: none; }
  a { color: inherit; }
}
