/* Flavio du Pin Calmon — homepage styles.
   Keeps the look of the original Bootstrap 3 site (Lato, crimson headings, light grey
   navigation bar, grey rules between sections) without the framework.
   Light theme only. */

:root {
  color-scheme: light;

  /* Same greys as the old site, nudged a touch darker to meet WCAG AA contrast
     (body text vs. links >= 3:1, grey text >= 4.5:1 on white and on the bar). */
  --text: #222;
  --muted: #6f6f6f;
  --crimson: #993333;
  --link: #0069d9;
  --link-hover: #00489a;
  --rule: #e5e5e5;
  --bar: #f8f8f8;
  --bar-border: #e7e7e7;
  --note: #fffbeb;

  /* Information Theory Lab wordmark (same colours as infotheorylab.github.io) */
  --lab: #a41034;
  --lab-ink: #111;

  --bar-h: 50px;
  --sans: 'Lato', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar-h) + 10px);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }
p { margin: 0 0 10px; }
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }

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

/* Links inside the crimson announcement titles are too close to crimson to be told
   apart by colour alone, so only these get a faint underline. */
.ann-title a {
  text-decoration: underline;
  text-decoration-color: rgba(0, 105, 217, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.ann-title a:hover { text-decoration-color: currentColor; }

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap {
  max-width: 1170px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--bar-border);
  border-radius: 4px;
}
.skip-link:focus { top: 8px; }

/* ---------------------------------------------------------------- Navigation bar */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bar);
  border-bottom: 1px solid var(--bar-border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  min-height: var(--bar-h);
}

.brand { display: none; }

.nav {
  display: flex;
  flex-wrap: wrap;
}
.nav a {
  display: block;
  padding: 0 15px;
  line-height: var(--bar-h);
  color: var(--muted);
  white-space: nowrap;
}
.nav a:hover { color: #333; text-decoration: none; }
.nav a[aria-current] { color: #555; background: #e7e7e7; }

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 46px;
  height: 36px;
  margin-left: auto;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}
.nav-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: #666;
}
.nav-toggle:hover, .nav-toggle[aria-expanded="true"] { background: #ddd; }

/* Medium screens: tighter spacing so all items fit on one line. */
@media (min-width: 860px) and (max-width: 1199.98px) {
  .nav a { padding: 0 10px; }
}

/* Phones and small tablets: collapsible menu (only when JavaScript is running). */
@media (max-width: 859.98px) {
  .js .brand {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 18px;
    line-height: var(--bar-h);
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .js .brand:hover { color: #333; text-decoration: none; }
  .js .nav-toggle { display: flex; flex: none; margin-left: auto; }

  .js .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 6px 0;
    background: var(--bar);
    border-bottom: 1px solid var(--bar-border);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    flex-wrap: nowrap;
    max-height: calc(100vh - var(--bar-h));
    max-height: calc(100dvh - var(--bar-h));
    overflow-y: auto;
  }
  .js .nav.open { display: flex; }
  .js .nav a {
    line-height: 22px;
    padding: 11px max(16px, env(safe-area-inset-left));
  }
  .js .nav a:focus-visible { outline-offset: -2px; }

  /* Without JavaScript the bar simply wraps. */
  .no-js .site-header { position: static; }
  .no-js .nav a { padding: 0 10px; line-height: 40px; }
}

/* ---------------------------------------------------------------- About */

.hero { padding-top: 24px; }

/* Grey rule under each section, inside the text column (as on the old site). */
.hero > .wrap::after, .section > .wrap::after {
  content: "";
  display: block;
  margin-top: 14px;
  border-bottom: 2px solid var(--rule);
}

.hero-grid {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  grid-template-areas:
    "photo head"
    "bio   bio";
  column-gap: 16px;
  align-items: start;
}

.hero-photo { grid-area: photo; }
.portrait {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.hero-head { grid-area: head; }

.name {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--crimson);
}

.aff {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.35;
  color: var(--muted);
}

/* Lab wordmark line, under the affiliations */
.aff-lab {
  margin: 6px 0 0;
  line-height: 1.35;
}

.hero-bio { grid-area: bio; }
.hero-bio > p:first-child { margin-top: 14px; }
.hero-bio > p:last-child { margin-bottom: 0; }


/* Lab wordmark: same type and colours as the header of the lab's website.
   On narrow phones it wraps before "Lab @ Harvard" (kept together). */
.wordmark {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: -0.03em;
  color: var(--lab-ink);
  text-decoration: none;
}
.wordmark:hover { color: var(--lab-ink); text-decoration: none; }
.wordmark-accent { color: var(--lab); }
@media (max-width: 299.98px) {
  .wordmark { font-size: 13px; }
}

@media (min-width: 480px) {
  .hero-grid { grid-template-columns: 120px minmax(0, 1fr); column-gap: 20px; }
  .name { font-size: 23px; }
  .aff { font-size: 16px; }
  .wordmark { font-size: 16px; }
}

@media (min-width: 768px) {
  .hero { padding-top: 30px; }
  .hero-grid {
    grid-template-columns: 165px minmax(0, 1fr);
    grid-template-areas:
      "photo head"
      "photo bio";
    column-gap: 30px;
  }
  /* The photo spans exactly the name-to-end-of-bio rows. Its top lines up with the top of
     the capitals in the name (about 6px below the 23px line box) and its bottom with the
     baseline of the bio's last line (about 7px above its line box). The image is cropped
     to fit, keeping the face in view. */
  .hero-photo { position: relative; align-self: stretch; margin: 6px 0 7px; }
  .portrait {
    position: absolute;
    inset: 0;
    height: 100%;
    object-fit: cover;
    object-position: 50% 25%;
  }
  .aff { font-size: 18px; margin-top: 2px; }
  .aff-lab { margin-top: 8px; }
  .wordmark { font-size: 17px; }
  .hero-bio > p:first-child { margin-top: 14px; }
}

/* ---------------------------------------------------------------- Sections */

.section { padding-top: 10px; }

.section-title {
  margin: 20px 0 12px;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.15;
  color: var(--crimson);
}

.sub-title, .pub-year {
  margin: 20px 0 6px;
  font-size: 21px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--muted);
}

/* Grey lead line above the papers, like the old site's .bold3 subheading */
.sub-lede {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.35;
  color: var(--muted);
}
@media (min-width: 768px) {
  .sub-lede { font-size: 22px; }
}
.section-lede { margin: 0 0 12px; }

@media (min-width: 992px) {
  .prose p, .note { text-align: justify; }
}

.note {
  margin: 0 0 14px;
  padding: 12px 15px;
  background: var(--note);
  border-radius: 5px;
}
.note strong { font-weight: 400; color: var(--crimson); }

/* Announcements (and teaching): crimson title line, description below. */
.ann {
  margin: 0;
  padding-left: 20px;
  list-style: disc;
}
.ann > li { margin: 14px 0; padding-left: 2px; }
.ann-title {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--crimson);
  text-wrap: pretty; /* avoid one-word last lines */
}
.ann-title time { white-space: nowrap; }
.ann p { margin: 0; }
.ann-papers { margin: 2px 0 4px; padding-left: 20px; list-style: circle; }
.ann-papers li { margin: 4px 0; }

