:root{
  color-scheme: light;
  --bg:#ffffff;
  --surface:#ffffff;
  --surface-2:#fafafa;
  --logo-bg:#ffffff;
  --text:#0f172a;
  --muted:#475569;
  --ink-soft:#334155;
  --accent:#1e3a8a;
  --accent-contrast:#ffffff;
  --border:#e2e8f0;
  --line:rgba(0,0,0,0.08);
  --line-strong:rgba(0,0,0,0.16);
  --header-bg:rgba(255,255,255,.98);
  --scrollbar:#c7cbd1;
  --scrollbar-hover:#aeb4bc;
  --divider-start:#06b6d4;
  --divider-end:rgba(6,182,212,0);
  --container: 1380px;
}

:root[data-theme="dark"]{
  color-scheme: dark;
  --bg:#161616;
  --surface:#1e1e1e;
  --surface-2:#262626;
  --logo-bg:#f1f5f9;
  --text:#ededed;
  --muted:#a3a3a3;
  --ink-soft:#d4d4d4;
  --accent:#93c5fd;
  --accent-contrast:#161616;
  --border:#2e2e2e;
  --line:rgba(255,255,255,0.09);
  --line-strong:rgba(255,255,255,0.16);
  --header-bg:rgba(20,20,20,.9);
  --scrollbar:#3f3f46;
  --scrollbar-hover:#52525b;
}

/* No-JS fallback: honor system preference unless an explicit choice is set */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]):not([data-theme="dark"]){
    color-scheme: dark;
    --bg:#161616;
    --surface:#1e1e1e;
    --surface-2:#262626;
    --logo-bg:#f1f5f9;
    --text:#ededed;
    --muted:#a3a3a3;
    --ink-soft:#d4d4d4;
    --accent:#93c5fd;
    --accent-contrast:#161616;
    --border:#2e2e2e;
    --line:rgba(255,255,255,0.09);
    --line-strong:rgba(255,255,255,0.16);
    --header-bg:rgba(20,20,20,.9);
    --scrollbar:#3f3f46;
    --scrollbar-hover:#52525b;
  }
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
html,body{margin:0;padding:0}
body{
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  line-height:1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:background-color .2s ease, color .2s ease;
}
@media (prefers-reduced-motion: reduce){
  body,
  .site-header,
  .news-list,
  .scroll-card,
  .pub-card,
  .company-logo,
  .btn-chip{
    transition:none !important;
  }
}

a{
  color:var(--accent);
  text-decoration:none;
  border-bottom:1px solid rgba(30,58,138,0.18);
}
a:hover{
  color:var(--accent);
  border-bottom-color:var(--accent);
}

a:focus-visible,
.btn:focus-visible,
.theme-toggle:focus-visible,
.nav-toggle:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}

/* Layout */
.container{max-width:var(--container);margin:0 auto;padding:0 0}
.section{padding:24px 0;scroll-margin-top:72px}

.page-layout{
  display:grid;
  grid-template-columns:minmax(360px,540px) minmax(0,1fr);
  gap:24px;
  padding:16px 0 32px;
  align-items:start;
}
.page-layout .container{max-width:none;padding:0}
.sidebar{
  display:flex;
  flex-direction:column;
  gap:20px;
  position:relative;
}
.profile.section{
  padding:0;
  position:relative;
  overflow:hidden;
}
.hero-left{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:6px;
  text-align:left;
  position: relative;
  padding-top: 20px;
  width:100%;
}
.hero-left::before{
  content:'';
  position:absolute;
  top:-20px;
  left:-20px;
  right:-20px;
  height:200px;
  background:linear-gradient(135deg,
    rgba(30,58,138,0.09) 0%,
    rgba(6,182,212,0.12) 50%,
    rgba(30,58,138,0.06) 100%
  );
  border-radius:16px;
  z-index:-1;
  filter:blur(40px);
  opacity:.8;
}

@media (max-width: 900px){
  .hero-left::before{
    left:-14px;
    right:-14px;
  }
}
.hero-left p{margin-top:6px}
.hero-subline{
  display:flex;
  align-items:baseline;
  gap:14px;
  flex-wrap:wrap;
}
.content{
  border-left:1px solid var(--border);
  padding-left:32px;
}

@media (max-width: 900px){
  .container{padding:0 20px}
  .page-layout{grid-template-columns:1fr;gap:24px;padding:16px 14px 24px}
  .content{border-left:none;padding-left:0}
}

h1,h2,h3{
  color:var(--accent);
  margin:0 0 6px 0;
  line-height:1.2;
  font-family:Georgia,"Times New Roman",Times,serif;
}
h1.hero-title{font-size:clamp(30px,4.6vw,46px);font-weight:700;margin-bottom:8px}
h2{font-size:1.75rem;font-weight:700;letter-spacing:-.5px}
h3{font-size:1.1rem;font-weight:600;margin-bottom:12px;letter-spacing:.2px}
.hero-subtitle{font-weight:400;color:var(--muted);margin:0}
.section-divider{
  height:3px;
  width:62%;
  max-width:360px;
  background:linear-gradient(90deg,var(--divider-start),var(--divider-end));
  margin:1px 0 10px;
  border-radius:999px;
  opacity:.85;
}

