/* -------- Base -------- */
html, body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  font-size: 1.05em;
  color: #fff;
  background-color: #000;
}

:root {
  --nav-h: 56px;  /* tweak if you want a taller/shorter bar */
}

/* -------- Layout (pure flex) -------- */
.container {
  display: flex;           /* two real flex children: sidebar + content */
  margin: 0 auto;
  /* no overflow here; sticky needs ancestors without overflow hidden/auto */
  padding-top: var(--nav-h);      /* new */
}

/* Sidebar: fixed 250px, sticky, independent scroll */
#sidebar-container {
  flex: 0 0 300px;         /* fixed column width */
  box-sizing: border-box;  /* padding included in 250px */
  background-color: #1a1a1a;
  padding: 0px 20px 20px 20px;
  font-size: 0.9em;

  position: sticky;        /* stay in view on scroll */
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));           /* fill viewport height */
  overflow-y: auto;        /* only scrolls when hovered/needed */
  -webkit-overflow-scrolling: touch;
}

/* Main content: fills remaining space, no horizontal overflow */
.content {
  flex: 1;
  min-width: 0;            /* critical to prevent flex overflow */
  padding: 20px;
  overflow-wrap: anywhere; /* break long tokens/URLs if necessary */
}

/* -------- Sticky Navbar -------- */
#top-navbar {
  position: fixed;     /* was: sticky */
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111;
  color: #fff;
  padding: 10px 20px;
  border-bottom: 1px solid #2a2a2a;
  height: var(--nav-h);           /* lock its height */
  box-sizing: border-box;
}

#scroll-progress {
  position: absolute;
  left: 0;
  right: 0;          /* let width be driven by scale for perf, but keep hitbox full */
  bottom: 0;
  height: 2px;       /* requested height */
  transform-origin: left center;
  transform: scaleX(0);     /* start empty */
  background: #0A84FF;      /* blue (dark theme) */
  will-change: transform;
  pointer-events: none;
  z-index: 1000;   /* <— add this */
}

#top-navbar .site-home-link {
  color: inherit;
  text-decoration: none;
}

#top-navbar .site-home-link:hover {
  text-decoration: underline;
}

/* Right cluster: links + icon sit together on the right */
#top-navbar .navbar-right{
  display: flex;
  align-items: center;
  gap: 16px;          /* space between the link group and the search icon */
  margin-left: auto;
}

/* Space between individual links (no margins needed) */
#top-navbar .navbar-right .nav-links{
  display: flex;
  gap: 16px;
}

/* Base link styling (no spacing here) */
#top-navbar .navbar-right a{
  color: #fff;
  text-decoration: none;
  font-size: 0.95em;
}

#top-navbar .navbar-right a:hover{
  text-decoration: underline;
}

/* Light theme links */
body.light #top-navbar .navbar-right a{
  color: #0D0D0D;
}


/* -------- Sidebar links -------- */
#sidebar-container a {
  display: block;
  color: #fff;
  padding: 5px 0 5px 10px;
  text-decoration: none;
  transition: color 0.2s;
}

#sidebar-container strong {
    font-weight: 700;
    display: inline-block;
    margin-top: 1em;
}

#sidebar-container a:hover {
  text-decoration: underline;
}
#sidebar-container a.active {
  color: #fff;
  font-weight: bold;
  background-color: #0055FF;
  border-radius: 4px;
}

.group-link { color: inherit; text-decoration: none; }
.subgroup { padding-left: 14px; display: block; }
.subgroup a { display: block;}
[data-group] { margin-bottom: 10px; }

/* A11y utility */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Sticky filter area */
#sidebar-container .sidebar-filter {
  position: sticky; top: 0; z-index: 2;
  padding-bottom: 12px; margin-bottom: 12px;
  padding-top: 20px;
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
}

/* Wrap to position icons inside the input */
#sidebar-container .sidebar-filter .filter-wrap { position: relative; }

