/* ==========================================================================
   Kiarash Aghakasiri — academic site
   Colours live in the tokens below; change them in one place.
   ========================================================================== */
:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --ink: #1b2330;
  --ink-2: #3b4452;
  --muted: #6b7380;
  --line: #e7e3db;
  --accent: #1f5c45;          /* deep green, a nod to UAlberta */
  --accent-ink: #ffffff;
  --accent-soft: #e6efe9;
  --gold: #a87a12;
  --gold-soft: #f7efd9;
  --shadow: 0 1px 2px rgba(20, 24, 32, .04), 0 8px 24px -12px rgba(20, 24, 32, .12);
  --radius: 14px;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --maxw: 1160px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a; --surface: #151c24; --surface-2: #1a232d; --ink: #e7ebef; --ink-2: #c3cad3;
    --muted: #8e99a6; --line: #25303c; --accent: #7cc9a3; --accent-ink: #0f141a; --accent-soft: #17302a;
    --gold: #e0b75a; --gold-soft: #2c2616; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a; --surface: #151c24; --surface-2: #1a232d; --ink: #e7ebef; --ink-2: #c3cad3;
  --muted: #8e99a6; --line: #25303c; --accent: #7cc9a3; --accent-ink: #0f141a; --accent-soft: #17302a;
  --gold: #e0b75a; --gold-soft: #2c2616; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.2; color: var(--ink); margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.icon { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.masthead-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; height: 64px; display: flex; align-items: center; gap: 24px; }
