:root {
  /* paper & ink */
  --bg: #f7f6f2;
  --panel: #ffffff;
  --nav-bg: rgba(247, 246, 242, 0.92);
  --ink: #1c2530;
  --ink-soft: #2a3340;
  --muted: #5b6570;
  --hairline: #e4e1d8;
  --hairline-soft: #eceae2;
  /* accents: navy for links, bronze for editorial marks */
  --navy: #20365c;
  --navy-deep: #16263f;
  --gold: #96733f;
  --code-bg: #232e3d;
  --code-ink: #d7e0ec;
  /* faces */
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino,
    Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--navy-deep); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.85rem 1.2rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}
.brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.nav nav { display: flex; gap: 1.6rem; }
.nav nav a {
  font-family: var(--sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.nav nav a:hover { color: var(--ink); text-decoration: none; }
.nav nav a.active { color: var(--ink); border-bottom-color: var(--gold); }

/* ---------- layout ---------- */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.2rem 4rem;
}

.hero { padding: 2.2rem 0 0.6rem; }
.hero h1 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.15;
}
.hero .sub {
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  margin: 0;
}

.sec {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin: 2.4rem 0 1rem;
}
.sec::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--gold);
  flex: none;
}

/* ---------- project cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 1.1rem 1.2rem;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  border-color: #cfd6e2;
  box-shadow: 0 1px 4px rgba(20, 30, 50, 0.07);
  text-decoration: none;
  color: var(--ink);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
}
.card-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
}
.card-desc {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
  margin: 0.55rem 0 0.75rem;
  min-height: 2.6em;
}
.badge {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 0.05rem 0.4rem;
  white-space: nowrap;
  background: var(--bg);
}
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 0.05rem 0.45rem;
  background: #f3f1ea;
}

/* ---------- post list ---------- */

.postlist { list-style: none; margin: 0; padding: 0; }
.postlist li {
  border-bottom: 1px solid var(--hairline-soft);
  padding: 0.6rem 0;
}
.postlist li:first-child { padding-top: 0.2rem; }
.post-date {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
  margin-right: 0.8rem;
  white-space: nowrap;
}

/* ---------- blog / prose ---------- */

.post { max-width: 760px; }
.post h1 {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 1.4rem 0 0.6rem;
}
.post-meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 1.8rem; }
.taglink { color: var(--navy); }

.prose { font-size: 1.08rem; line-height: 1.75; color: var(--ink-soft); }
.prose h2, .prose h3 { font-family: var(--serif); color: var(--ink); }
.prose h2 { margin: 2.2rem 0 0.8rem; font-size: 1.5rem; font-weight: 600; }
.prose h3 { margin: 1.7rem 0 0.6rem; font-size: 1.15rem; font-weight: 600; }
.prose p { margin: 0.95rem 0; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin: 0.3rem 0; }
.prose strong { color: var(--ink); }
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: #efece3;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 0.08rem 0.35rem;
}
.prose pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid #1b2431;
  border-radius: 6px;
  padding: 0.95rem 1.05rem;
  overflow-x: auto;
}
.prose pre code { background: none; border: none; padding: 0; color: inherit; }
.prose blockquote {
  margin: 1.2rem 0;
  padding: 0.15rem 0 0.15rem 1.1rem;
  border-left: 2px solid var(--gold);
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
}
.prose table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.prose th, .prose td { border: 1px solid var(--hairline); padding: 0.45rem 0.65rem; text-align: left; }
.prose th { background: var(--navy); color: #f4f1e8; font-weight: 600; }
.prose img { max-width: 100%; }

.tagrow { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.6rem; }
.tagrow a {
  font-family: var(--mono);
  font-size: 0.76rem;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 0.12rem 0.55rem;
  color: var(--muted);
  background: var(--panel);
}
.tagrow a.active {
  color: var(--navy);
  border-color: var(--navy);
  background: #eef1f7;
}

/* ---------- 404 ---------- */

.notfound { text-align: center; padding: 4rem 0; }
.notfound .code {
  font-family: var(--serif);
  font-size: 4rem;
  color: var(--gold);
  line-height: 1;
}
.notfound p { color: var(--muted); }

/* ---------- footer ---------- */

.footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.4rem 1.2rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  text-align: center;
}

@media (max-width: 640px) {
  .hero h1 { font-size: 1.9rem; }
  .nav-inner { flex-direction: column; gap: 0.4rem; }
  .nav nav { gap: 1.1rem; }
}

/* ---------- image lightbox (click post image -> full window) ---------- */
.prose img { cursor: zoom-in; }
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(14, 17, 23, 0.93);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2vmin;
  cursor: zoom-out;
  z-index: 50;
}
#lightbox.open { display: flex; }
#lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
}
/* Embedded playable games (e.g. Neon Serpent in the one-shot post) */
.game-embed { margin: 24px 0 8px; }
.game-embed iframe {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: #05070d;
  box-shadow: 0 0 0 1px #e4e1d8, 0 8px 32px rgba(14, 17, 23, 0.18);
}
.game-embed-caption {
  margin: 10px 0 0;
  font-size: 13px;
  color: #5b6570;
  text-align: center;
}

/* project card dates + tag filter (2026-10-27) */
.card-dates{margin:2px 0 8px;font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:#5b6570}
.card-feat{margin-left:8px;font:700 10px/1 system-ui,sans-serif;letter-spacing:.08em;text-transform:uppercase;color:#96733f}
.filterbar{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 18px}
.filterbtn{padding:5px 10px;font:600 12px/1.2 system-ui,sans-serif;letter-spacing:.03em;color:#20365c;background:transparent;border:1.5px solid #20365c;border-radius:6px;cursor:pointer}
.filterbtn:hover,.filterbtn.active{background:#20365c;color:#fff}
