@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Mono:wght@300;400;500&family=Syne:wght@400;700;800&display=swap');

:root {
  --ink:      #0a0b0f;
  --ink2:     #0f1117;
  --ink3:     #161820;
  --rule:     rgba(255,255,255,0.07);
  --rule-h:   rgba(255,255,255,0.14);
  --lime:     #c8f135;
  --lime-dim: rgba(200,241,53,0.1);
  --dim:      #4a5166;
  --mid:      #8892a8;
  --bright:   #d8dde8;
  --white:    #f0f2f7;
  --red:      #ff4444;
  --amber:    #ffb347;
  --green:    #44e08a;
  --mono:     'DM Mono', monospace;
  --serif:    'Instrument Serif', serif;
  --sans:     'Syne', sans-serif;
  --max:      1040px;
  --pad:      clamp(1.5rem, 4vw, 3.5rem);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--ink);
  color: var(--mid);
  font-family: var(--mono);
  font-size: .875rem;
  line-height: 1.7;
  overflow-x: hidden;
  cursor: none;
}

/* ── CURSOR ── */
#k-cur {
  position: fixed; top: 0; left: 0; z-index: 9000;
  width: 6px; height: 6px;
  background: var(--lime);
  border-radius: 50%;
  transform: translate(-50%,-50%);
  pointer-events: none;
  mix-blend-mode: exclusion;
  transition: width .12s, height .12s;
}
#k-cur.big { width: 20px; height: 20px; }

/* ── GRAIN ── */
.grain {
  position: fixed; inset: 0; z-index: 8000; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 1; mix-blend-mode: overlay;
}

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  border-bottom: 1px solid var(--rule);
  background: rgba(10,11,15,.9);
  backdrop-filter: blur(14px);
}
.nav-inner {
  max-width: var(--max); margin: 0 auto;
  padding: 1rem var(--pad);
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem;
}
.nav-logo {
  font-family: var(--sans); font-size: .95rem; font-weight: 800;
  letter-spacing: .02em; color: var(--white); text-decoration: none;
  display: flex; align-items: center; gap: .5rem;
}
.nav-logo-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); flex-shrink: 0; }
.nav-links { display: flex; gap: 1.8rem; list-style: none; align-items: center; }
.nav-links a {
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim); text-decoration: none; transition: color .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--white); }
.nav-links a.active { border-bottom: 1px solid var(--lime); padding-bottom: 1px; }
.nav-search {
  background: none; border: none; color: var(--dim);
  font-size: .78rem; cursor: none; transition: color .15s; padding: 0;
}
.nav-search:hover { color: var(--lime); }

/* ── LAYOUT ── */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
.page-body { padding-top: 5.5rem; }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--rule);
  margin-top: 6rem; padding: 2rem 0;
}
.foot-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--pad);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}
.foot-l { font-size: .7rem; color: var(--dim); display: flex; align-items: center; gap: 1.2rem; }
.foot-l a { color: var(--dim); text-decoration: none; transition: color .15s; }
.foot-l a:hover { color: var(--lime); }
.foot-r { font-size: .65rem; color: var(--dim); opacity: .5; }

/* ── PAGE TITLE BLOCK ── */
.ptitle {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0;
}
.ptitle .label {
  font-size: .65rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--lime); margin-bottom: .6rem;
  display: flex; align-items: center; gap: .6rem;
}
.ptitle .label::before { content: ''; width: 1.5rem; height: 1px; background: var(--lime); }
.ptitle h1 {
  font-family: var(--sans); font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--white); letter-spacing: -.01em; line-height: 1;
}
.ptitle p {
  margin-top: .9rem; font-size: .85rem; font-weight: 300;
  color: var(--mid); max-width: 500px; line-height: 1.85;
}

