/* ===========================================================================
   Scott Angus MacLennan — personal academic site
   Custom, self-contained styles (no framework).
   =========================================================================== */

:root {
  --bg:            #ffffff;
  --bg-alt:        #f5f3ef;   /* warm off-white */
  --bg-dark:       #20262b;
  --ink:           #23282d;
  --ink-soft:      #555f68;
  --ink-faint:     #8a949d;
  --line:          #e3ddd3;
  --accent:        #b5651d;   /* earthy ochre/copper */
  --accent-dark:   #8f4f16;
  --accent-soft:   #f0e3d4;
  --teal:          #2c6e6b;   /* secondary, geologic teal */
  --radius:        12px;
  --shadow:        0 6px 24px rgba(30, 35, 40, 0.08);
  --shadow-lg:     0 14px 48px rgba(30, 35, 40, 0.16);
  --maxw:          1080px;
  --serif:         "Iowan Old Style", "Palatino Linotype", "Palatino", "Georgia", serif;
  --sans:          system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

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

img { max-width: 100%; display: block; }

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

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; color: var(--ink); font-weight: 600; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---- Section scaffolding ------------------------------------------------- */
.section { padding: 84px 0; }
.section--alt { background: var(--bg-alt); }
.section__head { text-align: center; margin-bottom: 48px; }
.section__head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  margin: 0 0 12px;
}
.section__head h2::after {
  content: "";
  display: block;
  width: 56px; height: 3px;
  background: var(--accent);
  margin: 16px auto 0;
  border-radius: 2px;
}
.section__head p { color: var(--ink-soft); max-width: 640px; margin: 0 auto; }

