/* ---------- Tokens ---------- */
:root {
  --bg: #0e1114;
  --bg-card-hover: rgba(255, 255, 255, 0.035);
  --text: #9aa4ae;
  --text-strong: #e8ecef;
  --muted: #6b7680;
  --accent: #e8b46a;          /* warm amber — deliberately not Brittany's teal */
  --accent-soft: rgba(232, 180, 106, 0.12);
  --line: #2a3138;
  --todo: #ff8a7a;
  --spot: rgba(232, 180, 106, 0.07);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #faf8f4;
    --bg-card-hover: rgba(0, 0, 0, 0.035);
    --text: #4a5560;
    --text-strong: #14181c;
    --muted: #7a848d;
    --accent: #a8641a;
    --accent-soft: rgba(168, 100, 26, 0.1);
    --line: #e2ddd3;
    --todo: #c43d2b;
    --spot: rgba(168, 100, 26, 0.06);
    color-scheme: light;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-strong); text-decoration: none; }
a:hover, a:focus-visible { color: var(--accent); }
strong, b { color: var(--text-strong); font-weight: 600; }
::selection { background: var(--accent); color: var(--bg); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--accent); color: var(--bg); padding: .5rem 1rem; z-index: 10; }

.spotlight {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(600px at var(--x, 50%) var(--y, 30%), var(--spot), transparent 80%);
  transition: background .2s;
}

/* ---------- Layout ---------- */
.layout {
  position: relative; z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
@media (min-width: 1024px) {
  .layout { display: flex; gap: 4rem; padding: 0 3rem; }
  .side {
    position: sticky; top: 0;
    height: 100vh; width: 44%;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 6rem 0;
  }
  .main { width: 56%; padding: 6rem 0; }
}
.side { padding-top: 4rem; }

/* ---------- Identity column ---------- */
.avatar {
  width: 112px; height: 112px;
  border-radius: 50%;
  object-fit: cover; object-position: center 20%;
  border: 2px solid var(--line);
  margin-bottom: 1.25rem;
}
.name { margin: 0; font-size: clamp(2.2rem, 5vw, 3rem); line-height: 1.1; letter-spacing: -0.02em; }
.name a { color: var(--text-strong); }
.role { margin: .75rem 0 0; font-size: 1.15rem; font-weight: 500; color: var(--text-strong); }
.tagline { margin: 1rem 0 0; max-width: 22rem; }

.nav { display: none; margin-top: 4rem; }
@media (min-width: 1024px) { .nav { display: block; } }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav a {
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 0;
  font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
}
.nav-line { display: block; width: 2rem; height: 1px; background: var(--muted); transition: width .2s, background .2s; }
.nav a:hover .nav-line, .nav a.active .nav-line { width: 4rem; background: var(--text-strong); }
.nav a:hover, .nav a.active { color: var(--text-strong); }

.social { list-style: none; display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 2rem 0 0; padding: 0; }
.social a { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .85rem; }
.social a:hover { color: var(--text-strong); }
.social svg { width: 22px; height: 22px; }

/* ---------- Sections ---------- */
.section { margin-bottom: 6rem; scroll-margin-top: 4rem; }
.section-title {
  margin: 0 0 1.5rem;
  font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-strong);
}
@media (max-width: 1023px) {
  .section-title {
    position: sticky; top: 0; z-index: 2;
    margin: 0 -1.5rem 1.5rem; padding: 1.1rem 1.5rem;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(8px);
  }
  .main { padding: 3rem 0 4rem; }
}
.section > p { margin: 0 0 1rem; }
.section-intro { color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }
.chips span, .tags li {
  font-size: .75rem; font-weight: 500;
  padding: .25rem .75rem;
  border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}

