:root {
  --bg: #f7f7f5;
  --bg-elev: #ffffff;
  --text: #1b1b18;
  --text-muted: #6b6b64;
  --border: #e6e4de;
  --accent: #c15f3c;
  --accent-soft: #f3e3da;
  --accent-contrast: #ffffff;
  --shadow: 0 1px 2px rgba(20, 20, 15, 0.04), 0 8px 24px rgba(20, 20, 15, 0.06);
  --radius: 14px;
  --chip-bg: #f0efe9;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #16151a;
  --bg-elev: #1e1d24;
  --text: #f1efe9;
  --text-muted: #9b98a3;
  --border: #302e38;
  --accent: #e08a63;
  --accent-soft: #3a2a24;
  --accent-contrast: #16151a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 30px rgba(0, 0, 0, 0.35);
  --chip-bg: #26242c;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16151a;
    --bg-elev: #1e1d24;
    --text: #f1efe9;
    --text-muted: #9b98a3;
    --border: #302e38;
    --accent: #e08a63;
    --accent-soft: #3a2a24;
    --accent-contrast: #16151a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 30px rgba(0, 0, 0, 0.35);
    --chip-bg: #26242c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(600px circle at 15% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(500px circle at 100% 0%, var(--accent-soft), transparent 55%);
  opacity: 0.7;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gh-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}

.gh-link:hover {
  color: var(--text);
  border-color: var(--accent);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.icon-btn:hover { color: var(--text); border-color: var(--accent); }

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[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; }
}

/* Hero */
.hero {
  padding: 64px 0 28px;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 560px;
  margin: 0;
}

.stats {
  display: flex;
  gap: 20px;
  margin-top: 24px;
  font-family: var(--font-mono);
}

.stats .stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stats .stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.stats .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 9px 12px;
  flex: 1 1 220px;
  max-width: 320px;
  color: var(--text-muted);
}

.search-box:focus-within {
  border-color: var(--accent);
  color: var(--text);
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  width: 100%;
  font-family: var(--font-sans);
}

/* the tag filter: one dropdown beside the search box, in the same frame */
.tag-select {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 0 12px;
  flex: 0 1 260px;
  align-self: stretch;
  min-width: 0;
  color: var(--text-muted);
  cursor: pointer;
}

.tag-select:focus-within,
.tag-select:hover {
  border-color: var(--accent);
  color: var(--text);
}

.tag-select select {
  appearance: none;
  border: none;
  outline: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right center;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-sans);
  padding: 9px 20px 9px 0;
  width: 100%;
  min-width: 0;
  cursor: pointer;
}

.tag-select select option {
  background: var(--bg-elev);
  color: var(--text);
}

/* Early development: a separate section, and a badge on its cards */
.early-section { margin-top: 8px; padding-top: 22px; border-top: 1px dashed var(--border); }
.early-head h2 { margin: 0 0 4px; font-size: 1.35rem; }
.early-head p { margin: 0 0 18px; color: var(--text-muted); max-width: 70ch; }
.card .badge-early { align-self: flex-start; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px dashed var(--accent); color: var(--accent); }

/* Grid + cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  padding-bottom: 60px;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.card-date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.card[data-href] { cursor: pointer; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

/* the first few lines of the description; "More" shows the rest */
.card-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}
.card.expanded .card-desc {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}

.card-more {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.card-more:hover { text-decoration: underline; }
.card-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-tags span {
  background: var(--chip-bg);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  text-transform: lowercase;
}

.card-links {
  display: flex;
  gap: 14px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

.card-links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-links a:hover { text-decoration: underline; }

.card-links .no-link {
  font-size: 12.5px;
  color: var(--text-muted);
  font-style: italic;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0 80px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover { color: var(--accent); }

.site-footer p { margin: 0; }
.site-footer .consult {
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text);
}
.site-footer .consult a { color: var(--accent); }
