/* ---------- Base / Theme ---------- */
:root{
  --bg: #0b0f17;
  --panel: rgba(255,255,255,0.06);
  --panel-2: rgba(255,255,255,0.08);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.72);
  --faint: rgba(255,255,255,0.55);
  --border: rgba(255,255,255,0.12);
  --shadow: 0 10px 30px rgba(0,0,0,0.30);
  --accent: #7c5cff;
  --accent-2: #23d5ab;
  --code-bg: rgba(255,255,255,0.08);
  --radius: 16px;
  --glow-1: rgba(124,92,255,0.35);
  --glow-2: rgba(35,213,171,0.22);
}

:root[data-theme="light"]{
  --bg: #f7f7fb;
  --panel: rgba(0,0,0,0.035);
  --panel-2: rgba(0,0,0,0.055);
  --text: rgba(0,0,0,0.88);
  --muted: rgba(0,0,0,0.65);
  --faint: rgba(0,0,0,0.55);
  --border: rgba(0,0,0,0.12);
  --shadow: 0 10px 30px rgba(0,0,0,0.10);
  --accent: #4a2bff;
  --accent-2: #00a884;
  --code-bg: rgba(0,0,0,0.04);
  --glow-1: rgba(150,130,255,0.20);
  --glow-2: rgba(120,240,210,0.15);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace; }

/* ---------- Layout ---------- */
.container{
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header{
  position: sticky;
  top: 0;
  backdrop-filter: blur(12px);
  background: linear-gradient(to bottom, rgba(0,0,0,0.35), rgba(0,0,0,0.00));
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

:root[data-theme="light"] .site-header{
  background: linear-gradient(to bottom, rgba(247,247,251,0.85), rgba(247,247,251,0.55));
}

.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 14px;
}

.bg-glow{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background:
    radial-gradient(1000px 600px at 20% -10%, var(--glow-1), transparent 55%),
    radial-gradient(900px 600px at 110% 10%, var(--glow-2), transparent 60%);
}

/* Smoothly fades the glow into solid background at the bottom */
.bg-mask{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 220px;
  pointer-events: none;
  z-index: -1;
  background: linear-gradient(to top, var(--bg), transparent);
}

.brand{
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.nav{
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link{
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--muted);
}
.nav-link[aria-current="page"]{
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
}

.btn{
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
.btn:hover{ background: var(--panel-2); }
.btn-ghost{ display: inline-flex; align-items: center; gap: 8px; }
.icon{ font-size: 1rem; opacity: 0.9; }

.hero{
  padding: 34px 0 10px;
}
.eyebrow{
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  margin: 0 0 8px;
}
.hero-title{
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.1;
  margin: 0 0 10px;
  letter-spacing: -0.03em;
}
.hero-subtitle{
  margin: 0;
  color: var(--muted);
  max-width: 65ch;
}

.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card-header{
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.card-title{ margin: 0; font-size: 1.1rem; }
.card-subtitle{ margin: 0; color: var(--muted); }

.grid{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.doc-card{
  grid-column: span 6;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  transition: transform 120ms ease, background 120ms ease;
}
:root[data-theme="light"] .doc-card{ background: rgba(0,0,0,0.02); }

.doc-card:hover{
  transform: translateY(-2px);
  background: rgba(255,255,255,0.06);
}
:root[data-theme="light"] .doc-card:hover{ background: rgba(0,0,0,0.04); }

.doc-title{
  margin: 0 0 6px;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}
.doc-meta{
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.skeleton{
  grid-column: span 6;
  height: 86px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.10), rgba(255,255,255,0.02));
  background-size: 200% 100%;
  animation: shimmer 1.25s infinite linear;
}
:root[data-theme="light"] .skeleton{
  background: linear-gradient(90deg, rgba(0,0,0,0.02), rgba(0,0,0,0.06), rgba(0,0,0,0.02));
}

@keyframes shimmer{
  0%{ background-position: 0% 0; }
  100%{ background-position: 200% 0; }
}

.viewer{ padding: 22px 0 10px; }
.viewer-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}
.back-link{ color: var(--muted); }
.meta{ display:flex; gap:8px; align-items:center; }

.pill{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- Prose (Markdown) ---------- */
.prose{
  padding: 18px 18px;
}
.prose h1, .prose h2, .prose h3{
  letter-spacing: -0.02em;
  margin-top: 22px;
  margin-bottom: 10px;
}
.prose h1{ font-size: 1.9rem; margin-top: 6px; }
.prose h2{ font-size: 1.3rem; }
.prose h3{ font-size: 1.12rem; }

.prose p{ color: var(--text); margin: 12px 0; }
.prose ul, .prose ol{ margin: 12px 0 12px 22px; color: var(--text); }
.prose li{ margin: 6px 0; }

.prose a{
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--accent) 60%, transparent);
  text-underline-offset: 3px;
}
.prose blockquote{
  margin: 14px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  color: var(--muted);
}
:root[data-theme="light"] .prose blockquote{
  background: rgba(0,0,0,0.03);
}

.prose pre{
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  overflow: auto;
}
.prose code{
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.15em 0.35em;
}

.footer{
  padding: 22px 0 40px;
  color: var(--muted);
  font-size: 0.95rem;

  background: var(--bg);
  border-top: 1px solid var(--border);
}



.tooltip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--muted);
  display: inline-block;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);

  background: var(--bg);          /* opaque */
  color: var(--text);

  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.4;

  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);

  white-space: normal;
  min-width: 180px;
  max-width: 260px;

  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;

  z-index: 9999;
}

.tooltip.active::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

.tooltip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent var(--bg) transparent;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 9999;
}

.tooltip.active::before {
  opacity: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px){
  .doc-card, .skeleton{ grid-column: span 12; }
  .header-inner{ padding: 12px 0; }
  .nav{ gap: 6px; }
}
