:root{
  color-scheme: light;
  --background: #ffffff;
  --text: #111111;
  --heading: #000000;
  --muted: #333333;
  --line: #dddddd;
  --link: #0645ad;
  --control-background: #ffffff;
  --control-hover: #f2f4f6;
  --font-serif: "adobe-garamond-pro", Garamond, "Hoefler Text", Georgia, "Times New Roman", serif;
  --max: 1180px;
}

:root[data-theme="dark"]{
  color-scheme: dark;
  --background: #101418;
  --text: #f1f3f5;
  --heading: #ffffff;
  --muted: #c4cbd2;
  --line: #3a424a;
  --link: #8ab4f8;
  --control-background: #171c21;
  --control-hover: #252c33;
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
}

html{
  background: var(--background);
}

body{
  background: var(--background);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  transition: background-color 180ms ease, color 180ms ease;
}

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

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

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

.body,
.container{
  max-width: var(--max);
  width: calc(100% - 48px);
  margin: 0 auto 36px;
}

.profile-section{
  display: flex;
  gap: 40px;
  align-items: flex-start;
  margin-top: 30px;
  margin-bottom: 30px;
}

.profile-image{
  flex: 0 0 300px;
  max-width: 300px;
}

.profile-image img{
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  image-orientation: from-image;
}

.profile-text{
  flex: 1 1 auto;
  min-width: 0;
  max-width: 870px;
}

.profile-text p:first-of-type{
  margin-top: 8px;
}

h1,
h2{
  color: var(--heading);
  font-weight: 700;
}

.theme-toggle{
  align-items: center;
  background: var(--control-background);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  height: 40px;
  justify-content: center;
  padding: 0;
  position: fixed;
  right: max(14px, calc((100vw - var(--max)) / 2));
  top: 14px;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
  width: 40px;
  z-index: 10;
}

.theme-toggle:hover{
  background: var(--control-hover);
}

.theme-toggle:focus-visible{
  outline: 3px solid var(--link);
  outline-offset: 3px;
}

.theme-icon{
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  line-height: 1;
  transform: translateY(-1px);
}

h1{
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
}

h2{
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.25;
}

.no-top-margin{
  margin-top: 0;
}

p{
  margin: 0 0 1em;
}

.papers-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 560px));
  column-gap: 48px;
  align-items: start;
  justify-content: start;
}

.papers-column{
  min-width: 0;
}

.paper{
  margin: 0 0 18px;
}

.paper-title{
  margin: 0 0 2px;
  color: var(--link);
  font-size: 1.1em;
  font-weight: 700;
}

.paper-authors,
.paper-date,
.paper-appended-text,
.paper-links{
  margin: 0 0 2px;
  font-size: 0.95em;
}

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

.paper-date,
.paper-appended-text{
  color: var(--text);
}

.paper-links{
  margin-top: 4px;
}

.research-item{
  margin-bottom: 12px;
  padding-bottom: 12px;
  scroll-margin-top: 20px;
}

.research-summary{
  align-items: start;
  color: var(--link);
  column-gap: 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  list-style: none;
  padding: 2px 0;
}

.research-summary::-webkit-details-marker{
  display: none;
}

.research-summary:hover .research-title{
  text-decoration: underline;
}

.research-summary:focus-visible{
  border-radius: 2px;
  outline: 3px solid var(--link);
  outline-offset: 4px;
}

.research-heading{
  min-width: 0;
}

.research-title{
  display: block;
  font-size: 1.1em;
  font-weight: 700;
  line-height: 1.35;
}

.research-authors{
  color: var(--muted);
  display: block;
  font-size: 0.86em;
  line-height: 1.35;
  margin-top: 2px;
}

.research-summary-meta{
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.86em;
  gap: 8px;
  padding-top: 2px;
  white-space: nowrap;
}

.research-toggle-icon{
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-flex;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  height: 1.3rem;
  justify-content: center;
  line-height: 1;
  width: 1.3rem;
}

.research-toggle-icon::before{
  content: "+";
  transform: translateY(-0.04em);
}

.research-item[open] .research-toggle-icon::before{
  content: "−";
}

.research-details{
  padding: 8px 0 0;
}

.research-description{
  color: var(--text);
  font-size: 0.98em;
  margin: 4px 0 0;
}

.research-details > :last-child{
  margin-bottom: 0;
}

.topnav{
  padding: 18px 0 10px;
  color: var(--muted);
}

.topnav a b{
  color: var(--text);
  font-weight: 700;
}

.rule{
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0 0 24px;
}

.page-title{
  margin: 0 0 18px;
  font-size: 32px;
}

.item{
  max-width: 920px;
  margin: 0 0 20px;
}

.item-title{
  margin: 0 0 2px;
  color: var(--link);
  font-weight: 700;
  font-size: 1.1em;
  line-height: 1.35;
}

.item-meta{
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.95em;
}

.footer{
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 0.95em;
  margin-top: 30px;
  padding-top: 14px;
}

.footer-quote{
  font-size: 1.02em;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

.footer-quote p{
  font-style: italic;
  margin: 0 0 6px;
}

.footer-quote cite{
  font-style: normal;
}

.visit-counter{
  bottom: 14px;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  margin: 0;
  opacity: 0.72;
  pointer-events: none;
  position: fixed;
  right: max(14px, calc((100vw - var(--max)) / 2));
  z-index: 5;
}

@media (max-width: 860px){
  .body,
  .container{
    width: calc(100% - 40px);
  }

  .profile-section{
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
  }

  .profile-image{
    flex: 0 0 auto;
  }

  .profile-image img{
    max-width: 250px;
  }

  .papers-grid{
    grid-template-columns: 1fr;
    row-gap: 28px;
  }

  .theme-toggle{
    right: 10px;
    top: 10px;
  }

  .visit-counter{
    margin-top: 18px;
    position: static;
    text-align: right;
  }
}

@media (max-width: 560px){
  .research-summary{
    grid-template-columns: 1fr;
    row-gap: 4px;
  }

  .research-summary-meta{
    justify-content: space-between;
    padding-top: 0;
  }
}

@media (prefers-reduced-motion: reduce){
  body,
  .theme-toggle{
    transition: none;
  }
}