/* ---- Navbar ------------------------------------------------------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s, box-shadow .25s;
}
.nav.scrolled { border-bottom-color: var(--line); box-shadow: 0 2px 14px rgba(0,0,0,.05); }
.nav__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.nav__brand { font-family: var(--serif); font-weight: 600; font-size: 1.32rem; color: var(--ink); white-space: nowrap; }
.nav__brand:hover { text-decoration: none; }
.nav__links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; align-items: center; }
.nav__links a {
  color: var(--ink-soft); font-size: 1.08rem; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; transition: color .2s, background .2s;
}
.nav__links a:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.nav__links a.active { color: var(--accent); }
.nav__toggle {
  display: none; background: none; border: 0; cursor: pointer;
  width: 40px; height: 40px; padding: 8px;
}
.nav__toggle span { display: block; height: 2px; background: var(--ink); margin: 5px 0; border-radius: 2px; transition: .3s; }
.nav__toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.open span:nth-child(2) { opacity: 0; }
.nav__toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Hero --------------------------------------------------------------- */
.hero {
  position: relative; min-height: 100vh; display: flex; align-items: center;
  color: #fff; text-align: center;
  background: linear-gradient(rgba(20,24,28,.55), rgba(20,24,28,.6)), url("../../img/Ethiopia_2.jpg") center/cover no-repeat fixed;
}
.hero__inner { max-width: 820px; margin: 0 auto; padding: 120px 24px; }
.hero__avatar {
  width: 150px; height: 150px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 26px; border: 4px solid rgba(255,255,255,.85); box-shadow: var(--shadow-lg);
}
.hero h1 { color: #fff; font-size: clamp(2.1rem, 5vw, 3.4rem); margin: 0 0 10px; }
.hero__role { font-size: clamp(1.05rem, 2.4vw, 1.4rem); color: #f1e9df; margin: 0 0 4px; font-weight: 500; }
.hero__org { color: #d8cfc4; margin: 0 0 28px; }
.hero__social { display: flex; gap: 14px; justify-content: center; margin-bottom: 32px; }
.hero__social a {
  width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(255,255,255,.14); color: #fff;
  border: 1px solid rgba(255,255,255,.3); transition: .2s;
}
.hero__social a:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-3px); text-decoration: none; }
.hero__social svg { width: 20px; height: 20px; fill: currentColor; }
.hero__scroll { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.75); animation: bob 2s infinite; }
.hero__scroll svg { width: 30px; height: 30px; fill: currentColor; }
@keyframes bob { 0%,100% { transform: translate(-50%,0);} 50% { transform: translate(-50%,8px);} }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; padding: 11px 22px;
  border-radius: 8px; font-weight: 600; font-size: .92rem; border: 0; cursor: pointer;
  transition: background .2s, transform .15s;
}
.btn:hover { background: var(--accent-dark); color: #fff; text-decoration: none; transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn--ghost:hover { background: var(--accent); color: #fff; }
.btn svg { width: 17px; height: 17px; fill: currentColor; }

/* ---- About -------------------------------------------------------------- */
.about { display: grid; grid-template-columns: 280px 1fr; gap: 48px; align-items: start; }
.about__side { position: sticky; top: 96px; }
.about__avatar { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.about__card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; }
.about__card h4 { margin: 0 0 14px; font-size: 1rem; letter-spacing: .02em; text-transform: uppercase; color: var(--accent-dark); font-family: var(--sans); }
.interests { list-style: none; margin: 0; padding: 0; }
.interests li { padding: 6px 0 6px 24px; position: relative; color: var(--ink-soft); font-size: .94rem; }
.interests li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); }
.edu li { list-style: none; padding: 0 0 14px; border-left: 2px solid var(--line); padding-left: 16px; position: relative; }
.edu { padding: 0; margin: 0; }
.edu li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.edu li:last-child { padding-bottom: 0; }
.edu .deg { font-weight: 600; display: block; }
.edu .inst { color: var(--ink-soft); font-size: .9rem; }
.edu .yr { color: var(--ink-faint); font-size: .82rem; }
.about__bio p { margin: 0 0 18px; color: #3a4248; }
.about__bio h3 { margin: 0 0 18px; }

/* ---- Cards (publications / projects / posts) ---------------------------- */
.cards { display: grid; gap: 24px; }
.cards--2 { grid-template-columns: repeat(2, 1fr); }
.cards--3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card__media { aspect-ratio: 16/9; overflow: hidden; background: var(--bg-alt); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card__media img { transform: scale(1.05); }
.card__body { padding: 22px; display: flex; flex-direction: column; flex: 1; }
.card__meta { font-size: .8rem; color: var(--accent-dark); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; margin-bottom: 8px; }
.card__title { font-size: 1.12rem; margin: 0 0 10px; line-height: 1.3; }
.card__authors { font-size: .88rem; color: var(--ink-soft); margin: 0 0 12px; }
.card__authors .me { color: var(--ink); font-weight: 700; }
.card__summary { color: var(--ink-soft); font-size: .94rem; margin: 0 0 16px; }
.card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.tag { background: var(--accent-soft); color: var(--accent-dark); font-size: .74rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.card__actions { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* expandable region */
.expand { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s ease; }
.expand > div { overflow: hidden; }
.expand.open { grid-template-rows: 1fr; }
.expand__inner { padding-top: 4px; }
.expand__inner p { color: #3a4248; font-size: .94rem; }
.expand__inner figure { margin: 18px 0; }
.expand__inner figure img { border-radius: 8px; box-shadow: var(--shadow); }
.expand__inner figcaption { font-size: .83rem; color: var(--ink-faint); font-style: italic; margin-top: 8px; }
.abstract-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-dark); margin: 0 0 6px; }

.link-btn {
  background: none; border: 0; cursor: pointer; color: var(--accent);
  font: inherit; font-size: .88rem; font-weight: 600; padding: 0; display: inline-flex; align-items: center; gap: 5px;
}
.link-btn:hover { color: var(--accent-dark); text-decoration: underline; }
.link-btn svg { width: 14px; height: 14px; fill: currentColor; transition: transform .25s; }
.link-btn.open svg.chev { transform: rotate(180deg); }
.pdf-link { font-size: .88rem; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.pdf-link svg { width: 15px; height: 15px; fill: currentColor; }

/* ---- Talks -------------------------------------------------------------- */
.talks { display: grid; gap: 18px; max-width: 820px; margin: 0 auto; }
.talk { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.talk__date { font-size: .82rem; color: var(--accent-dark); font-weight: 600; }
.talk__title { font-size: 1.08rem; margin: 6px 0 8px; }
.talk__event { color: var(--ink-soft); font-size: .9rem; margin: 0 0 12px; }
.talk__event strong { color: var(--ink); }

/* ---- Teaching ----------------------------------------------------------- */
.teaching { max-width: 760px; margin: 0 auto; }
.teaching > p { text-align: center; color: var(--ink-soft); margin-bottom: 28px; }
.course { background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 18px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.course h4 { margin: 0 0 6px; font-family: var(--sans); }
.course .code { color: var(--accent-dark); }
.course p { margin: 0; color: var(--ink-soft); font-size: .93rem; }

/* ---- Gallery ------------------------------------------------------------ */
.gallery { columns: 3; column-gap: 14px; }
.gallery figure { margin: 0 0 14px; break-inside: avoid; position: relative; cursor: pointer; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.gallery img { width: 100%; transition: transform .4s; }
.gallery figure:hover img { transform: scale(1.06); }
.gallery figcaption {
  position: absolute; inset: auto 0 0 0; padding: 28px 14px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.8)); color: #fff; font-size: .82rem;
  opacity: 0; transition: opacity .25s;
}
.gallery figure:hover figcaption { opacity: 1; }

/* ---- Lightbox ----------------------------------------------------------- */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(12,14,16,.94); display: none; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox__img { max-width: 90vw; max-height: 80vh; border-radius: 6px; box-shadow: var(--shadow-lg); }
.lightbox__cap { position: absolute; bottom: 28px; left: 0; right: 0; text-align: center; color: #eee; font-size: .92rem; padding: 0 20px; }
.lightbox__btn { position: absolute; background: rgba(255,255,255,.12); border: 0; color: #fff; cursor: pointer; width: 52px; height: 52px; border-radius: 50%; font-size: 1.6rem; display: grid; place-items: center; transition: background .2s; }
.lightbox__btn:hover { background: var(--accent); }
.lightbox__prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox__close { top: 20px; right: 20px; width: 46px; height: 46px; }

/* ---- CV ----------------------------------------------------------------- */
.cv { text-align: center; }
.cv p { color: var(--ink-soft); max-width: 560px; margin: 0 auto 26px; }

/* ---- Contact ------------------------------------------------------------ */
.contact { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; max-width: 860px; margin: 0 auto; }
.contact__item { text-align: center; padding: 28px 20px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.contact__item .ic { width: 46px; height: 46px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); }
.contact__item .ic svg { width: 22px; height: 22px; fill: currentColor; }
.contact__item h4 { margin: 0 0 8px; font-family: var(--sans); }
.contact__item a, .contact__item p { color: var(--ink-soft); font-size: .92rem; margin: 0; word-break: break-word; }

/* ---- Footer ------------------------------------------------------------- */
.footer { background: var(--bg-dark); color: #b9c2c9; text-align: center; padding: 36px 24px; }
.footer__social { display: flex; gap: 12px; justify-content: center; margin-bottom: 18px; }
.footer__social a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.08); color: #cdd5db; transition: .2s; }
.footer__social a:hover { background: var(--accent); color: #fff; text-decoration: none; }
.footer__social svg { width: 18px; height: 18px; fill: currentColor; }
.footer p { margin: 4px 0; font-size: .85rem; }
.footer a { color: #e0c9ad; }

/* ---- Reveal on scroll --------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 900px) {
  .cards--3 { grid-template-columns: repeat(2, 1fr); }
  .about { grid-template-columns: 1fr; }
  .about__side { position: static; max-width: 360px; margin: 0 auto; }
  .gallery { columns: 2; }
}
@media (max-width: 720px) {
  .nav__links {
    position: fixed; top: 64px; right: 0; left: 0;
    background: #fff; flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 16px 16px; border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow); transform: translateY(-130%); transition: transform .3s; max-height: calc(100vh - 64px); overflow-y: auto;
  }
  .nav__links.open { transform: none; }
  .nav__links a { padding: 12px; border-radius: 8px; }
  .nav__toggle { display: block; }
  .hero { background-attachment: scroll; }
  .section { padding: 60px 0; }
}
@media (max-width: 560px) {
  .cards--2, .cards--3 { grid-template-columns: 1fr; }
  .gallery { columns: 1; }
  .contact { grid-template-columns: 1fr; }
}
