/* single-page academic layout after Jon Barron's template (jonbarron.info) */
/* loaded from CSS rather than a <link>: Google Fonts' stylesheet changes per
   browser, so it can't carry the SRI hash the CI's html-proofer demands */
@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400&display=swap');

body {
  margin: 0;
  background: #fff;
  color: #000;
  /* Chinese text falls through to Songti, as on the rest of the site */
  font-family: 'Lato', Verdana, Helvetica, "Songti SC", STSong, "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", SimSun, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

a {
  color: #1772d0;
  text-decoration: none;
}
a:focus,
a:hover {
  color: #f09228;
}

.page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 25px 40px;
}

/* intro: name, bio and links on the left, round photo on the right */
.intro {
  display: flex;
  align-items: center;
  gap: 5%;
}
.intro-text {
  flex: 1 1 63%;
}
.intro-photo {
  flex: 0 0 32%;
}
.intro-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: 50%;
}
.name {
  text-align: center;
  font-size: 36px;
  margin: 16px 0;
  font-weight: 400;
}
.links {
  text-align: center;
}
/* a light tint of the link blue */
.highlight {
  background-color: rgba(23, 114, 208, .08);
  padding: 10px 14px;
}

h2 {
  font-size: 24px;
  font-weight: 400;
  margin: 36px 0 12px;
}

ul {
  padding-left: 20px;
}
li {
  margin-bottom: 4px;
}

/* paper entries: 160px figure on the left, details on the right */
.paper {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 20px 0;
}
/* the figures are pre-cropped to one part of each diagram (the *-thumb
   files) so they stay legible at this size */
.paper-img {
  flex: 0 0 200px;
}
.paper-img img {
  display: block;
  width: 200px;
  max-height: 180px;
  object-fit: contain;
}
.paper-title {
  font-weight: 700;
}
.paper p {
  margin: 10px 0 0;
}

/* blog, post and photo pages: the name links home, Blog and Photos on the right */
.sub-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  margin: 8px 0 32px;
}
.site-title {
  font-size: 24px;
  color: #000;
}

hr {
  border: 0;
  border-top: 1px solid #e5e5e5;
  margin: 32px 0;
}
pre {
  overflow-x: auto;
  padding: 10px 14px;
  background: #f6f6f6;
  font-size: 14px;
}
blockquote {
  margin: 16px 0;
  padding-left: 16px;
  border-left: 3px solid #e5e5e5;
  color: #555;
}

.credit {
  text-align: right;
  font-size: 14px;
  margin-top: 60px;
}
.credit a {
  font-size: 14px;
}

