/* ═══════════════════════════════════════════════════════════════════════════
   RougeLM pkgdown theme — WaszKrak Noir
   District 7, 2047. Data is power. Statistics is resistance.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Custom properties ──────────────────────────────────────────────────── */
:root {
  --rl-rust:       #c4521a;
  --rl-rust-light: #e8844b;
  --rl-teal:       #1d9e75;
  --rl-blue:       #378add;
  --rl-amber:      #ef9f27;
  --rl-bg:         #0d0f14;
  --rl-bg-2:       #131620;
  --rl-bg-3:       #1a1d26;
  --rl-border:     #252830;
  --rl-text:       #c8c5bc;
  --rl-muted:      #5a5855;
  --rl-code:       #9FE1CB;
  --rl-font-mono:  "IBM Plex Mono", monospace;
  --rl-font-sans:  "Space Grotesk", sans-serif;
  --rl-grid-size:  20px;
  --rl-scan-speed: 8s;
}

/* ── Base reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background-color: var(--rl-bg);
  color: var(--rl-text);
  font-family: var(--rl-font-mono);
  font-size: 14px;
  line-height: 1.75;
  letter-spacing: 0.01em;
}

/* ── Scanline overlay ───────────────────────────────────────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ── Grid background ────────────────────────────────────────────────────── */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(196, 82, 26, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 82, 26, 0.03) 1px, transparent 1px);
  background-size: var(--rl-grid-size) var(--rl-grid-size);
  pointer-events: none;
  z-index: 0;
}

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  background: #07090e !important;
  border-bottom: 1px solid var(--rl-border);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    var(--rl-rust) 20%,
    var(--rl-rust) 80%,
    transparent);
  opacity: 0.6;
}

.navbar-brand {
  font-family: var(--rl-font-mono) !important;
  font-weight: 600;
  font-size: 1rem;
  color: var(--rl-rust) !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.navbar-brand::before {
  content: "> ";
  opacity: 0.5;
}

.nav-link {
  font-family: var(--rl-font-mono) !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a8880 !important;
  transition: color 0.2s;
  padding: 0.5rem 0.75rem !important;
}

.nav-link:hover,
.nav-link.active {
  color: var(--rl-rust) !important;
}

/* ── Hero section ───────────────────────────────────────────────────────── */
.jumbotron,
.page-header,
div[class*="jumbotron"] {
  background: transparent !important;
  border: none !important;
  padding: 5rem 2rem 4rem !important;
  text-align: center;
  position: relative;
}

.jumbotron::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%,
      rgba(196, 82, 26, 0.08) 0%,
      transparent 70%);
  pointer-events: none;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--rl-font-sans) !important;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #e8e5dc;
}

h1 { font-size: 2.8rem; line-height: 1.1; }
h2 { font-size: 1.8rem; border-bottom: 1px solid var(--rl-border); padding-bottom: 0.4rem; }
h3 { font-size: 1.25rem; color: var(--rl-rust); }

.page-header h1 {
  font-size: 3.5rem !important;
  color: #e8e5dc;
  text-shadow: 0 0 40px rgba(196, 82, 26, 0.3);
}

.page-header .lead,
.jumbotron p.lead {
  font-size: 0.9rem !important;
  color: var(--rl-muted);
  font-family: var(--rl-font-mono);
  max-width: 540px;
  margin: 1rem auto 2rem;
  line-height: 1.8;
}

/* ── Links ──────────────────────────────────────────────────────────────── */
a {
  color: var(--rl-rust);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--rl-rust-light);
  text-decoration: none;
}

/* ── Code blocks ────────────────────────────────────────────────────────── */
pre, code {
  font-family: var(--rl-font-mono) !important;
  font-size: 0.82rem;
}

pre {
  background: var(--rl-bg-2) !important;
  border: 1px solid var(--rl-border);
  border-left: 3px solid var(--rl-rust);
  border-radius: 0;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  position: relative;
}

pre::before {
  content: "$ ";
  color: var(--rl-rust);
  opacity: 0.5;
  user-select: none;
}

code {
  background: var(--rl-bg-2) !important;
  color: var(--rl-code) !important;
  padding: 0.1em 0.35em;
  border-radius: 0;
  border: 1px solid var(--rl-border);
}

pre code {
  border: none;
  padding: 0;
  background: transparent !important;
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-family: var(--rl-font-mono);
}

thead th {
  background: var(--rl-bg-3);
  color: var(--rl-rust);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--rl-rust);
  border-top: 1px solid var(--rl-border);
}

tbody td {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--rl-border);
  color: var(--rl-text);
}

tbody tr:hover td {
  background: rgba(196, 82, 26, 0.04);
}

