/* ============================================================
   Lara Kassab — academic website
   Aesthetic: editorial-minimal, monochrome, serif display + clean sans
   ============================================================ */

:root {
  --ink:        #111111;   /* near-black text          */
  --ink-soft:   #3a3a3a;   /* secondary text           */
  --muted:      #6b6b6b;   /* meta / captions          */
  --line:       #e2e2e2;   /* hairline rules           */
  --line-soft:  #efefef;
  --bg:         #ffffff;
  --bg-tint:    #fafafa;
  --accent:     #1a1a1a;   /* restrained charcoal accent */
  --accent-bar: #111111;
  --header-bg:  rgba(255,255,255,0.92);
  --max:        920px;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

/* ---------- dark theme ----------
   Applied via data-theme="dark" on <html>, set by the inline script in
   <head> (checks localStorage, falls back to system preference) and
   toggled by theme.js. Keeping it to variable overrides means every
   existing rule below (which all read the variables) works in both
   themes without change. */
:root[data-theme="dark"] {
  --ink:        #f2f2f2;
  --ink-soft:   #cfcfcf;
  --muted:      #9a9a9a;
  --line:       #2c2c2c;
  --line-soft:  #232323;
  --bg:         #0e0e0e;
  --bg-tint:    #171717;
  --accent:     #f2f2f2;
  --accent-bar: #f2f2f2;
  --header-bg:  rgba(14,14,14,0.86);
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

/* ---------- layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 28px; }

/* ---------- header / nav ---------- */
header.site {
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(8px);
  position: sticky; top: 0; z-index: 50;
  transition: background-color .25s ease, border-color .25s ease;
}
.nav-inner {
  max-width: var(--max); margin: 0 auto; padding: 20px 28px;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.nav-right { display: flex; align-items: center; gap: 22px; }

/* ---------- theme toggle ---------- */
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.theme-toggle:hover { background: var(--bg-tint); border-color: var(--ink); }
.theme-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.theme-toggle .icon { width: 16px; height: 16px; display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.brand {
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
nav.links { display: flex; gap: 30px; }
nav.links a {
  font-family: var(--sans);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 1.5px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
nav.links a:hover { color: var(--ink); }
nav.links a.active { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- typography ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 500; color: var(--ink); letter-spacing: 0.01em; }

.page-title {
  font-size: clamp(2.1rem, 5vw, 3rem);
  line-height: 1.08;
  margin: 0 0 6px;
}
.section-h {
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-family: var(--sans);
  font-weight: 600;
  color: var(--ink);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 22px;
}
p { margin: 0 0 1.15em; color: var(--ink-soft); }
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); transition: border-color .15s ease; }
a:hover { border-bottom-color: var(--ink); }

.lead { font-size: 1.16rem; color: var(--ink); line-height: 1.65; }

/* ---------- hero (about) ---------- */
.hero { display: grid; grid-template-columns: 230px 1fr; gap: 48px; align-items: start; padding: 64px 0 8px; }
.portrait {
  width: 230px; height: 288px; object-fit: cover;
  background: var(--bg-tint);
  border: 1px solid var(--line);
}
.portrait-frame { position: relative; }
.portrait-frame::after {
  content: ""; position: absolute; left: 12px; top: 12px;
  width: 100%; height: 100%;
  border: 1px solid var(--ink); z-index: -1;
}
.hero-text { padding-top: 6px; }
.role { font-family: var(--sans); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); margin: 0 0 18px; }

/* ---------- generic spacing ---------- */
section.block { padding: 46px 0; }
section.block:first-of-type { padding-top: 56px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- contact / facts grid ---------- */
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 40px; margin: 8px 0 0; }
.fact { padding: 13px 0; border-top: 1px solid var(--line-soft); }
.fact .k { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); display: block; margin-bottom: 2px; }
.fact .v { font-size: 0.98rem; color: var(--ink); }
.fact .v a { border: none; }
.fact .v a:hover { border-bottom: 1px solid var(--ink); }

/* ---------- pill / highlight chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin: 4px 0 0; }
.chip {
  font-size: 0.8rem; letter-spacing: 0.02em;
  padding: 6px 13px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink-soft); background: var(--bg-tint);
}

/* ---------- honors list ---------- */
ul.clean { list-style: none; margin: 0; padding: 0; }
ul.clean li { padding: 14px 0; border-top: 1px solid var(--line-soft); color: var(--ink-soft); display: flex; gap: 16px; }
ul.clean li:first-child { border-top: none; }
ul.clean li .yr { flex: 0 0 110px; font-size: 0.82rem; color: var(--muted); letter-spacing: 0.04em; padding-top: 2px; }
ul.clean li .body { flex: 1; }
ul.clean li .body strong { color: var(--ink); font-weight: 600; }

/* ---------- research themes ---------- */
.theme { padding: 26px 0; border-top: 1px solid var(--line); }
.theme:first-of-type { border-top: none; }
.theme h3 { font-size: 1.45rem; margin: 0 0 8px; }
.theme .tag { font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 10px; }

/* ---------- publications ---------- */
.pub { padding: 20px 0; border-top: 1px solid var(--line-soft); display: grid; grid-template-columns: 56px 1fr; gap: 18px; }
.pub:first-of-type { border-top: none; }
.pub .yr { font-family: var(--serif); font-size: 1.05rem; color: var(--muted); padding-top: 1px; }
.pub .meta { }
.pub .ptitle { color: var(--ink); font-weight: 500; }
.pub .authors { font-size: 0.92rem; color: var(--ink-soft); margin-top: 3px; }
.pub .venue { font-size: 0.9rem; color: var(--muted); font-style: italic; margin-top: 3px; }
.pub .me { font-weight: 700; color: var(--ink); }
.pub .links { margin-top: 6px; font-size: 0.82rem; }
.pub .links a { color: var(--muted); border: none; text-transform: uppercase; letter-spacing: 0.08em; margin-right: 14px; }
.pub .links a:hover { color: var(--ink); }
.group-label { font-family: var(--sans); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--ink); font-weight: 600; margin: 40px 0 6px; }
.group-label:first-of-type { margin-top: 4px; }

/* ---------- teaching ---------- */
.course { padding: 16px 0; border-top: 1px solid var(--line-soft); }
.course:first-of-type { border-top: none; }
.course .code { font-family: var(--serif); font-size: 1.08rem; color: var(--ink); }
.course .terms { font-size: 0.82rem; color: var(--muted); margin-top: 2px; letter-spacing: 0.03em; }
.inst-label { font-family: var(--sans); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink); font-weight: 600; margin: 38px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.inst-label:first-of-type { margin-top: 0; }

/* ---------- footer ---------- */
footer.site { border-top: 1px solid var(--line); margin-top: 40px; padding: 36px 0; color: var(--muted); font-size: 0.85rem; }
footer.site .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
footer.site a { color: var(--muted); border: none; }
footer.site a:hover { color: var(--ink); }

/* ---------- entrance animation ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .7s cubic-bezier(.2,.7,.3,1) both; }
.d1 { animation-delay: .05s; } .d2 { animation-delay: .14s; } .d3 { animation-delay: .23s; } .d4 { animation-delay: .32s; }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }

/* ---------- research map ---------- */
:root {
  --c-it: #3552a0; --c-tn: #b8791a; --c-mf: #7a4aa8; --c-fa: #007a99; --c-td: #b0344a;
}
:root[data-theme="dark"] {
  --c-it: #5a7ad0; --c-tn: #b8801f; --c-mf: #8a62c8; --c-fa: #2ba0bf; --c-td: #d4506e;
}
.note { font-size: 0.86rem; color: var(--muted); font-style: italic; max-width: 760px; margin: 10px 0 0; }

.map-layout {
  display: block;
}
.map-layout .diagram-wrap { width: 100%; }
.map-layout .panel {
  margin-top: 28px;
  margin-bottom: 0;
}

@media (min-width: 1200px) {
  main.map-page { max-width: 1260px; }
  .map-layout {
    display: flex;
    align-items: flex-start;
    gap: 32px;
  }
  .map-layout .diagram-wrap { flex: 1 1 840px; min-width: 0; width: auto; }
  .map-layout .panel {
    flex: 0 0 320px;
    position: sticky;
    top: 92px;
    margin-top: 0;
  }
}

.diagram-wrap { overflow: auto; border: 1px solid var(--line); background: var(--bg-tint); border-radius: 6px; padding: 6px; }
svg#map { display: block; width: 100%; min-width: 520px; height: auto; }

aside.panel {
  margin-bottom: 28px;
  border: 1px solid var(--line); border-radius: 6px; padding: 22px;
  background: var(--bg-tint); min-height: 220px;
}
.panel-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin: 0 0 14px; }
.legend-list { list-style: disc; margin: 0; padding-left: 1.1em; }
.legend-row { padding: 9px 0; border-top: 1px solid var(--line-soft); cursor: pointer; }
.legend-row:first-child { border-top: none; }
.legend-row::marker { color: var(--dot); font-size: 1.15em; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.legend-name { font-size: 0.9rem; color: var(--ink); font-weight: 600; }
.legend-row.dim { opacity: 0.4; }

.paper-title { font-family: var(--serif); font-size: 1.12rem; line-height: 1.3; color: var(--ink); margin: 0 0 10px; }
.paper-meta { font-size: 0.86rem; color: var(--ink-soft); margin: 0 0 4px; }
.paper-venue { font-size: 0.84rem; color: var(--muted); font-style: italic; margin: 0 0 14px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pill { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 9px; border-radius: 999px; color: #fff; }
.paper-link { font-size: 0.8rem; color: var(--muted); border-bottom: 1px solid var(--line); text-decoration: none; }
.paper-link:hover { color: var(--ink); border-color: var(--ink); }
.theme-desc { font-size: 0.9rem; color: var(--ink-soft); margin-top: 2px; }
.hint { font-size: 0.84rem; color: var(--muted); margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }

#map text { font-family: var(--sans); user-select: none; }
.hub-label { font-size: 15px; font-weight: 600; fill: var(--ink); }
.vein { fill: none; stroke-width: 2; transition: opacity .18s ease; }
.aura { transition: opacity .18s ease; }
.hub { transition: opacity .18s ease; }
.hub-ring { fill: none; stroke: var(--bg); stroke-width: 2.4; }
.node { cursor: pointer; transition: opacity .18s ease, transform .15s ease; }
.node-ring { fill: none; stroke: var(--bg); stroke-width: 1.6; }
.dim { opacity: 0.12 !important; }
.dim-soft { opacity: 0.35 !important; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 40px; }
  .portrait { width: 180px; height: 224px; }
  .facts { grid-template-columns: 1fr; }
  .nav-inner { padding: 16px 22px; }
  nav.links { gap: 20px; }
  .nav-right { gap: 14px; }
  .pub { grid-template-columns: 44px 1fr; gap: 12px; }
  ul.clean li { flex-direction: column; gap: 2px; }
  ul.clean li .yr { flex: none; }
}
