:root {
  --green: #16a34a;
  --green-bright: #22c55e;
  --yellow: #f4c542;
  --orange: #ff7a45;

  --bg: #14110f;
  --bg-soft: #1d1917;
  --surface: #211c19;
  --surface-2: #2a2421;
  --text: #f3ede3;
  --text-dim: #a89f92;
  --border: #38302b;
  --card-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);

  --radius: 18px;
  --radius-sm: 12px;
  --font-sans: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --maxw: 1120px;
}

:root[data-theme='light'] {
  --bg: #efe9df;
  --bg-soft: #f7f4ee;
  --surface: #fffdf9;
  --surface-2: #f2ece1;
  --text: #14110f;
  --text-dim: #6d6355;
  --border: #ddd3c3;
  --card-shadow: 0 16px 34px rgba(56, 45, 32, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  background-image: radial-gradient(
    circle at 1px 1px,
    rgba(128, 128, 128, 0.08) 1px,
    transparent 0
  );
  background-size: 22px 22px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── top bar ─────────────────────────────────────────── */
.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.wordmark span {
  color: var(--green-bright);
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--green);
  transform: rotate(20deg);
}

/* ── hero ────────────────────────────────────────────── */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  padding: 72px 0 56px;
  max-width: 720px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green-bright);
  margin: 0 0 18px;
}

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0 0 22px;
}

.lede {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0;
  max-width: 58ch;
}

/* ── project grid ────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding-bottom: 80px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--green);
  box-shadow: var(--card-shadow);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.glyph {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 1.25rem;
  color: var(--green-bright);
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.card h2 a {
  color: var(--text);
  text-decoration: none;
}

/* Make the whole card clickable while keeping one real link for crawlers. */
.card h2 a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.card:hover h2 a {
  color: var(--green-bright);
}

.card p {
  margin: 0;
  font-size: 0.925rem;
  line-height: 1.65;
  color: var(--text-dim);
  flex: 1;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 0;
  padding: 0;
}

.tags li {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

/* ── footer ──────────────────────────────────────────── */
footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 24px 64px;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

footer p {
  margin: 0 0 6px;
}

footer .muted {
  color: var(--text-dim);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
