:root {
  --bg: #0b0d12;
  --bg-elevated: #12151c;
  --border: #232733;
  --text: #eef0f4;
  --text-muted: #9aa1b0;
  --text-faint: #5b6272;
  --accent: #6ee7c8;
  --accent-2: #7c9eff;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --container-w: 780px;
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fafafa;
    --bg-elevated: #ffffff;
    --border: #e7e7ea;
    --text: #14161b;
    --text-muted: #5b6272;
    --text-faint: #9aa1b0;
    --accent: #0f9d70;
    --accent-2: #3b5bdb;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; text-decoration: none; }

.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle at 20% 10%, rgba(110,231,200,0.06), transparent 40%),
                     radial-gradient(circle at 85% 50%, rgba(124,158,255,0.06), transparent 45%);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

.header-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}
.logo .dot { color: var(--accent); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.main-nav a:hover { color: var(--text); }
.nav-cta {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text) !important;
}
.nav-cta:hover { border-color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  display: block;
}

/* ---------- Hero ---------- */
.hero-blog { padding: 96px 0 64px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0 0 20px;
}
.eyebrow a { color: var(--accent); }
.eyebrow a:hover { text-decoration: underline; }

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  max-width: 18ch;
}
.hero h1 .highlight {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lede {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 60ch;
  margin: 0;
}

/* ---------- Post list ---------- */
.post-list {
  padding-top: 32px;
  padding-bottom: 96px;
  display: flex;
  flex-direction: column;
}

.post-preview {
  border-top: 1px solid var(--border);
}
.post-preview:last-child { border-bottom: 1px solid var(--border); }

.post-preview-link {
  display: block;
  padding: 32px 0;
  transition: transform 0.15s ease;
}
.post-preview-link:hover { transform: translateX(4px); }
.post-preview-link:hover h2 { color: var(--accent); }

.post-preview-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.post-preview h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 10px;
  transition: color 0.15s ease;
}

.post-preview p {
  color: var(--text-muted);
  margin: 0 0 12px;
  max-width: 65ch;
}

.post-preview-tags, .post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.post-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-faint);
  display: inline-block;
}
a.post-tag:hover { border-color: var(--accent); color: var(--accent); }

.post-tag-lg {
  font-size: 0.85rem;
  padding: 8px 18px;
}

.dot-sep { margin: 0 4px; color: var(--text-faint); }

/* ---------- Single post ---------- */
.post-header { padding: 64px 0 40px; }
.post-header h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}
.post-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 48px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.post-body { font-size: 1.08rem; padding-bottom: 96px; }
.post-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 48px 0 20px;
  letter-spacing: -0.01em;
}
.post-body h3 { font-size: 1.2rem; font-weight: 700; margin: 36px 0 16px; }
.post-body p { color: var(--text-muted); margin: 0 0 22px; }
.post-body ul, .post-body ol { color: var(--text-muted); margin: 0 0 22px; padding-left: 22px; }
.post-body li { margin-bottom: 8px; }
.post-body strong { color: var(--text); }
.post-body a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
.post-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 5px;
}
.post-body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
}
.post-body pre code { border: none; padding: 0; background: none; }
.post-body blockquote {
  margin: 0 0 22px;
  padding: 4px 24px;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}

/* ---------- About page ---------- */
.about-page { padding-top: 24px; padding-bottom: 96px; }
.about-page h1 {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 800;
  margin: 0 0 40px;
}
.about-body p { color: var(--text-muted); font-size: 1.05rem; margin: 0 0 22px; max-width: 65ch; }
.about-body h2 { font-size: 1.3rem; font-weight: 700; margin: 40px 0 16px; }
.about-body ul { color: var(--text-muted); padding-left: 22px; }
.about-body li { margin-bottom: 10px; }
.about-body a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Tags page ---------- */
.tags-page { padding-top: 24px; padding-bottom: 96px; }
.tags-page h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; margin: 0 0 40px; }

.page-hero h1 {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0; }
.footer-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 10px;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.footer-inner a:hover { color: var(--text); }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    z-index: 10;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 24px 28px;
    gap: 18px;
    transform: translateY(calc(-100% - 100px));
    transition: transform 0.25s ease;
  }
  .main-nav.open { transform: translateY(0); }
  .nav-toggle { display: flex; }
  .hero-blog { padding: 72px 0 48px; }
  .post-header { padding: 48px 0 28px; }
  .post-body { padding-bottom: 72px; }
  .about-page, .tags-page { padding-top: 56px; padding-bottom: 72px; }
}

/* ---------- Print button ---------- */
.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.print-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ---------- Hero background: animated wire + glow ---------- */
.hero, .post-header, .page-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.hero-bg {
  position: absolute;
  inset: -10% -5%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  animation: heroDrift 18s ease-in-out infinite alternate;
}
.hero-glow-a {
  width: 380px;
  height: 380px;
  top: -120px;
  left: -60px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
}
.hero-glow-b {
  width: 320px;
  height: 320px;
  bottom: -140px;
  right: -40px;
  background: radial-gradient(circle, var(--accent-2), transparent 70%);
  animation-delay: -9s;
  animation-direction: alternate-reverse;
}

@keyframes heroDrift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, 20px) scale(1.12); }
}

.hero-wire {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-wire .wire {
  fill: none;
  stroke: url(#none);
  stroke: var(--accent);
  stroke-width: 1.2;
  opacity: 0.35;
  stroke-dasharray: 6 10;
  stroke-linecap: round;
  animation: wireFlow 26s linear infinite;
}
.hero-wire .wire-2, .hero-wire .wire-5 { stroke: var(--accent-2); }
.hero-wire .wire-1 { animation-duration: 22s; }
.hero-wire .wire-2 { animation-duration: 30s; animation-direction: reverse; }
.hero-wire .wire-3 { animation-duration: 26s; }
.hero-wire .wire-4 { animation-duration: 34s; animation-direction: reverse; }
.hero-wire .wire-5 { animation-duration: 20s; }
.hero-wire .wire-6 { animation-duration: 28s; animation-direction: reverse; }

@keyframes wireFlow {
  to { stroke-dashoffset: -400; }
}

.hero-wire .wire-nodes circle {
  fill: var(--accent);
  opacity: 0.55;
  animation: nodePulse 3.2s ease-in-out infinite;
}
.hero-wire .wire-nodes circle:nth-child(2) { animation-delay: 0.5s; }
.hero-wire .wire-nodes circle:nth-child(3) { animation-delay: 1s; }
.hero-wire .wire-nodes circle:nth-child(4) { animation-delay: 1.5s; }
.hero-wire .wire-nodes circle:nth-child(5) { animation-delay: 2s; }
.hero-wire .wire-nodes circle:nth-child(6) { animation-delay: 2.5s; }

@keyframes nodePulse {
  0%, 100% { opacity: 0.3; r: 3.5; }
  50% { opacity: 0.85; r: 5; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-glow, .hero-wire .wire, .hero-wire .wire-nodes circle {
    animation: none !important;
  }
}

/* ---------- Small page hero (About / Tags) ---------- */
.page-hero {
  padding: 72px 0 8px;
}
.page-hero .container { position: relative; z-index: 1; }

/* ---------- Credential card (certificate + QR) ---------- */
.credential-card {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  margin: 0 0 40px;
}
.credential-qr {
  flex: none;
  width: 96px;
  height: 96px;
  padding: 8px;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.credential-info { min-width: 0; }
.credential-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--text);
}
.credential-body {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.credential-meta {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-faint);
}
.credential-meta code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
}
.credential-meta a {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 500px) {
  .credential-card { flex-direction: column; align-items: flex-start; }
}