/* Input pill */
#sidebar-container .sidebar-filter input[type="search"] {
  width: 100%;
  padding: 10px 44px 10px 44px;   /* space for left icon + right clear */
  border-radius: 14px;
  border: 1px solid #2a2a2a;
  background: #111;
  color: #fff;
  font-size: 0.95em;
}
#sidebar-container .sidebar-filter input[type="search"]:focus {
  outline: 2px solid #0A84FF; outline-offset: 2px;
}

/* Left “filter” glyph drawn with 3 bars (CSS, no SVG) */
#sidebar-container .sidebar-filter .icon-left {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: #8a8a8a; pointer-events: none;
  background:
    linear-gradient(currentColor 2px, transparent 0) 0 3px / 18px 2px no-repeat,
    linear-gradient(currentColor 2px, transparent 0) 3px 8px / 12px 2px no-repeat,
    linear-gradient(currentColor 2px, transparent 0) 6px 13px / 6px 2px no-repeat;
  opacity: .9;
}

/* Right clear (×) button INSIDE the input */
#sidebar-container .sidebar-filter .clear-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  display: none;                  /* shown only when there is text */
  width: 24px; height: 24px;
  border: 0; background: transparent; color: #8a8a8a;
  padding: 0; cursor: pointer; border-radius: 50%;
  font-size: 16px; line-height: 1;
}
#sidebar-container .sidebar-filter .clear-btn:hover { color: #fff; }

/* -------- Typography -------- */
p {
    margin-block-start: 0.5em;
    margin-block-end: 0.5em;
    font-weight: 400;
}

h1 {
  font-size: 2em;
  color: #fff;
  margin: 0 0 0.5em 0;
  font-weight: 400;
}

h1::after {
  content: "";
  display: block;
  width: 100%; /* length of line */
  height: 1px; /* thickness */
  background: #ccc; /* subtle color */
  margin-top: 0.5em;
}