/* ── Cards / boxes ──────────────────────────────────────────────────────── */
.card,
.pkgdown-description {
  background: var(--rl-bg-2) !important;
  border: 1px solid var(--rl-border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.card-header {
  background: var(--rl-bg-3) !important;
  border-bottom: 1px solid var(--rl-rust) !important;
  font-family: var(--rl-font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rl-rust) !important;
  padding: 0.6rem 1rem;
}

/* ── Reference index ────────────────────────────────────────────────────── */
.ref-index h2 {
  font-family: var(--rl-font-mono) !important;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--rl-rust);
  border-bottom: 1px solid var(--rl-rust);
  padding-bottom: 0.3rem;
  margin-top: 2.5rem;
}

.ref-index .name {
  font-family: var(--rl-font-mono);
  font-weight: 600;
  color: var(--rl-code);
}

.ref-index .desc {
  color: var(--rl-muted);
  font-size: 0.82rem;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
#pkgdown-sidebar {
  border-left: 1px solid var(--rl-border);
  padding-left: 1.5rem;
}

#pkgdown-sidebar .list-unstyled li a {
  font-size: 0.8rem;
  color: var(--rl-muted);
  font-family: var(--rl-font-mono);
}

#pkgdown-sidebar .list-unstyled li a:hover {
  color: var(--rl-rust);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  border-radius: 0 !important;
  font-family: var(--rl-font-mono) !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 1.25rem;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--rl-rust) !important;
  border-color: var(--rl-rust) !important;
  color: #fff !important;
}

.btn-primary:hover {
  background: var(--rl-rust-light) !important;
  border-color: var(--rl-rust-light) !important;
}

.btn-outline-primary {
  border-color: var(--rl-rust) !important;
  color: var(--rl-rust) !important;
  background: transparent !important;
}

.btn-outline-primary:hover {
  background: rgba(196, 82, 26, 0.1) !important;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer {
  background: #07090e !important;
  border-top: 1px solid var(--rl-border);
  color: var(--rl-muted) !important;
  font-family: var(--rl-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 1.5rem 2rem;
  margin-top: 4rem;
  position: relative;
}

footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    var(--rl-rust) 20%,
    var(--rl-rust) 80%,
    transparent);
  opacity: 0.4;
}

footer p { margin: 0.2rem 0; }
footer a { color: var(--rl-rust) !important; }

/* ── Search ─────────────────────────────────────────────────────────────── */
.form-control,
input[type="search"] {
  background: var(--rl-bg-2) !important;
  border: 1px solid var(--rl-border) !important;
  border-radius: 0 !important;
  color: var(--rl-text) !important;
  font-family: var(--rl-font-mono) !important;
  font-size: 0.82rem;
}

.form-control:focus,
input[type="search"]:focus {
  border-color: var(--rl-rust) !important;
  box-shadow: 0 0 0 2px rgba(196, 82, 26, 0.15) !important;
  background: var(--rl-bg-2) !important;
}

/* ── Alerts / callouts ──────────────────────────────────────────────────── */
.alert {
  border-radius: 0 !important;
  border-left-width: 3px !important;
  font-family: var(--rl-font-mono);
  font-size: 0.82rem;
}

.alert-info    { background: rgba(55, 138, 221, 0.08) !important; border-color: var(--rl-blue) !important; }
.alert-warning { background: rgba(239, 159, 39, 0.08) !important; border-color: var(--rl-amber) !important; }
.alert-danger  { background: rgba(226, 75, 74, 0.08) !important;  border-color: #e24b4a !important; }
.alert-success { background: rgba(29, 158, 117, 0.08) !important; border-color: var(--rl-teal) !important; }

/* ── Blinking cursor animation ──────────────────────────────────────────── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.cursor-blink::after {
  content: "_";
  animation: blink 1.2s step-end infinite;
  color: var(--rl-rust);
}

/* ── Data stat badges (for hero) ────────────────────────────────────────── */
.stat-badge {
  display: inline-block;
  font-family: var(--rl-font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rl-rust);
  border: 1px solid var(--rl-rust);
  padding: 0.25rem 0.6rem;
  margin: 0.25rem;
  opacity: 0.8;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: var(--rl-bg); }
::-webkit-scrollbar-thumb  { background: var(--rl-border); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--rl-rust); }

/* ── Selection ──────────────────────────────────────────────────────────── */
::selection {
  background: rgba(196, 82, 26, 0.3);
  color: #fff;
}

/* ── Vignette / article pages ───────────────────────────────────────────── */
.contents {
  max-width: 860px;
}

.section.level2 {
  margin-top: 3rem;
  padding-top: 1rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  .page-header h1 { font-size: 2.2rem !important; }
  pre { padding: 1rem; }
}

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  body::before,
  body::after { display: none; }
  body { background: #fff; color: #000; }
}
