/* ==========================================================================
   chang-han-chen.github.io — single custom stylesheet, no theme
   ========================================================================== */

:root {
  --text: #1c1e21;
  --muted: #6a737d;
  --border: #e1e4e8;
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --link: #0b5fd7;
  --info-border: #2563eb;
  --info-bg: #eff6ff;
  --success-border: #16a34a;
  --success-bg: #f0fdf4;
  /* Widths in rem so the text column scales with the font size */
  --content-width: 46rem;
  --content-width-wide: 58rem;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 19px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   Header / navigation
   -------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-nav {
  max-width: var(--content-width-wide);
  margin: 0 auto;
  padding: 0.9em 1.25em;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5em 1.5em;
}

.site-title {
  font-weight: 700;
  font-size: 1.15em;
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.6em;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 1em;
}

.nav-links a:hover {
  color: var(--link);
}

.nav-links a.current {
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Main column
   -------------------------------------------------------------------------- */

.container {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.5em 1.25em 3em;
}

.container--wide {
  max-width: var(--content-width-wide);
}

.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.85em;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4 {
  line-height: 1.3;
  margin: 2em 0 0.7em;
}

h1 {
  font-size: 1.9em;
  margin-top: 0;
}

h2 {
  font-size: 1.45em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.15em;
}

p {
  margin: 0 0 1.4em;
}

a {
  color: var(--link);
}

ul, ol {
  margin: 0 0 1.4em;
  padding-left: 1.6em;
}

li {
  margin-bottom: 0.45em;
}

li > ul, li > ol {
  margin-top: 0.45em;
  margin-bottom: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

blockquote {
  margin: 1.5em 0;
  padding: 0.1em 1.2em;
  border-left: 4px solid var(--border);
  color: var(--muted);
}

code {
  background: var(--bg-soft);
  border-radius: 4px;
  padding: 0.15em 0.35em;
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1em 1.2em;
  overflow-x: auto;
  line-height: 1.55;
  margin: 0 0 1.5em;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
}

/* Tables */

table {
  border-collapse: collapse;
  margin: 1.8em 0 2em;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

th, td {
  border: 1px solid var(--border);
  padding: 0.5em 0.9em;
  text-align: left;
}

th {
  background: var(--bg-soft);
}

/* Figures */

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

figure {
  margin: 2.2em 0;
}

figure img {
  display: block;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}

figcaption {
  color: var(--muted);
  font-size: 0.85em;
  line-height: 1.5;
  text-align: center;
  margin-top: 0.75em;
}

/* --------------------------------------------------------------------------
   About page profile header
   -------------------------------------------------------------------------- */

.profile {
  text-align: center;
  margin-bottom: 2.5em;
}

.profile img {
  width: 150px;
  height: 150px;
  border-radius: 0;
  object-fit: cover;
  border: 1px solid var(--border);
}

.profile h1 {
  margin: 0.6em 0 0.2em;
  font-size: 1.7em;
}

.profile .profile-tagline {
  color: var(--muted);
  margin: 0;
}

/* --------------------------------------------------------------------------
   Blog index
   -------------------------------------------------------------------------- */

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin-bottom: 2em;
}

.post-list .post-link {
  font-size: 1.25em;
  font-weight: 700;
  text-decoration: none;
}

.post-list .post-link:hover {
  text-decoration: underline;
}

.post-list .post-date {
  color: var(--muted);
  font-size: 0.9em;
  display: block;
  margin-bottom: 0.1em;
}

.post-list .post-excerpt {
  margin: 0.3em 0 0;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Blog posts
   -------------------------------------------------------------------------- */

.post-title {
  margin-bottom: 0.2em;
}

.post-meta {
  color: var(--muted);
  font-size: 0.9em;
  margin-bottom: 2em;
}

.post-subtitle {
  font-style: italic;
  color: var(--muted);
  font-size: 1.05em;
  margin-bottom: 1.5em;
}

/* Collapsible table of contents (EleutherAI / PaperMod style) */

details.post-toc {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 0.85em 1.15em;
  margin: 1.75em 0 2.25em;
}

details.post-toc summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05em;
  user-select: none;
}

details.post-toc summary:focus {
  outline: none;
}

details.post-toc > ul {
  max-height: 60vh;
  overflow-y: auto;
  margin: 0.9em 0 0.25em;
  padding-left: 1.4em;
}

details.post-toc > ul ul {
  margin: 0.25em 0;
  padding-left: 1.2em;
}

details.post-toc li {
  margin: 0.35em 0;
  font-size: 0.95em;
  line-height: 1.5;
}

details.post-toc a {
  text-decoration: none;
}

details.post-toc a:hover {
  text-decoration: underline;
}

/* Notice boxes (used via kramdown {: .notice--info} etc.) */

.notice--info,
.notice--success {
  padding: 1em 1.2em;
  margin: 1.5em 0;
  border-radius: 0 8px 8px 0;
}

.notice--info {
  border-left: 4px solid var(--info-border);
  background: var(--info-bg);
}

.notice--success {
  border-left: 4px solid var(--success-border);
  background: var(--success-bg);
}

/* --------------------------------------------------------------------------
   Resume PDF embed
   -------------------------------------------------------------------------- */

.pdf-embed {
  width: 100%;
  height: 90vh;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  html {
    font-size: 17px;
  }
}

@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .site-nav {
    justify-content: center;
    text-align: center;
  }
}