/* Header / Nav with Active Indicator */
.site-header{
  position:sticky;top:0;z-index:10;background:var(--header-bg);
  border-bottom:1px solid var(--border);backdrop-filter:saturate(180%) blur(8px);
  transition:background-color .2s ease, border-color .2s ease;
}
.nav{display:flex;align-items:center;justify-content:space-between;height:56px;gap:16px}
.nav-left{flex:0 0 auto}
.nav-cta{display:flex;align-items:center;gap:10px}
.nav-cta .btn{padding:6px 12px;font-size:.85rem}
.nav-right{display:flex;align-items:center;gap:16px}

/* Theme toggle */
.theme-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  padding:0;
  border:1px solid var(--border);
  border-radius:8px;
  background:transparent;
  color:var(--muted);
  cursor:pointer;
  transition:color .15s ease, border-color .15s ease, background-color .15s ease;
}
.theme-toggle:hover{
  color:var(--accent);
  border-color:var(--accent);
}
.theme-toggle svg{width:18px;height:18px;display:block}
.theme-toggle .icon-sun{display:none}
:root[data-theme="dark"] .theme-toggle .icon-sun{display:block}
:root[data-theme="dark"] .theme-toggle .icon-moon{display:none}
.nav-links{display:flex;gap:20px;list-style:none;margin:0;padding:0;align-items:center}
.nav-links li{position:relative}
.nav-link{
  color:var(--text);
  text-decoration:none;
  font-size:.95rem;
  display:block;
  padding:4px 0;
  position:relative;
}
.nav-link::after{
  content:'';
  position:absolute;
  bottom:0;
  left:0;
  width:0;
  height:2px;
  background:var(--accent);
  transition:width .2s ease;
}
.nav-link.active::after{
  width:100%;
}
.nav-link:hover{opacity:.7}

.nav-toggle{
  display:none;
  border:1px solid var(--border);
  background:transparent;
  font-size:28px;
  padding:6px 10px;
  line-height:1;
  cursor:pointer;
}
@media (max-width: 720px){
  .nav-toggle{display:block}
  .hide-sm{display:none}
  .nav-links{
    display:none;position:absolute;top:56px;left:0;right:0;
    background:var(--header-bg);backdrop-filter:blur(8px);
    border-bottom:1px solid var(--border);padding:12px 20px;
    flex-direction:column;align-items:flex-start;gap:12px;
  }
  .nav-links.open{display:flex}
  .nav-link::after{display:none} /* Hide underline on mobile */
}

/* Buttons */
.btn{
  display:inline-flex;align-items:center;gap:6px;
  padding:10px 18px;border:1px solid var(--accent);
  text-decoration:none;font-weight:600;border-radius:6px;
  transition:all .15s ease;
}
.btn-solid{background:var(--accent);color:var(--accent-contrast)}
.btn-outline{background:transparent;color:var(--accent)}
.btn:hover{transform:translateY(-1px);box-shadow:0 2px 8px rgba(0,0,0,.08)}
.btn-small{padding:8px 14px;font-size:.9rem}

