/* ==========================================================================
   shadow-docs — Design System v2
   Minimāls terminal izskats: viens monospace fonts, plakans, 1px robežas,
   bez ēnām un kartiņām. Layout ir full-width — sānjosla pieguļ pašai kreisajai
   malai, saturs aizpilda atlikušo platumu (nekas nav centrēts kastē).
   ========================================================================== */

:root {
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 3px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* category accents */
  --c-wordpress: #5fd38d;
  --c-javascript: #e2b93b;
  --c-php: #8a8ff0;
  --c-git: #ef6b6b;
}

/* ---------- Dark theme (default — this is the point) ----------
   Katram slānim (fons / panelis / hover / robeža) jābūt skaidri
   atšķiramam no kaimiņa — pretējā gadījumā sānjosla, saturs un
   koda bloki vizuāli saplūst vienā traipā. */
:root {
  --bg: #12161a;
  --bg-panel: #1a2024;
  --bg-hover: #262e33;
  --border: #3a444a;
  --text: #edf2f3;
  --text-dim: #a4b0b4;
  --text-faint: #6b767a;

  --accent: #6ee6a3;
  --accent-strong: #97f4bf;
  --accent-soft: rgba(110, 230, 163, 0.14);
  --warn: #f0c453;
  --warn-soft: rgba(240, 196, 83, 0.12);

  --code-bg: #0c0f11;
  --code-text: #edf2f3;
  --inline-code-bg: rgba(255, 255, 255, 0.09);
}

:root[data-theme="light"] {
  --bg: #f7f7f5;
  --bg-panel: #ffffff;
  --bg-hover: #eeeeea;
  --border: #dcdcd6;
  --text: #1b1f1d;
  --text-dim: #5c655f;
  --text-faint: #93998f;

  --accent: #0f8a4d;
  --accent-strong: #0b6b3b;
  --accent-soft: rgba(15, 138, 77, 0.08);
  --warn: #9a7207;
  --warn-soft: rgba(154, 114, 7, 0.08);

  --code-bg: #0f1210;
  --code-text: #eef2f0;
  --inline-code-bg: rgba(0, 0, 0, 0.055);
}

* {
  box-sizing: border-box;
  font-variant-ligatures: none;
  -webkit-font-feature-settings: "liga" 0, "calt" 0;
  font-feature-settings: "liga" 0, "calt" 0;
}
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-mono);
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.6em;
}
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; margin-top: 2.4rem; padding-top: 0.2rem; border-top: 1px solid var(--border); }
h3 { font-size: 1.05rem; margin-top: 1.8rem; }

h2::before { content: "## "; color: var(--text-faint); font-weight: 400; }
h3::before { content: "### "; color: var(--text-faint); font-weight: 400; }

p { margin: 0 0 1rem; color: var(--text); max-width: 860px; }
ul, ol { max-width: 860px; }
li { margin-bottom: 0.35rem; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--inline-code-bg);
  color: var(--accent-strong);
  padding: 0.1em 0.4em;
  border-radius: var(--radius);
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.65;
  margin: 0 0 1.5rem;
  max-width: 100%;
}
pre code { background: none; padding: 0; color: inherit; font-size: 1em; }

/* ---------- Layout shell (edge-to-edge, no centering) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 0.95rem;
}
.brand::before { content: "$ "; color: var(--accent); }

.brand-mark {
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #05130b;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
}

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle,
.gh-link {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.theme-toggle:hover, .gh-link:hover { background: var(--bg-hover); border-color: var(--text-faint); }

.layout {
  display: flex;
  width: 100%;
  align-items: stretch;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  padding: 1.25rem 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  align-self: flex-start;
  position: sticky;
  top: 49px;
  max-height: calc(100vh - 49px);
  overflow-y: auto;
}

.sidebar-group { margin-bottom: 1.4rem; }
.sidebar-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
  padding: 0 1.1rem;
}
.sidebar-link {
  display: block;
  padding: 0.4rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  border-left: 2px solid transparent;
}
.sidebar-link:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.sidebar-link.disabled { color: var(--text-faint); cursor: default; }
.sidebar-link.disabled:hover { background: none; color: var(--text-faint); }

main.content {
  flex: 1;
  min-width: 0;
  padding: 2.25rem 3rem 6rem;
}

.crumbs {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
.crumbs a:hover { color: var(--accent); }

.lede { font-size: 1rem; color: var(--text-dim); max-width: 780px; }

/* ---------- Directory-style list (replaces cards) ---------- */
.dir-list { margin: 1.5rem 0; border-top: 1px solid var(--border); max-width: 900px; }