/* "Older announcements" / "Earlier publications" toggles */
.more { margin: 2px 0 10px; }
.more > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  color: var(--link);
  cursor: pointer;
  list-style: none;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before, .more-close::before {
  content: "";
  width: 0.42em;
  height: 0.42em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}
.more[open] > summary::before { transform: rotate(45deg); }
.more > summary:hover, .more-close:hover { color: var(--link-hover); text-decoration: underline; }
.summary-open, .more[open] .summary-closed { display: none; }
.more[open] .summary-open { display: inline; }

.more-close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  cursor: pointer;
}
.more-close::before { transform: rotate(-135deg); margin-top: 0.25em; }

/* Honors & service */
.cols-2 { display: grid; column-gap: 40px; }
@media (min-width: 992px) {
  .cols-2 { grid-template-columns: 1fr 1fr; }
}
/* Each item reads "2026 — Award name, Organization" */
.kv { margin: 0 0 10px; list-style: disc; }
.kv li { margin: 8px 0; }
.kv .k { color: var(--crimson); white-space: nowrap; }
.kv .k::after { content: " \2014  "; }
.kv small { font-size: inherit; color: var(--muted); }
.kv small::before { content: ", "; }

/* Publications */
.pubs { margin: 0; list-style: disc; }
.pub { margin: 12px 0; }
.pub-title { color: var(--crimson); }
a.pub-title:hover { color: var(--crimson); }
.pub-authors, .pub-meta { font-size: 14px; line-height: 1.5; }
.pub-meta { color: #555; }
.pub-meta > * + *::before { content: "\00b7"; margin: 0 0.5em; color: #aaa; }
.badge { color: var(--crimson); }
.pub-links a + a { margin-left: 0.8em; }

.plain-list { margin: 0 0 10px; }
.plain-list li { margin: 6px 0; }

/* Bullet indent: on wide screens the text starts 10px in and the bullet hangs
   in the margin, as on the old site; phones keep the bullet inside the column. */
.ann, .pubs, .kv, .plain-list { padding-left: 20px; }
@media (min-width: 768px) {
  .ann, .pubs, .kv, .plain-list { padding-left: 10px; }
  .ann > li, .pub { padding-left: 0; }
}

/* Contact */
#contact p { margin-bottom: 4px; }

/* LinkedIn / Google Scholar logos under the Contact heading: grey, brand colour on hover */
.profiles { display: flex; gap: 4px; margin: -6px 0 6px -5px; }
.profiles a {
  display: inline-flex;
  padding: 5px;
  border-radius: 4px;
  color: var(--muted);
}
.profiles svg { display: block; width: 22px; height: 22px; fill: currentColor; }
.profiles .profile-li:hover { color: #0a66c2; }
.profiles .profile-gs:hover { color: #4285f4; }
address { margin: 0 0 10px; font-style: normal; }

/* ---------------------------------------------------------------- Footer */

.site-footer {
  padding: 2px 0 28px;
  color: var(--muted);
  font-size: 14px;
}
.site-footer p { margin: 0; }

/* ---------------------------------------------------------------- Touch screens */

@media (pointer: coarse) {
  .pub-links a { display: inline-block; padding: 6px 0; }
  .profiles a { padding: 11px; }
  .profiles { margin-left: -11px; margin-top: -12px; }
  .more > summary, .more-close { padding: 10px 0; }
}

/* ---------------------------------------------------------------- Print */

@media print {
  .site-header, .skip-link, .more > summary, .more-close { display: none !important; }
  a, .prose a { color: inherit; text-decoration: none; }
  .pub, .ann > li, .kv li { break-inside: avoid; }
}
