/* ============================================================
   SliceWin Docs — layout + theme
   Matches brand palette from /styles.css
   ============================================================ */
:root {
  --bg: #020817;
  --card: #0f172a;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --accent-soft: rgba(56, 189, 248, .12);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: rgba(148, 163, 253, .16);

  --sidebar-w: 288px;
  --toc-w: 240px;
  --content-max: 780px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  overflow-x: hidden;
}

.bg-gradient {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, .10), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(34, 197, 94, .08), transparent 45%),
    #020817;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Layout grid
   ============================================================ */
.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1440px;
  margin: 0 auto;
}

/* ============================================================
   Sidebar
   ============================================================ */
.docs-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 16px 32px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: rgba(2, 8, 23, .6);
  backdrop-filter: blur(8px);
}

.docs-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.15rem; font-weight: 700; color: var(--text);
  padding: 4px 8px;
}
.docs-brand:hover { text-decoration: none; }
.docs-logo-img { width: 32px; height: 32px; }
.docs-logo-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Search box (disabled placeholder until search ships) */
.docs-search { position: relative; }
.docs-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.docs-search input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: rgba(15, 23, 42, .6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: .92rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s ease;
}
.docs-search input::placeholder { color: var(--muted); }
.docs-search input:disabled { cursor: not-allowed; opacity: .7; }
.docs-search input:focus { border-color: var(--accent); }

/* Nav sections */
.docs-nav { display: flex; flex-direction: column; gap: 22px; flex: 1; }
.docs-nav-section-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px 8px;
}
.docs-nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.docs-nav-link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: .93rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
  border-left: 2px solid transparent;
}
.docs-nav-link:hover { color: var(--text); background: rgba(56, 189, 248, .08); text-decoration: none; }
.docs-nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}

