:root{
  /* =========================
     Color system (charcoal + cream - mature minimal)
     ========================= */
  --bg: #f7f5f2;                /* warm off-white cream */
  --surface: #ffffff;           /* pure white cards */
  --surface-2: rgba(24,24,27,.02);
  --text: #18181b;              /* charcoal black */
  --muted: #71717a;             /* warm grey */
  --accent: #1f2937;            /* deep charcoal accent */
  --accent-2: #374151;          /* lighter charcoal */
  --rule: rgba(15,15,20,.08);   /* warm subtle dividers */
  --ring: rgba(31,41,55,.15);

  /* =========================
     Layout
     ========================= */
  --sidebar: 220px;             /* more compact sidebar */
  --max: 980px;
  --gutter: 24px;
  --container-padding: 32px;

  /* =========================
     Sizing + typography
     ========================= */
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 10px;

  /* =========================
     Shadows (minimal - professional)
     ========================= */
  --shadow-subtle: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-hover: 0 2px 4px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);

  --focus: 0 0 0 3px var(--ring);
}

*{ box-sizing:border-box; }

html, body{
  margin:0;
  padding:0;
  background: var(--bg);
  color: var(--text);
  font-family: "Lato", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection{ background: rgba(31,41,55,.12); }

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

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

/* =========================
   Top nav (enhanced professional)
   ========================= */
.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255,255,255,.98);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.topbar-inner{
  max-width: calc(var(--max) + var(--sidebar));
  margin: 0 auto;
  padding: 16px var(--gutter);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 24px;
}

.site-title{
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.site-title:hover{
  text-decoration:none;
  color: var(--accent);
}

.topnav{
  display:flex;
  flex-wrap:wrap;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.topnav a{
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: color .2s ease, background .2s ease;
  position: relative;
}

.topnav a:hover{
  color: var(--text);
  background: rgba(24,24,27,.04);
  text-decoration:none;
}

.topnav a.active{
  color: var(--text);
  font-weight: 600;
}

.topnav a.active::after{
  content: '';
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--accent);
}

/* =========================
   Global page layout (used by most pages)
   ========================= */
.page{
  max-width: calc(var(--max) + var(--sidebar));
  margin: 0 auto;
  padding: 40px var(--gutter) 80px;
  display:grid;
  grid-template-columns: var(--sidebar) 1fr;
  gap: 48px;
  align-items: start;
}

/* =========================
   Sidebar (site-wide)
   ========================= */
.sidebar{
  padding: 0;
  background: transparent;
  border: none;
  height: fit-content;
  position: sticky;
  top: calc(60px + 40px);
}

.avatar{
  width: 160px;
  height: 160px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--surface);
  overflow:hidden;
  box-shadow: var(--shadow-subtle);
  margin: 0 auto 24px;
  display: block;
}


.sidebar-name{
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--text);
}

.sidebar-bio{
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}

.sidebar-links{
  display:flex;
  flex-direction:column;
  gap: 12px;
  margin-top: 0;
  font-size: 13px;
  text-align: left;
}

.sidebar-links > div{
  color: var(--muted);
  line-height: 1.6;
}

.sidebar-links > div:not(:last-child){ margin-bottom: 4px; }

.sidebar-links a{
  color: var(--accent);
  text-decoration: none;
  transition: color .2s ease;
  display: inline-block;
}
.sidebar-links a:hover{
  color: var(--text);
  text-decoration: none;
}

/* =========================
   Main content (site-wide)
   ========================= */
main{
  max-width: var(--max);
  background: transparent;
  border: none;
  padding: 0;
}

h1, h2, h3{
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
}

h1{
  font-size: 32px;
  margin: 0 0 16px;
  font-weight: 700;
}

