@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* ---------------------------------------------------------------
   Palette. Barron's original: link #1772d0, hover #f09228,
   highlight #ffffd0. Kept verbatim in light mode.
   --------------------------------------------------------------- */
:root {
  --bg:        #ffffff;
  --fg:        #000000;
  --muted:     #555555;
  --link:      #1772d0;
  --link-hover:#f09228;
  --highlight: #ffffd0;
  --rule:      #e6e6e6;
  --box-fg:    #000000;

  --maxw:      800px;
  --fs:        14px;
  --fs-name:   32px;
  --fs-h2:     22px;
}

html[data-theme="dark"] {
  --bg:        #14161a;
  --fg:        #e8e8e8;
  --muted:     #9aa0a6;
  --link:      #6aaef5;
  --link-hover:#f5b44e;
  --highlight: #2e2a17;
  --rule:      #2c3038;
  --box-fg:    #101216;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 12px;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: var(--fs);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
}

a { color: var(--link); text-decoration: none; }
a:focus, a:hover { color: var(--link-hover); text-decoration: none; }

p { margin: 0 0 1em; }

h2 {
  margin: 0;
  font-weight: normal;
  font-size: var(--fs-h2);
  line-height: 1.2;
}

strong { font-weight: 700; }

span.highlight { background-color: var(--highlight); }

/* ---------------------------------------------------------------
   Masthead: 63% text / 37% photo, 2.5% padding (Barron's ratios)
   --------------------------------------------------------------- */
.masthead {
  display: flex;
  align-items: center;
  gap: 0;
}

.masthead-text  { flex: 0 1 63%; padding: 2.5%; min-width: 0; }
.masthead-photo { flex: 0 0 37%; padding: 2.5%; max-width: 37%; }

.masthead-photo img {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
}

.name {
  padding-top: 20px;
  margin: 0 0 0.4em;
  font-size: var(--fs-name);
  line-height: 1.2;
  text-align: center;
}

.name .name-alt { white-space: nowrap; }

.tagline {
  margin: -0.2em 0 1em;
  text-align: center;
  color: var(--muted);
}

.email { text-align: center; }
.email code { font-size: 0.92em; }

.social { text-align: center; margin-bottom: 0; }
.social .sep { color: var(--muted); }

/* ---------------------------------------------------------------
   Sections
   --------------------------------------------------------------- */
.section-head { padding: 16px; }

.news { padding: 0 16px 8px; margin: 0; list-style: none; }
.news li { margin-bottom: 0.35em; }
.news .news-date { color: var(--muted); white-space: nowrap; }

/* ---------------------------------------------------------------
   Publication rows: 20% thumb / 80% body, 10px vertical gutter
   --------------------------------------------------------------- */
.pub-list { display: flex; flex-direction: column; gap: 10px; }

.pub { display: flex; align-items: center; }
.pub.is-highlight { background-color: var(--highlight); }

.pub-thumb { flex: 0 0 20%; max-width: 20%; padding: 16px; }
.pub-body  { flex: 1 1 80%; padding: 8px; min-width: 0; }

/* Barron's crossfade: base image, overlay revealed on row hover. */
.thumb-swap { position: relative; width: 100%; }
.thumb-swap > img,
.thumb-swap > video { display: block; width: 100%; height: auto; }

.thumb-swap .thumb-hover {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .2s ease-in-out;
}
.thumb-swap .thumb-hover img,
.thumb-swap .thumb-hover video {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
.pub:hover .thumb-swap .thumb-hover,
.pub:focus-within .thumb-swap .thumb-hover { opacity: 1; }

.papertitle { font-weight: 700; }
.pub-venue { display: block; }
.pub-links { margin-top: 0.1em; }
.pub-links .sep { color: var(--muted); }
.pub-desc { margin: 0.6em 0 0; }
.pub-note { margin: 0.4em 0 0; }

/* ---------------------------------------------------------------
   Miscellanea: colored label box + link column
   --------------------------------------------------------------- */
.misc-row { display: flex; align-items: center; }
.misc-label { flex: 0 0 20%; max-width: 20%; padding: 16px; text-align: center; }
.misc-body  { flex: 1 1 80%; padding: 8px; min-width: 0; }
.misc-body a { display: inline-block; margin-bottom: 0.2em; }

.colored-box {
  color: var(--box-fg);
  padding: 20px;
  display: inline-block;
  border-radius: 10px;
}
.colored-box h2 { font-size: var(--fs-h2); }

/* ---------------------------------------------------------------
   Free-form markdown pages (post.pug / page.pug)
   --------------------------------------------------------------- */
.markdown { padding: 16px; }
.markdown h1 { font-size: 26px; font-weight: normal; }
.markdown h2 { font-size: var(--fs-h2); margin: 1.2em 0 0.4em; }
.markdown img { max-width: 100%; height: auto; }
.markdown pre {
  overflow-x: auto;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.markdown code { font-size: 0.92em; }
.markdown table { border-collapse: collapse; }
.markdown td, .markdown th { border: 1px solid var(--rule); padding: 6px 10px; }

/* ---------------------------------------------------------------
   Footer + theme toggle
   --------------------------------------------------------------- */
.site-footer {
  padding: 16px;
  font-size: small;
  text-align: right;
  color: var(--muted);
}
.site-footer a { color: var(--muted); text-decoration: underline; }
.site-footer a:hover { color: var(--link-hover); }

.theme-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  padding: 0;
  cursor: pointer;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1;
}
.theme-toggle:hover { color: var(--link-hover); }

/* ---------------------------------------------------------------
   Mobile: stack everything into one column
   --------------------------------------------------------------- */
@media (max-width: 620px) {
  .masthead { flex-direction: column-reverse; }
  .masthead-text  { flex: 1 1 auto; width: 100%; padding: 0 4px 8px; }
  .masthead-photo { flex: 1 1 auto; width: 60%; max-width: 220px; padding: 16px 0 4px; }

  .name { padding-top: 8px; font-size: 28px; }

  .pub, .misc-row { flex-direction: column; align-items: stretch; }
  .pub-thumb  { flex: 1 1 auto; max-width: 200px; width: 60%; padding: 16px 8px 0; }
  .pub-body   { flex: 1 1 auto; padding: 8px; }
  .misc-label { flex: 1 1 auto; max-width: 100%; text-align: left; padding: 16px 8px 8px; }
  .misc-body  { flex: 1 1 auto; padding: 0 8px 8px; }
}

@media print {
  .theme-toggle { display: none; }
  body { padding: 0; }
  a { color: #000; }
}
