:root {
  --bg: #0a0b0f;
  --fg: #e8eaf0;
  --dim: #8a8f9c;
  --accent: #5ee6c9;
  --accent2: #6ea8fe;
  --line: rgba(255, 255, 255, 0.08);
  --danger: #e6756a;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  background: var(--accent);
  color: #0a0b0f;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

canvas#net {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: linear-gradient(to bottom, rgba(10, 11, 15, 0.85), rgba(10, 11, 15, 0.55));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
.site-header .brand {
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.site-header nav a {
  color: var(--dim);
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--fg); }
.site-header nav a[aria-current="page"] { border-bottom: 1px solid var(--accent); padding-bottom: 2px; }
.site-header nav a.rss { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.dot { margin: 0 8px; opacity: 0.5; }

main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

footer {
  text-align: center;
  font-size: 0.75rem;
  color: #4a4e5a;
  padding: 18px;
}
footer a { color: inherit; text-decoration: none; }
footer a:hover { color: var(--dim); }

/* ---- Home hero ---- */
.hero {
  min-height: calc(100vh - 150px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.mark {
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  background: linear-gradient(120deg, var(--fg) 20%, var(--accent) 55%, var(--accent2) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  transform: translateY(10px);
  animation: rise 1s ease forwards 0.15s;
}
.tagline {
  margin: 14px 0 0;
  font-size: clamp(0.95rem, 2.2vw, 1.15rem);
  color: var(--dim);
  max-width: 36em;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(10px);
  animation: rise 1s ease forwards 0.4s;
}
.tagline strong { color: var(--fg); font-weight: 600; }
.links {
  margin-top: 28px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  animation: rise 1s ease forwards 0.65s;
}
.links a, .links button {
  color: var(--dim);
  text-decoration: none;
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.links a:hover, .links button:hover {
  color: var(--fg);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.counter {
  margin-top: 32px;
  font-size: 0.75rem;
  color: #4a4e5a;
  opacity: 0;
  animation: rise 1s ease forwards 0.9s;
}
#latest-posts { width: 100%; max-width: 540px; text-align: left; }
.latest-title { margin-top: 36px; text-align: center; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); }

/* Featured post card (home) */
.featured-post {
  display: block;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: rgba(17, 19, 26, 0.55);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.featured-post:hover { border-color: var(--accent); transform: translateY(-2px); background: rgba(17, 19, 26, 0.85); }
.featured-img { width: 100%; height: 240px; object-fit: cover; display: block; }
.featured-body { padding: 20px 22px 22px; }
.featured-body h2 { margin: 0 0 10px; font-size: 1.35rem; line-height: 1.3; letter-spacing: -0.02em; }
.featured-body p { margin: 0 0 12px; color: var(--dim); font-size: 0.95rem; line-height: 1.6; }
.featured-body .meta { font-size: 0.75rem; color: #4a4e5a; }

/* Compact post list (home) */
.compact-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 2px; }
.compact-list li a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}
.compact-list li:last-child a { border-bottom: none; }
.compact-list li a:hover { color: var(--accent); }
.compact-title { font-size: 0.95rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-date { font-size: 0.75rem; color: #4a4e5a; flex-shrink: 0; }
.all-posts-link {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.all-posts-link:hover { opacity: 0.75; }
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Blog list ---- */
.blog-head { margin-top: 44px; }
.blog-head h1 { margin: 0; font-size: clamp(1.8rem, 5vw, 2.4rem); letter-spacing: -0.02em; }
.blog-head .accent { color: var(--accent); }
.blog-intro { margin: 10px 0 0; color: var(--dim); font-size: 1.02rem; }
.clear-filter {
  display: inline-block;
  margin-top: 12px;
  color: var(--dim);
  text-decoration: none;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}
.clear-filter:hover { color: var(--fg); border-color: var(--accent); }
.post-list {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.post-list li { position: relative; }
.post-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  text-decoration: none;
  color: inherit;
  background: rgba(17, 19, 26, 0.55);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); background: rgba(17, 19, 26, 0.85); }
.post-card.has-thumb { padding: 0; overflow: hidden; }
.post-card.has-thumb .card-thumb { width: 100%; height: 200px; object-fit: cover; display: block; border-radius: 0; }
.post-card.has-thumb .card-body { padding: 20px 24px 22px; }
.post-card .card-body { flex: 1; min-width: 0; }
.post-card h2 { margin: 0 0 8px; font-size: 1.25rem; line-height: 1.3; letter-spacing: -0.01em; }
.post-card .meta { color: var(--dim); font-size: 0.78rem; margin-bottom: 10px; display: flex; align-items: center; flex-wrap: wrap; }
.post-card p { margin: 0; color: var(--dim); font-size: 0.95rem; line-height: 1.55; }
.views { color: #4a4e5a; font-size: 0.75rem; }
.post-list li .tags { position: absolute; left: 24px; right: 24px; bottom: 18px; margin: 0; pointer-events: none; }
.post-list li .tags .tag { pointer-events: auto; }
.post-list li:has(.tags) .post-card { padding-bottom: 56px; }
.badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent2);
  border: 1px solid rgba(110, 168, 254, 0.35);
  border-radius: 999px;
  padding: 1px 8px;
}
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tag {
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  text-decoration: none;
  background: var(--bg);
  transition: border-color 0.2s ease, background 0.2s ease;
}
a.tag:hover { border-color: var(--accent); background: rgba(94, 230, 201, 0.08); }
.empty { color: var(--dim); margin-top: 24px; }
.empty a { color: var(--accent2); }

/* ---- Post page ---- */
.back {
  display: inline-block;
  margin: 40px 0 0;
  color: var(--dim);
  text-decoration: none;
  font-size: 0.85rem;
}
.back:hover { color: var(--fg); }
article.post { margin-top: 18px; }
article.post h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 12px; line-height: 1.15; letter-spacing: -0.02em; }
article.post header { margin-bottom: 32px; }
article.post header .meta { color: var(--dim); font-size: 0.85rem; display: flex; align-items: center; flex-wrap: wrap; }
article.post header .tags { margin-top: 14px; }
article.post .cover { width: 100%; border-radius: 12px; margin-bottom: 28px; display: block; }
article.post .content { line-height: 1.75; font-size: 1.05rem; }
article.post .content > :first-child { margin-top: 0; }
article.post .content p { margin: 0 0 1.25em; }
article.post .content h2 { font-size: 1.5rem; margin: 2em 0 0.6em; letter-spacing: -0.01em; line-height: 1.25; }
article.post .content h3 { font-size: 1.2rem; margin: 1.6em 0 0.5em; }
article.post .content h4 { font-size: 1.05rem; margin: 1.4em 0 0.4em; color: var(--dim); }
article.post .content ul, article.post .content ol { padding-left: 1.4em; margin: 0 0 1.25em; }
article.post .content li { margin: 0.3em 0; }
article.post .content li > p { margin-bottom: 0.5em; }
article.post .content hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em auto; width: 40%; }
article.post .content img { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: 1.5em auto; }
article.post .content pre {
  background: #11131a;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 1.5em;
  font-size: 0.9rem;
  line-height: 1.55;
}
article.post .content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}
article.post .content :not(pre) > code {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.4em;
  font-size: 0.86em;
}
article.post .content pre code { font-size: inherit; }
article.post .content blockquote {
  border-left: 3px solid var(--accent);
  margin: 0 0 1.5em;
  padding: 2px 0 2px 18px;
  color: var(--dim);
  font-style: italic;
}
article.post .content blockquote p:last-child { margin-bottom: 0; }
article.post .content a { color: var(--accent2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(110, 168, 254, 0.4); }
article.post .content a:hover { text-decoration-color: var(--accent2); }
article.post .content table { width: 100%; border-collapse: collapse; margin: 0 0 1.5em; font-size: 0.95rem; display: block; overflow-x: auto; }
article.post .content th, article.post .content td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
article.post .content th { color: var(--dim); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
article.post .content del { color: var(--dim); }

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.post-nav a:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-nav a span { font-size: 0.75rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.post-nav a strong { font-weight: 600; font-size: 0.95rem; line-height: 1.35; }
.post-nav a.older { text-align: right; }
@media (max-width: 560px) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav a.older { text-align: left; }
  .site-header { padding: 14px 18px; }
  main { padding: 0 18px 48px; }
  .post-card { padding: 18px 18px; }
  .post-list li .tags { left: 18px; right: 18px; }
}

.pager { display: flex; justify-content: space-between; margin-top: 36px; }
.pager a {
  color: var(--dim);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.85rem;
}
.pager a:hover { color: var(--fg); border-color: var(--accent); }

/* ---- Admin ---- */
.admin { margin-top: 36px; }
.admin h1 { font-size: 1.6rem; }
.admin label { display: block; margin: 16px 0 6px; font-size: 0.85rem; color: var(--dim); }
.admin input[type="text"],
.admin input[type="password"],
.admin textarea {
  width: 100%;
  background: #11131a;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
}
.admin textarea { min-height: 280px; font-family: ui-monospace, Menlo, monospace; resize: vertical; }
.admin button {
  margin-top: 18px;
  background: var(--accent);
  color: #0a0b0f;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}
.admin button.secondary { background: transparent; border: 1px solid var(--line); color: var(--fg); }
.admin button.danger { background: var(--danger); color: #1a0a0a; }
.admin table { width: 100%; border-collapse: collapse; margin-top: 24px; font-size: 0.9rem; }
.admin th, .admin td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.admin .status-draft { color: var(--dim); }
.admin .status-published { color: var(--accent); }
.admin .err { color: var(--danger); margin-top: 12px; font-size: 0.9rem; }
.admin .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.admin .cover-preview { max-width: 240px; border-radius: 8px; margin-top: 10px; display: block; }
.admin .cover-preview[hidden] { display: none; }
.admin .preview-content { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 20px; }
.admin a.button-link {
  display: inline-block;
  text-decoration: none;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}
.admin a.button-link:hover { border-color: var(--accent); }
.admin .hint { color: var(--dim); font-size: 0.78rem; margin-top: 4px; }

.admin .tabs { display: flex; gap: 4px; margin: 20px 0 8px; border-bottom: 1px solid var(--line); }
.admin .tabs button {
  margin: 0;
  background: transparent;
  color: var(--dim);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 14px;
  font-weight: 500;
}
.admin .tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.admin .toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.admin .toolbar h1 { margin: 0; }
.admin .toolbar .row button { margin-top: 0; }
.admin table .actions button { margin-top: 0; padding: 6px 12px; font-size: 0.8rem; }
.admin td.title a { color: inherit; text-decoration: none; }
.admin td.title a:hover { color: var(--accent); }
.admin td .slug { display: block; color: var(--dim); font-size: 0.75rem; margin-top: 2px; font-family: ui-monospace, Menlo, monospace; }
.admin .table-wrap { overflow-x: auto; }
.admin .dropzone {
  margin-top: 8px;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  color: var(--dim);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.admin .dropzone:hover, .admin .dropzone.over { border-color: var(--accent); background: rgba(94, 230, 201, 0.05); color: var(--fg); }
.admin .dropzone strong { color: var(--fg); }
.admin .dropzone input { display: none; }
.admin .file-info { font-size: 0.82rem; color: var(--accent); margin-top: 8px; }
.admin .checkbox { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 0.9rem; color: var(--fg); }
.admin .checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }
.admin details { margin-top: 16px; }
.admin details summary { cursor: pointer; color: var(--dim); font-size: 0.85rem; }
.admin details textarea { margin-top: 10px; }
.admin textarea.html { min-height: 360px; font-size: 0.82rem; }
.admin .url-preview {
  margin-top: 6px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--accent2);
  word-break: break-all;
}
.admin .url-preview a { color: inherit; }
.admin .ok { color: var(--accent); margin-top: 12px; font-size: 0.9rem; }
.admin .lead { color: var(--dim); margin: 6px 0 0; font-size: 0.92rem; }
.admin input[type="text"]:focus, .admin input[type="password"]:focus, .admin textarea:focus { border-color: var(--accent); outline: none; }
@media (max-width: 560px) {
  .admin .toolbar { flex-direction: column; align-items: flex-start; }
}
