/* 0VLD Writeups — technical, readable, elevated code */
:root {
  --w-bg: #0b0f12;
  --w-panel: #131a1f;
  --w-panel-2: #182028;
  --w-border: rgba(90, 160, 130, 0.25);
  --w-border-hi: rgba(100, 180, 140, 0.4);
  --w-text: #e2ece6;
  --w-body: #c0d0c6;
  --w-muted: #87a090;
  --w-faint: #5e7368;
  --w-accent: #6bc49a;
  --w-accent-dim: rgba(107, 196, 154, 0.14);
  --w-warn: #d4a85c;
  --w-font-d: "Space Grotesk", system-ui, sans-serif;
  --w-font: "Inter", system-ui, sans-serif;
  --w-mono: "JetBrains Mono", ui-monospace, monospace;
  --w-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --w-shadow: 0 8px 28px rgba(0, 0, 0, 0.38);
  --w-code-bg: #0a100e;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--w-bg); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .preloader { display: none !important; }
}

body.writeups-site {
  background:
    radial-gradient(ellipse 800px 420px at 8% 0%, rgba(107, 196, 154, 0.07), transparent 55%),
    var(--w-bg);
  color: var(--w-text);
  font-family: var(--w-font);
  font-size: 16px;
  line-height: 1.68;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.preloader {
  position: fixed; inset: 0; z-index: 9999; background: var(--w-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s;
}
.preloader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-brand {
  font-family: var(--w-font-d); font-weight: 700; font-size: 1.4rem;
  letter-spacing: 0.12em; margin-bottom: 18px;
}
.preloader-bar {
  width: 120px; height: 2px; background: rgba(107, 196, 154, 0.2); border-radius: 2px; overflow: hidden;
}
.preloader-bar span {
  display: block; height: 100%; width: 0; background: var(--w-accent);
  animation: prefill 0.9s var(--w-ease) forwards;
}
@keyframes prefill { to { width: 100%; } }

#readingProgress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 60;
  background: var(--w-accent); pointer-events: none;
}

.page-chrome {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 4vw 0; max-width: 1180px; margin: 0 auto;
}
.page-chrome a.brand {
  font-family: var(--w-font-d); font-weight: 700; font-size: 0.95rem;
  letter-spacing: 0.08em; color: var(--w-text); text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.page-chrome a.brand::before {
  content: ""; width: 8px; height: 8px; border-radius: 2px;
  background: var(--w-accent); box-shadow: 0 0 8px var(--w-accent);
}
.page-chrome .back-link {
  font-family: var(--w-mono); font-size: 11px; color: var(--w-muted); text-decoration: none;
}
.page-chrome .back-link:hover { color: var(--w-accent); }

.wu-shell { max-width: 1100px; margin: 0 auto; padding: 32px 4vw 64px; }
.wu-hero {
  margin-bottom: 28px; padding: 18px 20px;
  background: var(--w-panel); border: 1px solid var(--w-border);
  border-radius: 12px; border-left: 3px solid var(--w-accent);
  box-shadow: var(--w-shadow);
}
.wu-hero-kicker {
  font-family: var(--w-mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--w-accent); margin-bottom: 8px;
}
.wu-hero h1 {
  font-family: var(--w-font-d); font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 700; margin-bottom: 8px;
}
.wu-hero p { color: var(--w-muted); font-size: 0.95rem; max-width: 42em; }

.wu-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}
.wu-card {
  display: grid; grid-template-rows: auto 1fr;
  background: var(--w-panel); border: 1px solid var(--w-border);
  border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit;
  box-shadow: var(--w-shadow);
  transition: border-color 0.2s, transform 0.3s var(--w-ease), box-shadow 0.3s;
}
.wu-card:hover {
  border-color: var(--w-border-hi); transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
}
.wu-card-cover {
  aspect-ratio: 16 / 10; background: #0c1210; position: relative; overflow: hidden;
}
.wu-card-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.94;
  transition: transform 0.4s var(--w-ease);
}
.wu-card:hover .wu-card-cover img { transform: scale(1.03); opacity: 1; }
.wu-card-badge {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--w-mono); font-size: 10px; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 4px;
  background: rgba(11, 15, 18, 0.88); border: 1px solid var(--w-border); color: var(--w-accent);
}
.wu-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.wu-card-meta {
  font-family: var(--w-mono); font-size: 10px; color: var(--w-faint);
  display: flex; gap: 10px; flex-wrap: wrap;
}
.wu-card h2 { font-family: var(--w-font-d); font-size: 1.05rem; font-weight: 650; line-height: 1.25; }
.wu-card p { color: var(--w-muted); font-size: 0.88rem; line-height: 1.5; }

.wu-article-wrap {
  max-width: 1180px; margin: 0 auto; padding: 20px 4vw 72px;
  display: grid; grid-template-columns: 210px 1fr; gap: 32px; align-items: start;
}
@media (max-width: 900px) {
  .wu-article-wrap { grid-template-columns: 1fr; }
  .wu-toc { position: static !important; max-height: none; }
}

