@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('/fonts/bricolage-grotesque.woff2') format('woff2');
}

@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/hanken-grotesk-400.woff2') format('woff2');
}

:root {
  --bg:      #FEFCF4;
  --surface: #F3F0E4;
  --ink:     #0E0D0B;
  --muted:   #5C554B;
  --accent:  #1F6AAD;
  --a-light: #E6F2FB;
  --blue:    #1530CC;
  --b-light: #EAF0FF;
  --border:  rgba(14,13,11,.1);
  --focus:   #1F6AAD;
  --content: 1100px;
}

[data-theme="dark"] {
  --bg:      #0F0E0C;
  --surface: #1A1813;
  --ink:     #ECE6DA;
  --muted:   #B0A594;
  --accent:  #5AA9E0;
  --a-light: #14222E;
  --blue:    #7B9BFF;
  --b-light: #15192B;
  --border:  rgba(236,230,218,.12);
  --focus:   #5AA9E0;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; animation: none; }
  .btn:hover, .prow:hover .prow-arrow, .post:hover .post-arrow { transform: none; }
}
body {
  background: var(--bg); color: var(--ink);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.skip-link {
  position: absolute; left: 1rem; top: -100%;
  z-index: 200; padding: .6rem 1rem;
  background: var(--ink); color: var(--bg);
  text-decoration: none; border-radius: 6px; font-size: 14px; font-weight: 500;
}
.skip-link:focus { top: 1rem; }

/* ── Nav ── */
nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 2.5rem; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.logo { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 1rem; color: var(--ink); text-decoration: none; }
.logo span { color: var(--accent); }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: .35rem .65rem; cursor: pointer;
  font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-family: 'Hanken Grotesk', sans-serif;
}
.nav-toggle:hover { color: var(--ink); }
.nav-links { display: flex; gap: 2rem; list-style: none; align-items: center; }
.nav-links a { font-size: 14px; color: var(--muted); text-decoration: none; font-weight: 500; transition: color .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.theme-toggle { background: none; border: none; cursor: pointer; font-family: monospace; font-size: 13px; color: var(--muted); padding: 0; transition: color .15s; }
.theme-toggle:hover { color: var(--ink); }

/* ── Section header ── */
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4rem 2.5rem 2rem; max-width: var(--content); margin: 0 auto;
}
.sec-title {
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800;
  font-size: 2rem; letter-spacing: -.025em;
}
.sec-sub { font-size: 13px; color: var(--muted); }
.sec-link { font-size: 14px; color: var(--muted); text-decoration: none; font-weight: 500; transition: color .15s; }
.sec-link:hover { color: var(--accent); }

/* ── Hero ── */
.hero {
  padding: 7rem 2.5rem 5rem; border-bottom: 1px solid var(--border);
  max-width: var(--content); margin: 0 auto;
}
.hero-tag {
  display: inline-block; background: var(--a-light); color: var(--accent);
  font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  padding: .3rem .8rem; border-radius: 999px; margin-bottom: 2.5rem;
}
.hero-title {
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800;
  font-size: clamp(3.2rem, 7vw, 6.5rem); line-height: 1; letter-spacing: -.03em; margin-bottom: 2rem;
}
.hero-title .hl { color: var(--accent); }
.hero-title .lnbr { display: block; }
.hero-body { max-width: 500px; color: var(--muted); font-size: 1.05rem; line-height: 1.75; margin-bottom: 2.5rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: .6rem; padding: .75rem 1.5rem;
  background: var(--ink); color: var(--bg); font-family: 'Hanken Grotesk', sans-serif;
  font-size: 14px; font-weight: 500; text-decoration: none; border-radius: 6px;
  transition: background .18s, transform .12s; border: none; cursor: pointer;
}
.btn:hover { background: var(--accent); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--surface); transform: translateY(-1px); }