h2 {
  font-size: 1.5em;
  color: #fff;
  font-weight: 400;
  
  margin-block-start: 1.5em;
  margin-block-end: 0.5em;
}
h3 {
  font-size: 1.2em;
  color: #fff;
  font-weight: 400;

  margin-block-start: 1em;
  margin-block-end: 0.5em;
}
a {
  color: #0055FF;
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: #0033CC;
  text-decoration: underline;
}
ul, ol {
  margin: 1em 0;
  padding-left: 2em;
  color: #fff;
}
strong { color: #fff; }

/* -------- Code blocks -------- */

pre {
  background-color: rgb(22, 22, 22);
  border: 1px solid #575757;
  padding: 15px;
  border-radius: 4px;
  overflow-x: auto;
  font-family: "SF Mono", "Courier New", Courier, monospace;
  margin: 0 0;
  transition: box-shadow 0.2s;
}

/* Inline code (everywhere except inside <pre>) */
code {
  background-color: #2d2d2d;
  color: #f8f8f2;
  padding: .15rem .3rem;
  border-radius: .25rem;
  font-size: 0.875em;
  font-weight: 500;
  margin: 0 .15rem;
}

/* Reset for <pre><code>…</code></pre> */
pre code {
  background: transparent;   /* remove the inline pill bg */
  color: #D4D4D4;            /* base text in blocks */
  padding: 0;
  margin: 0;
  border-radius: 0;
  display: block;            /* avoid per-line “pills” */
  font-size: 1.05em;
}

/* Token colors only inside code blocks */
pre code .keyword      { color: #C586C0; }
pre code .string       { color: #CE9178; }
pre code .comment      { color: #6A9955; }
pre code .number       { color: #B5CEA8; }
pre code .operator     { color: #D4D4D4; }
pre code .type         { color: #4EC9B0; }
pre code .function     { color: #DCDCAA; }
pre code .variable     { color: #9CDCFE; }
pre code .preprocessor { color: #C586C0; }
pre code .url          { color: #9CDCFE; }
pre code .heading      { color: #DCDCAA; }
pre code .attribute    { color: #9CDCFE; }
pre code .note { font-style: italic; color: #555; margin: 1em 0; }

.highlight {
  background-color: #2d2d2d;   /* dark background */
  color: #f5f5f5;              /* light text */
  border-left: 5px solid #888; /* subtle left border */
  padding: 16px;
  margin: 20px 0;
  border-radius: 4px;
  line-height: 1.5;
}

.highlight strong {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #fff;
}

.upscale {
  background-color: #2d2d2d;  /* dark background */
  color: #f8f8f2;            /* light text */
  padding: 2px 6px;          /* small padding around text */
  border-radius: 4px;        /* rounded corners */
  font-size: 0.9em;
}

/* --- Article pager (prev/next under H1 and all Content) --- */
.article-pager {
  margin-top: 0.75rem;   /* a touch of space under the H1 + its ::after line */
  margin-bottom: 1.75rem;
  padding-top: 0.25rem;
}
.article-pager .pager-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.article-pager .spacer { flex: 1; }

.pager-link {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95em;

  border-color: #ccc;
  color: #fff;
}
.pager-link:hover { text-decoration: none; border-color: #555; }

/* Top instance sits under H1; bottom instance adds a separator */
.article-pager--bottom {
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid #2a2a2a;
}

/* Light theme adjustments */
body.light .pager-link { border-color: #ccc; color: #0D0D0D; }
body.light .article-pager--bottom { border-top: 1px solid #ccc; }

body.light .pager-link {
  border-color: #ccc;
  color: #0D0D0D;
}


/* -------- Responsive (stack on phones) -------- */
@media (max-width: 850px) {
  .container {
    flex-direction: column;    /* stack */
  }
  #sidebar-container {
    position: static;          /* no sticky on tiny screens */
    height: auto;
    top: 0;
    flex: none;
    width: 100%;
  }
  .content {
    padding: 10px;
  }
  h1 { font-size: 1.5em; }
  h2 { font-size: 1.2em; }
}

/* -------- Footer Design -------- */

/* Footer layout */
#site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-top: 1px solid #2a2a2a;
  background: #1a1a1a;       /* default dark */
  color: #ccc;
  font-size: 0.9em;
}

#site-footer a {
  color: #4ea3ff;
  text-decoration: none;
}
#site-footer a:hover {
  text-decoration: underline;
}

/* Theme toggle buttons */
#site-footer .footer-right button {
  border: 1px solid #666;
  background: transparent;
  color: #ccc;
  padding: 6px 12px;
  margin-left: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85em;
}

#site-footer .footer-right button.active {
  background: #0070f3;
  border-color: #0070f3;
  color: #fff;
}

#site-footer .footer-right button:hover:not(.active) {
  border-color: #999;
  color: #fff;
}

#site-footer .footer-right button:focus-visible {
  outline: 2px solid #0A84FF;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Small "NEW" tag beside sidebar links */
.tag-new {
  display: inline-block;
  margin-left: 3px;
  padding: 2px 5px;
  background: #0A84FF;      /* bright red */
  color: #fff;
  font-size: 0.5em;
  font-weight: bold;
  border-radius: 10px;
  text-transform: uppercase;
  vertical-align: middle;
}

/* --- Search form: compact pill overlaid inside the fixed header (right-aligned) --- */
#searchForm{
  display:none;
  position:absolute;                /* relative to #top-navbar (fixed) */
  right:12px;
  top:50%;
  transform: translateY(-50%);
  align-items:center;
  gap:8px;
  width:min(360px, 60vw);           /* compact, like the sidebar filter */
  z-index:1001;                     /* above progress line */
}

/* Input styling (dark) — extra right padding for the close button inside */
#searchInput{
  flex:1;
  height:36px;
  padding:8px 40px 8px 12px;        /* room for the X on the right */
  border:1px solid #2a2a2a;
  background:#111;
  color:#fff;
  border-radius:14px;
  outline:none;
  font-size:15px;
}
#searchInput::placeholder{
  font-size:15px;
  color:#9aa0a6;
}
#searchInput:focus{
  outline:2px solid #0A84FF;
  outline-offset:2px;
}

/* In-field close button (bigger, clearer) */
.search-close{
  position:absolute;
  right:8px;
  top:50%;
  transform:translateY(-50%);
  width:28px; height:28px;
  border:0; background:transparent; color:#9aa0a6;
  display:grid; place-items:center;
  border-radius:8px; cursor:pointer;
}
.search-close svg{ width:16px; height:16px; }
.search-close:hover{ background:rgba(255,255,255,0.06); color:#cfd8dc; }

/* Toggle logic (checkbox drives visibility) */
#searchToggleChk:checked ~ .navbar-right .nav-links{ display:none; }  /* hide links */
#searchToggleChk:checked ~ .navbar-right .search-open{ display:none; }/* hide icon  */
#searchToggleChk:checked ~ #searchForm{ display:flex; }               /* show form   */

/* Icon uses SVG, inherits currentColor */
.search-open { background:transparent; border:0; cursor:pointer; line-height:1; padding:6px; }
.search-open .ico { display:block; }

/* Light theme */
body.light #searchInput{
  background:#fff;
  border-color:#ccc;
  color:#0d0d0d;
}
body.light #searchInput::placeholder{ color:#6b7280; }
body.light .search-close:hover{ background:rgba(0,0,0,0.06); color:#374151; }

/* visible focus for Tab users on the search icon and the close button. */
.search-open:focus-visible,
.search-close:focus-visible {
  outline: 2px solid #0A84FF;
  outline-offset: 2px;
  border-radius: 8px;
}

/* keep the pill comfy on phones; slightly narrower and readable text. */
@media (max-width: 480px){
  #searchForm { right: 8px; width: min(280px, 90vw); }
  #searchInput { font-size: 14px; }
}

/* ---------- HOMEPAGE ---------- */

body.homepage {
  overflow: hidden;
}

.homepage-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100svh - var(--nav-h));
  margin-top: var(--nav-h);
  padding: 0 24px;
  box-sizing: border-box;
  overflow: hidden;
}

.hp-spacer {
  display: block;
}

.homepage-main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.55) 0 1px, transparent 1.5px),
    radial-gradient(circle at 28% 62%, rgba(255,255,255,0.3) 0 1px, transparent 1.5px),
    radial-gradient(circle at 57% 44%, rgba(255,255,255,0.45) 0 1px, transparent 1.5px),
    radial-gradient(circle at 83% 24%, rgba(255,255,255,0.35) 0 1px, transparent 1.5px),
    radial-gradient(circle at 95% 72%, rgba(255,255,255,0.25) 0 1px, transparent 1.5px);
  opacity: 0.7;
}

.homepage-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: min(700px, 90vw);
  transition: transform 0.2s ease;
}

.homepage-center.suggestions-open {
  transform: translateY(-110px);
}

.homepage-hero {
  width: 100%;
  text-align: center;
}

.homepage-hero h1 {
  margin: 0 0 16px;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.homepage-hero p {
  margin: 0;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: #a0a0a0;
  line-height: 1.6;
}

body.light .homepage-hero h1 {
  color: #0D0D0D;
}

.homepage-hero h1::after {
  display: none;
}

.homepage-search {
  position: relative;
  z-index: 1;
  width: 100%;
}

.homepage-search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 62px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
  box-shadow: 0 10px 35px rgba(0,0,0,0.22);
  backdrop-filter: blur(10px);
}

.homepage-search-icon {
  display: grid;
  place-items: center;
  width: 48px;
  color: #8d8d8d;
  flex: 0 0 auto;
}

.homepage-search-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
}