.wu-toc {
  position: sticky; top: 16px;
  font-family: var(--w-mono); font-size: 11px;
  padding: 14px; background: var(--w-panel); border: 1px solid var(--w-border);
  border-radius: 10px; max-height: calc(100vh - 32px); overflow-y: auto;
  box-shadow: var(--w-shadow);
}
.wu-toc-title {
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--w-faint);
  margin-bottom: 10px; font-size: 10px;
}
.wu-toc a {
  display: block; color: var(--w-muted); text-decoration: none; padding: 5px 0 5px 10px;
  border-left: 2px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.wu-toc a:hover { color: var(--w-accent); border-left-color: var(--w-accent); }
.wu-toc a.depth-3 { padding-left: 18px; font-size: 10.5px; }

.wu-main { min-width: 0; }
.wu-header {
  margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--w-border);
}
.wu-header-kicker {
  font-family: var(--w-mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--w-accent); margin-bottom: 10px;
}
.wu-header h1 {
  font-family: var(--w-font-d); font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700; line-height: 1.2; margin-bottom: 12px;
}
.wu-meta-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-family: var(--w-mono); font-size: 11px; color: var(--w-muted);
}
.wu-meta-row span {
  padding: 3px 8px; background: var(--w-accent-dim); border-radius: 4px;
  border: 1px solid var(--w-border);
}
.wu-cover {
  margin: 0 0 26px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--w-border); box-shadow: var(--w-shadow);
}
.wu-cover img { width: 100%; display: block; max-height: 360px; object-fit: cover; }

.writeup-content { color: var(--w-body); font-size: 1rem; line-height: 1.72; }
.writeup-content h2 {
  font-family: var(--w-font-d); font-size: 1.28rem; font-weight: 650;
  margin: 2em 0 0.65em; color: var(--w-text);
  padding-bottom: 6px; border-bottom: 1px solid var(--w-border);
}
.writeup-content h3 {
  font-family: var(--w-font-d); font-size: 1.08rem; font-weight: 600;
  margin: 1.55em 0 0.5em; color: var(--w-text);
}
.writeup-content p { margin: 0 0 1.1em; }
.writeup-content a { color: var(--w-accent); text-underline-offset: 2px; }
.writeup-content ul, .writeup-content ol { margin: 0 0 1.1em 1.25em; }
.writeup-content li { margin-bottom: 0.3em; }
.writeup-content img {
  max-width: 100%; height: auto; border-radius: 8px; margin: 1.2em 0;
  border: 1px solid var(--w-border); cursor: zoom-in; box-shadow: var(--w-shadow); background: #000;
}
.writeup-content pre {
  margin: 1.35em 0;
  padding: 18px;
  background: var(--w-code-bg);
  border: 1px solid var(--w-border);
  border-left: 3px solid var(--w-accent);
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--w-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  position: relative;
  color: #b8d4c4;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.writeup-content code {
  font-family: var(--w-mono); font-size: 0.88em;
  background: rgba(107, 196, 154, 0.12); padding: 2px 6px; border-radius: 3px; color: #9fd4b4;
}
.writeup-content pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.writeup-content blockquote {
  margin: 1.2em 0; padding: 10px 14px; border-left: 3px solid var(--w-warn);
  background: rgba(212, 168, 92, 0.1); color: var(--w-muted); border-radius: 0 8px 8px 0;
}

.wu-nav-posts {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 44px;
  padding-top: 20px; border-top: 1px solid var(--w-border); flex-wrap: wrap;
}
.wu-nav-posts a {
  font-family: var(--w-mono); font-size: 11px; color: var(--w-muted); text-decoration: none;
}
.wu-nav-posts a:hover { color: var(--w-accent); }

.site-footer {
  border-top: 1px solid var(--w-border); padding: 28px 4vw 36px; margin-top: 16px;
}
.footer-nav {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-bottom: 18px;
}
.footer-nav a {
  font-family: var(--w-mono); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--w-muted); text-decoration: none;
  padding: 6px 10px; border-radius: 8px;
}
.footer-nav a:hover { color: var(--w-text); background: var(--w-accent-dim); }
.footer-copy {
  text-align: center; font-family: var(--w-mono); font-size: 11px;
  color: var(--w-faint); letter-spacing: 0.04em;
}

.reveal {
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.55s var(--w-ease), transform 0.55s var(--w-ease);
}
.reveal.in { opacity: 1; transform: none; }

.ovld-lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.9);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity 0.2s ease;
}
.ovld-lightbox.open { opacity: 1; }
.ovld-lb-img {
  max-width: min(96vw, 1280px); max-height: 90vh; object-fit: contain; border-radius: 6px;
}
.ovld-lb-close {
  position: absolute; top: 14px; right: 18px; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12); color: #fff; width: 38px; height: 38px;
  border-radius: 6px; font-size: 15px; cursor: pointer;
}
.ovld-lb-caption {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  color: #888; font-size: 12px; font-family: var(--w-mono);
}
.copy-btn {
  position: absolute; top: 10px; right: 10px; font-family: var(--w-mono);
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 5px; border: 1px solid var(--w-border);
  background: rgba(11, 15, 18, 0.95); color: var(--w-muted); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.copy-btn:hover, .copy-btn.copied {
  color: var(--w-accent); border-color: var(--w-accent); background: var(--w-accent-dim);
}

@media (max-width: 640px) {
  .wu-grid { grid-template-columns: 1fr; }
}
