:root {
  --burgundy-dark: #3d1017;
  --burgundy: #6b1f2a;
  --burgundy-mid: #8b3a47;
  --burgundy-soft: #b06a73;
  --burgundy-pale: #ead7cf;
  --cream: #fffaf7;
  --cream-2: #f8eee9;
  --white: #ffffff;
  --text: #321217;
  --muted: #73545b;
  --soft-text: #9b747c;
  --line: #ead7cf;
  --gold: #b8935a;
  --gold-dark: #9a7740;
  --gold-pale: #f4ecdc;
  --max: 980px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(90deg, var(--burgundy-dark) 0 260px, var(--cream) 260px 100%);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.site-shell {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.home-page .site-shell::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 260px;
  background: url("assets/home-hero-math.png") center top / cover no-repeat;
  opacity: 0.65;
  filter: grayscale(100%);
  pointer-events: none;
  z-index: 0;
}

.home-page .side-rail,
.home-page .page {
  position: relative;
  z-index: 1;
}

/* Left rail */
.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--burgundy-dark), var(--burgundy));
  color: #fff8f5;
  padding: 34px 28px;
  display: flex;
  flex-direction: column;
}

.rail-brand {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 23px;
  line-height: 1.2;
  text-decoration: none;
  letter-spacing: .01em;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,.22);
}

.rail-subtitle {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255,255,255,.70);
  line-height: 1.5;
}

.rail-subtitle a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .32);
  transition: color .15s ease, border-color .15s ease;
}

.rail-subtitle a:hover {
  color: #fff;
  border-bottom-color: #fff;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 28px;
}

.rail-nav a {
  text-decoration: none;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.76);
  padding: 8px 0 8px 12px;
  border-left: 2px solid transparent;
  transition: .15s ease;
}

.rail-nav a:hover,
.rail-nav a.active {
  color: #fff;
  border-left-color: #fff;
  background: linear-gradient(90deg, rgba(255,255,255,.10), transparent);
}


.rail-footer {
  margin-top: auto;
  font-size: 12px;
  color: rgba(255,255,255,.68);
  overflow-wrap: anywhere;
  border-top: 1px solid rgba(255,255,255,.18);
  padding-top: 18px;
}

.rail-footer a { text-decoration: none; }
.rail-footer a:hover { color: #fff; }

/* Page canvas */
.page {
  width: min(var(--max), calc(100% - 64px));
  margin: 0 auto;
  padding: 58px 0 40px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--burgundy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: clamp(42px, 6vw, 68px);
  line-height: 1;
  color: var(--burgundy-dark);
  letter-spacing: -.03em;
}

/* Home */
.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 245px;
  gap: 54px;
  align-items: end;
  padding: 42px 28px 42px;
  border-top: 4px solid var(--burgundy);
  border-bottom: 4px solid var(--burgundy);
  background: rgba(255, 250, 247, 0.52);
  backdrop-filter: blur(0.5px);
}


.affiliation {
  margin: 18px 0 0;
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 20px;
  color: var(--burgundy-mid);
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid rgba(50,18,23,.12);
}

.quick-links a {
  color: var(--gold-dark);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid rgba(184,147,90,.58);
  background: rgba(255,250,247,.82);
  box-shadow: 0 1px 0 rgba(184,147,90,.14);
  transition: .18s ease;
}

.quick-links a:hover {
  color: var(--burgundy-dark);
  background: var(--gold-pale);
  border-color: var(--gold);
  transform: translateY(-1px);
}


.portrait {
  position: relative;
  margin: 0;
  justify-self: end;
  width: 245px;
  padding: 0;
  background: transparent;
}

.portrait::before { display: none; }
.portrait::after { display: none; }

.portrait img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 20%;
  border: none;
  box-shadow: 7px 7px 0 var(--burgundy);
}

/* Section style: no cards, just spacing and rules */
.section {
  padding: 42px 0 4px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 24px;
}

.section:last-of-type { border-bottom: none; }

.section h2 {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 0 0 22px;
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 25px;
  color: var(--burgundy-dark);
  font-weight: 700;
}

.section h2::before {
  content: "";
  height: 4px;
  background: var(--burgundy);
}

.prose {
  max-width: 100%;
}

.prose p,
.welcome-section p {
  margin: 0 0 1rem;
  font-size: 17px;
  color: var(--muted);
}

.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--burgundy-dark); font-weight: 700; }

/* Page headers */
.page-header {
  padding: 30px 0 38px;
  border-bottom: 4px solid var(--burgundy);
  margin-bottom: 34px;
  position: relative;
  overflow: visible;
}

.page-header::after {
  content: attr(data-watermark);
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: clamp(72px, 11vw, 136px);
  font-weight: 700;
  color: rgba(107, 31, 42, 0.055);
  letter-spacing: -.04em;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
  z-index: 0;
}

.page-header > * {
  position: relative;
  z-index: 1;
}

