:root{
  --accent: #ff2d6f;            /* dark pink */
  --bg: #ffffff;
  --fg: #1f2937;
  --muted: #6b7280;
  --link: var(--accent);
  --border: #e5e7eb;
  --code-bg: #f6f8fa;
  --code-fg: #24292e;
  --pre-bg: #0f172a;            /* for dark-highlight areas */
  --pre-fg: #e5e7eb;
  --side-bg: #f8fafc;
}
html[data-theme="dark"]{
  --accent: #ff2d6f;
  --bg: #0b0f14;
  --fg: #e5e7eb;
  --muted: #9ca3af;
  --link: var(--accent);
  --border: #1f2937;
  --code-bg: #111827;
  --code-fg: #e5e7eb;
  --pre-bg: #111827;
  --pre-fg: #e5e7eb;
  --side-bg: #0f172a;
}

*{box-sizing:border-box}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
body{margin:0;background:var(--bg);color:var(--fg);font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;line-height:1.55}
.wrap{max-width:1100px;margin:0 auto;padding:0 16px}

/* Header / Nav */
.site-header{background:#111;color:#fff}
.site-header .wrap{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;gap:16px}
.site-header .brand{color:#fff;text-decoration:none;font-weight:700}
.site-nav{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.site-nav a{color:#ddd;text-decoration:none}
.site-nav a:hover{color:#fff}
.site-nav .toggle{margin-left:4px;border:1px solid var(--accent);background:#222;color:#eee;border-radius:8px;padding:6px 10px;cursor:pointer}

/* Layout */
.layout{display:grid;grid-template-columns:270px 1fr;gap:24px;padding:24px 0 36px}
.sidebar{position:sticky;top:12px;align-self:start;background:var(--side-bg);border:1px solid var(--border);border-radius:12px;padding:12px}
.side-title{margin:8px 0 10px}
.side-group{margin:6px 0;border:1px solid var(--border);border-radius:8px;padding:6px;background:transparent}
.side-group summary{cursor:pointer;font-weight:600}
.side-list{margin:6px 0 0 18px;padding:0}
.side-list li{margin:4px 0}
.side-list li.active > a{font-weight:700;text-decoration:underline}
.content h1,h2,h3{line-height:1.2}
.desc{color:var(--muted)}
a{color:var(--link)}

/* Code blocks */
.prose code{background:var(--code-bg);color:var(--code-fg);padding:0 4px;border-radius:4px}
pre{background:var(--pre-bg);color:var(--pre-fg);padding:14px;border-radius:8px;overflow:auto;border:1px solid var(--border)}
/* Hugo Chroma override */
.chroma{background:var(--pre-bg);color:var(--pre-fg);border-radius:8px;border:1px solid var(--border)}

/* Copy button */
.pre-wrap { position: relative; }
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  font: inherit; padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--side-bg); cursor: pointer;
}
.copy-btn:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.copy-btn[data-copied="1"] { opacity: 0.85; }

/* Progress (optional utility) */
.progress{position:relative;height:8px;background:var(--border);border-radius:8px;margin:8px 0 12px}
.progress .bar{height:100%;background:linear-gradient(90deg,#34d399,#3b82f6);border-radius:8px}
.progress .label{position:absolute;top:-22px;right:0;font-size:.85rem;color:var(--muted)}

/* Prev/Next nav */
.prevnext{display:flex;gap:12px;align-items:center;justify-content:space-between;margin-top:24px}
.prevnext a{text-decoration:none;border:1px solid var(--border);padding:6px 10px;border-radius:8px}
.prevnext .home{margin-right:auto}

/* Search UI */
.search { position: relative; max-width: 520px; flex: 1 1 320px; }
.search input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--side-bg); color: var(--fg);
}
.results { position: absolute; top: 46px; left: 0; right: 0;
  background: var(--bg); border:1px solid var(--border); border-radius:10px;
  max-height: 60vh; overflow:auto; display:none; z-index: 20; }
.results a { display:block; padding:10px 12px; text-decoration:none; border-bottom:1px solid var(--border); }
.results a:hover, .results a:focus { background: var(--side-bg); }

/* Responsive */
@media (max-width: 960px){
  .layout{grid-template-columns:1fr}
  .sidebar{position:relative}
}
