/* ==========================================================
   Design tokens — tweak these to restyle the whole site
   ========================================================== */
:root {
  --bg: #faf9f5;          /* warm paper */
  --surface: #f0eee6;
  --text: #141413;
  --text-2: var(--text);
  --text-3: var(--text);
  --rule: #e3dfd4;
  --accent: #c15f3c;      /* clay */

  --max: 680px;
  --serif: "Cabin", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sans: "Cabin", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1e1c;
    --surface: #2a2926;
    --text: #ece9e1;
    --text-2: var(--text);
    --text-3: var(--text);
    --rule: #3a3833;
    --accent: #e08a65;
  }
}
:root[data-theme="dark"] {
  --bg: #1f1e1c;
  --surface: #2a2926;
  --text: #ece9e1;
  --text-2: var(--text);
  --text-3: var(--text);
  --rule: #3a3833;
  --accent: #e08a65;
}

/* ==========================================================
   Base
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

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

h1, h2, h3 { font-weight: 500; margin: 0; line-height: 1.2; }

/* Small sans labels used for nav, dates, section headings */
.label, .site-header, .site-footer, time, .meta, .aside {
  font-family: var(--sans);
  font-size: 13.5px;
  letter-spacing: 0.01em;
}

/* ==========================================================
   Header
   ========================================================== */
.site-header { padding: 36px 0 0; }
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 20px;
  text-decoration: none;
}
.logo img { width: 28px; height: 28px; transition: transform 0.2s ease; }
.logo:hover img { transform: rotate(-6deg); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a { color: var(--text-2); text-decoration: none; }
.nav-links a:hover { color: var(--accent); }
.nav-links a[aria-current="page"] { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-3);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { width: 15px; height: 15px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

/* ==========================================================
   Page structure
   ========================================================== */
main.container { padding-top: 96px; padding-bottom: 120px; }

.intro h1 {
  font-size: clamp(40px, 7vw, 56px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 28px;
}
.intro p { margin: 0 0 1em; color: var(--text-2); }
.intro p:first-of-type { color: var(--text); }

.page-title {
  font-size: clamp(36px, 6vw, 48px);
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.page-dek { margin: 0; color: var(--text-2); }

section { margin-top: 72px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.section-head h2 {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
}
.section-head a { font-family: var(--sans); font-size: 13.5px; color: var(--text-3); text-decoration: none; }
.section-head a:hover { color: var(--accent); }

/* ==========================================================
   Entry lists (projects, writing, links)
   ========================================================== */
.entries { list-style: none; margin: 0; padding: 0; }
.entries li { border-bottom: 1px solid var(--rule); }
.entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 24px;
  padding: 22px 0;
  text-decoration: none;
}
.entry h3 { font-size: 22px; letter-spacing: -0.01em; transition: color 0.15s ease; }
.entry p { grid-column: 1; margin: 2px 0 0; font-size: 17px; color: var(--text-2); }
.entry time, .entry .aside { color: var(--text-3); white-space: nowrap; padding-top: 6px; }
.entry .meta { grid-column: 1; margin-top: 8px; color: var(--text-3); }
.entry:hover { color: inherit; }
.entry:hover h3 { color: var(--accent); }

.page-head + .entries { margin-top: 48px; border-top: 1px solid var(--rule); }

/* ==========================================================
   Article
   ========================================================== */
.article header { margin-bottom: 48px; }
.article .back { font-family: var(--sans); font-size: 13.5px; color: var(--text-3); text-decoration: none; }
.article .back:hover { color: var(--accent); }
.article h1 {
  font-size: clamp(36px, 6vw, 48px);
  letter-spacing: -0.02em;
  margin: 28px 0 14px;
}
.article .byline { color: var(--text-3); }
.prose p { margin: 0 0 1.25em; }
.prose h2 { font-size: 26px; margin: 1.8em 0 0.5em; }
.prose blockquote {
  margin: 1.6em 0;
  padding-left: 22px;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--text-2);
}
.prose code {
  font-size: 0.85em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
}

/* ==========================================================
   Footer
   ========================================================== */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 28px 0 48px;
  color: var(--text-3);
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.site-footer a { color: var(--text-3); text-decoration: none; }
.footer-links { display: flex; gap: 20px; }
.site-footer a:hover { color: var(--accent); }

@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .container { padding: 0 20px; }
  .site-header { padding-top: 24px; }
  .nav-links { gap: 14px; }
  main.container { padding-top: 64px; }
  .entry { grid-template-columns: 1fr; }
  .entry time, .entry .aside { grid-row: 1; padding-top: 0; }
}
