/* =============================================================================
   styles.css  —  minimal, typography-first. Light + dark via data-theme.
   To change the accent color, edit --accent in BOTH themes below.
   ============================================================================= */

:root {
  --accent: #2563eb;          /* muted academic blue */
  --accent-hover: #1d4ed8;

  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --text: #1a1a1a;
  --text-soft: #555c66;
  --text-faint: #8a929c;
  --border: #e7e9ee;
  --card: #ffffff;

  --maxw: 720px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --accent: #5b9bff;
  --accent-hover: #7cb0ff;

  --bg: #0f1115;
  --bg-soft: #161922;
  --text: #e8eaed;
  --text-soft: #b3b9c2;
  --text-faint: #7d8590;
  --border: #262b36;
  --card: #161922;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

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

/* ---------- nav ----------------------------------------------------------- */
header.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
}
nav.nav {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-weight: 700; color: var(--text); font-size: 1rem; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-link { color: var(--text-soft); font-size: .94rem; }
.nav-link:hover { color: var(--accent); text-decoration: none; }
.nav-link.active { color: var(--text); font-weight: 600; }

.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 34px; height: 34px; cursor: pointer; color: var(--text-soft);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
  transition: border-color .15s ease, color .15s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: inline; }

/* ---------- layout -------------------------------------------------------- */
main { padding: 48px 0 64px; }
h1 { font-size: 2rem; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 0; }
h3 { font-size: 1.02rem; margin: 0 0 4px; }
.page-intro { color: var(--text-soft); margin: 0 0 28px; }

/* ---------- home hero ----------------------------------------------------- */
.hero { display: flex; gap: 28px; align-items: flex-start; margin-bottom: 16px; }
.hero-photo {
  width: 132px; height: 132px; border-radius: 14px; object-fit: cover;
  flex-shrink: 0; border: 1px solid var(--border);
}
.hero-text h1 { margin-bottom: 6px; }
.tagline { color: var(--text-soft); font-size: 1.05rem; margin: 0 0 6px; }
.degree {
  color: var(--text-faint); font-family: var(--mono); font-size: .82rem;
  margin: 0 0 18px; text-transform: none; letter-spacing: .01em;
}
.bio { color: var(--text); margin: 0 0 14px; }
.hero-socials { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; }
.hero-socials a { font-size: .9rem; }

/* ---------- section headers + lists --------------------------------------- */
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 44px 0 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section-link { font-size: .85rem; white-space: nowrap; }

.entry-list { list-style: none; margin: 0; padding: 0; }
.entry {
  display: flex; gap: 14px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px dotted var(--border);
}
.entry:last-child { border-bottom: none; }
.entry-date {
  color: var(--text-faint); font-family: var(--mono); font-size: .78rem;
  flex-shrink: 0; width: 96px;
}
.entry-title { color: var(--text); }
.entry-title:hover { color: var(--accent); }
.entry.paper { flex-direction: column; gap: 2px; }
.entry-note { color: var(--text-faint); font-size: .82rem; }
.empty { color: var(--text-faint); font-style: italic; padding: 8px 0; }

/* ---------- courses grid -------------------------------------------------- */
.course-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 8px;
}
.course-card {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--card); color: var(--text); display: flex; flex-direction: column;
  transition: border-color .15s ease, transform .15s ease;
}
.course-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.course-thumb { position: relative; aspect-ratio: 16/9; background: var(--bg-soft); }
.course-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.course-thumb.no-thumb { display: flex; align-items: center; justify-content: center; }
.play-badge {
  position: absolute; inset: 0; margin: auto; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); color: #fff; border-radius: 50%; font-size: 1.1rem;
}
.play-badge.link-badge { font-size: .82rem; font-weight: 700; letter-spacing: .03em; }
.course-body { padding: 14px 16px 18px; }
.course-body p { color: var(--text-soft); font-size: .9rem; margin: 4px 0 0; }

/* ---------- footer -------------------------------------------------------- */
footer.site-footer {
  border-top: 1px solid var(--border); margin-top: 24px; padding: 28px 0 48px;
}
.footer-socials { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
.footer-socials a { font-size: .85rem; color: var(--text-soft); }
.footer-copy { color: var(--text-faint); font-size: .82rem; margin: 0; }

/* ---------- edit page ----------------------------------------------------- */
.edit-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 28px; padding: 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg-soft);
}
.edit-bar .spacer { flex: 1; }
.btn {
  font: inherit; font-size: .9rem; cursor: pointer; border-radius: 8px;
  padding: 8px 14px; border: 1px solid var(--border); background: var(--card);
  color: var(--text); transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger:hover { border-color: #dc2626; color: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: .82rem; }

.save-status { font-size: .85rem; color: var(--text-faint); }
.save-status.saved { color: #16a34a; }

fieldset {
  border: 1px solid var(--border); border-radius: 12px; margin: 0 0 24px; padding: 20px;
}
legend { font-weight: 700; padding: 0 8px; font-size: 1.05rem; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; color: var(--text-soft); margin-bottom: 5px; font-weight: 600; }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: .92rem; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
  color: var(--text); resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field .hint { font-size: .76rem; color: var(--text-faint); margin-top: 4px; }

.row {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  margin-bottom: 12px; background: var(--bg-soft);
}
.row-grid { display: grid; gap: 10px; }
.row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.row-head .row-num { font-size: .78rem; color: var(--text-faint); font-family: var(--mono); }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.notice {
  background: var(--bg-soft); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 12px 14px; font-size: .88rem; color: var(--text-soft); margin-bottom: 24px;
}

/* ---------- responsive ---------------------------------------------------- */
@media (max-width: 620px) {
  body { font-size: 16px; }
  .hero { flex-direction: column; gap: 18px; }
  .hero-photo { width: 110px; height: 110px; }
  .course-grid { grid-template-columns: 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
  .entry { flex-direction: column; gap: 2px; }
  .entry-date { width: auto; }
  nav.nav { flex-wrap: wrap; }
  .nav-links { gap: 14px; }
}
