/* ─── Variables ──────────────────────────────────────────── */
:root {
  --bg: #faf8f3;
  --text: #1a1a1a;
  --muted: #666;
  --rule: #ccc8be;
  --font: "Times New Roman", Times, serif;
  --width: 680px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141414;
    --text: #e8e4db;
    --muted: #888;
    --rule: #2e2e2e;
  }
}

:root[data-theme="dark"] {
  --bg: #141414;
  --text: #e8e4db;
  --muted: #888;
  --rule: #2e2e2e;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Base ───────────────────────────────────────────────── */
html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Layout ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
  padding: 4rem 0 6rem;
}

/* ─── Nav ────────────────────────────────────────────────── */
nav {
  border-bottom: 1px solid var(--rule);
  padding: 1.25rem 0;
}

nav .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-home {
  font-weight: bold;
  font-size: 1.35rem;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
  line-height: 1;
}

.nav-links {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  flex-wrap: wrap;
}

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

.nav-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

.toggle-track {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  border: 1px solid var(--muted);
  display: flex;
  align-items: center;
  padding: 2px;
  transition: border-color 0.2s;
}

.toggle-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s, background 0.2s;
}

.theme-toggle.is-dark .toggle-track {
  border-color: var(--text);
}

.theme-toggle.is-dark .toggle-thumb {
  transform: translateX(12px);
  background: var(--text);
}

.nav-links .sep {
  color: var(--muted);
  user-select: none;
}

/* ─── Typography ─────────────────────────────────────────── */
h1 {
  font-size: 2.1rem;
  font-weight: bold;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1.3;
}

h3 {
  font-size: 1rem;
  font-weight: bold;
}

p {
  margin-top: 1rem;
}

p:first-child {
  margin-top: 0;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: none;
}

/* ─── Section headings (ruled) ───────────────────────────── */
.section-heading {
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
  margin-bottom: 1.75rem;
}

/* ─── Home ───────────────────────────────────────────────── */
.home-header {
  margin-bottom: 3.5rem;
}

.home-header h1 {
  margin-bottom: 0.2rem;
}

.home-subtitle {
  font-style: italic;
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  margin-top: 0.2rem;
}

/* ─── Post list ──────────────────────────────────────────── */

.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.post-list li a {
  text-decoration: none;
  display: block;
}

.post-list li a:hover .post-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-title {
  font-weight: bold;
  font-size: 1rem;
  line-height: 1.3;
}

.post-meta {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
  margin-top: 0.15rem;
}

.post-inline-date {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
  font-weight: normal;
  margin-left: 0.4rem;
}

.post-desc {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.35rem;
  line-height: 1.6;
}

/* ─── Recognition list ───────────────────────────────────── */
.recognition-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.rec-year {
  display: inline-block;
  width: 2.5rem;
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.rec-note {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ─── Home section spacing ───────────────────────────────── */
.home-section {
  margin-top: 3rem;
}

/* ─── Page title ─────────────────────────────────────────── */
.page-title {
  margin-bottom: 3rem;
}

.page-title h1 {
  font-size: 1.75rem;
  margin-bottom: 0.3rem;
}

.page-title .subtitle {
  font-style: italic;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

/* ─── CV / About ─────────────────────────────────────────── */
.cv-section {
  margin-bottom: 2.75rem;
}

.cv-entry {
  margin-bottom: 1.75rem;
}

.cv-role {
  font-weight: bold;
  font-size: 0.975rem;
}

.cv-date {
  font-style: italic;
  font-size: 0.875rem;
  color: var(--muted);
  display: block;
  margin-top: 0.1rem;
  margin-bottom: 0.45rem;
}

.cv-body {
  font-size: 0.95rem;
  line-height: 1.75;
}

.cv-bullets {
  list-style: none;
  padding: 0;
  margin-top: 0.65rem;
}

.cv-bullets li {
  padding-left: 1.2rem;
  position: relative;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.7;
}

.cv-bullets li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--muted);
}

/* ─── Blog post ──────────────────────────────────────────── */
.post-back {
  font-size: 0.875rem;
  display: inline-block;
  margin-bottom: 2.5rem;
  text-decoration: none;
  color: var(--muted);
}

.post-back:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-header {
  margin-bottom: 2.5rem;
}

.post-header h1 {
  font-size: 1.65rem;
  margin-bottom: 0.3rem;
}

.post-date {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
  margin-top: 0;
}

.prose {
  font-size: 1rem;
  line-height: 1.8;
}

.prose p {
  margin-top: 1.35rem;
}

.prose p:first-child {
  margin-top: 0;
}

.prose h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.6rem;
}

.prose strong {
  font-weight: bold;
}

.prose em {
  font-style: italic;
}

.prose img {
  display: block;
  width: 100%;
  margin: 2rem 0;
  filter: grayscale(100%) brightness(0.75);
}

.prose figcaption {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
  margin-top: 0.5rem;
  text-align: center;
}

.prose blockquote {
  border-left: 2px solid var(--rule);
  padding-left: 1.25rem;
  color: var(--muted);
  margin: 1.5rem 0;
  font-style: italic;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  html { font-size: 16px; }
  h1 { font-size: 1.75rem; }
  main { padding: 2.5rem 0 4rem; }

  nav .container {
    align-items: center;
    gap: 0.6rem;
  }

  .nav-home { font-size: 1.1rem; }

  .nav-links {
    gap: 0.65rem;
    font-size: 0.85rem;
  }

  .nav-links a { font-size: 0.85rem; }

  .home-section { margin-top: 2rem; }

  .post-list { gap: 1.25rem; }

  .home-header { margin-bottom: 2.5rem; }
}
