/* ── Tokens ────────────────────────────────────────────────── */

:root {
  --bg:              #fafaf7;
  --surface:         #f0f0eb;
  --border:          #deded6;
  --text:            #1c1c1a;
  --text-secondary:  #626260;
  --accent:          #3b7a54;
  --accent-hover:    #2e6043;
  --accent-subtle:   #e6f0ea;

  --font-sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;

  --max-w: 740px;
  --spacing-section: 4rem;
}

[data-theme="dark"] {
  --bg:              #141412;
  --surface:         #1e1e1b;
  --border:          #2c2c28;
  --text:            #e8e8e0;
  --text-secondary:  #8e8e84;
  --accent:          #5fa872;
  --accent-hover:    #74bf88;
  --accent-subtle:   #1b3025;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:              #141412;
    --surface:         #1e1e1b;
    --border:          #2c2c28;
    --text:            #e8e8e0;
    --text-secondary:  #8e8e84;
    --accent:          #5fa872;
    --accent-hover:    #74bf88;
    --accent-subtle:   #1b3025;
  }
}

/* ── Reset ─────────────────────────────────────────────────── */

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

/* ── Base ──────────────────────────────────────────────────── */

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  transition: background-color 0.2s ease, color 0.2s ease;
  padding: 0 1.25rem;
}

/* ── Header ────────────────────────────────────────────────── */

header {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.wordmark {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: normal;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.wordmark:hover {
  color: var(--accent);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  transition: border-color 0.15s, color 0.15s;
  width: 2rem;
  height: 2rem;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  width: 1rem;
  height: 1rem;
}

.icon-moon { display: none; }

[data-theme="dark"] .icon-sun  { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun  { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ── Main ──────────────────────────────────────────────────── */

main {
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ── Hero ──────────────────────────────────────────────────── */

.hero {
  padding: 3.5rem 0 var(--spacing-section);
  border-bottom: 1px solid var(--border);
}

.kicker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: normal;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 1.25rem;
  max-width: 30ch;
}

.lead {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 58ch;
  line-height: 1.75;
}

/* ── Prose section ─────────────────────────────────────────── */

.prose-section {
  padding: var(--spacing-section) 0;
  border-bottom: 1px solid var(--border);
}

.prose-section h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: normal;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.prose-section p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  max-width: 62ch;
}

.prose-section p:last-child {
  margin-bottom: 0;
}

.prose-section strong {
  color: var(--text);
  font-weight: 600;
}

.prose-section em {
  font-style: italic;
}

/* ── Principles ────────────────────────────────────────────── */

.principles-section {
  padding: var(--spacing-section) 0;
  border-bottom: 1px solid var(--border);
}

.principles-section h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: normal;
  color: var(--text);
  margin-bottom: 1.75rem;
}

.principles {
  list-style: none;
  counter-reset: principles;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.principles li {
  counter-increment: principles;
  display: flex;
  gap: 1.25rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.principles li::before {
  content: counter(principles);
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--accent);
  min-width: 1.25rem;
  padding-top: 0.2rem;
  flex-shrink: 0;
}

.principles li strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Projects ──────────────────────────────────────────────── */

.projects-section {
  padding: var(--spacing-section) 0;
}

.projects-section h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: normal;
  color: var(--text);
  margin-bottom: 1.75rem;
}

.project-grid {
  display: grid;
  gap: 1.25rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: border-color 0.15s;
}

.project-card:hover {
  border-color: var(--accent);
}

.project-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.project-header h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: normal;
  color: var(--text);
}

.project-link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.project-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.project-description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
  max-width: 60ch;
}

.project-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.project-tags li {
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-subtle);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  letter-spacing: 0.02em;
}

/* ── Footer ────────────────────────────────────────────────── */

footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ── Utilities ─────────────────────────────────────────────── */

@media (max-width: 600px) {
  html { font-size: 16px; }
  .hero { padding-top: 2.5rem; }
  .project-header { flex-direction: column; }
}