.dir-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.9rem 0.25rem;
  border-bottom: 1px solid var(--border);
}
a.dir-row:hover { background: var(--bg-hover); }
a.dir-row:hover .dir-title { color: var(--accent); }
a.dir-row:hover .dir-arrow { transform: translateX(3px); color: var(--accent); }

.dir-row.is-disabled { opacity: 0.5; }

.dir-index {
  font-size: 0.8rem;
  color: var(--text-faint);
  width: 1.6rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
}
.dir-body { flex: 1; min-width: 0; }
.dir-title { display: block; font-weight: 700; color: var(--text); margin-bottom: 0.2rem; }
.dir-desc { display: block; font-size: 0.82rem; color: var(--text-dim); }
.dir-arrow { color: var(--text-faint); flex-shrink: 0; transition: transform 0.15s var(--ease), color 0.15s var(--ease); padding-top: 0.15rem; }
.dir-soon { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- Callouts (flat, left-border accent, no shadow) ---------- */
.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  margin: 1.5rem 0;
  background: var(--bg-panel);
  max-width: 860px;
}
.callout-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--accent);
}
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.warn .callout-title { color: var(--warn); }
.callout.tip { border-left-color: var(--accent); background: var(--accent-soft); }
.callout.note { border-left-color: var(--text-dim); }
.callout.note .callout-title { color: var(--text-dim); }

/* ---------- Hero (homepage) ---------- */
.hero { padding: 2.75rem 3rem 1.5rem; }
.hero-kicker { font-size: 0.78rem; color: var(--text-faint); margin-bottom: 0.6rem; }
.hero-kicker::before { content: "> "; color: var(--accent); }
.hero h1 { max-width: 34ch; }
.hero .lede { margin-top: 0.75rem; }

.section-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 2.5rem 0 0;
  padding: 0 3rem;
}

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 3rem;
  font-size: 0.8rem;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
footer.site-footer a:hover { color: var(--accent); }

table {
  width: 100%;
  max-width: 900px;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.85rem;
}
th, td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
}
th {
  background: var(--bg-panel);
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-dim);
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}
.tag::before { content: "[ "; }
.tag::after { content: " ]"; }

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  max-width: 900px;
}
.page-nav a {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  font-size: 0.82rem;
  max-width: 45%;
}
.page-nav a:hover { background: var(--bg-hover); border-color: var(--text-faint); }
.page-nav .dir { display: block; font-size: 0.68rem; color: var(--text-faint); text-transform: uppercase; margin-bottom: 0.2rem; }

.sidebar-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  font-family: var(--font-mono);
}

@media (max-width: 900px) {
  .sidebar-toggle { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: 45px;
    left: 0;
    bottom: 0;
    background: var(--bg-panel);
    z-index: 30;
    width: 260px;
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.2s var(--ease);
  }
  .sidebar.open { transform: translateX(0); }
  main.content { padding: 1.75rem 1.25rem 4rem; }
  .hero { padding: 1.75rem 1.25rem 1rem; }
  .section-title { padding: 0 1.25rem; }
  footer.site-footer { padding: 1.25rem; }
  .page-nav a { max-width: 100%; }
  .page-nav { flex-direction: column; }
}