@media (max-width: 600px) {
  .intro {
    flex-direction: column-reverse;
  }
  .intro-photo {
    width: 60%;
  }
  .paper {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* blog */
:root {
    /* used by inline captions carried over from the old blog's posts */
    --content-secondary: #8a8a8a;
}
/* blog index, laid out like a Substack home page: the newest post as a
   wide feature, then the rest as a list beside a short about panel */
.post-card {
    display: flex;
    flex-direction: column;
    color: inherit;
}
.post-card-img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}
.post-card-noimg {
    background: #eee;
}
.post-card-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.post-card-title {
    font-weight: 700;
    font-size: 19px;
    line-height: 1.25;
    color: #222;
}
.post-card-sub {
    margin-top: 6px;
    font-size: 14px;
    color: #555;
}
.post-date {
    margin-top: 8px;
    font-size: 11px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #8a8a8a;
}
/* the feature: large image on the left, centered text on the right */
.post-card-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    margin-bottom: 40px;
}
.post-card-main .post-card-text {
    align-items: center;
    text-align: center;
}
.post-card-main .post-card-title {
    font-size: 30px;
}
.post-card-main .post-card-sub {
    margin-top: 10px;
    font-size: 17px;
}
.post-card-main .post-date {
    margin-top: 12px;
}
/* the rest: rows with a thumbnail on the right, next to the about panel */
.blog-bottom {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 48px;
}
.blog-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.blog-list li {
    margin: 0;
    padding: 16px 0;
}
.blog-list li:first-child {
    padding-top: 0;
}
.post-card-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.post-card-row .post-card-img {
    flex: 0 0 160px;
    width: 160px;
}
.post-card-row .post-card-noimg {
    display: none;
}
.blog-about {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    align-self: start;
}
.blog-about-name {
    font-weight: 700;
    font-size: 20px;
    color: #222;
}
.blog-about-desc {
    font-size: 13px;
    color: #8a8a8a;
}
.blog-about-subscribe {
    margin-top: 6px;
    font-size: 13px;
}
/* cards are whole links: no bold-on-hover, the title turns orange instead */
.post-card:hover,
.post-card:focus {
    font-weight: inherit;
}
.post-card:hover .post-card-title,
.post-card:focus .post-card-title {
    color: #f09228;
}
/* tablets and phones: the feature stacks, the about panel goes below */
@media screen and (max-width: 720px) {
    .post-card-main {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .blog-bottom {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}
@media screen and (max-width: 480px) {
    .post-card-main .post-card-title {
        font-size: 24px;
    }
    .post-card-row .post-card-img {
        flex-basis: 96px;
        width: 96px;
    }
}

.post-title {
    margin-bottom: 4px;
}
.post-subtitle {
    font-size: 15px;
    color: #555;
    margin: 0 0 4px;
}
.post-meta {
    font-size: 12px;
    color: #8a8a8a;
    margin-bottom: 24px;
}
/* every post photo fits the same 360x480 box as the photo in the
   rain-night post (portrait photos match its height, landscape its width) */
.post img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100%, 360px);
    max-height: 480px;
    margin: 0 auto 6px;
}
.post-back {
    margin-top: 32px;
}
.post-comments {
    margin-top: 24px;
}

/* photo gallery: two masonry columns that keep each photo's shape */
.photo-grid {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.photo-col {
    flex: 1;
    min-width: 0;
}
.photo-grid a {
    display: block;
    margin-bottom: 8px;
}
.photo-grid img {
    display: block;
    width: 100%;
    height: auto;
}
@media screen and (max-width: 480px) {
    .photo-grid {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }
    /* merge the two columns into one list, sorted by each photo's order */
    .photo-col {
        display: contents;
    }
}

/* photo lightbox: the tapped photo shown plain, with square corners, on a
   white backdrop (like every other picture on the site) */
.lightbox-open {
    overflow: hidden;
}
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .97);
    animation: lightbox-in .2s ease;
}
.lightbox:focus {
    outline: none;
}
.lightbox[hidden] {
    display: none;
}
@keyframes lightbox-in {
    from { opacity: 0; }
}
.photo-view {
    margin: 0;
}
.photo-frame img {
    display: block;
    width: auto;
    height: auto;
    /* leave room for the caption and the buttons around the photo */
    max-width: calc(100vw - 120px);
    max-height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px);
}
.photo-view figcaption {
    margin-top: 14px;
    font-size: 13px;
    color: #8a8a8a;
    text-align: center;
}
.lightbox button {
    position: absolute;
    padding: 0;
    border: 0;
    background: none;
    color: rgba(0, 0, 0, .45);
    font: 300 44px/1 sans-serif;
    cursor: pointer;
}
.lightbox button:hover,
.lightbox button:focus-visible {
    color: #222;
}
.lightbox button[hidden] {
    display: none;
}
.lightbox-close {
    top: 12px;
    right: 18px;
    width: 44px;
    height: 44px;
}
.lightbox-prev,
.lightbox-next {
    top: 50%;
    width: 44px;
    height: 88px;
    margin-top: -44px;
    font-size: 56px !important;
}
.lightbox-prev {
    left: 8px;
}
.lightbox-next {
    right: 8px;
}
/* phones: the photo uses the full width, swipe instead of arrows */
@media screen and (max-width: 480px) {
    .photo-frame img {
        max-width: calc(100vw - 24px);
    }
    .lightbox-prev,
    .lightbox-next {
        display: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    .lightbox {
        animation: none;
    }
}