h2{
  font-size: 20px;
  margin: 40px 0 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h2:first-of-type{ margin-top: 0; }

h3{
  font-size: 16px;
  margin: 18px 0 8px;
  font-weight: 900;
}

p{ margin: 0 0 18px; line-height: 1.7; }

.lede{
  color: var(--muted);
  font-size: 16px;
  max-width: 74ch;
}

hr{
  border: none;
  border-top: 1px solid var(--rule);
  margin: 48px 0;
}

.footer{
  margin-top: 48px;
  padding-top: 24px;
  border-top: 0;
  color: var(--muted);
  font-size: 14px;
}

/* =========================
   Shared UI
   ========================= */
.manuscript-note{
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

/* Button (keep .btn) */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  box-shadow: none;
  text-decoration:none;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.btn:hover{
  border-color: var(--accent);
  background: var(--bg);
  color: var(--accent);
  text-decoration:none;
}
.btn:focus{
  outline: none;
  box-shadow: var(--focus);
}
.btn.primary{
  border-color: rgba(30,64,175,.18);
  background: rgba(30,64,175,.10);
  color: #0b1f5c;
}

/* Shared cover images (legacy) */
.book-cover img,
.proj-cover img{
  width:100%;
  height:auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15,23,42,.06);
}

/* =========================
   Feature layouts (legacy-safe)
   ========================= */
.book-feature{
  display:grid;
  grid-template-columns: 1fr 300px;
  gap: 44px;
  margin-top: 20px;
  align-items:flex-start;
}
.book-links{ margin-top: 14px; }

.proj-feature{
  display:grid;
  grid-template-columns: 1fr 240px;
  gap: 28px;
  align-items:flex-start;
}
.proj-feature h2{ margin-top: 0; }
.proj-cover{ align-self:flex-start; }
.proj-links{ margin-top: 14px; }

/* =========================
   Projects
   ========================= */
.projects-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.project-card{
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 28px;
  margin: 24px 0;
  box-shadow: var(--shadow-subtle);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.project-card:hover{
  box-shadow: var(--shadow);
  border-color: rgba(24,24,27,.15);
}

.project-top{
  display:flex;
  justify-content:space-between;
  gap: 16px;
  align-items:flex-start;
}

.project-title{
  margin:0;
  font-size: 20px;
  line-height:1.2;
  font-weight: 950;
}

.project-tags{
  margin-top: 10px;
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  font-size: 12px;
}
.project-tags span{
  color: rgba(11,18,32,.84);
  background: rgba(30,64,175,.06);
  border: 1px solid rgba(30,64,175,.14);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 800;
}

.project-top-right{
  display:flex;
  flex-direction:column;
  gap: 10px;
  text-align:right;
  white-space:nowrap;
}

.proj-link{
  font-size: 13px;
  color: var(--text);
  text-decoration:none;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 6px;
  font-weight: 500;
  box-shadow: none;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.proj-link:hover{
  border-color: var(--accent);
  background: var(--bg);
  color: var(--accent);
  text-decoration:none;
}

.project-desc{
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.65;
  color: rgba(11,18,32,.92);
  max-width: none;
}
.project-card--with-cover .project-desc{ max-width: 62ch; }

.project-divider{
  border-top: 1px solid var(--rule);
  margin: 20px 0;
}

.project-metrics{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.project-metrics > div{
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 16px 14px;
  background: var(--bg);
  box-shadow: none;
}
.metric-value{
  font-size: 18px;
  font-weight: 950;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.metric-label{
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.project-two-col{ margin-top: 12px; display:block; }

.project-card--with-cover .project-two-col{
  display:grid;
  grid-template-columns: 1fr 300px;
  gap: 22px;
  align-items:start;
}

.project-cover{ justify-self:end; align-self:start; }

.project-cover img{
  width:100%;
  max-width:300px;
  height:340px;
  object-fit:cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  background: var(--surface);
  box-shadow: var(--shadow-subtle);
  transition: box-shadow .2s ease;
}
.project-cover img:hover{ box-shadow: var(--shadow); }

/* =========================
   Research Interests list
   ========================= */
.ri{
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 20px;
  color: var(--text);
}
.ri li{
  margin: 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-subtle);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.ri li:hover{
  box-shadow: var(--shadow);
  border-color: rgba(24,24,27,.12);
}
.ri li strong{
  color: var(--text);
  font-weight: 600;
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.ri li span{
  color: var(--muted);
  display: block;
  line-height: 1.7;
  font-size: 14px;
}

/* =========================
   Experience cards (legacy class; safe to keep)
   ========================= */
.experience-item{
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 28px;
  margin: 28px 0;
  box-shadow: var(--shadow-subtle);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.experience-item:hover{
  box-shadow: var(--shadow);
  border-color: rgba(24,24,27,.12);
}
.experience-item h2{ margin-top: 0; margin-bottom: 8px; }
.experience-item .lede{
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.experience-item ul{ margin: 0; padding-left: 20px; }
.experience-item li{ margin-bottom: 12px; line-height: 1.7; }

/* =========================
   Detail pages
   ========================= */
.detail{
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px var(--gutter) 84px;
}

.detail-content{
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--container-padding);
  box-shadow: var(--shadow);
  margin-top: 20px;
}

.detail-back{
  display:inline-block;
  margin: 0 0 32px;
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  padding: 6px 0;
  transition: color .2s ease;
}
.detail-back:hover{ color: var(--text); }

.detail-hero{
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 36px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-subtle);
}

.detail-kicker{
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 900;
}

.detail-title{
  font-size: 36px;
  line-height: 1.1;
  margin: 0 0 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.detail-subtitle{
  color: var(--muted);
  font-size: 16px;
  margin: 0 0 14px;
  max-width: 74ch;
}

.detail-meta{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  color: var(--text);
  font-size: 14px;
  margin: 10px 0 16px;
}

.detail-meta span{
  color: var(--muted);
  font-weight: 500;
}

.detail-actions{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  margin-top: 8px;
}

.detail-section{
  margin: 32px 0 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 32px;
  box-shadow: var(--shadow-subtle);
}
.detail-section:first-of-type{ margin-top: 0; }

.detail-section h2{
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.muted{ color: var(--muted); }

.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card{
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-subtle);
  transition: box-shadow .2s ease;
}
.card:hover{ box-shadow: var(--shadow); }

.card-title{
  font-weight: 950;
  margin: 0 0 8px;
}

.tight{
  margin: 0;
  padding-left: 18px;
}
.tight li{ margin: 0 0 6px; }

.callout{
  margin-top: 24px;
  border: 1px solid var(--rule);
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  box-shadow: none;
}

.callout-title{
  font-weight: 950;
  margin: 0 0 8px;
}

.figure{
  margin: 32px 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow:hidden;
  box-shadow: var(--shadow-subtle);
}

.figcap{
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.figimg{ width:100%; height:auto; }

/* =========================
   Responsive (site-wide)
   ========================= */
@media (min-width: 980px){
  .projects-grid{ grid-template-columns: 1fr 1fr; }
  .projects-grid .project-card{ margin: 0; }
}

@media (max-width: 900px){
  .page{
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 32px var(--gutter) 60px;
  }

  .sidebar{
    position: static;
    margin-bottom: 0;
    text-align: center;
  }

  .avatar{
    width: 100px;
    height: 100px;
  }

  .sidebar-links{ text-align: center; }

  .book-feature{ grid-template-columns: 1fr; }
  .book-cover{ order:-1; max-width: 340px; }

  .proj-feature{ grid-template-columns: 1fr; }
  .proj-cover{ max-width: 320px; }

  .project-top-right{
    text-align:left;
    flex-direction:row;
    flex-wrap:wrap;
  }

  .project-metrics{ grid-template-columns: 1fr; }

  .project-card--with-cover .project-two-col{ grid-template-columns: 1fr; }
  .project-cover{ justify-self:start; }

  .project-cover img{
    max-width: 360px;
    height:auto;
    object-fit:contain;
  }
}

@media (max-width: 860px){
  .detail-meta{ grid-template-columns: 1fr; }
  .grid-2{ grid-template-columns: 1fr; }
  .detail-title{ font-size: 34px; }
}