.homepage-search-form input::placeholder {
  color: #8f8f8f;
}

.homepage-search-form input[type="search"]::-webkit-search-cancel-button,
.homepage-search-form input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.homepage-search-form button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: 8px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.28);
  color: #111;
  cursor: pointer;
}

.homepage-search-form button:hover {
  background: rgba(255,255,255,0.42);
}

.homepage-search-form:focus-within {
  outline: 2px solid #0A84FF;
  outline-offset: 3px;
}

.homepage-article-count {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 1;
  margin: 0;
  transform: translateX(-50%);
  color: #a0a0a0;
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: center;
}

.homepage-article-count span,
.homepage-article-count strong {
  display: block;
}

.homepage-article-count strong {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.homepage-links {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.78rem;
}

.homepage-links a {
  color: #a0a0a0;
  text-decoration: none;
}

.homepage-links a + a::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 10px 2px 0;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.homepage-links a:hover {
  color: #fff;
  text-decoration: none;
}

/* Homepage theme-toggle icon button */
.theme-toggle-hp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin-left: 4px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #a0a0a0;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.theme-toggle-hp:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* Show moon in dark mode, hide sun */
.theme-toggle-hp .icon-sun  { display: none; }
.theme-toggle-hp .icon-moon { display: block; }

/* Show sun in light mode, hide moon */
.theme-toggle-hp.is-light .icon-moon { display: none; }
.theme-toggle-hp.is-light .icon-sun  { display: block; }

body.light .theme-toggle-hp {
  background: rgba(0,0,0,0.07);
  color: #555;
}

body.light .theme-toggle-hp:hover {
  background: rgba(0,0,0,0.13);
  color: #0D0D0D;
}

body.light .homepage-search-form {
  border-color: rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.06);
  box-shadow: 0 10px 35px rgba(0,0,0,0.08);
}

