/* Shared by every page. Colours are set once here, light first, then dark. */
:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #1d2422;
  --muted: #5d6762;
  --line: #e2ddd2;
  --accent: #1f5a4c;
  --accent-ink: #fffdf8;
  --accent-soft: #e3eee9;
  --todo: #fdf1d6;
  --todo-ink: #7a5200;
  --shadow: 0 1px 2px rgba(30, 36, 34, .06), 0 8px 24px rgba(30, 36, 34, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121615; --card: #1a201e; --ink: #ece9e1; --muted: #9aa49f;
    --line: #2a3330; --accent: #7cc3ae; --accent-ink: #10201b; --accent-soft: #1f2e2a;
    --todo: #33290f; --todo-ink: #f0c56a; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121615; --card: #1a201e; --ink: #ece9e1; --muted: #9aa49f;
  --line: #2a3330; --accent: #7cc3ae; --accent-ink: #10201b; --accent-soft: #1f2e2a;
  --todo: #33290f; --todo-ink: #f0c56a; --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 Karla, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 680px; }

/* Top bar */
.topbar { border-bottom: 1px solid var(--line); }
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 24px;
  padding-top: 18px; padding-bottom: 18px;
}
.brand {
  font: 700 20px/1 Fraunces, Georgia, serif;
  color: var(--ink); text-decoration: none;
}
.nav { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.nav a {
  display: block; padding: 6px 12px; border-radius: 999px;
  color: var(--muted); font-weight: 500; text-decoration: none;
}
.nav a:hover { color: var(--ink); background: var(--accent-soft); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 700; }

/* Page headings */
main { padding: 64px 0 24px; }
.eyebrow {
  margin: 0 0 12px;
  font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent);
}
h1 {
  margin: 0 0 16px;
  font: 700 clamp(38px, 7vw, 58px)/1.05 Fraunces, Georgia, serif;
  letter-spacing: -.02em;
}
h2 { font: 600 26px/1.25 Fraunces, Georgia, serif; margin: 0 0 12px; }
h3 { font: 600 19px/1.3 Fraunces, Georgia, serif; margin: 24px 0 6px; }
.lede { margin: 0; max-width: 640px; font-size: 19px; color: var(--muted); }
.page-head { margin-bottom: 48px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 64px 0 20px; }
.section-title h2 { margin: 0; }
.section-title a { font-weight: 700; text-decoration: none; white-space: nowrap; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 999px;
  border: 1px solid var(--accent);
  font-weight: 700; text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { color: var(--accent); }

/* Project cards (Home) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h3 { margin: 0 0 6px; font-size: 20px; }
.card p { margin: 0 0 14px; color: var(--muted); flex: 1; font-size: 15px; }
.card .more { font-weight: 700; text-decoration: none; }
/* The whole card is clickable through its link's ::after. */
.card .more::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.card .more:focus-visible { outline: none; }
.card:has(.more:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

.mark {
  display: grid; place-items: center; flex: none;
  width: 52px; height: 52px; margin-bottom: 18px;
  border-radius: 14px;
  background: var(--accent-soft); color: var(--accent);
  font: 700 24px/1 Fraunces, Georgia, "PingFang TC", serif;
}

/* Project write-ups (Projects page) */
.project {
  display: grid; grid-template-columns: 52px 1fr; gap: 0 24px;
  padding: 40px 0; border-top: 1px solid var(--line);
  scroll-margin-top: 24px;
}
.project:first-of-type { border-top: 0; padding-top: 0; }
.project .mark { margin: 4px 0 0; }
.project h2 { margin-bottom: 4px; }
.project h3 { font-size: 16px; font-family: Karla, system-ui, sans-serif; font-weight: 700; color: var(--ink); margin: 20px 0 4px; }
.project p { margin: 0; color: var(--muted); max-width: 640px; }
.project-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 8px 0 4px; }
.project-links a { font-weight: 700; text-decoration: none; }
.lock { font-size: 13px; color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.tags li { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--muted); }

/* Boxes */
.panel {
  padding: 24px 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
.panel h2 { font-size: 22px; }

/* About */
.about { display: grid; grid-template-columns: 1fr; gap: 32px; }
.about .photo { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.prose p { margin: 0 0 16px; }
.prose h2 { margin-top: 40px; }
/* Text still waiting to be written shows as a highlighted note. */
.todo {
  display: inline; padding: 2px 6px; border-radius: 6px;
  background: var(--todo); color: var(--todo-ink); font-style: italic;
}

/* Now / Notes */
.now-list { margin: 0; padding-left: 20px; }
.now-list li { margin-bottom: 6px; }
.notes { margin: 0; padding: 0; list-style: none; }
.note { display: grid; grid-template-columns: 120px 1fr; gap: 4px 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.note time { color: var(--muted); font-size: 14px; padding-top: 3px; }
.note h3 { margin: 0 0 4px; }
.note p { margin: 0; color: var(--muted); }
.lately time { display: block; color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.lately h3 { margin: 0 0 6px; }
.lately p { margin: 0 0 12px; color: var(--muted); }

footer { margin-top: 72px; border-top: 1px solid var(--line); }
footer .wrap { padding-top: 24px; padding-bottom: 40px; font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
footer a { color: var(--muted); }

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  main { padding-top: 40px; }
  .page-head { margin-bottom: 32px; }
  .grid { grid-template-columns: 1fr; }
  .project { grid-template-columns: 1fr; }
  .project .mark { margin-bottom: 14px; }
  .note { grid-template-columns: 1fr; }
  .section-title { margin-top: 48px; }
}
