/* ============================================================
   Biruk Seyoum — academic site
   Design tokens, then layout, then components.
   ============================================================ */

:root {
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1120px;
  --prose: 68ch;
  --radius: 10px;
  --radius-lg: 16px;

  --bg: #fbfaf8;
  --bg-elev: #ffffff;
  --bg-sunk: #f3f0eb;
  --text: #1b1c1f;
  --text-muted: #5b5e66;
  --text-faint: #8b8e96;
  --border: #e4dfd7;
  --border-strong: #d0c9be;
  --accent: #1c4e80;
  --accent-hover: #143a61;
  --accent-soft: #e9eff6;
  --accent-line: #b9cee3;
  --shadow: 0 1px 2px rgba(26, 26, 30, .05), 0 8px 24px -12px rgba(26, 26, 30, .14);
  --shadow-lift: 0 2px 4px rgba(26, 26, 30, .06), 0 16px 40px -16px rgba(26, 26, 30, .22);

  --tag-journal-bg: #e7f0e9;  --tag-journal-fg: #2f6b41;
  --tag-conference-bg: #e9eef7; --tag-conference-fg: #2a4f88;
  --tag-workshop-bg: #f6eee2; --tag-workshop-fg: #85602c;
  --tag-thesis-bg: #efe9f3;   --tag-thesis-fg: #614080;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101217;
    --bg-elev: #171a21;
    --bg-sunk: #0b0c10;
    --text: #e9e7e4;
    --text-muted: #a3a7ae;
    --text-faint: #737780;
    --border: #262a33;
    --border-strong: #3a414c;
    --accent: #83b6e2;
    --accent-hover: #a8cef0;
    --accent-soft: #16263a;
    --accent-line: #2c4a70;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 16px 40px -16px rgba(0, 0, 0, .75);

    --tag-journal-bg: #16291d;  --tag-journal-fg: #8fcaa2;
    --tag-conference-bg: #16233a; --tag-conference-fg: #93b6e6;
    --tag-workshop-bg: #2b2317; --tag-workshop-fg: #d5ab6d;
    --tag-thesis-bg: #241c2e;   --tag-thesis-fg: #b799d6;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #101217;
  --bg-elev: #171a21;
  --bg-sunk: #0b0c10;
  --text: #e9e7e4;
  --text-muted: #a3a7ae;
  --text-faint: #737780;
  --border: #262a33;
  --border-strong: #3a414c;
  --accent: #83b6e2;
  --accent-hover: #a8cef0;
  --accent-soft: #16263a;
  --accent-line: #2c4a70;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 16px 40px -16px rgba(0, 0, 0, .75);

  --tag-journal-bg: #16291d;  --tag-journal-fg: #8fcaa2;
  --tag-conference-bg: #16233a; --tag-conference-fg: #93b6e6;
  --tag-workshop-bg: #2b2317; --tag-workshop-fg: #d5ab6d;
  --tag-thesis-bg: #241c2e;   --tag-thesis-fg: #b799d6;

  color-scheme: dark;
}

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

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 1.15rem + 1vw, 1.85rem); }
h3 { font-size: 1.16rem; }
p { margin: 0 0 1.1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.prose { max-width: var(--prose); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 1.25rem; min-height: 4rem; }

.brand { font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; color: var(--text); letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { color: var(--accent); text-decoration: none; }
.brand .brand-sub { display: block; font-family: var(--font-body); font-size: .7rem; font-weight: 500; color: var(--text-faint); letter-spacing: .04em; text-transform: uppercase; margin-top: .05rem; }

.nav { margin-left: auto; display: flex; align-items: center; gap: .2rem; }
.nav a {
  color: var(--text-muted); font-size: .9rem; font-weight: 500;
  padding: .45rem .7rem; border-radius: var(--radius); position: relative;
  transition: color .15s ease, background .15s ease;
}
.nav a:hover { color: var(--text); background: var(--bg-sunk); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.theme-toggle {
  margin-left: .4rem; display: grid; place-items: center;
  width: 2.1rem; height: 2.1rem; padding: 0;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-sunk); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

@media (max-width: 680px) {
  .site-header .wrap { flex-wrap: wrap; padding-block: .6rem; row-gap: .5rem; min-height: 0; }
  .brand { order: 1; }
  .theme-toggle { order: 2; margin-left: auto; }
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .brand .brand-sub { display: none; }
}

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

.section { padding-block: clamp(2.75rem, 5vw, 4.5rem); }
.section + .section { border-top: 1px solid var(--border); }
.section-head { margin-bottom: 2rem; }
.section-head h2 { margin-bottom: .3rem; }
.eyebrow {
  font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 .55rem; font-family: var(--font-body);
}

/* ---------- hero ---------- */

.hero { padding-block: clamp(3rem, 6vw, 5rem) clamp(2.5rem, 4vw, 3.5rem); }
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.hero h1 { margin-bottom: .35rem; }
.hero-role { font-size: 1.02rem; color: var(--text-muted); margin: 0 0 .15rem; }
.hero-role strong { color: var(--text); font-weight: 600; }
.hero-affil { font-size: .95rem; color: var(--text-faint); margin: 0 0 1.5rem; }
.hero-tagline {
  font-family: var(--font-display); font-size: clamp(1.05rem, .95rem + .5vw, 1.28rem);
  line-height: 1.5; color: var(--text); max-width: 40ch;
  padding-left: 1.1rem; border-left: 3px solid var(--accent-line); margin: 0 0 1.75rem;
}

.portrait { width: 168px; }
.portrait img {
  width: 168px; height: 210px; object-fit: cover; object-position: center top;
  border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow);
  background: var(--bg-sunk);
}
@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; width: 130px; }
  .portrait img { width: 130px; height: 160px; }
}

.actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .88rem; font-weight: 500; padding: .5rem .9rem;
  border-radius: var(--radius); border: 1px solid var(--border-strong);
  color: var(--text); background: var(--bg-elev);
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { color: #0d1117; }
  :root:not([data-theme="light"]) .btn-primary:hover { color: #0d1117; }
}
:root[data-theme="dark"] .btn-primary { color: #0d1117; }
:root[data-theme="dark"] .btn-primary:hover { color: #0d1117; }
.btn svg { width: .95rem; height: .95rem; flex: none; }

/* ---------- interests ---------- */

.tags { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0; }
.tags li {
  font-size: .82rem; color: var(--text-muted);
  background: var(--bg-sunk); border: 1px solid var(--border);
  padding: .28rem .65rem; border-radius: 999px;
}

/* ---------- metrics ---------- */

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.metric { background: var(--bg-elev); padding: 1.25rem 1.35rem; }
.metric .n { font-family: var(--font-display); font-size: 2.1rem; font-weight: 600; line-height: 1; color: var(--text); display: block; }
.metric .l { font-size: .8rem; color: var(--text-muted); margin-top: .4rem; display: block; }
.metric .s { font-size: .74rem; color: var(--text-faint); margin-top: .1rem; display: block; }
@media (max-width: 560px) { .metrics { grid-template-columns: 1fr; } }
.metrics-note { font-size: .78rem; color: var(--text-faint); margin: .7rem 0 0; }

/* ---------- cards ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 1rem; }
.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.4rem 1.45rem; display: flex; flex-direction: column;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.card h3 { margin-bottom: .5rem; }
.card h3 a { color: inherit; }
.card h3 a:hover { color: var(--accent); text-decoration: none; }
.card p { font-size: .92rem; color: var(--text-muted); margin: 0; }
.card .card-more { margin-top: auto; padding-top: 1rem; font-size: .85rem; font-weight: 500; }

/* ---------- news ---------- */

.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.news li:last-child { border-bottom: 0; }
.news time { font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--text-faint); font-weight: 500; letter-spacing: .02em; }
.news p { margin: 0; font-size: .94rem; }
@media (max-width: 560px) { .news li { grid-template-columns: 1fr; gap: .2rem; } }

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

.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 2rem; }
.chip {
  font: inherit; font-size: .85rem; font-weight: 500;
  padding: .38rem .85rem; border-radius: 999px; cursor: pointer;
  background: var(--bg-elev); color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all .15s ease;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .chip[aria-pressed="true"] { color: #0d1117; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip[aria-pressed="true"] { color: #0d1117; } }
.chip .count { opacity: .65; margin-left: .3rem; font-variant-numeric: tabular-nums; }

.year-group { margin-bottom: 2.25rem; }
.year-group > h3 {
  font-family: var(--font-body); font-size: .78rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-faint);
  padding-bottom: .5rem; margin-bottom: .35rem; border-bottom: 1px solid var(--border);
}

.pub { padding: 1.05rem 0; border-bottom: 1px solid var(--border); }
.pub:last-child { border-bottom: 0; }
.pub-title { font-family: var(--font-body); font-size: 1rem; font-weight: 600; line-height: 1.4; margin: 0 0 .3rem; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); text-decoration: none; }
.pub-authors { font-size: .88rem; color: var(--text-muted); margin: 0 0 .3rem; }
.pub-authors .me { color: var(--text); font-weight: 600; }
.pub-venue { font-size: .87rem; color: var(--text-faint); margin: 0; }
.pub-venue em { font-style: italic; color: var(--text-muted); }
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .6rem; }