body.light .homepage-search-form input {
  color: #0D0D0D;
}

body.light .homepage-search-form button {
  background: rgba(0,0,0,0.18);
  color: #fff;
}

/* --- Search suggestions dropdown --- */
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 100;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  border-radius: 16px;
  background: rgba(30,30,30,0.97);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.search-suggestions li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  color: #e0e0e0;
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.3;
}

.search-suggestions li a:hover,
.search-suggestions li a:focus {
  background: rgba(255,255,255,0.06);
  outline: none;
}

.suggestion-icon {
  flex: 0 0 auto;
  color: #6b6b6b;
  display: grid;
  place-items: center;
}

.suggestion-body {
  flex: 1;
  min-width: 0;
}

.suggestion-crumb {
  color: #8d8d8d;
  font-size: 0.82rem;
}

.suggestion-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-title mark {
  background: none;
  color: #fff;
  font-weight: 600;
}

.suggestion-chevron {
  flex: 0 0 auto;
  color: #555;
  display: grid;
  place-items: center;
}

body.light .search-suggestions {
  background: rgba(255,255,255,0.97);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

body.light .search-suggestions li a {
  color: #111;
}

body.light .search-suggestions li a:hover,
body.light .search-suggestions li a:focus {
  background: rgba(0,0,0,0.04);
}

body.light .suggestion-icon { color: #aaa; }
body.light .suggestion-crumb { color: #888; }
body.light .suggestion-title mark { color: #000; }
body.light .suggestion-chevron { color: #ccc; }

body.light .homepage-article-count strong,
body.light .homepage-links a:hover {
  color: #0D0D0D;
}

@media (max-width: 700px) {
  body.homepage {
    overflow: auto;
  }

  .homepage-main {
    padding: 80px 24px 96px;
  }

  .homepage-center {
    width: min(700px, 92vw);
  }

  .homepage-links {
    right: 0;
    left: 0;
    bottom: 24px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0 24px;
  }

  .homepage-article-count {
    bottom: 64px;
  }
}

/* ---------- SEARCH PAGE ---------- */

/* results wrapper sizing */
.results { max-width: 900px; margin: 24px auto; padding: 0 16px; }

/* results page title */
.results h1 { font-size: 2rem; font-weight: 700; margin: 0 0 8px 0; }

/* muted "help"er line under H1 */
.results .muted { color: #9aa0a6; font-size: 0.95rem; margin: 0 0 16px 0; }

/* each result block spacing */
.results .result { padding: 14px 0 18px; }

/* clickable title (inherits text color, looks native) */
.results .result-title a { color: inherit; font-weight: 700; text-decoration: none; }
.results .result-title a:hover { text-decoration: underline; }

/* snippet (2-line clamp) */
.results .result-snippet {
  color: #6b7280;
  font-size: 0.98rem;
  margin: 4px 0 6px;
  display: -webkit-box;          /* legacy Safari/Chromium */
  -webkit-line-clamp: 2;         /* legacy property */
  line-clamp: 2;                 /* standard property */
  -webkit-box-orient: vertical;  /* legacy Safari */
  overflow: hidden;              /* hide extra lines */
}

/* url line (blue link) */
.results .result-url { color: #8ab4f8; font-size: 0.95rem; text-decoration: none; }
.results .result-url:hover { text-decoration: underline; }

/* ──────────────────────────────────────────────────────────────
   DevDocs10 – Editor Page (scoped under .editor-page)
   ────────────────────────────────────────────────────────────── */

.editor-page { max-width: 1100px; margin: 24px auto 40px; }
.editor-page h1 { font-size: 1.6rem; margin: 0 0 8px; }
.editor-page p.meta { margin: 0 0 18px; opacity: .8; }

.editor-page .editor-card {
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  background: #0e0e0f;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
  padding: 16px;
  margin-bottom: 14px;
}
body.light .editor-page .editor-card {
  background: #fff;
  border-color: #e6e6e6;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
}

.editor-page .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor-page .form-grid.full { grid-template-columns: 1fr; }
@media (max-width: 900px){
  .editor-page .form-grid { grid-template-columns: 1fr; }
}

.editor-page .field { display: flex; flex-direction: column; gap: 6px; }
.editor-page .field label { font-size: .92rem; opacity: .9; }
.editor-page .help { font-size: .85rem; opacity: .7; }

.editor-page .input,
.editor-page .select,
.editor-page .textarea {
  border: 1px solid #2a2a2a;
  background: #111214;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  font-size: 0.9em;
}
.editor-page .textarea { min-height: 260px; resize: vertical; line-height: 1.4; }
.editor-page .select { padding-right: 34px; }
.editor-page .input:focus,
.editor-page .select:focus,
.editor-page .textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
.editor-page .select:disabled { opacity: .6; cursor: not-allowed; }

/* Light overrides (must come after base rules) */
body.light .editor-page .input,
body.light .editor-page .select,
body.light .editor-page .textarea {
  background: #fff; color: #111; border-color: #ddd;
}
body.light .editor-page .input:focus,
body.light .editor-page .select:focus,
body.light .editor-page .textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* Buttons */
.editor-page .actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.editor-page .btn {
  border: 1px solid #2a2a2a;
  background: #16171a;
  color: #fff;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.editor-page .btn:hover { background: #1b1d21; }
.editor-page .btn:active { transform: translateY(1px); }
.editor-page .btn.primary { background: #0066ff; border-color: #0066ff; color: #fff; }
.editor-page .btn.primary:hover { filter: brightness(1.05); }
.editor-page .btn[disabled] { opacity: .6; cursor: not-allowed; }

body.light .editor-page .btn { background: #f6f7f9; color: #111; border-color: #e3e5ea; }
body.light .editor-page .btn:hover { background: #eef1f6; }
body.light .editor-page .btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }

/* Status line */
.editor-page .status { font-size: .92rem; opacity: .85; }
.editor-page .status.ok { color: #22c55e; opacity: 1; }
.editor-page .status.err { color: #ef4444; opacity: 1; }

/* Optional: compact spacer under fixed navbar */
.editor-page .spacer { height: 6px; }

/* ---------- Tables (dark + light) ---------- */

/* Base table look (dark theme) */
.content table,
table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  background: #0e0e0f;             /* dark surface behind rows */
  border: 1px solid #2a2a2a;        /* faint outer stroke */
  margin: 10px 0 18px;
}

.content thead th,
thead th {
  text-align: left;
  font-weight: 700;
  color: #fff;
  background: #111;                 /* slightly darker head row */
  padding: 12px 16px;
}

.content tbody td,
tbody td {
  padding: 12px 16px;
  color: #fff;
}

/* subtle separators between body rows */
tbody tr + tr {
  border-top: 1px solid #2a2a2a;
}

/* optional: tiny hover to match the screenshot’s clean feel */
tbody tr:hover {
  background: #141414;
}

/* Light theme overrides to keep parity */
body.light table {
  background: #fff;
  border: 1px solid #e6e6e6;
}
body.light thead th {
  background: #f5f5f5;
  color: #0D0D0D;
}
body.light tbody tr + tr {
  border-top: 1px solid #e6e6e6;
}

body.light tbody tr:hover {
  background: #f5f5f5;
}


/* ---------------- LIGHT THEME ---------------- */

body.light {
  background: #fff;
  color: #0D0D0D;
}

body.light strong {
  color:#0D0D0D;
}

/* 🌞 Inline code chips in light mode */
body.light code {
  background-color: #ECECEC;
  color: #222;
}

/* 🚫 Reset for code inside pre (so it doesn’t inherit the chip style) */
body.light pre code {
  background: transparent;
  color: #D4D4D4;            /* base text in blocks */
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  display: block;
}


/* Sidebar (light) */
body.light #sidebar-container {
  background: #fafafa;
  color: #0D0D0D;
  border-right: 1px solid #ddd;
}
body.light #sidebar-container a { color: #0D0D0D; }
body.light #sidebar-container strong { color: #0D0D0D; }
body.light #sidebar-container a.active { background-color: #0070f3; color: #fff; }

/* Filter (light) */
body.light #sidebar-container .sidebar-filter { background: #fafafa; border-bottom: 1px solid #ddd; }
body.light #sidebar-container .sidebar-filter input[type="search"] { background: #fff; border: 1px solid #ccc; color: #0D0D0D; }
body.light #sidebar-container .sidebar-filter .icon-left,
body.light #sidebar-container .sidebar-filter .clear-btn { color: #666; }

/* Content text (light) — ensure headings + body copy flip */
body.light main, body.light article,
body.light, body.light p, body.light li, body.light li strong,
body.light blockquote, body.light table, body.light th, body.light td {
  color: #0D0D0D;
}
body.light h1, body.light h2, body.light h3, body.light h4, body.light h5, body.light h6 {
  color: #0D0D0D;
}

body.light .upscale, body.light .highlight, body.light .highlight strong {
    color: #0D0D0D;  /* dark background */
    background-color: #ECECEC;   
}

body.light #site-footer .footer-right button:not(.active) {
  color: #0D0D0D;
}
/* Lists (light) — force “normal” bullets + spacing */
body.light ul, body.light ol {
  color: #0D0D0D;               /* text color */
  list-style-position: outside;
  padding-left: 1.5rem;      /* override any UA/WebKit default (40px) */
  margin: 1em 0;
}
body.light li { display: list-item; text-align: left; }
body.light li p { margin: 0; }      /* avoid paragraph margins pushing text */
body.light ul { list-style-type: disc; }
body.light ol { list-style-type: decimal; }

/* Footer (light) */
body.light #site-footer { background: #f5f5f5; border-top: 1px solid #ddd; color: #333; }
body.light #site-footer a { color: #0070f3; }

body.light .tag-new {
  background: #0A84FF;
}

/* header: light theme overrides (ensure this is last) */
body.light #top-navbar { background:#fafafa; color:#0D0D0D; border-bottom:1px solid #ddd; }  /* bar bg + base text */
body.light #top-navbar .site-title { color:#0D0D0D; }                                      /* brand text */
body.light #top-navbar .navbar-right a { color:#0D0D0D; }                                   /* nav links */
body.light #top-navbar .icon-btn { color:#0D0D0D; }                                         /* search icon (SVG uses currentColor) */

/* ---------- EMPTY STATE (404 / unpublished article) ---------- */

.empty-state-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 130px);
  padding: 48px 20px;
  text-align: center;
}

.empty-state-card {
  margin-bottom: 36px;
}

.empty-state-image {
  display: block;
  width: min(760px, 90vw);
  height: auto;
}

.empty-state-actions {
  display: flex;
  justify-content: center;
}

.empty-state-btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: filter 0.15s ease;
  cursor: pointer;
}

.empty-state-btn.primary {
  background: #0066ff;
  color: #fff;
  border-color: #0066ff;
}

.empty-state-btn.primary:hover { filter: brightness(1.1); }
