/* ---------- tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #f6f1e4;
  --bg-elev: #fffcf5;
  --bg-elev-2: #fdf6e6;
  --fg: #2b2620;
  --muted: #776b56;
  --border: #e4dac0;
  --accent: #5f7a35;
  --accent-fg: #f6f1e4;
  --accent-2: #b5793a;
  --shadow: 0 1px 2px rgba(43, 38, 32, 0.06), 0 6px 16px rgba(43, 38, 32, 0.06);

  --max-width: 44rem;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17160f;
    --bg-elev: #201e16;
    --bg-elev-2: #26231a;
    --fg: #ece5d3;
    --muted: #a89a7c;
    --border: #383425;
    --accent: #9cbf6a;
    --accent-fg: #17160f;
    --accent-2: #d9a35e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #17160f;
  --bg-elev: #201e16;
  --bg-elev-2: #26231a;
  --fg: #ece5d3;
  --muted: #a89a7c;
  --border: #383425;
  --accent: #9cbf6a;
  --accent-fg: #17160f;
  --accent-2: #d9a35e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  transition: background-color .15s ease, color .15s ease;
}

img { max-width: 100%; border-radius: var(--radius); display: block; }

h1, h2, h3 { line-height: 1.25; margin: 1.6em 0 0.5em; }
h1:first-child, h2:first-child, h3:first-child { margin-top: 0; }

p { margin: 0 0 1em; }

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

code, pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

pre {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  overflow-x: auto;
}

code { background: var(--bg-elev-2); padding: 0.15em 0.4em; border-radius: 4px; }
pre code { background: none; padding: 0; }

blockquote {
  margin: 1em 0;
  padding: 0.2rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

/* ---------- header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-title {
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.site-title .tagline {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); }

/* ---------- layout ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.2rem 1rem 3.5rem;
}

.site-footer {
  border-top: 1px solid var(--border);
}
.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- hero ---------- */
.hero {
  padding: 1.5rem 0 0.5rem;
}
.hero h1 {
  font-size: 2rem;
  margin-bottom: 0.4rem;
}
.hero .lede {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 38rem;
}
.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.4rem 0 0.5rem;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--fg);
  background: var(--bg-elev);
}
.btn:hover { text-decoration: none; border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.btn-primary:hover { filter: brightness(1.06); }

/* ---------- cards ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  margin: 1rem 0;
}

.card-grid {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}
@media (min-width: 640px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 14%, transparent);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

/* ---------- entry list ---------- */
.entry-list { list-style: none; margin: 1.5rem 0; padding: 0; display: grid; gap: 0.9rem; }

.entry-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  transition: transform .12s ease, border-color .12s ease;
}
.entry-card:hover { transform: translateY(-1px); border-color: var(--accent); }

.entry-card a {
  color: var(--fg);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}
.entry-card a:hover { color: var(--accent-2); }

.entry-card time {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.2rem;
}

.entry-card .excerpt {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- single entry ---------- */
.entry-header time {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}

/* ---------- people / roles ---------- */
.people {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}
@media (min-width: 640px) {
  .people { grid-template-columns: 1fr 1fr; }
}
.person-role {
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---------- figures ---------- */
figure {
  margin: 1.6rem 0;
}
figure img {
  width: 100%;
  border: 1px solid var(--border);
}
figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}
.figure-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .figure-grid { grid-template-columns: 1fr 1fr; }
  .figure-grid figcaption { grid-column: 1 / -1; }
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  margin: 1em 0;
  display: block;
  overflow-x: auto;
}
th, td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }

/* ---------- misc ---------- */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}
