/* ================================
   Proletarian Archive – Dark Theme
   Clean, modern, accessible
   ================================ */

/* ---------- CSS variables ---------- */
:root {
  --bg: #0f1115;
  --bg-elev: #151823;
  --panel: #171a24;
  --panel-2: #1b1f2b;
  --text: #e8ecf1;
  --text-muted: #a9b1bd;
  --brand: #9ec1ff;
  --brand-2: #7aa5ff;
  --border: #242939;
  --focus: #9ec1ff;
  --danger: #ff6b6b;
  --success: #7ce38b;
  --shadow: 0 6px 24px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.25);
}

/* Respect OS preference if ever switched */
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; }
}

/* ---------- Base / reset ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 900px at 10% -10%, #121522 0%, var(--bg) 50%) fixed;
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

/* Links */
a {
  color: var(--brand);
  text-decoration: none;
}
a:hover { color: var(--brand-2); }
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Selection */
::selection { background: #2b3b66; color: #fff; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem;
}
@media (min-width: 768px) {
  .container { padding: 1.5rem; }
}
main.container > * + * { margin-top: 1rem; }

/* Cards / panels */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
  max-width: 700px;
  margin: 1rem auto;
}
@media (min-width: 768px) {
  .card { padding: 1.25rem; }
}

/* Muted text */
.small { color: var(--text-muted); font-size: .925rem; }

/* ---------- Header / Navbar ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(16,18,24,.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.nav-container {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1100px; margin: 0 auto; padding: .75rem 1rem;
}
.site-title a {
  color: var(--text);
  font-size: 1.25rem; font-weight: 800; letter-spacing: .3px;
}
.nav { display: flex; gap: 2rem; }
.nav a {
  color: var(--text-muted);
  font-weight: 600;
  padding: .45rem .7rem;
  border-radius: 10px;
  transition: background .2s, color .2s, transform .06s;
}
.nav a:hover { background: #212636; color: var(--text); }
.nav a:active { transform: translateY(1px); }
.nav a.active { background: #2a3146; color: #fff; }

/* ---------- Typography ---------- */
h1,h2,h3,h4 { margin: .2rem 0 .6rem; line-height: 1.25; }
h1 { font-size: clamp(1.6rem, 1.1rem + 2vw, 2.25rem); }
h2 { font-size: clamp(1.35rem, 1rem + 1.2vw, 1.7rem); }
h3 { font-size: 1.15rem; }
p { margin: .5rem 0 1rem; }

/* Highlight for in-document search results */
mark.hl {
  background: #ffd54a; color: #111;
  padding: 0 .2em; border-radius: 3px;
}

/* Lists */
ul, ol { padding-left: 1.25rem; }
li + li { margin-top: .35rem; }

/* Tables */
table {
  width: 100%; border-collapse: collapse; margin: 1rem 0;
  background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
th, td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
th { text-align: left; color: var(--text-muted); font-weight: 600; background: #1a1f2d; }

/* Code blocks */
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre {
  background: #141826; color: #eaeef7;
  border: 1px solid var(--border); border-radius: 12px;
  padding: .9rem 1rem; overflow: auto;
}

/* ---------- Forms / Controls ---------- */
.controls {
  display: flex; flex-wrap: wrap; gap: .6rem;
  align-items: center;
  padding: 0.5rem 0;
}
input[type="text"], input[type="search"], select, textarea {
  width: 100%;
  background: #0f1322;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .8rem;
  transition: border-color .2s, box-shadow .2s, background .2s;
  flex: 1 1 250px;
  min-width: 0;
}
input::placeholder, textarea::placeholder { color: #7e879a; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(158,193,255,.18);
}
button, .btn {
  display: inline-flex; align-items: center; gap: .5rem;
  background: linear-gradient(180deg, #28304a, #1e2741);
  color: #eef3ff;
  border: 1px solid #2b3553;
  border-radius: 10px;
  padding: .55rem .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .06s, filter .2s, box-shadow .2s;
}
button:hover, .btn:hover { filter: brightness(1.06); }
button:active, .btn:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Input + button row helper */
.input-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.input-row > input { flex: 1 1 260px; }

/* ---------- Layout helpers ---------- */
.grid { display: grid; gap: .9rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.center { text-align: center; }
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: .5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: #111420;
  color: var(--text-muted);
  padding: 1rem;
}
.site-footer .container {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}

/* ---------- Search results ---------- */
.result { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: 0; }
.result a { color: var(--text); }
.result .meta { color: var(--text-muted); font-size: .9rem; }

/* ---------- References ---------- */
ol#references { padding-left: 1.25rem; }
ol#references li { margin: .4rem 0; }

/* ---------- Page container defaults ---------- */
header .container, main.container { max-width: 1100px; }

/* ---------- Alias for old .control class ---------- */
.control { display: flex; gap: .6rem; flex-wrap: wrap; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  margin-right: 1.5rem;
  user-select: none;
  position: relative;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

/* Slider track */
.switch .slider {
  width: 46px;
  height: 24px;
  background: #333;              /* darker grey for off */
  border-radius: 24px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

/* Knob */
.switch .slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #eee;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

/* Checked state */
.switch input:checked + .slider {
  background: #a62828;           /* deep red background */
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
  background: #fff2f2;           /* pale red knob for contrast */
}

/* Label text */
.switch .label-text {
  color: #ddd;
  font-size: 0.95rem;
}

mark.hl {
  background: #ffd54a;
  color: #000;
  padding: 0 .2em;
  border-radius: 3px;
}

.highlight-nav {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  gap: .5rem;
  z-index: 100;
}
.highlight-nav button {
  background: #28304a;
  color: #fff;
  border: 1px solid #2b3553;
  border-radius: 6px;
  padding: .4rem .7rem;
  cursor: pointer;
}