.headshot.round{
  width: 170px;
  height: 170px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.lazy-img{
  opacity:0;
  transition: opacity .25s ease;
}
.lazy-img.is-loaded{
  opacity:1;
}

/* Social icons */
.social-text{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  font-size:.84rem;
  color:var(--muted);
}
.social-text a{
  color:var(--muted);
  text-decoration:none;
  border-bottom:0;
}
.social-text a:hover{
  color:var(--accent);
}
.social-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  border-radius:8px;
  background:transparent;
  border:1px solid transparent;
  transition:all .2s ease;
}
.social-icon svg{
  width:20px;
  height:20px;
  display:block;
  transition:all .2s ease;
}
.social-icon:hover{
  transform:translateY(-2px);
  box-shadow:0 4px 12px rgba(0,0,0,0.15);
  border-color:transparent;
}
.social-icon.gmail:hover{
  background:#F36C61;
}
.social-icon.gmail:hover svg path{ fill:#fff; }
.social-icon.scholar:hover{
  background:#6AA6FF;
}
.social-icon.scholar:hover svg path{ fill:#fff; }
/* GitHub mark follows the text colour so it stays visible in dark mode */
.social-icon.github{ color:var(--text); }
.social-icon.github:hover{
  background:#4A4A4A;
}
.social-icon.github:hover svg path{ fill:#fff; }
.social-icon.linkedin:hover{
  background:#3A8AD6;
}
.social-icon.linkedin:hover svg path{ fill:#fff; }
.social-icon.x:hover{
  background:#4A4A4A;
}
.social-icon.x:hover svg path{ fill:#fff; }
.social-icon.orcid:hover{
  background:#A6CE39;
}
.social-icon.orcid:hover svg path{ fill:#fff; }
.social-icon.openreview:hover{
  background:#8C1B13;
}
.social-icon.openreview:hover svg path{ fill:#fff; }

/* Clean List Style - NO BOXES */
.clean-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.clean-list li{
  padding:0;
  border:none;
  background:transparent;
}

.item-header{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  margin-bottom:6px;
}

.item-title{
  font-weight:600;
  font-size:1rem;
  color:var(--text);
  line-height:1.35;
  letter-spacing:-.2px;
}

.item-meta{
  color:var(--muted);
  font-size:.92rem;
  margin-bottom:6px;
}

.item-desc{
  margin:6px 0;
  color:var(--ink-soft);
  font-size:.96rem;
  line-height:1.65;
  max-width:65ch;
  text-wrap:pretty;
}
.experience-list .item-desc{
  max-width:none;
}

/* Links in items */
.item-links{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-top:8px;
}

.item-links a{
  color:var(--accent);
  text-decoration:none;
  font-size:.9rem;
  font-weight:400;
  border-bottom:1px solid var(--border);
  padding-bottom:1px;
  transition:all .15s ease;
}

.item-links a:hover{
  border-bottom-color:var(--accent);
}

.projects-section .clean-list{
  gap:14px;
}
.projects-section .item-title{
  font-weight:600;
}
.projects-section .item-header{
  margin-bottom:2px;
  align-items:center;
  gap:14px;
}
.projects-section .item-header .item-links{
  margin-top:0;
  gap:10px;
  margin-left:auto;
}
.projects-section .item-header .item-links a{
  display:inline-flex;
  align-items:center;
  color:var(--muted);
  border-bottom:none;
}
.projects-section .item-header .item-links a svg{
  width:17px;
  height:17px;
  display:block;
}
.projects-section .item-header .item-links a:hover{
  color:var(--accent);
}
.projects-section .item-desc{
  margin:0;
}
.awards-list{
  gap:16px;
}
.awards-list .item-desc{
  margin:4px 0;
  text-wrap:balance;
}
.projects-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:32px;
}
.projects-column h3{
  margin-bottom:12px;
}
@media (max-width: 900px){
  .projects-grid{grid-template-columns:1fr;gap:20px}
}

/* Experience with company logos */
.experience-list{
  gap:28px;
}
.experience-list > li{
  display:grid;
  grid-template-columns:40px minmax(0,1fr);
  column-gap:12px;
  row-gap:0;
  align-items:start;
}

.experience-list .exp-header{
  display:contents;
}

.experience-list .company-logo{
  grid-column:1;
  grid-row:1 / span 2;
  width:40px;
  height:40px;
  object-fit:contain;
  border-radius:8px;
  border:1px solid var(--border);
  padding:6px;
  background:var(--logo-bg);
  flex-shrink:0;
}

.experience-list .exp-title-group{
  grid-column:2;
  grid-row:1;
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:0 16px;
  justify-content:space-between;
  margin-bottom:4px;
}

.experience-list .item-title{
  margin:0;
  line-height:1.3;
}

.experience-list .item-meta{
  margin:0;
  line-height:1.3;
  margin-left:auto;
  text-align:right;
}

.experience-list .item-desc{
  grid-column:2;
  grid-row:2;
  margin:0;
  padding:0;
  line-height:1.45;
}

@media (max-width: 600px){
  .experience-list > li{
    grid-template-columns:36px minmax(0,1fr);
    column-gap:10px;
  }
  .experience-list .company-logo{
    width:36px;
    height:36px;
    padding:4px;
  }
}

/* Awards / Off the Clock - tight layout */
.awards-list li{
  display:grid;
  grid-template-columns:40px 1fr;
  column-gap:12px;
  row-gap:0;
  align-items:start;
}
.awards-list .exp-header{
  display:contents;
}
.awards-list .company-logo{
  grid-column:1;
  grid-row:1 / span 2;
  width:40px;
  height:40px;
  object-fit:contain;
  border-radius:8px;
  border:1px solid var(--border);
  padding:6px;
  background:var(--logo-bg);
  flex-shrink:0;
}
.awards-list .exp-title-group{
  grid-column:2;
  grid-row:1;
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:0 12px;
  margin-bottom:4px;
}
.awards-list .item-title{
  margin:0;
  line-height:1.3;
}
.awards-list .item-meta{
  margin:0;
  line-height:1.3;
}
.awards-list .item-desc{
  grid-column:2;
  grid-row:2;
  margin:0;
  padding:0;
  line-height:1.45;
}

@media (max-width: 600px){
  .awards-list li{
    grid-template-columns:36px 1fr;
    column-gap:10px;
  }
  .awards-list .company-logo{
    width:36px;
    height:36px;
    padding:4px;
  }
}



/* Footer */
.site-footer{
  border-top:1px solid var(--border);
  padding:24px 0;
  background:var(--surface-2);
  margin-top:20px;
}
.footer-inner{
  display:flex;justify-content:space-between;align-items:center;
  flex-wrap:wrap;gap:12px;font-size:.92rem;color:var(--muted);
}
.footer-links{display:flex;gap:16px;flex-wrap:wrap}
.footer-links a{text-decoration:none;color:var(--muted)}
.footer-links a:hover{color:var(--text)}

/* Mobile adjustments */
@media (max-width: 600px){
  .section{padding:22px 0}
  .headshot.round{width:160px;height:160px}
  .hero-title{font-size:32px}
  .company-logo{width:40px;height:40px}
  .exp-header{gap:10px}
  .item-title{font-size:1rem}
}


/* ===== Publications (minimal, left-thumb / right-details) ===== */

.pub-list {
  display: grid;
  gap: 1rem;
}

.pub-card {
  display: grid;
  grid-template-columns: 160px 1fr;       /* thumb | details */
  gap: 1.25rem;
  align-items: start;
  padding: 0.5rem 0;
  border-bottom: 0.5px solid var(--line);
  background: transparent;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.pub-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.pub-thumb {
  display: block;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface-2);
}
.no-logos .pub-thumb{
  background: linear-gradient(135deg, rgba(30,58,138,0.14), rgba(6,182,212,0.10));
  min-height: 96px;
}
.no-logos .pub-thumb::after{
  content:"";
  display:block;
  height:100%;
}

.pub-thumb img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;      /* consistent thumbs */
  object-fit: cover;
  display: block;
  transform: scale(1.001);
}

.pub-body {
  min-width: 0;
}

.pub-title {
  margin: 0 0 .35rem;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 600;
}

.pub-badge {
  display: inline-block;
  margin-left: .5rem;
  padding: .1rem .45rem;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 6px;
  /* explicit text colour: inheriting the title's colour made it white-on-yellow in dark mode */
  color: var(--badge-ink);
  background: var(--badge-bg);
  border: 1px solid var(--badge-line);
  vertical-align: baseline;
}
:root{ --badge-ink:#78350f; --badge-bg:#fef3c7; --badge-line:#f59e0b; }
:root[data-theme="dark"]{ --badge-ink:#fcd34d; --badge-bg:rgba(245,158,11,.14); --badge-line:rgba(252,211,77,.45); }
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]):not([data-theme="dark"]){
    --badge-ink:#fcd34d; --badge-bg:rgba(245,158,11,.14); --badge-line:rgba(252,211,77,.45);
  }
}

.pub-meta {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: .6rem;
}

.pub-venue {
  font-weight: 600;
}

.pub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

/* Chips (small action buttons) */
.btn-chip {
  display: inline-block;
  font-size: .85rem;
  padding: .36rem .6rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  transition: background .15s ease, border-color .15s ease, transform .02s ease;
}

.btn-chip:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

.btn-chip:active {
  transform: translateY(1px);
}

/* Responsive: stack on small screens */
@media (max-width: 720px) {
  .pub-card {
    grid-template-columns: 1fr;
  }
  .pub-thumb img { aspect-ratio: 16 / 9; }
}

/* === Scroll card wrapper with fades + shadows === */
.scroll-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 0;                /* the UL has its own padding */
  overflow: hidden;          /* contain fades */
}

/* the actual scrollable area: height is per-section via --scroll-max */
.scroll-card .scroll-body {
  max-height: var(--scroll-max, 320px);
  overflow-y: auto;
  margin: 0;
  list-style: none;
  padding: .25rem 1rem;      /* room for scrollbar */
  scrollbar-gutter: stable;
}

/* Experience: three roles visible with the fourth peeking in, so the panel
   visibly scrolls; extra top room keeps the first date clear of the "Scroll" pill */
.experience-scroll {
  --scroll-max: 410px;
  --scroll-max-sm: 420px;
}
.experience-scroll .scroll-body {
  padding-top: 2.25rem;
  padding-bottom: .75rem;
}

/* items */
.news-list li {
  padding: .75rem 0;
  border-bottom: 1px solid var(--line);
}
.news-list li:last-child { border-bottom: 0; }
.news-date { color: var(--muted); white-space: nowrap; margin-right: .35rem; }

/* Always-visible minimal scrollbar */
.scroll-body { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.scroll-body::-webkit-scrollbar { width: 8px; }
.scroll-body::-webkit-scrollbar-track { background: transparent; }
.scroll-body::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 999px; }
.scroll-body::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* Top/bottom gradient fades as affordances */
.scroll-card::before,
.scroll-card::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 22px;
  pointer-events: none;
  transition: opacity .2s ease;
  opacity: 0;                /* hidden when not needed */
}
.scroll-card::before {
  top: 0;
  background: linear-gradient(to bottom, var(--surface), transparent);
  box-shadow: 0 -6px 10px rgba(0,0,0,0.04) inset;
}
.scroll-card::after {
  bottom: 0;
  background: linear-gradient(to top, var(--surface), transparent);
  box-shadow: 0 6px 10px rgba(0,0,0,0.04) inset;
}

/* Show fades when content overflows; hide at edges */
.scroll-card.is-scrollable::before,
.scroll-card.is-scrollable::after { opacity: 1; }
.scroll-card.at-top::before { opacity: 0; }
.scroll-card.at-bottom::after { opacity: 0; }

/* “Scroll” hint */
.scroll-hint {
  position: absolute;
  right: .75rem;
  top: .35rem;
  font-size: .78rem;
  color: var(--muted);
  background: var(--surface-2);
  padding: .15rem .5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  user-select: none;
  transition: opacity .3s ease, transform .3s ease;
  opacity: .95;
}
.prefers-reduced-motion .scroll-hint { transition: none; }

/* fade the hint after first scroll */
.scroll-card.scrolled .scroll-hint {
  opacity: 0;
  transform: translateY(-4px);
}

/* Mobile: shorter panel */
@media (max-width: 720px) {
  .scroll-card .scroll-body { max-height: var(--scroll-max-sm, 240px); }
}


/* ============================================================
   Datasheet theme: fieldset-style panels (title notched into border)
   ============================================================ */
:root{
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --rule:#cdd2da;      /* panel border (a touch stronger than hairline) */
  --stripe:#f6f7f9;    /* subtle zebra tint */
}
:root[data-theme="dark"]{ --rule:#3a3a3d; --stripe:#1c1c1c; }
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]):not([data-theme="dark"]){ --rule:#3a3a3d; --stripe:#1c1c1c; }
}

/* Monospace, uppercase labels (section titles + metadata; prose stays as-is) */
.section h2{
  font-family:var(--mono);
  font-size:.8rem;
  font-weight:700;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.item-meta,.pub-meta,.pub-venue,.news-date{ font-family:var(--mono); letter-spacing:.01em; }
.pub-meta,.news-date,.item-meta{ font-size:.8rem; }
.projects-column h3{
  font-family:var(--mono); text-transform:uppercase; letter-spacing:.1em;
  font-size:.78rem; color:var(--muted);
}

/* Fieldset-style bordered panels */
#service, #projects, #publications, #experience, #news, #athletics, #skills, #education{
  border:1.5px solid var(--rule);
  border-radius:4px;
  background:transparent;
  padding:0;
  margin-top:8px;                 /* room for the legend that straddles the top edge */
}
#service > .container,
#projects > .container,
#publications > .container,
#experience > .container,
#news > .container,
#athletics > .container,
#skills > .container,
#education > .container{
  padding:0 18px 18px;
}
/* The legend: lift the title onto the top border and mask the line behind the text */
#service > .container > h2,
#projects > .container > h2,
#publications > .container > h2,
#experience > .container > h2,
#news > .container > h2,
#athletics > .container > h2,
#skills > .container > h2,
#education > .container > h2{
  display:inline-block;
  margin:0 0 14px 8px;
  transform:translateY(-50%);
  padding:0 8px;
  background:var(--bg);
  color:var(--text);
}
.content #publications, .content #experience, .content #skills, .content #education{ margin-bottom:22px; }   /* gap between stacked content panels */

