/* Yang Liu — plain personal site.
   One sans-serif family. Hierarchy by size (and bold); bold is the only
   emphasis. Blue links, one gray for secondary text, a thin rule under the
   nav and one above the footer. Nothing else. */

:root {
  color-scheme: light dark;
  --bg: #fff;
  --fg: #222;
  --muted: #666;
  --link: #0b5fa5;
  --rule: rgba(128, 128, 128, .35);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --fg: #ddd;
    --muted: #999;
    --link: #6fb0ea;
  }

}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  background: var(--bg);
  color: var(--fg);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

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

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

main:focus:not(:focus-visible) {
  outline: none;
}

p {
  margin: 0 0 10px;
}

/* Five sizes: 28 name/page title, 22 section, 17 entry title, 16 body, 14 small. */

h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 10px;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin: 30px 0 12px;
}

/* An entry's title is whatever heading it contains (h2 on Service, h3 under a
   section on the home page); it is always set at entry size. */

h3,
.entry h2 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

/* Secondary text: authors, venue, role tag, dates, link rows, footer. */

.meta,
.authors,
.links,
footer {
  font-size: 14px;
  color: var(--muted);
}

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

/* Navigation: a row of text links over a thin rule, current page in bold. */

nav ul {
  list-style: none;
  margin: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 2px 24px;
}

nav a {
  display: inline-block;
  padding: 4px 0;
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

nav a[aria-current="page"] {
  color: var(--fg);
  font-weight: 700;
}

main {
  padding-top: 22px;
}

/* Identity header on the home page: text left, photo in its own column right. */

.head {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.head-text {
  flex: 1;
  min-width: 0;
}

.photo {
  flex: none;
  width: 120px;
  height: 180px;
  border: 1px solid var(--rule);
}

/* Descriptions are collapsed; the summary is the button that opens them. */

details {
  margin-top: 6px;
}

summary {
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  width: fit-content;
}

summary:hover {
  color: var(--link);
}

/* Entries: a plain list; bold title, gray meta lines, description, gray link row. */

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1 + .entries,
h1 + p + .entries {
  margin-top: 18px;
}

.entry {
  margin: 0 0 18px;
}

.entry p {
  margin: 6px 0 0;
}

.entry .meta,
.entry .authors,
.entry .links {
  margin-top: 3px;
}


/* Definition rows on the About page: dates left, text right. */

dl {
  margin: 0 0 12px;
  display: grid;
  grid-template-columns: 12em 1fr;
  gap: 6px 24px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
}

footer {
  margin-top: 32px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

footer p {
  margin: 0;
}

.skip {
  position: absolute;
  left: -100vw;
  top: 8px;
  padding: 4px 8px;
  background: var(--bg);
}

.skip:focus {
  left: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 480px) {
  body {
    padding: 14px 16px 32px;
  }

  /* Photo above the name, so the role line keeps the full column width. */
  .head {
    flex-direction: column-reverse;
    gap: 12px;
  }

  .photo {
    width: 90px;
    height: 135px;
  }

  dl {
    grid-template-columns: 1fr;
    gap: 0;
  }

  dd {
    margin-bottom: 8px;
  }
}

@media print {
  .skip,
  nav {
    display: none;
  }

  .entry {
    break-inside: avoid;
  }
}