/* ---------- Cards (experience / projects) ---------- */
.timeline, .projects { list-style: none; margin: 0; padding: 0; }
.card {
  position: relative;
  display: grid; gap: .5rem 1.5rem;
  padding: 1.25rem; margin: 0 -1.25rem 1rem;
  border-radius: 8px;
  transition: background .2s, box-shadow .2s;
}
@media (min-width: 640px) { .card { grid-template-columns: 8rem 1fr; } }
@media (min-width: 1024px) {
  .card:hover { background: var(--bg-card-hover); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
  /* Dim siblings while hovering one card, as in the reference design */
  .timeline:hover .card:not(:hover), .projects:hover .card:not(:hover) { opacity: .5; }
}
.card-date { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: .25rem; }
.card h3 { margin: 0 0 .5rem; font-size: 1rem; font-weight: 600; color: var(--text-strong); line-height: 1.4; }
.card p { margin: 0 0 .5rem; font-size: .92rem; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: .75rem 0 0; padding: 0; }
.arrow { display: inline-block; transition: transform .2s; }
.card:hover .arrow { transform: translate(2px, -2px); }

.project-img {
  width: 100%; aspect-ratio: 2 / 1; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--line);
  order: 0;
}
.project-img.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), transparent);
}
.metric { color: var(--accent); font-weight: 600; font-size: .85rem !important; }
.links { font-size: .85rem !important; }
.links a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }

.more-link { display: inline-flex; gap: .4rem; margin-top: 1rem; font-weight: 600; }

/* ---------- Publications ---------- */
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { border-top: 1px solid var(--line); }
.pub > a {
  display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem;
  padding: 1rem .75rem; margin: 0 -.75rem; border-radius: 6px;
  color: inherit; transition: background .2s;
}
.pub > a:hover { background: var(--bg-card-hover); }
.pub > a:hover h3 { color: var(--accent); }
@media (max-width: 639px) {
  .pub > a { grid-template-columns: 1fr; gap: .5rem; }
  .venue { justify-self: start; }
}
.pubs.collapsed .pub:not(.selected) { display: none; }
.venue {
  align-self: start;
  font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-align: center;
  padding: .3rem .4rem; border-radius: 4px;
  border: 1px solid var(--accent); color: var(--accent);
}
.pub h3 { margin: 0 0 .25rem; font-size: .98rem; font-weight: 600; line-height: 1.45; color: var(--text-strong); }
.pub .authors, .pub .meta { margin: 0; font-size: .85rem; }
.pub .meta { color: var(--muted); }
.lang { font-size: .7rem; padding: 0 .35rem; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-weight: 500; }

/* ---------- Mentoring ---------- */
.sub { font-size: .95rem; color: var(--text-strong); margin: 1.5rem 0 .75rem; font-weight: 600; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: .45rem 0; font-size: .92rem; display: flex; gap: .75rem; }
.deg { flex: 0 0 3.2rem; font-size: .75rem; font-weight: 700; color: var(--accent); padding-top: .15rem; }

/* ---------- Footer ---------- */
.footer { font-size: .8rem; color: var(--muted); max-width: 28rem; }
.footer a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line); }