/* Old cyan divider not needed: the legend defines the header */
#service .section-divider,
#projects .section-divider,
#publications .section-divider,
#experience .section-divider,
#news .section-divider,
#athletics .section-divider,
#skills .section-divider,
#education .section-divider{ display:none; }

/* News scroll-card: drop its own frame; the panel provides it */
#news .scroll-card{ border:0; border-radius:0; background:transparent; }
#news .scroll-card .news-list{ padding-left:0; }
/* News: date column + item, one row each (home card and News page) */
.news-table{width:100%;border-collapse:collapse}
.news-table th,.news-table td{padding:.65rem 0;border-bottom:1px solid var(--line);vertical-align:top;text-align:left}
.news-table tr:last-child th,.news-table tr:last-child td{border-bottom:0}
.news-table th{width:6.5rem;padding-right:1rem;white-space:nowrap;font-weight:600;
  font-size:.86rem;color:var(--muted);font-variant-numeric:tabular-nums}
.news-table td{color:var(--ink-soft);line-height:1.6;overflow-wrap:anywhere}
.news-full th{width:8.5rem;font-size:.92rem}
.news-full td{font-size:1rem}
#news .scroll-body{padding-top:1.9rem}   /* first row clears the "Scroll" pill */
@media (max-width:520px){
  .news-full tr{display:block;padding:.65rem 0;border-bottom:1px solid var(--line)}
  .news-full tr:last-child{border-bottom:0}
  .news-full th,.news-full td{display:block;width:auto;padding:0;border:0}
  .news-full th{margin-bottom:.2rem}
}