.tag {
  font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: .2rem .5rem; border-radius: 5px;
}
.tag-journal { background: var(--tag-journal-bg); color: var(--tag-journal-fg); }
.tag-conference { background: var(--tag-conference-bg); color: var(--tag-conference-fg); }
.tag-workshop { background: var(--tag-workshop-bg); color: var(--tag-workshop-fg); }
.tag-thesis { background: var(--tag-thesis-bg); color: var(--tag-thesis-fg); }

.pub-link {
  font-size: .78rem; font-weight: 500; padding: .2rem .55rem;
  border: 1px solid var(--border); border-radius: 5px; color: var(--text-muted);
  transition: all .15s ease;
}
.pub-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.cites { font-size: .76rem; color: var(--text-faint); font-variant-numeric: tabular-nums; margin-left: auto; }
@media (max-width: 560px) { .cites { margin-left: 0; } }

/* ---------- CV / timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 1.9rem 1.6rem; border-left: 2px solid var(--border); }
.timeline > li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline > li::before {
  content: ""; position: absolute; left: -.45rem; top: .45rem;
  width: .7rem; height: .7rem; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.tl-period { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: .2rem; }
.tl-title { font-family: var(--font-body); font-size: 1.02rem; font-weight: 600; margin: 0 0 .15rem; }
.tl-org { font-size: .92rem; color: var(--text-muted); margin: 0 0 .35rem; }
.tl-note { font-size: .89rem; color: var(--text-faint); margin: 0; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; list-style: none; padding: 0; margin: 0; }
.people li { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }
.people .pn { font-weight: 600; font-size: .93rem; display: block; }
.people .po { font-size: .82rem; color: var(--text-faint); }

/* ---------- contact ---------- */

.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem 2.5rem; }
.contact-item .k { font-size: .74rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 .3rem; }
.contact-item .v { font-size: .98rem; margin: 0; }
.email-link { font-family: var(--font-mono); font-size: .93rem; }

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

.site-footer { border-top: 1px solid var(--border); background: var(--bg-sunk); padding-block: 2.25rem; margin-top: 1rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.site-footer p { margin: 0; font-size: .84rem; color: var(--text-faint); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.footer-links a { font-size: .84rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }

/* ---------- utilities ---------- */

.stack-lg > * + * { margin-top: 2.5rem; }
.hidden { display: none !important; }
.empty-note { font-size: .9rem; color: var(--text-faint); font-style: italic; }

/* ---------- hero subtitle ---------- */

.hero-subtitle {
  display: flex; align-items: flex-start; gap: .5rem;
  font-size: .95rem; color: var(--text-muted);
  margin: 0 0 1.5rem; max-width: 46ch;
}
.hero-subtitle svg { width: 1.05rem; height: 1.05rem; flex: none; color: var(--accent); margin-top: .28rem; }

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

.project-featured {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: clamp(1.4rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}
.project-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .75rem; margin-bottom: .5rem; }
.project-name { font-family: var(--font-display); font-size: 1.7rem; margin: 0; letter-spacing: -.02em; }
.project-name.sm { font-size: 1.2rem; }
.project-full { font-size: .92rem; color: var(--text-faint); }
.project-full.sm { display: block; margin: -.2rem 0 .7rem; font-size: .84rem; }
.role-badge {
  font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-radius: 999px; padding: .18rem .6rem;
  white-space: nowrap;
}
.project-tagline {
  font-family: var(--font-display); font-size: 1.1rem; color: var(--text);
  margin: 0 0 1rem;
}
.project-body { margin-bottom: 1.1rem; }
.project-body p { margin-bottom: .9rem; }
.project-body ul { margin: 0; padding-left: 1.1rem; }
.project-body li { font-size: .93rem; color: var(--text-muted); margin-bottom: .35rem; }
.project-tech { margin-bottom: 1.2rem; }
.project-tech li { font-size: .76rem; }

.project-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.stat { background: var(--bg-sunk); padding: .8rem 1rem; }
.stat .sv { display: block; font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.1; }
.stat .sk { display: block; font-size: .74rem; color: var(--text-faint); margin-top: .2rem; }

.project-links { margin-top: 1.2rem; }
.card .project-links { margin-top: auto; padding-top: 1rem; }
.project-card p { margin-bottom: .9rem; }
.project-card .tags { margin-bottom: 0; }

/* the featured card is wider than a text column, so let its prose breathe */
.project-featured .prose { max-width: 82ch; }