.docs-sidebar-footer { padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.docs-back-link { color: var(--muted); font-size: .88rem; }
.docs-back-link:hover { color: var(--accent); }

/* Language switcher */
.docs-lang { position: relative; display: flex; align-items: center; }
.docs-lang-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.docs-lang select {
  width: 100%;
  background: rgba(15, 23, 42, .8);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 28px 8px 32px;
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color .2s ease;
}
.docs-lang select:hover, .docs-lang select:focus { border-color: var(--accent); }

/* ============================================================
   Main content
   ============================================================ */
.docs-main { min-width: 0; padding: 40px 48px 96px; }
.docs-content-wrap { max-width: var(--content-max); margin: 0 auto; }

.docs-breadcrumb { font-size: .88rem; color: var(--muted); margin-bottom: 20px; }
.docs-breadcrumb a { color: var(--muted); }
.docs-breadcrumb a:hover { color: var(--accent); }
.docs-breadcrumb .sep { margin: 0 8px; opacity: .5; }

.docs-loading { color: var(--muted); padding: 40px 0; }

/* ============================================================
   Article typography
   ============================================================ */
.docs-article { font-size: 1.02rem; color: #dde5f0; }
.docs-article h1 {
  font-size: 2.3rem; font-weight: 800; line-height: 1.15;
  color: #fff; margin-bottom: 28px; letter-spacing: -.02em;
}
.docs-article h2 {
  font-size: 1.55rem; font-weight: 700; color: #fff;
  margin: 52px 0 18px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 90px;
}

.docs-article .docs-section {
  margin: 20px 0;
  padding: 20px 22px 6px;
  background: rgba(15, 23, 42, .55);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 14px;
}
.docs-article .docs-section:nth-of-type(even) {
  border-left-color: var(--accent-2);
  background: rgba(15, 23, 42, .4);
}
.docs-article .docs-section h2 {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom-color: rgba(56, 189, 248, .22);
}
.docs-article .docs-section:nth-of-type(even) h2 {
  border-bottom-color: rgba(34, 197, 94, .28);
}
.docs-article h3 {
  font-size: 1.2rem; font-weight: 600; color: var(--accent);
  margin: 32px 0 12px; scroll-margin-top: 90px;
}
.docs-article p { margin: 0 0 18px; }
.docs-article ul, .docs-article ol { margin: 0 0 20px; padding-left: 24px; }
.docs-article li { margin-bottom: 8px; }
.docs-article li::marker { color: var(--accent); }
.docs-article strong { color: #fff; font-weight: 600; }
.docs-article a { text-decoration: underline; text-underline-offset: 2px; }
.docs-article code {
  background: rgba(148, 163, 253, .12);
  padding: 2px 6px; border-radius: 5px;
  font-size: .88em; font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color: #e2e8f0;
}
.docs-article hr {
  border: none; border-top: 1px solid var(--border); margin: 40px 0;
}

/* Blockquote → tip/callout */
.docs-article blockquote {
  margin: 24px 0;
  padding: 16px 20px;
  background: rgba(34, 197, 94, .07);
  border: 1px solid rgba(34, 197, 94, .25);
  border-left: 3px solid var(--accent-2);
  border-radius: 10px;
  color: #d7e4d9;
}
.docs-article blockquote p:last-child { margin-bottom: 0; }
.docs-article blockquote strong { color: var(--accent-2); }

/* Tables */
.docs-article table {
  width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: .95rem;
}
.docs-article th, .docs-article td {
  text-align: left; padding: 10px 14px; border: 1px solid var(--border);
}
.docs-article th {
  background: rgba(56, 189, 248, .12);
  color: var(--accent);
  font-weight: 600;
}
.docs-article tbody tr:nth-child(even) { background: rgba(56, 189, 248, .04); }
.docs-article td:first-child { color: #fff; }

/* Figures / screenshots — phone screenshots are portrait, so keep them small + centered */
.docs-figure {
  margin: 24px auto;
  max-width: 220px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(15, 23, 42, .5);
}
.docs-figure img { display: block; width: 100%; height: auto; }

/* Consecutive screenshots render side by side (wraps on narrow screens) */
.docs-figure-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 12px;
  margin: 24px 0;
}
.docs-figure-row .docs-figure {
  margin: 0;
  flex: 1 1 0;
  max-width: 190px;
  min-width: 130px;
}
.docs-figure figcaption {
  padding: 10px 16px;
  font-size: .85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: rgba(2, 8, 23, .4);
}
/* Missing-image placeholder */
.docs-figure.is-placeholder {
  border-style: dashed;
  border-color: rgba(56, 189, 248, .35);
}
.docs-img-placeholder {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; min-height: 180px; padding: 24px;
  color: var(--muted); text-align: center;
  background:
    repeating-linear-gradient(45deg, rgba(56,189,248,.04) 0 12px, transparent 12px 24px);
}
.docs-img-placeholder svg { width: 22px; height: 22px; flex-shrink: 0; opacity: .8; }

/* Feedback footer */
.docs-feedback {
  margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: .9rem;
}
.docs-feedback-btns { display: flex; gap: 10px; }
.docs-feedback-btns button {
  background: rgba(15, 23, 42, .7); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 8px 14px;
  cursor: pointer; font-size: 1rem; transition: all .15s ease; font-family: inherit;
}
.docs-feedback-btns button:hover { border-color: var(--accent); background: rgba(56,189,248,.1); }

/* ============================================================
   Right-hand "On this page" TOC
   ============================================================ */
.docs-toc {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 44px 20px 40px; font-size: .86rem;
}
.docs-toc-title {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 12px;
}
.docs-toc-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.docs-toc-list a {
  display: block; color: var(--muted); padding: 4px 0;
  border-left: 2px solid transparent; padding-left: 12px; margin-left: -2px;
  transition: color .15s ease, border-color .15s ease;
}
.docs-toc-list a:hover { color: var(--text); text-decoration: none; }
.docs-toc-list a.active { color: var(--accent); border-left-color: var(--accent); }
.docs-toc-list a.lvl-3 { padding-left: 26px; font-size: .82rem; }

/* ============================================================
   Mobile top bar (hidden on desktop)
   ============================================================ */
.docs-topbar {
  display: none;
  align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 16px;
  position: sticky; top: 0; z-index: 40;
  background: rgba(2, 8, 23, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.docs-menu-btn {
  background: none; border: none; color: var(--text); cursor: pointer;
  padding: 6px; border-radius: 8px; display: flex;
}
.docs-menu-btn svg { width: 24px; height: 24px; }
.docs-topbar-logo { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; }
.docs-backdrop { display: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
  .docs-layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .docs-toc { display: none; }
  .docs-main { padding: 36px 40px 80px; }
}

@media (max-width: 820px) {
  .docs-topbar { display: flex; }
  .docs-layout { grid-template-columns: 1fr; }

  .docs-sidebar {
    position: fixed; top: 0; left: 0; z-index: 50;
    width: min(86vw, var(--sidebar-w)); height: 100vh;
    transform: translateX(-100%);
    transition: transform .25s ease;
    background: rgba(2, 8, 23, .98);
  }
  .docs-sidebar.open { transform: translateX(0); }

  .docs-backdrop {
    display: block; position: fixed; inset: 0; z-index: 45;
    background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
  }
  .docs-backdrop.open { opacity: 1; pointer-events: auto; }

  .docs-main { padding: 28px 20px 72px; }
  .docs-article h1 { font-size: 1.9rem; }
  .docs-article h2 { font-size: 1.35rem; }
}