/* Subtle zebra striping (datasheet texture), full-bleed within panel padding */
.experience-list > li:nth-child(odd),
.awards-list > li:nth-child(odd){
  background:var(--stripe);
  margin:0 -18px;
  padding-left:18px;
  padding-right:18px;
}

/* Facts strip: same bordered datasheet look */
.facts{
  margin:18px 0 4px;
  border:1.5px solid var(--rule);
  border-radius:4px;
  overflow:hidden;
  font-family:var(--mono);
  font-size:.8rem;
  background:transparent;
}
.facts .fact{ display:grid; grid-template-columns:92px 1fr; border-bottom:1px solid var(--rule); }
.facts .fact:last-child{ border-bottom:0; }
.facts dt.fact-k{
  margin:0; padding:9px 12px; color:var(--muted);
  text-transform:uppercase; letter-spacing:.1em;
  border-right:1px solid var(--rule); background:var(--stripe);
}
.facts dd.fact-v{ margin:0; padding:9px 12px; color:var(--text); }

/* Athletics: compact PR cards (datasheet style) */
.pr-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.pr-card{
  border:1.5px solid var(--rule);
  border-radius:4px;
  padding:14px 12px;
  background:var(--bg);
  text-align:center;
  font-family:var(--mono);
}
.pr-card .pr-dist{
  margin:0 0 6px; color:var(--muted);
  text-transform:uppercase; letter-spacing:.12em; font-size:.72rem;
}
.pr-card .pr-time{ margin:0; color:var(--accent); font-size:1.6rem; font-weight:700; line-height:1; }
.pr-card .pr-note{ margin:6px 0 0; color:var(--muted); font-size:.68rem; letter-spacing:.04em; }
@media (max-width:480px){ .pr-grid{ grid-template-columns:1fr; } }