/* ── POST LIST ── */
.post-list { display: flex; flex-direction: column; }
.pitem {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0 1.5rem;
  padding: 1.8rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  position: relative;
  transition: background .15s;
}
.pitem:first-child { border-top: 1px solid var(--rule); }
.pitem::after {
  content: ''; position: absolute;
  left: calc(-1 * var(--pad)); right: calc(-1 * var(--pad)); top: 0; bottom: 0;
  background: var(--lime-dim); opacity: 0;
  transition: opacity .2s; pointer-events: none;
}
.pitem:hover::after { opacity: 1; }
.pitem-num {
  font-family: var(--sans); font-size: .65rem; font-weight: 700;
  color: var(--dim); padding-top: .2rem; letter-spacing: .05em;
  transition: color .2s;
}
.pitem:hover .pitem-num { color: var(--lime); }
.pitem-body {}
.pitem-cat {
  font-size: .6rem; letter-spacing: .18em; text-transform: uppercase;
  margin-bottom: .45rem; display: flex; align-items: center; gap: .4rem;
}
.pitem-cat::before { content: ''; width: 3px; height: 3px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.c-hacking  { color: var(--lime); }
.c-ctf      { color: var(--amber); }
.c-research { color: #a78bfa; }
.c-misc     { color: var(--mid); }

.pitem-title {
  font-family: var(--serif); font-size: 1.2rem;
  color: var(--bright); line-height: 1.3;
  margin-bottom: .35rem;
  transition: color .15s;
}
.pitem:hover .pitem-title { color: var(--white); }
.pitem-excerpt {
  font-size: .78rem; font-weight: 300;
  color: var(--dim); line-height: 1.75;
  max-width: 560px; margin-bottom: .55rem;
  transition: color .15s;
}
.pitem:hover .pitem-excerpt { color: var(--mid); }
.pitem-meta { display: flex; align-items: center; gap: .9rem; }
.pitem-date, .pitem-read { font-size: .65rem; color: var(--dim); }
.pitem-diff {
  font-size: .6rem; padding: .1rem .45rem;
  border: 1px solid; letter-spacing: .06em;
}
.d-easy   { border-color: rgba(68,224,138,.35); color: var(--green); }
.d-medium { border-color: rgba(255,179,71,.35);  color: var(--amber); }
.d-hard   { border-color: rgba(255,68,68,.35);   color: var(--red); }
.d-insane { border-color: rgba(167,139,250,.35); color: #a78bfa; }

/* Empty state */
.empty {
  padding: 4rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  text-align: center;
}
.empty-t { font-size: .68rem; letter-spacing: .15em; text-transform: uppercase; color: var(--dim); margin-bottom: .4rem; }
.empty-s { font-size: .8rem; font-weight: 300; color: var(--dim); opacity: .6; }

/* ── TAGS ── */
.tag-group { margin-bottom: 2.5rem; }
.tag-group-lbl { font-size: .6rem; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); opacity: .5; margin-bottom: .8rem; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-pill {
  padding: .28rem .75rem;
  border: 1px solid var(--rule); color: var(--mid);
  font-size: .7rem; text-decoration: none; letter-spacing: .03em;
  transition: border-color .15s, color .15s;
  display: inline-flex; align-items: center; gap: .45rem;
}
.tag-pill:hover { border-color: var(--lime); color: var(--lime); }
.tag-pill .tc { font-size: .6rem; color: var(--lime); opacity: .6; }

/* ── SEARCH ── */
.search-overlay {
  position: fixed; inset: 0; z-index: 700;
  background: rgba(10,11,15,.96);
  backdrop-filter: blur(18px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 18vh;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.search-overlay.open { opacity: 1; pointer-events: all; }
.search-box { width: 100%; max-width: 520px; padding: 0 var(--pad); }
.search-input {
  width: 100%; background: var(--ink2);
  border: none; border-bottom: 1px solid var(--lime);
  padding: .9rem .2rem; font-family: var(--mono); font-size: .95rem;
  color: var(--white); outline: none;
}
.search-input::placeholder { color: var(--dim); }
.search-hint { font-size: .62rem; color: var(--dim); margin-top: .5rem; letter-spacing: .06em; }
.search-results { margin-top: 1.5rem; display: flex; flex-direction: column; gap: .3rem; }
.sr-item { padding: .8rem .6rem; border-bottom: 1px solid var(--rule); text-decoration: none; display: flex; justify-content: space-between; align-items: center; transition: background .15s; }
.sr-item:hover { background: var(--ink2); }
.sr-title { font-size: .85rem; color: var(--bright); }
.sr-cat   { font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--lime); }

/* ── SCROLL PROGRESS ── */
#kprog { position: fixed; top: 0; left: 0; height: 1px; background: var(--lime); z-index: 999; width: 0%; }

/* ── REVEAL ── */
.rev { opacity: 0; transform: translateY(18px); transition: opacity .55s ease, transform .55s ease; }
.rev.in { opacity: 1; transform: translateY(0); }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .nav-links { gap: 1rem; }
  .nav-links li:not(:last-child):not(:nth-last-child(2)) { display: none; }
  .pitem { grid-template-columns: 1fr; gap: 0; }
  .pitem-num { display: none; }
}
