/* Melika Baghi — personal site */

:root {
  --bg:        #ffffff;
  --fg:        #22262b;
  --muted:     #5b6270;
  --faint:     #9aa1ab;
  --accent:    #155263;
  --rule:      #e6e3dc;
  --gold:      #b3a369;
  --callout-bg:#faf8f4;
  --maxw:      1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #14161a;
    --fg:        #dfe2e6;
    --muted:     #9aa1ab;
    --faint:     #767d87;
    --accent:    #7fbdd0;
    --rule:      #2c3037;
    --gold:      #b3a369;
    --callout-bg:#1b1e23;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.62 -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- layout ---------- */

.layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 64px 32px 96px;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.rail-inner { position: sticky; top: 48px; }

/* ---------- sidebar ---------- */

.portrait {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 22px;
  background: var(--rule);
}

.portrait-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--muted);
  background: var(--callout-bg);
  border: 1px solid var(--rule);
}

.rail h1 {
  margin: 0 0 5px;
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.4px;
  text-align: center;
}

.role {
  margin: 0 0 16px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--accent);
}

.tagline {
  margin: -10px 0 16px;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: 0.855rem;
}

.nav a {
  color: var(--muted);
  letter-spacing: 0.02em;
}

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

.affil {
  margin: 0 0 24px;
  text-align: center;
  font-size: 0.79rem;
  line-height: 1.6;
  color: var(--muted);
}

.links {
  list-style: none;
  margin: 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--rule);
  font-size: 0.875rem;
}

.links li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.links .ico {
  flex: 0 0 14px;
  display: inline-flex;
  color: var(--faint);
}

.links .ico svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.links li:hover .ico { color: var(--accent); }

.links a { color: var(--fg); }
.links a:hover { color: var(--accent); }

/* ---------- main column ---------- */

main { max-width: 44rem; }

main > p { margin: 0 0 1.05em; }

.callout {
  margin: 1.6em 0 0;
  padding: 12px 0 12px 18px;
  border-left: 3px solid var(--gold);
  background: var(--callout-bg);
  color: var(--muted);
  font-size: 0.94rem;
}

section { margin-top: 54px; scroll-margin-top: 24px; }

h2 {
  margin: 0 0 20px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg);
}

.lede {
  font-size: 1.06rem;
  line-height: 1.62;
}

.lede strong { font-weight: 650; }

.note {
  margin: -6px 0 22px;
  font-size: 0.86rem;
  color: var(--muted);
}

/* ---------- selected work cards ---------- */

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

.card {
  margin-bottom: 22px;
  padding: 18px 20px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--callout-bg);
}

.ctitle {
  margin: 0 0 7px;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.4;
}

.cdesc {
  margin: 0;
  font-size: 0.93rem;
  color: var(--fg);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
}

.tags span {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--rule);
  font-size: 0.71rem;
  color: var(--muted);
}

.figure {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 5px;
  overflow-x: auto;
}

.figure svg {
  display: block;
  width: 100%;
  min-width: 460px;
  height: auto;
}

.plinks .status {
  display: inline-block;
  padding: 2px 9px;
  border: 1px dashed var(--rule);
  border-radius: 3px;
  font-size: 0.71rem;
  font-style: italic;
  color: var(--faint);
}

.card .plinks { margin-top: 12px; }
.card .plinks a { background: var(--bg); }

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

.group {
  margin: 26px 0 16px;
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--fg);
}

.group:first-of-type { margin-top: 0; }

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

.pubs > li {
  position: relative;
  margin-bottom: 26px;
  padding-left: 30px;
}

.pubs > li::before {
  counter-increment: pub;
  content: counter(pub) ".";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}

.ptitle  { margin: 0 0 3px; font-weight: 600; line-height: 1.45; }
.pauth   { margin: 0 0 2px; font-size: 0.89rem; color: var(--muted); }
.pvenue  { margin: 0; font-size: 0.89rem; font-style: italic; color: var(--muted); }

.plinks { margin: 7px 0 0; }

.plinks a {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 9px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.plinks a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ---------- projects ---------- */

.projects {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
}

.projects > li {
  position: relative;
  margin-bottom: 11px;
  padding-left: 15px;
  font-size: 0.93rem;
  line-height: 1.6;
}

.projects > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

.projects b { font-weight: 650; }

.projects .meta {
  color: var(--faint);
  font-size: 0.83rem;
  white-space: nowrap;
}

.more { margin-top: 18px; }

.more > summary {
  cursor: pointer;
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}

.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: " +"; }
.more[open] > summary::after { content: " –"; }
.more > summary:hover { border-color: var(--accent); color: var(--accent); }
.more[open] > summary { margin-bottom: 16px; }

/* ---------- skills ---------- */

.skills {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px 20px;
  margin: 0;
}

.skills dt {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
  padding-top: 3px;
}

.skills dd {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.skills dd span {
  padding: 3px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.78rem;
}

/* ---------- dated entry lists ---------- */

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

.entries > li {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 26px;
}

.when {
  font-size: 0.79rem;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  padding-top: 3px;
}

.wtitle { margin: 0 0 3px; font-weight: 600; line-height: 1.45; }
.wwhere { margin: 0 0 5px; font-size: 0.89rem; color: var(--muted); }
.wdesc  { margin: 0; font-size: 0.93rem; color: var(--fg); }

/* ---------- awards / service ---------- */

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

.awards > li {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 13px;
  font-size: 0.94rem;
}

.yr {
  font-size: 0.79rem;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  padding-top: 3px;
}

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

footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 0.8rem;
  color: var(--faint);
}

.fnote  { margin: 0 0 6px; }
.flinks { margin: 0; }
.flinks a { color: var(--muted); }
.flinks a:hover { color: var(--accent); }

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

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 44px;
    padding: 44px 24px 72px;
  }
  .rail-inner { position: static; }
  .links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 22px;
  }
  .links li { margin-bottom: 0; }
  main { max-width: none; }
  .entries > li,
  .awards > li,
  .skills {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .skills dd { margin-bottom: 10px; }
  .skills dt { padding-top: 6px; }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
  }
  .when, .yr { padding-top: 0; }
}
