/* Dantong Liu — personal site. Static, no build step. */

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fdfdfc;
  --text: #111111;
  --muted: #555555;
  --accent: #a33c2a;
  --rule: #e6e6e4;
  --serif: "Source Serif 4", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem 1.35rem 4.5rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

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

/* Header: tiny mark + CSS-only cursor */

header {
  margin-bottom: 2.15rem;
}

.mark {
  font-family: var(--mono);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.mark:hover,
.mark:focus-visible {
  color: var(--accent);
}

.mark::after {
  content: "";
  display: inline-block;
  width: 0.55ch;
  height: 1em;
  margin-left: 0.2em;
  background: var(--text);
  vertical-align: -0.12em;
  animation: blink 1.15s steps(1, end) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Intro */

.intro {
  margin: 0 0 2.4rem;
}

.intro p {
  margin: 0 0 0.9rem;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.75;
}

.intro .more {
  margin: 0 0 0.9rem;
}

.intro .more summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}

.intro .more summary:hover {
  text-decoration: underline;
}

.intro .more[open] summary {
  margin-bottom: 0.7rem;
}

.intro .more p {
  color: var(--muted);
}

/* Sections */

section {
  margin: 0 0 2.35rem;
}

h2 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin: 0 0 1rem;
}

h2::before {
  content: "$ ";
  color: var(--accent);
}

p {
  margin: 0 0 1em;
}

/* Articles: title + first paragraph */

.article {
  margin: 0 0 1.25rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--rule);
}

.article:last-child {
  margin-bottom: 0;
}

.article h3 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.98rem;
  line-height: 1.45;
  margin: 0 0 0.4rem;
}

.article p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.status {
  display: block;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0.2rem 0 0;
  text-transform: lowercase;
}

/* Notes: native disclosure widgets */

.notes details,
.papers {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.notes summary,
.papers summary {
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.92rem;
  line-height: 1.5;
}

.notes summary:hover,
.papers summary:hover {
  color: var(--accent);
}

.notes summary:focus-visible,
.papers summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.notes details p {
  margin: 0.55rem 0 0.2rem 1.15rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

/* Papers, lower down */

.elsewhere {
  margin: 0 0 1.25rem;
}

.papers summary {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
}

.papers .pub {
  margin: 0.9rem 0 0;
}

.papers[open] .pub:first-of-type {
  margin-top: 0.85rem;
}

.pub-title {
  margin: 0 0 0.1rem;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.88rem;
  line-height: 1.45;
}

.pub-meta {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.pub-venue {
  font-style: italic;
}

.pub-links {
  font-family: var(--mono);
  font-size: 0.75rem;
}

.pub .note {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Footer */

footer {
  margin-top: 0.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--rule);
}

.contact-links {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.contact-links .sep {
  color: var(--muted);
}

.todo {
  color: var(--muted);
  font-size: 0.75rem;
}

.updated {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0.55rem 0 0;
}

/* Mobile */

@media (max-width: 520px) {
  body {
    font-size: 1.0625rem;
  }

  .wrap {
    padding: 1.5rem 1.1rem 3.25rem;
  }

  .intro p {
    font-size: 0.88rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .mark::after {
    animation: none;
    opacity: 1;
  }
}


/* Essay pages. Scoped so homepage typography is unchanged. */

.essay h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.7rem;
  line-height: 1.3;
  margin: 0 0 0.4rem;
}

.essay .date {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 1.85rem;
}

.essay h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.22rem;
  letter-spacing: 0;
  color: var(--text);
  margin: 2.1rem 0 0.85rem;
}

.essay h2::before {
  content: none;
}

.essay ul,
.essay ol {
  margin: 0 0 1em;
  padding-left: 1.4rem;
}

.essay li {
  margin: 0 0 0.4rem;
}

.essay li:last-child {
  margin-bottom: 0;
}