/* Athletics: race photo gallery below the timing box (uniform tiles) */
.race-gallery{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:14px; }
.race-shot{ margin:0; }
.race-frame{
  position:relative; width:100%; aspect-ratio:3/4;
  border-radius:4px; overflow:hidden; border:1.5px solid var(--rule);
  background:var(--stripe);
  transition:transform .2s ease, box-shadow .2s ease;
}
.race-frame img{
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:cover; object-position:center; display:block;
}
.race-shot:hover .race-frame{ transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,0.10); }
@media (max-width:480px){ .race-gallery{ grid-template-columns:repeat(3,1fr); } }

/* Dotted drop-shadow (turbopuffer technique): a tiled-dot layer offset to the
   bottom-right, sitting BEHIND the opaque panel so it only peeks on right+bottom */
:root{ --dots: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23000'/%3E%3C/svg%3E"); }

/* panels must be opaque so the dot layer is hidden except at the offset */
#service, #projects, #publications, #experience, #news, #athletics, #skills, #education{
  position:relative;
  background:var(--bg);
}
#service::after, #projects::after,
#publications::after, #experience::after, #news::after, #athletics::after, #skills::after, #education::after{
  content:"";
  position:absolute;
  top:8px; left:8px; right:-8px; bottom:-8px;
  z-index:-1;
  border-radius:4px;
  background-color:var(--rule);
  -webkit-mask:var(--dots) repeat;
  mask:var(--dots) repeat;
}

/* same dotted drop-shadow on the facts strip */
.facts{ position:relative; background:var(--bg); overflow:visible; }
.facts::after{
  content:"";
  position:absolute;
  top:8px; left:8px; right:-8px; bottom:-8px;
  z-index:-1;
  border-radius:4px;
  background-color:var(--rule);
  -webkit-mask:var(--dots) repeat;
  mask:var(--dots) repeat;
}


/* ============================================================
   Header: theme-aware bar with presence (crisp edge + soft lift)
   Light: stays light, separated by a clear border + gentle shadow.
   Dark:  stays dark, separated by a hairline + subtle shadow.
   ============================================================ */
:root{
  --header-bg:rgba(255,255,255,0.80);
  --header-shadow:0 1px 0 rgba(0,0,0,0.04), 0 6px 20px -12px rgba(0,0,0,0.18);
}
:root[data-theme="dark"]{
  --header-bg:rgba(22,22,22,0.78);
  --header-shadow:0 1px 0 rgba(0,0,0,0.6), 0 8px 24px -14px rgba(0,0,0,0.7);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]):not([data-theme="dark"]){
    --header-bg:rgba(22,22,22,0.78);
    --header-shadow:0 1px 0 rgba(0,0,0,0.6), 0 8px 24px -14px rgba(0,0,0,0.7);
  }
}
.site-header{
  background:var(--header-bg);
  border-bottom:1px solid var(--rule);
  box-shadow:var(--header-shadow);
  backdrop-filter:saturate(180%) blur(12px);
  -webkit-backdrop-filter:saturate(180%) blur(12px);
}

/* Subtle brand gradient keyline under the header (navy -> cyan) */
.site-header{ position:sticky; }
.site-header::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-1px;
  height:2px;
  background:linear-gradient(90deg, var(--accent), var(--divider-start));
  opacity:.85;
}

/* =========================================================================
   Additions: components the base layout does not include
   (search, resume CTAs, skills, education, inner pages, project prose)
   ========================================================================= */

.nav-brand{font-weight:700;letter-spacing:-.02em;color:var(--text);text-decoration:none;
  margin-right:14px;white-space:nowrap}
.nav-brand:hover{color:var(--accent)}
.nav-left{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.btn.is-disabled{opacity:.5;pointer-events:none}
.hero-cta{margin:14px 0 4px;display:flex;gap:8px;flex-wrap:wrap}
.status-line{font-size:.92rem;color:var(--text);background:var(--stripe);
  border:1px solid var(--rule);border-left:3px solid var(--accent);
  border-radius:8px;padding:9px 12px;margin-top:10px}

/* search ------------------------------------------------------------- */
.search-wrap{position:relative;display:flex;align-items:center}
#site-search{width:150px;padding:6px 10px;font:inherit;font-size:.85rem;color:var(--text);
  background:var(--surface-2);border:1px solid var(--border);border-radius:8px;
  transition:width .18s ease}
#site-search:focus{outline:2px solid var(--accent);outline-offset:1px;width:220px}
.search-results{position:absolute;top:calc(100% + 8px);right:0;width:min(430px,84vw);
  max-height:min(68vh,440px);overflow:auto;background:var(--surface);
  border:1px solid var(--border);border-radius:10px;padding:5px;z-index:80;
  box-shadow:0 10px 30px -12px rgba(0,0,0,.35)}