.stats-band {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
  padding: 2rem 2.5rem 3rem; max-width: var(--content); margin: 0 auto;
  border-bottom: 1px solid var(--border);
}
.hero-stat {
  text-align: left; padding: 1.25rem 1.5rem; background: var(--surface);
  border-radius: 12px;
}
.hero-stat-n { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 2.5rem; line-height: 1; }
.hero-stat-l { font-size: 12px; color: var(--muted); margin-top: .25rem; font-weight: 500; }

.site-main { min-height: 50vh; }
.list-wrap { max-width: var(--content); margin: 0 auto; }

/* ── Project rows ── */
.project-rows { border-top: 1px solid var(--border); }
.prow {
  display: grid; grid-template-columns: 3.5rem 1fr auto; gap: 0 2rem;
  padding: 2rem 2.5rem; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit; align-items: center; transition: background .18s;
}
.prow:hover { background: var(--surface); }
.prow:hover .prow-arrow { opacity: 1; transform: rotate(-45deg); }
.prow:hover .prow-name { color: var(--accent); }
.prow-num { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 1.1rem; color: var(--muted); transition: color .18s; }
.prow:hover .prow-num { color: var(--accent); }
.prow-top { display: flex; align-items: baseline; gap: 1rem; margin-bottom: .3rem; }
.prow-name { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 1.25rem; letter-spacing: -.015em; transition: color .18s; }
.prow-cat { font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.prow-desc { font-size: 14px; color: var(--muted); line-height: 1.5; }
.prow-right { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.tags { display: flex; gap: .4rem; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 5px; background: var(--surface); color: var(--muted); }
.prow:hover .tag { background: var(--bg); }
.badge { font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 999px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.badge.app  { background: var(--a-light); color: var(--accent); }
.badge.tool { background: var(--b-light); color: var(--blue); }
.badge.lib  { background: #F5ECFF; color: #7B2FBE; }
.badge.game { background: #FFF6E0; color: #A3620A; }
[data-theme="dark"] .badge.lib  { background: #241833; color: #C49BFF; }
[data-theme="dark"] .badge.game { background: #2A2110; color: #E0B060; }
.prow-arrow { font-size: 1.1rem; color: var(--accent); opacity: 0; transition: opacity .18s, transform .18s; }

/* ── Posts / Writing ── */
.posts { border-top: 1px solid var(--border); }
.post {
  display: grid; grid-template-columns: 1fr auto; gap: 1.5rem;
  padding: 1.75rem 2.5rem; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit; align-items: center; transition: background .18s;
}
.post:hover { background: var(--surface); }
.post-kicker { display: flex; align-items: center; gap: .75rem; margin-bottom: .4rem; }
.post-tag {
  font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .05em; background: var(--surface); color: var(--muted); transition: background .18s;
}
.post:hover .post-tag { background: var(--a-light); color: var(--accent); }
.post-date { font-size: 12px; color: var(--muted); font-weight: 500; }
.post-title { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 1.25rem; letter-spacing: -.015em; transition: color .18s; }
.post:hover .post-title { color: var(--accent); }
.post-arrow { font-size: 1.1rem; color: var(--accent); opacity: 0; transition: opacity .18s, transform .18s; }
.post:hover .post-arrow { opacity: 1; transform: rotate(-45deg); }

/* ── Post body (single post page) ── */
.post-body { padding: 4rem 2.5rem; max-width: 720px; margin: 0 auto; }
.post-body h1 { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 2.5rem; letter-spacing: -.03em; margin-bottom: 1rem; line-height: 1.1; }
.post-body .post-meta { display: flex; gap: 1rem; align-items: center; margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.post-body .content { color: var(--ink); font-size: 1.05rem; line-height: 1.85; }
.post-body .content p { margin-bottom: 1.5rem; }
.post-body .content h2 { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 1.5rem; margin: 2.5rem 0 1rem; }
.post-body .content h3 { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 1.2rem; margin: 2rem 0 .75rem; }
.post-body .content code { font-size: .9em; background: var(--surface); padding: 2px 6px; border-radius: 4px; }
.post-body .content pre { background: var(--surface); padding: 1.25rem; border-radius: 8px; overflow-x: auto; margin-bottom: 1.5rem; }
.post-body .content pre code { background: none; padding: 0; }
.post-body .content blockquote { border-left: 3px solid var(--accent); padding-left: 1.25rem; color: var(--muted); margin: 1.5rem 0; }
.post-body .content a { color: var(--accent); text-underline-offset: 3px; }
.post-related {
  margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border);
  font-size: 14px; color: var(--muted);
}
.post-related a { color: var(--accent); text-underline-offset: 3px; }

/* ── Signals ── */
.signals-list { padding: 0 0 5rem; max-width: var(--content); margin: 0 auto; }
.signal-row {
  display: flex; align-items: flex-start; gap: 1.25rem; padding: 1.25rem 2.5rem;
  border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; transition: background .15s;
}
.signal-row:first-child { border-top: 1px solid var(--border); }
.signal-row:hover { background: var(--surface); }
.signal-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex-shrink: 0; margin-top: .45rem; transition: background .2s; }
.signal-row:hover .signal-dot { background: var(--accent); }
.signal-body { flex: 1; }
.signal-title { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; margin-bottom: .25rem; transition: color .15s; }
.signal-row:hover .signal-title { color: var(--accent); }
.signal-meta { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.signal-source { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .04em; }
.signal-note { font-size: 13px; color: var(--muted); font-style: italic; }
.signal-strength { font-size: 11px; color: var(--accent); opacity: .5; flex-shrink: 0; letter-spacing: .15em; padding-top: .3rem; }
.signal-row:hover .signal-strength { opacity: 1; }

/* ── CV ── */
.cv-body {
  padding: 0 2.5rem 5rem; display: grid; grid-template-columns: 1fr 1fr;
  gap: 0 5rem; align-items: start; max-width: var(--content); margin: 0 auto;
}
.cv-col-title {
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: .7rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 2rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border);
}
.cv-entries { display: flex; flex-direction: column; gap: 2.25rem; margin-bottom: 3.5rem; }
.cv-entry-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .2rem; }
.cv-entry-title { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.cv-entry-period { font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; margin-left: 1rem; }
.cv-entry-org { font-size: 14px; color: var(--accent); font-weight: 500; margin-bottom: .4rem; }
.cv-entry-desc { font-size: 14px; color: var(--muted); line-height: 1.6; }
.cv-skills { display: flex; flex-direction: column; gap: 1.5rem; margin-bottom: 3.5rem; }
.cv-skill-label { font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .6rem; }
.cv-skill-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.cv-skill-tag { font-size: 12px; font-weight: 500; padding: 4px 11px; border-radius: 6px; background: var(--surface); color: var(--ink); }
.cv-patent { margin-bottom: 3.5rem; }
.cv-patent-box { padding: 1.25rem 1.5rem; background: var(--a-light); border-radius: 12px; border: 1px solid rgba(42,124,199,.15); }
.cv-patent-num { font-size: 11px; font-weight: 500; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; margin-bottom: .35rem; }
.cv-patent-title { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 1rem; letter-spacing: -.01em; margin-bottom: .3rem; }
.cv-patent-meta { font-size: 13px; color: var(--muted); }
.cv-patent-desc { margin-top: .4rem; font-size: 13px; line-height: 1.6; color: var(--muted); }

/* ── About ── */
.about-inner { max-width: 680px; padding: 4rem 2.5rem 5rem; }
.about-inner h1 { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 2rem; letter-spacing: -.025em; margin-bottom: 2rem; }
.about-text { color: var(--muted); font-size: 1.05rem; line-height: 1.85; }
.about-text p + p { margin-top: 1.25rem; }
.about-text a { color: var(--ink); text-underline-offset: 3px; transition: color .15s; }
.about-text a:hover { color: var(--accent); }

/* ── Tools ── */
.tool-rows { border-top: 1px solid var(--border); max-width: var(--content); margin: 0 auto; padding-bottom: 4rem; }
.tool-row {
  display: grid; grid-template-columns: 140px 1fr 1fr auto; gap: .75rem;
  padding: 1rem 2.5rem; border-bottom: 1px solid var(--border); align-items: start;
}
.tool-label {
  font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding-top: .45rem;
}
.tool-input, .tool-output {
  width: 100%; font-family: monospace; font-size: 12.5px; border: none; border-radius: 6px;
  padding: .4rem .65rem; resize: vertical; min-height: 32px; line-height: 1.5;
}
.tool-input { background: var(--surface); color: var(--ink); }
.tool-output { background: transparent; color: var(--muted); }
.tool-input:focus, .tool-output:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.tool-copy {
  font-size: 11px; padding: .3rem .7rem; border: 1.5px solid var(--border); border-radius: 5px;
  background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap;
  align-self: start; transition: color .15s, border-color .15s;
  font-family: 'Hanken Grotesk', sans-serif;
}
.tool-copy:hover { color: var(--ink); border-color: var(--ink); }

/* ── Email (obfuscated via object/SVG) ── */
object.email { vertical-align: text-bottom; margin-bottom: -2px; }

/* ── Footer ── */
footer {
  padding: 1.75rem 2.5rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--content); margin: 0 auto;
}
.foot-logo { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: .95rem; color: var(--ink); text-decoration: none; }
.foot-logo span { color: var(--accent); }
.foot-links { display: flex; gap: 1.25rem; }
.foot-links a { font-size: 13px; color: var(--muted); text-decoration: none; transition: color .15s; }
.foot-links a:hover { color: var(--ink); }
.foot-copy { font-size: 13px; color: var(--muted); }
.foot-ascii { font-family: monospace; font-size: 13px; color: var(--border); letter-spacing: -.05em; user-select: none; transition: color .3s; }
.foot-ascii:hover { color: var(--accent); }

/* ── Reveal ── */
.reveal { opacity: 0; transform: translateY(14px); animation: revealIn .5s ease forwards; }
@keyframes revealIn { to { opacity: 1; transform: none; } }
.reveal:nth-child(1) { animation-delay: .05s; }
.reveal:nth-child(2) { animation-delay: .10s; }
.reveal:nth-child(3) { animation-delay: .15s; }
.reveal:nth-child(4) { animation-delay: .20s; }
.reveal:nth-child(5) { animation-delay: .25s; }
.reveal:nth-child(6) { animation-delay: .30s; }
.reveal:nth-child(7) { animation-delay: .35s; }
.reveal:nth-child(8) { animation-delay: .40s; }
.reveal:nth-child(9) { animation-delay: .45s; }
.reveal:nth-child(10) { animation-delay: .50s; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .cv-body { grid-template-columns: 1fr; gap: 0; }
  .stats-band { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  nav { padding: 1rem 1.5rem; flex-wrap: wrap; gap: .75rem; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .nav-links {
    display: none; flex-direction: column; align-items: flex-start;
    width: 100%; gap: 0; padding: .5rem 0 0;
  }
  .nav-links.is-open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a, .nav-links .theme-toggle {
    display: block; width: 100%; padding: .7rem 0;
    border-bottom: 1px solid var(--border); font-size: 14px;
  }
  .hero { padding: 4rem 1.5rem 3rem; }
  .stats-band { padding: 1.5rem; gap: .75rem; }
  .sec-head { padding: 3rem 1.5rem 1.5rem; }
  .prow { grid-template-columns: 2.5rem 1fr; padding: 1.5rem; }
  .prow-right { display: none; }
  .prow-arrow { opacity: 1; }
  .post { padding: 1.5rem; }
  .signal-row { padding: 1.25rem 1.5rem; }
  .about-inner { padding: 3rem 1.5rem; }
  .cv-body { padding: 0 1.5rem 3.5rem; }
  .post-body { padding: 3rem 1.5rem; }
  footer { padding: 1.5rem; flex-direction: column; gap: 1rem; text-align: center; }
  .tool-row {
    grid-template-columns: 1fr; padding: 1.25rem 1.5rem;
  }
  .tool-copy { justify-self: start; }
}