.brand { font-family: var(--serif); font-size: 1.28rem; font-weight: 600; color: var(--ink); letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--accent); }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { color: var(--ink-2); font-size: .92rem; font-weight: 500; padding: 7px 12px; border-radius: 999px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.masthead-actions { display: flex; gap: 4px; }
.icon-btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; cursor: pointer; font-size: 17px; transition: border-color .15s, color .15s; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.show-dark, .i-close, .menu-btn { display: none; }
:root[data-theme="dark"] .show-dark { display: inline; } :root[data-theme="dark"] .show-light { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .show-dark { display: inline; } :root:not([data-theme="light"]) .show-light { display: none; } }

/* ---------- layout ---------- */
.layout { max-width: var(--maxw); margin: 0 auto; padding: 48px 28px 72px; display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 64px; align-items: start; }
.content { min-width: 0; max-width: 760px; }

/* ---------- profile sidebar ---------- */
.profile { position: sticky; top: 104px; }
.avatar { width: 188px; height: 188px; border-radius: 50%; object-fit: cover; border: 4px solid var(--surface); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.profile-name { font-size: 1.5rem; margin-top: 20px; font-weight: 600; }
.profile-role { color: var(--muted); margin: 4px 0 14px; font-size: .95rem; }
.profile-meta { list-style: none; padding: 0; margin: 0 0 18px; font-size: .92rem; color: var(--ink-2); }
.profile-meta li { display: flex; gap: 10px; align-items: flex-start; padding: 3px 0; }
.profile-meta .icon { color: var(--muted); margin-top: .3em; }
.profile-meta a { color: var(--ink-2); }
.profile-meta a:hover { color: var(--accent); }
.profile-links { list-style: none; padding: 16px 0 0; margin: 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.profile-links a { display: flex; align-items: center; gap: 11px; padding: 6px 10px; margin: 0 -10px; border-radius: 9px; color: var(--ink-2); font-size: .93rem; font-weight: 500; }
.profile-links a:hover { background: var(--surface-2); color: var(--accent); text-decoration: none; }
.profile-links .icon { font-size: 1.05rem; color: var(--muted); }
.profile-links a:hover .icon { color: var(--accent); }

/* ---------- typography blocks ---------- */
.kicker { font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.kicker a { color: inherit; }
.hero-title { font-size: clamp(1.9rem, 3.2vw, 2.55rem); line-height: 1.16; margin-bottom: 22px; font-weight: 500; }
.hero-title em { font-style: italic; color: var(--accent); }
.page-header { margin-bottom: 34px; }
.page-title { font-size: clamp(2rem, 3.4vw, 2.6rem); font-weight: 500; }
.lede { font-size: 1.1rem; color: var(--muted); margin: 12px 0 0; max-width: 62ch; }
.meta { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }
.prose { color: var(--ink-2); font-size: 1.02rem; }
.prose > p a:not([class]), .prose > ul a:not([class]), .prose > ol a:not([class]) { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.prose > p a:not([class]):hover, .prose > ul a:not([class]):hover { text-decoration-color: var(--accent); }
.prose > h2 { font-size: 1.55rem; margin: 2em 0 .6em; }
.prose > h3 { font-size: 1.22rem; margin: 1.6em 0 .5em; }
.prose > ul, .prose > ol { padding-left: 1.3em; }
.prose > ul > li, .prose > ol > li { margin: .3em 0; }
.prose blockquote { margin: 1.4em 0; padding: .2em 0 .2em 1.1em; border-left: 3px solid var(--accent); color: var(--muted); font-family: var(--serif); font-size: 1.12rem; font-style: italic; }
.prose code { font-size: .88em; background: var(--surface-2); padding: .12em .38em; border-radius: 5px; }
.prose pre { background: var(--surface-2); border: 1px solid var(--line); padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: .88rem; }
.prose pre code { background: none; padding: 0; }
.prose > p > img { border-radius: 10px; margin: 1.2em 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }

/* ---------- sections ---------- */
.section { margin-top: 60px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.section-head h2 { font-size: 1.45rem; }
.more { font-size: .9rem; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.group-title { font-size: 1.4rem; margin: 44px 0 16px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; margin: 44px 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.group-head .group-title { margin: 0; }
.group-blurb { color: var(--muted); font-size: .9rem; margin: 0; }
.project-group:first-child .group-head { margin-top: 0; }

/* ---------- tags / chips / buttons ---------- */
.tags, .interests { display: flex; flex-wrap: wrap; gap: 6px; }
.interests { margin: 22px 0 26px; }
.tag { font-size: .78rem; font-weight: 500; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.interests .tag { font-size: .85rem; padding: 5px 12px; background: var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .78rem; font-weight: 600; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); padding: 3px 11px; border-radius: 999px; transition: background .15s; letter-spacing: .01em; }
.chip:hover { background: var(--accent-soft); text-decoration: none; }
.chip-accent { background: var(--accent-soft); border-color: transparent; }
.cta, .page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.page-actions { margin: -8px 0 8px; }
.btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: .93rem; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 1px 1px rgba(0,0,0,.03); transition: border-color .15s, transform .15s, background .15s; }
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.08); }

/* ---------- news ---------- */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 9px 0; color: var(--ink-2); }
.news li + li { border-top: 1px dashed var(--line); }
.news-date { font-size: .82rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: .15em; }
.news-text strong { color: var(--ink); font-weight: 600; }

/* ---------- publications ---------- */
.pubs { display: grid; gap: 14px; }
.pub { display: grid; grid-template-columns: 84px 1fr; gap: 20px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .2s, box-shadow .2s; }
.pub:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow); }
.pub:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pub-venue { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.venue { display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); padding: 4px 9px; border-radius: 7px; }
.pub-year { font-size: .8rem; color: var(--muted); padding-left: 2px; font-variant-numeric: tabular-nums; }
.pub-title { font-family: var(--serif); font-size: 1.14rem; font-weight: 500; line-height: 1.32; margin-bottom: 6px; }
.pub-title a { color: var(--ink); }
.pub-title a:hover { color: var(--accent); text-decoration: none; }
.pub-authors { font-size: .9rem; color: var(--ink-2); margin: 0 0 3px; }
.pub-authors .me { font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.pub-where { font-size: .86rem; color: var(--muted); margin: 0 0 8px; }
.eq { font-style: normal; }
.pub-tldr { font-size: .92rem; color: var(--ink-2); margin: 0 0 12px; padding-left: 12px; border-left: 2px solid var(--line); }

/* ---------- tiles (home) ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink-2); transition: border-color .2s, transform .2s, box-shadow .2s; }
.tile:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile-title { font-family: var(--serif); font-size: 1.15rem; color: var(--ink); display: inline-flex; gap: 8px; align-items: center; }
.tile-title .icon { color: var(--accent); }
.tile-text { font-size: .88rem; color: var(--muted); line-height: 1.5; }

/* ---------- project cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .2s, box-shadow .2s; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow); }
.card-meta { font-size: .76rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.card-title { font-size: 1.12rem; font-weight: 500; line-height: 1.3; margin-bottom: 8px; }
.card-text { font-size: .92rem; color: var(--ink-2); margin: 0 0 14px; flex: 1; }
.card-foot { display: flex; flex-direction: column; gap: 10px; }

/* ---------- ideas ---------- */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .84rem; color: var(--muted); margin: -6px 0 22px; }
.legend .status { margin-left: 8px; } .legend .status:first-child { margin-left: 0; }
.status { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.status-seed { background: var(--gold-soft); color: var(--gold); }
.status-exploring { background: color-mix(in srgb, #3b6fd8 14%, transparent); color: #3b6fd8; }
.status-active { background: var(--accent-soft); color: var(--accent); }
.status-parked { background: var(--surface-2); color: var(--muted); }
:root[data-theme="dark"] .status-exploring { color: #8fb0f2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .status-exploring { color: #8fb0f2; } }
.idea-list { display: grid; gap: 12px; }
.idea-card { display: block; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); transition: border-color .2s, transform .2s, box-shadow .2s; }
.idea-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.idea-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.idea-top .meta { margin: 0; }
.idea-title { font-size: 1.22rem; margin-bottom: 6px; }
.idea-summary { font-size: .94rem; margin: 0 0 12px; }

/* ---------- blog ---------- */
.post-list { display: grid; }
.post-item { display: grid; grid-template-columns: 116px 1fr; gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.post-item:hover { text-decoration: none; }
.post-item:hover .post-title { color: var(--accent); }
.post-date { font-size: .85rem; color: var(--muted); padding-top: .25em; font-variant-numeric: tabular-nums; }
.post-main { display: flex; flex-direction: column; gap: 4px; }
.post-title { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); transition: color .15s; }
.post-excerpt { font-size: .93rem; color: var(--muted); }
.back { margin-top: 48px; font-weight: 500; }
.post .tags, .idea .tags { margin-top: 14px; }

/* ---------- empty states ---------- */
.empty { display: flex; gap: 16px; align-items: flex-start; padding: 26px; border: 1.5px dashed var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 60%, transparent); color: var(--muted); }
.empty > .icon { font-size: 1.6rem; color: var(--accent); flex: none; margin-top: 2px; }
.empty p { margin: 0; }
.empty strong { color: var(--ink); font-weight: 600; }

/* ---------- rows (teaching, awards) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-title { font-family: var(--sans); font-size: 1rem; font-weight: 600; margin: 0 0 2px; letter-spacing: 0; }
.row-title a { color: var(--ink); }
.row-title a:hover { color: var(--accent); }
.row-sub { font-size: .9rem; color: var(--muted); margin: 0; }
.row-when { font-size: .85rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: .1em; }
.teach .group-head { margin-top: 8px; }
.teach + .teach .group-head { margin-top: 44px; }

/* ---------- CV ---------- */
.cv-block .group-title { margin-top: 48px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 124px 1fr; gap: 22px; padding: 16px 0; position: relative; }
.timeline li + li { border-top: 1px dashed var(--line); }
.tl-when { font-size: .85rem; font-weight: 600; color: var(--muted); padding-top: .2em; font-variant-numeric: tabular-nums; }
.tl-body h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; letter-spacing: 0; }
.tl-org { color: var(--accent); font-size: .9rem; font-weight: 500; margin: 2px 0 6px; }
.tl-body p:last-child { margin: 0; font-size: .93rem; color: var(--ink-2); }
.skills { display: grid; grid-template-columns: 124px 1fr; gap: 10px 22px; margin: 0; }
.skills dt { font-size: .85rem; font-weight: 600; color: var(--muted); padding-top: .15em; }
.skills dd { margin: 0; font-size: .95rem; color: var(--ink-2); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 26px 28px 34px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--muted); font-size: .85rem; }
.footer a { color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.footer a:hover { color: var(--accent); }
.dot { opacity: .5; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1020px) {
  .layout { grid-template-columns: 220px minmax(0,1fr); gap: 44px; }
  .avatar { width: 150px; height: 150px; }
  .nav a { padding: 7px 9px; }
}
@media (max-width: 880px) {
  .menu-btn { display: grid; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0; margin: 0;
    flex-direction: column; gap: 2px; padding: 10px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    display: none;
  }
  .nav a { padding: 11px 14px; font-size: 1rem; border-radius: 10px; }
  .masthead-actions { margin-left: auto; }
  body.nav-open .nav { display: flex; }
  body.nav-open .i-open { display: none; } body.nav-open .i-close { display: inline; }

  .layout { grid-template-columns: 1fr; gap: 36px; padding: 28px 20px 56px; }
  .content { max-width: none; }
  .profile {
    position: static; display: grid; grid-template-columns: 96px 1fr; gap: 4px 18px; align-items: center;
    padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  }
  .avatar { width: 96px; height: 96px; border-width: 3px; }
  .profile-name { margin-top: 0; font-size: 1.3rem; }
  .profile-role { margin: 2px 0 6px; font-size: .88rem; }
  .profile-meta { margin: 0; font-size: .85rem; }
  .profile-meta li { padding: 1px 0; gap: 8px; }
  .profile-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 14px; }
  .profile-links a { margin: 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; gap: 7px; }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .masthead-inner { padding: 0 16px; }
  .layout { padding: 20px 16px 48px; }
  .footer-inner { padding: 22px 16px 30px; }
  .hero-title { font-size: 1.72rem; }
  .cards, .tiles { grid-template-columns: 1fr; }
  .pub { grid-template-columns: 1fr; gap: 10px; padding: 18px; }
  .pub-venue { flex-direction: row; align-items: center; gap: 8px; }
  .post-item, .timeline li, .skills { grid-template-columns: 1fr; gap: 4px; }
  .row { flex-direction: column; gap: 4px; }
  .news li { grid-template-columns: 48px 1fr; gap: 10px; }
  .section { margin-top: 48px; }
}
@media (max-width: 380px) {
  .profile { grid-template-columns: 76px 1fr; }
  .avatar { width: 76px; height: 76px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .masthead, .footer, .profile-links { display: none; } .layout { display: block; } }
.lede p, .card-text p { margin: 0; }
.lede p + p { margin-top: .6em; }