.search-results a{display:block;padding:8px 10px;border-radius:7px;color:var(--text);
  text-decoration:none}
.search-results a:hover,.search-results a.sel{background:var(--stripe)}
.sr-title{font-weight:600;font-size:.9rem}
.sr-kind{font-family:var(--mono);font-size:.66rem;text-transform:uppercase;letter-spacing:.06em;
  color:var(--accent);margin-left:6px}
.sr-desc{font-size:.79rem;color:var(--muted);margin-top:2px;display:-webkit-box;
  -webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.sr-empty{padding:12px;color:var(--muted);font-size:.85rem}
mark{background:rgba(6,182,212,.22);color:inherit;border-radius:3px;padding:0 .1em}

/* tags / skills ------------------------------------------------------ */
.tag-row{display:flex;flex-wrap:wrap;gap:5px;margin-top:8px}
.tag{font-family:var(--mono);font-size:.71rem;color:var(--ink-soft);background:var(--stripe);
  border:1px solid var(--rule);border-radius:999px;padding:2px 8px;white-space:nowrap}
.skills-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px}
.skill-group{border:1px solid var(--rule);border-radius:10px;padding:11px 13px;background:var(--surface)}
.skill-group h3{font-family:var(--mono);font-size:.72rem;text-transform:uppercase;
  letter-spacing:.07em;color:var(--accent);margin:0 0 4px}
.courses-label{font-family:var(--mono);font-size:.7rem;text-transform:uppercase;
  letter-spacing:.05em;color:var(--accent);margin-right:6px}

/* experience detail --------------------------------------------------- */
.exp-points{margin:9px 0 4px;padding-left:18px;color:var(--ink-soft);font-size:.92rem}
.exp-points li{margin-bottom:4px}
/* bullets and tags sit under the title, not in the 40px logo column */
.experience-list > li > .exp-points,
.experience-list > li > .tag-row{grid-column:2}
.experience-list > li > .tag-row{margin-top:6px}
/* initials badge when an org has no logo file */
.logo-mono{display:grid;place-items:center;font-family:var(--mono);font-size:.7rem;
  font-weight:700;letter-spacing:.02em;color:var(--accent);background:var(--stripe)}
.clean-list.detailed > li{padding-top:14px;padding-bottom:14px}

/* section head with a right-aligned link ------------------------------ */
.section-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.section-more{font-size:.82rem;font-weight:600;white-space:nowrap;text-decoration:none}
.section-more:hover{text-decoration:underline}

/* inner pages --------------------------------------------------------- */
.inner-page{padding:22px 0 40px;max-width:1000px}
.page-title{font-size:clamp(1.7rem,3.4vw,2.3rem);margin:2px 0 6px;letter-spacing:-.02em}
.page-lede{color:var(--muted);max-width:70ch;margin:10px 0 18px}
.sub-h2{margin-top:30px;font-size:1.12rem}
.sub-h3{font-family:var(--mono);font-size:.72rem;text-transform:uppercase;letter-spacing:.07em;color:var(--accent);margin:22px 0 10px}
.back-link{font-size:.84rem;color:var(--muted);text-decoration:none;display:inline-block;
  margin-bottom:10px}
.back-link:hover{color:var(--accent)}

/* project page prose -------------------------------------------------- */
.prose{max-width:74ch;margin-top:22px}
.prose h2{margin-top:30px;font-size:1.14rem}
.prose p{margin:0 0 1em;color:var(--ink-soft)}
.prose strong{color:var(--text)}
.prose ul,.prose ol{padding-left:19px;color:var(--ink-soft)}
.prose li{margin-bottom:5px}
.prose code{font-family:var(--mono);font-size:.87em;background:var(--stripe);
  border:1px solid var(--rule);border-radius:4px;padding:1px 5px}