/* ---------- Demo placeholders: things you still need to fill in ---------- */
.todo, .todo-inline { color: var(--todo); border-bottom: 1px dashed var(--todo); }
li.todo { background: transparent !important; border: 1px dashed var(--todo); color: var(--todo) !important; }
.todo-block {
  color: var(--todo); font-size: .85rem;
  border: 1px dashed var(--todo); border-radius: 6px; padding: .6rem .8rem; margin-top: 1rem;
}
.todo-link { opacity: .45; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ================= v2 additions ================= */
.contact { list-style: none; margin: 1.25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.contact a { display: inline-flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--text-strong); }
.contact a:hover { color: var(--accent); }
.contact svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.contact svg.flag { width: 20px; height: 14.5px; border-radius: 2px; }


/* Whole card is clickable: the title button/link stretches over the card */
.hit {
  all: unset; cursor: pointer; color: var(--text-strong);
  font-weight: 600; line-height: 1.4;
}
.hit::after { content: ""; position: absolute; inset: 0; border-radius: 8px; }
.hit:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.card:hover .hit, .hit:focus-visible { color: var(--accent); }
.card { cursor: pointer; }
.card a:not(.hit) { position: relative; z-index: 1; }
.more {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15rem; height: 1.15rem; margin-left: .3rem; border-radius: 50%;
  border: 1px solid currentColor; font-size: .8rem; line-height: 1; vertical-align: 1px;
  transition: transform .2s;
}
.card:hover .more { transform: rotate(90deg); }
.badge {
  font-size: .65rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: .1rem .45rem; border-radius: 4px; margin-left: .25rem; vertical-align: 2px;
  background: var(--accent); color: var(--bg);
}

/* Generated cover tiles for items without photos */
.tile {
  display: flex; align-items: flex-end; padding: .6rem .7rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; position: relative; overflow: hidden;
}
.tile span { position: relative; z-index: 1; text-shadow: 0 1px 6px rgba(0,0,0,.35); }
.tile::before { content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.35) 1px, transparent 1px); background-size: 12px 12px; }
.tile-sea   { background: linear-gradient(135deg, #0f4c75, #3282b8 60%, #8fd3fe); }
.tile-geo   { background: linear-gradient(135deg, #3d2c8d, #916bbf 55%, #c996cc); }
.tile-grant { background: linear-gradient(135deg, #7a4b12, #c98a2c 55%, #f3c77a); }
.tile-agent { background: linear-gradient(135deg, #0b3b2e, #1f7a5a 55%, #7fd1ae); }
.tile-logic { background: linear-gradient(135deg, #3a1f2b, #8a3b58 55%, #e09aa8); }
.project-img.tile { border: 0; }

/* Publications toggle */
.toggle-pubs {
  display: inline-flex; align-items: center; gap: .5rem;
  margin-top: 1.25rem; padding: .6rem 1.1rem; border-radius: 999px;
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
  transition: border-color .2s;
}
.toggle-pubs:hover { border-color: var(--accent); }
.toggle-pubs .count { opacity: .75; font-weight: 500; }
.toggle-pubs .chev { transition: transform .2s; }
.toggle-pubs[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* Teaching & service mini cards */
.mini-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
@media (min-width: 640px) { .mini-grid { grid-template-columns: 1fr 1fr; } }
.card.mini { display: block; margin: 0; border: 1px solid var(--line); }
.card.mini h3 { font-size: .95rem; }

/* ================= Modal ================= */
.modal {
  width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 4rem);
  padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--text);
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  overflow: hidden;
}
.modal[open] { display: flex; flex-direction: column; animation: pop .22s ease-out; }
.modal::backdrop { background: rgba(5, 8, 10, .65); backdrop-filter: blur(4px); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-content { overflow-y: auto; padding: 0 2rem 2rem; font-size: .95rem; }
@media (max-width: 639px) { .modal-content { padding: 0 1.25rem 1.5rem; } }
.modal-close {
  position: absolute; top: .75rem; right: .75rem; z-index: 3;
  width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 0; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: #fff; background: rgba(0,0,0,.45);
}
.modal-close:hover { background: var(--accent); color: var(--bg); }
.modal-content > :first-child { margin-top: 0; }
.m-img, .m-hero {
  display: block; width: calc(100% + 4rem); margin: 0 -2rem 1.5rem;
  aspect-ratio: 2.4 / 1; object-fit: cover; border-bottom: 1px solid var(--line);
}
@media (max-width: 639px) { .m-img, .m-hero { width: calc(100% + 2.5rem); margin: 0 -1.25rem 1.25rem; } }
.m-img.light { background: #fbf8f3; object-fit: contain; }
.m-hero { font-size: 1rem; padding: 1.25rem 2rem; }
.modal-content > .m-kicker:first-child { margin-top: 2rem; }
.m-kicker { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 .4rem; }
.modal h2 { margin: 0 0 1rem; font-size: 1.45rem; line-height: 1.25; color: var(--text-strong); padding-right: 2rem; }
.modal h3 { margin: 1.5rem 0 .5rem; font-size: 1rem; color: var(--text-strong); }
.modal ul:not(.tags) { padding-left: 1.2rem; }
.modal li { margin: .35rem 0; }
.modal a:not(.btn) { color: var(--text-strong); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.modal a:not(.btn):hover { color: var(--accent); }
.modal code { font-size: .85em; padding: .1rem .35rem; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.m-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .55rem 1rem; border-radius: 8px; font-weight: 600; font-size: .85rem;
  background: var(--accent); color: var(--bg); border: 1px solid var(--accent);
}
.btn:hover { color: var(--bg); filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--accent); }
.m-list > div { padding: 1rem 0; border-top: 1px solid var(--line); }
.m-list > div:first-child { border-top: 0; padding-top: 0; }
.m-list h3 { margin-top: 0; }
.m-sub { font-size: .8rem; color: var(--muted); margin: -.25rem 0 .5rem; }
.m-table-wrap { overflow-x: auto; }
.m-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.m-table th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.m-table td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.dim { color: var(--muted); font-size: .8em; }
body.modal-open { overflow: hidden; }