.page-header p {
  margin: 14px 0 0;
  max-width: 730px;
  color: var(--muted);
  font-size: 17px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.anim-1 { animation: fadeUp .6s cubic-bezier(0.16,1,0.3,1) both; }
.anim-2 { animation: fadeUp .6s .08s cubic-bezier(0.16,1,0.3,1) both; }
.anim-3 { animation: fadeUp .6s .16s cubic-bezier(0.16,1,0.3,1) both; }
.anim-4 { animation: fadeUp .6s .24s cubic-bezier(0.16,1,0.3,1) both; }

/* Lists */
.entry-list,
.paper-list,
.compact-list,
.field-list {
  display: grid;
  gap: 0;
}

.entry,
.paper,
.field-row {
  border-top: 1px solid var(--line);
}

.entry:first-child,
.paper:first-child,
.field-row:first-child { border-top: none; }

.entry {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 22px;
  padding: 18px 0;
}

.entry-year {
  color: var(--burgundy);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .03em;
}

.entry h3,
.paper h3,
.field-row h3 {
  margin: 0 0 4px;
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.entry p,
.paper p,
.field-row p {
  margin: 0;
  color: var(--muted);
}

.entry a,
.paper a {
  display: inline-block;
  margin-top: 5px;
  color: var(--burgundy);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1px solid var(--burgundy-soft);
}

.entry a:hover,
.paper a:hover { color: var(--burgundy-dark); }

.field-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 22px;
  padding: 17px 0;
}

.field-tag {
  color: var(--burgundy);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.compact-list p {
  margin: 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.compact-list p:first-child { border-top: none; }

.compact-list strong {
  color: var(--burgundy);
  margin-right: 8px;
}

.paper { padding: 18px 0; }
.paper span { color: var(--muted); font-style: italic; font-family: 'Source Sans 3', sans-serif; font-weight: 400; }

/* CV and notes without boxes */
.cv-panel,
.note-panel {
  padding: 0;
  background: transparent;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cv-panel h2,
.note-panel h2 {
  margin: 0;
  padding: 20px 0 6px;
  font-family: 'Libre Baskerville', Georgia, serif;
  color: var(--burgundy-dark);
}

.cv-panel p,
.note-panel p {
  color: var(--muted);
  margin: 0 0 20px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 0 4px;
  text-decoration: none;
  color: var(--burgundy);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--burgundy);
  transition: .15s ease;
}

.button:hover { color: var(--burgundy-dark); border-bottom-color: var(--burgundy-dark); }
.button.primary, .button.secondary { background: transparent; color: var(--burgundy); }

code { background: var(--cream-2); color: var(--burgundy); padding: 2px 5px; }

/* Links without boxes */
.link-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.link-grid a {
  text-decoration: none;
  color: var(--burgundy);
  font-weight: 700;
  border-top: 1px solid var(--line);
  padding: 14px 0;
  transition: .15s ease;
}

.link-grid a:first-child { border-top: none; }
.link-grid a:hover { color: var(--burgundy-dark); padding-left: 8px; }


/* SCI badge */
.sci-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 2px 7px 1px;
  border: 1px solid #b8935a;
  color: #b8935a;
  background: #fff9ef;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.2;
  vertical-align: middle;
  transform: translateY(-1px);
}

/* Embedded CV preview */
.cv-actions {
  margin: 18px 0 22px;
}

.cv-embed-wrap {
  width: 100%;
  border-top: 4px solid var(--burgundy);
  background: var(--white);
}

.cv-frame {
  display: block;
  width: 100%;
  height: min(78vh, 900px);
  min-height: 620px;
  border: 1px solid var(--line);
  border-top: none;
  background: var(--white);
}

.site-footer {
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 880px) {
  body { background: var(--cream); }
  .home-page .site-shell::after { left: 0; opacity: 0.16; background-position: center top; }

  .site-shell { grid-template-columns: 1fr; }
  .side-rail {
    position: static;
    height: auto;
    padding: 22px;
  }
  .rail-brand { border-bottom: none; padding-bottom: 6px; }
  .rail-nav { flex-direction: row; flex-wrap: wrap; gap: 4px 10px; margin-top: 14px; }
  .rail-nav a { padding: 5px 0 5px 9px; }
  .rail-footer { display: none; }
  .page { width: min(100% - 34px, var(--max)); padding-top: 30px; }
  .home-hero { grid-template-columns: 1fr; gap: 30px; align-items: start; padding: 24px 18px 30px; }
  .portrait { justify-self: start; width: min(260px, 100%); }
  .portrait::before { inset: 10px; }
  .portrait img { width: 100%; }
}

@media (max-width: 620px) {
  .entry, .field-row { grid-template-columns: 1fr; gap: 4px; }
  .home-hero { padding-bottom: 32px; }
  .section h2 { grid-template-columns: 36px 1fr; }
  h1 { font-size: 42px; }
  .prose p, .welcome-section p { font-size: 16px; }
}