.fig{margin:24px 0;padding:0}
.fig img{width:100%;border-radius:10px;border:1px solid var(--rule);background:#fbfcfd}
.fig a{display:block;cursor:zoom-in}
/* very wide multi-panel plots extend past the 74ch text column to the page width */
.fig-wide{width:min(980px, calc(100vw - 32px));max-width:none}
.fig figcaption{font-size:.8rem;color:var(--muted);margin-top:7px;text-align:center}

@media (max-width:900px){
  .nav-brand{margin-right:6px}
  #site-search,#site-search:focus{width:100%}
  .search-results{width:100%;right:auto;left:0}
  .inner-page{padding:16px 0 32px}
}

/* --- nav fits more items than the reference layout carried ------------ */
.nav{flex-wrap:nowrap;min-width:0}
.nav-left{min-width:0;flex:0 1 auto}
.nav-right{min-width:0;flex:1 1 auto;justify-content:flex-end}
.nav-links{min-width:0}

/* collapse the link list earlier: this site has six items plus search */
@media (max-width:1180px){
  .nav-toggle{display:block}
  .nav-links{
    display:none;position:absolute;top:56px;left:0;right:0;
    background:var(--header-bg);backdrop-filter:blur(8px);
    border-bottom:1px solid var(--border);padding:12px 20px;
    flex-direction:column;align-items:flex-start;gap:12px;z-index:70;
  }
  .nav-links.open{display:flex}
  .nav-link::after{display:none}
}
/* the resume buttons also live in the hero, so drop them from the bar first */
@media (max-width:1080px){ .nav-cta{display:none} }

@media (max-width:520px){ .nav-brand{font-size:.95rem} }

/* nested .container inside a .container page wrapper must not re-pad */
.inner-page .container{max-width:none;padding:0;width:100%}
.inner-page{min-width:0}
.nav-links li{max-width:100%;min-width:0}
.clean-list li{min-width:0}

/* grid/flex children must be allowed to shrink below their min-content width,
   otherwise long titles push the whole row past the viewport */
.awards-list li{grid-template-columns:40px minmax(0,1fr)}
/* awards rows have no logo: span the full width */
.awards-list > li > .item-header{grid-column:1 / -1}
/* space between a category's last card and the next category heading */
.projects-column ul + h3{margin-top:18px}
.exp-header{min-width:0}
.exp-title-group{min-width:0}
.item-title,.item-meta,.item-desc{overflow-wrap:anywhere}
.item-header{min-width:0;flex-wrap:wrap}
.experience-list > li{min-width:0}
.projects-column{min-width:0}
.pub-card{min-width:0}
.pub-body{min-width:0}

/* list rows use a full-bleed  padding:0 18px / margin:0 -18px  trick that
   assumes an 18px-padded parent panel; give inner pages that padding back */
.inner-page .container{padding:0 18px}
@media (max-width:1180px){ .page-layout{padding-left:14px;padding-right:14px} }
/* keep 18px here: the row bleed is -18px and must land inside */

/* the 'see all' link sits at the foot of a panel, so the legend h2 stays a
   direct child of .container (his selector depends on that) */
.section-more-wrap{margin-top:14px;text-align:right}
.section-more{font-size:.82rem;font-weight:600;text-decoration:none;white-space:nowrap}
.section-more:hover{text-decoration:underline}

/* search travels with the nav: inline on desktop, inside the drawer on mobile */
.nav-search{display:flex;align-items:center}
@media (max-width:1180px){
  .nav-search{width:100%;margin-top:4px}
  .nav-search .search-wrap{width:100%}
  #site-search,#site-search:focus{width:100%}
  .search-results{position:static;width:100%;max-height:46vh;margin-top:6px;box-shadow:none}
}

/* mobile drawer: opaque enough to read over the hero, and the results panel
   must be a block (not a flex sibling of the input) so it spans full width */
@media (max-width:1180px){
  .nav-links{background:var(--bg);border-bottom:1px solid var(--border)}
  .nav-search .search-wrap{display:block}
  .search-results{position:static;width:100%;max-height:46vh;margin-top:6px;
    box-shadow:none;border:1px solid var(--border)}
}

.fig-note{font-size:.86rem;color:var(--muted)}

/* Logos: a larger box so crests stay legible; full-bleed logos (USC shield has its own
   background) fill the box edge to edge instead of floating in white padding */
.experience-list > li{ grid-template-columns:44px minmax(0,1fr); }
.awards-list li{ grid-template-columns:44px minmax(0,1fr); }
.experience-list .company-logo,
.awards-list .company-logo{ width:44px; height:44px; padding:4px; }
.company-logo.logo-fill{ padding:0; object-fit:cover; overflow:hidden; }
@media (max-width:600px){
  .experience-list > li,.awards-list li{ grid-template-columns:40px minmax(0,1fr); }
  .experience-list .company-logo,.awards-list .company-logo{ width:40px; height:40px; padding:3px; }
  .company-logo.logo-fill{ padding:0; }
}

/* research card without a figure yet */
.pub-thumb.pub-ph{display:grid;place-items:center;aspect-ratio:4/3;background:var(--stripe);
  border:1px solid var(--border);font-family:var(--mono);font-size:.8rem;font-weight:700;
  letter-spacing:.04em;color:var(--accent)}
@media (max-width:600px){ .pub-thumb.pub-ph{aspect-ratio:16/9} }

/* blog posts */
.post-byline{margin:6px 0 10px}
.prose h3{margin-top:22px;font-size:1rem}
.prose hr{border:0;border-top:1px solid var(--rule);margin:28px 0}
.prose pre{margin:0 0 1.1em;padding:12px 14px;overflow-x:auto;border-radius:8px;
  background:var(--stripe);border:1px solid var(--rule);line-height:1.5}
.prose pre code{background:none;border:0;border-radius:0;padding:0;display:block;font-size:.82rem;color:var(--text);white-space:pre}
.prose .table-wrap{overflow-x:auto;margin:0 0 1.1em}
.prose table{border-collapse:collapse;width:100%;font-size:.88rem}
.prose th,.prose td{text-align:left;vertical-align:top;padding:8px 10px;border-bottom:1px solid var(--rule)}
.prose th{color:var(--text);font-weight:600}
.prose td{color:var(--ink-soft)}
.post-body .fig figcaption{text-align:left}
.prose .math-display{overflow-x:auto;overflow-y:hidden;margin:0 0 1.1em;padding:2px 0}
.prose .katex{font-size:1.06em}
.prose .math-display .katex{font-size:1.14em}
.prose span.math{white-space:nowrap}
.fig figcaption a{display:inline;cursor:pointer}
