/* ==========================================================
   Xiaolin Shi — personal site
   Colors live in :root so you can retheme in one place.
   ========================================================== */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #5f5a52;
  --line: #e6e1d8;
  --accent: #9b2335;        /* deep crimson */
  --accent-soft: #f6e9eb;
  --radius: 14px;
  --max: 980px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16140f;
    --surface: #1f1c17;
    --text: #ece8e1;
    --muted: #a9a297;
    --line: #34302a;
    --accent: #e07a8a;
    --accent-soft: #33212499;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); margin: 0 0 .6em; }
h3 { font-size: 1.2rem; margin: 0 0 .3em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--text); text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block; padding: 6px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: .93rem; font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--accent-soft); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.menu-toggle { display: none; }
@media (max-width: 760px) {
  .menu-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: 1px solid var(--line); border-radius: 999px;
    color: var(--text); font: inherit; font-size: .9rem; padding: 6px 14px; cursor: pointer;
  }
  .nav { display: none; width: 100%; flex-direction: column; padding-bottom: 12px; }
  .nav.open { display: flex; }
}

/* ---------- sections ---------- */
main { padding: 56px 0 80px; }
section + section { margin-top: 64px; }
.eyebrow { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: .6em; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 46ch; }

/* hero */
.hero { display: grid; grid-template-columns: 220px 1fr; gap: 48px; align-items: center; }
.avatar {
  width: 220px; aspect-ratio: 1; border-radius: 50%;
  object-fit: cover; border: 6px solid var(--surface);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  background: var(--accent-soft);
}
.avatar-fallback {
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 4rem; color: var(--accent);
}
@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; gap: 24px; text-align: left; }
  .avatar { width: 150px; }
}

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1.4em; }
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 999px;
  font-weight: 600; font-size: .95rem; text-decoration: none;
  border: 1px solid var(--accent);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }

/* prose */
.prose { max-width: 70ch; }
.prose p { color: var(--text); }

/* cards */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; display: flex; flex-direction: column;
}
a.card { color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card p { color: var(--muted); font-size: .96rem; margin-bottom: 0; }
.card .more { margin-top: auto; padding-top: 14px; color: var(--accent); font-weight: 600; font-size: .9rem; }

/* cards with an image on top */
.card-media { padding: 0; overflow: hidden; }
.card-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid var(--line); }
.card-media h3, .card-media p { padding: 0 22px; }
.card-media h3 { margin-top: 18px; }
.card-media .more { padding: 14px 22px 20px; }

/* course list */
.course {
  border-top: 1px solid var(--line); padding: 24px 0;
  display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start;
}
.course-thumb { width: 200px; aspect-ratio: 23 / 15; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
@media (max-width: 640px) {
  .course { grid-template-columns: 1fr; gap: 14px; }
  .course-thumb { width: 100%; max-width: 360px; }
}
.course:last-child { border-bottom: 1px solid var(--line); }
.course-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.tag {
  font-size: .78rem; font-weight: 600; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.tag.plain { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.course p { color: var(--muted); margin: 0; max-width: 75ch; }

/* evaluation table */
.eval-group { margin-bottom: 36px; }
.eval-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.eval-row strong { min-width: 260px; font-weight: 600; }
.pill-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-links a {
  font-size: .86rem; padding: 3px 12px; border-radius: 999px;
  border: 1px solid var(--line); text-decoration: none; color: var(--text);
}
.pill-links a:hover { border-color: var(--accent); color: var(--accent); }

/* numbered lecture notes */
.notes {
  list-style: none; counter-reset: day; padding: 0; margin: 0;
  display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.notes li { counter-increment: day; }
.notes a {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.notes a::before {
  content: counter(day); flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .9rem;
}
.notes a:hover { border-color: var(--accent); color: var(--accent); }

/* pricing plans */
.price { font-family: var(--serif); font-size: 2rem; font-weight: 600; color: var(--text); margin: 4px 0 6px; }
.card .note { font-size: .85rem; }

/* contact */
.contact {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px;
}
.contact dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
.contact dt { color: var(--muted); }
.contact dd { margin: 0; word-break: break-word; }
@media (max-width: 520px) { .contact dl { grid-template-columns: 1fr; } .contact dd { margin-bottom: 8px; } }

/* video */
.video { margin: 0; max-width: 760px; }
.video video {
  width: 100%; aspect-ratio: 16 / 9; display: block;
  background: #000; border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.video figcaption { margin-top: 10px; color: var(--muted); font-size: .9rem; }

blockquote {
  margin: 1.2em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent);
  color: var(--muted); font-family: var(--serif); font-style: italic;
}

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.site-footer a { color: var(--muted); }
