/* ============================================================
   GINIE DOCS — SHARED STYLESHEET
   Faithful port of canton.ginie.xyz brand (index.html inline CSS).
   ============================================================ */
:root {
  --bg: #ffffff;
  --bg2: #f9fafb;
  --bg3: #f3f4f6;
  --border: #e5e7eb;
  --border2: #d1d5db;
  --text: #111827;
  --text2: #374151;
  --text3: #6b7280;
  --text4: #9ca3af;
  --accent: #16a34a;
  --accent-bg: #f0fdf4;
  --accent-border: #bbf7d0;
  --accent-dark: #15803d;
  --green: #059669;
  --green-bg: #ecfdf5;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --blue: #1d4ed8;
  --blue-bg: #eff6ff;
  --blue-border: #bfdbfe;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', sans-serif;
  --sidebar-w: 256px;
}
/* ── DARK THEME ───────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #111827;
  --bg2: #1f2937;
  --bg3: #374151;
  --border: #374151;
  --border2: #4b5563;
  --text: #f9fafb;
  --text2: #e5e7eb;
  --text3: #9ca3af;
  --text4: #6b7280;
  --accent: #22c55e;
  --accent-bg: rgba(34,197,94,.12);
  --accent-border: rgba(34,197,94,.35);
  --accent-dark: #4ade80;
  --green: #34d399;
  --green-bg: rgba(52,211,153,.1);
  --amber-bg: rgba(217,119,6,.12);
  --red-bg: rgba(220,38,38,.12);
  --blue-bg: rgba(29,78,216,.12);
  --blue-border: rgba(96,165,250,.3);
}
[data-theme="dark"] .logo-sq   { background: #000; }
[data-theme="dark"] .logo-ver  { background: var(--bg3); }
[data-theme="dark"] .search-box { background: var(--bg2); color: var(--text); border-color: var(--border2); }
[data-theme="dark"] .search-results { background: var(--bg2); border-color: var(--border2); }
[data-theme="dark"] .sr-item:hover  { background: var(--bg3); }
[data-theme="dark"] th         { background: var(--bg2); }
[data-theme="dark"] .pipe-node { background: var(--bg2); }
[data-theme="dark"] .card      { background: var(--bg2); }
[data-theme="dark"] .gate-item { background: var(--bg2); }
[data-theme="dark"] .pn-link   { background: var(--bg); }
[data-theme="dark"] .pn-link:hover { background: var(--accent-bg); }
[data-theme="dark"] .t-theme   { color: var(--text3); }
[data-theme="dark"] .t-theme:hover { color: var(--text); background: var(--bg3); }

/* ── READ / SEPIA THEME ───────────────────────────────────── */
[data-theme="read"] {
  --bg:  #faf6ef;
  --bg2: #f2ece0;
  --bg3: #ebe2d0;
  --border: #d9cdb8;
  --border2: #c9bca4;
  --text: #2c1f0e;
  --text2: #3d2e18;
  --text3: #6b5740;
  --text4: #9b8468;
  --accent: #1a7a3a;
  --accent-bg: #e8f5ee;
  --accent-border: #a3d1b3;
  --accent-dark: #155e2e;
  --green: #2d8a50;
  --green-bg: #e4f4ec;
  --amber-bg: #fdf2de;
  --red-bg: #fde8e8;
  --blue-bg: #e8eef8;
  --blue-border: #b0c4e4;
}
[data-theme="read"] .cb,
[data-theme="read"] .term  { background: #2a1f12; }
[data-theme="read"] .logo-sq { background: #2c1f0e; }
[data-theme="read"] .t-theme { color: var(--text3); }
[data-theme="read"] .t-theme:hover { color: var(--text); background: var(--bg3); }

/* ── THEME TOGGLE BUTTON ──────────────────────────────────── */
.t-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.t-theme:hover { background: var(--bg3); color: var(--text); }

/* smooth theme transitions */
body, .topbar, .sidebar, .card, .gate-item,
.callout, table, .cb, .term, .pipe-node,
.search-results, .pn-link, .search-box {
  transition: background-color .2s, color .2s, border-color .2s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

/* ── TOPBAR ───────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 54px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  width: var(--sidebar-w);
  flex-shrink: 0;
}
.logo-img {
  width: 26px; height: 26px;
  border-radius: 5px;
}
.logo-name { font-size: 15px; font-weight: 600; color: var(--text); }
.logo-ver {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text4);
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 3px;
}
.search-wrap { flex: 1; max-width: 380px; position: relative; }
.search-ico {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text4);
  pointer-events: none;
}
.search-box {
  width: 100%;
  height: 33px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 0 12px 0 32px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  background: var(--bg2);
  outline: none;
}
.search-box:focus { border-color: var(--accent); background: var(--bg); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.t-link { font-size: 13px; color: var(--text3); text-decoration: none; }
.t-link:hover { color: var(--text); }
.t-btn {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.t-btn:hover { background: var(--accent-dark); }

/* ── SEARCH RESULTS ───────────────────────────────────────── */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  max-height: 380px;
  overflow-y: auto;
  display: none;
  z-index: 300;
}
.search-results.open { display: block; }
.sr-header {
  padding: 7px 14px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text4);
  border-bottom: 1px solid var(--border);
}
.sr-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--bg2); }
.sr-section {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  font-weight: 600;
}
.sr-title { font-size: 13px; font-weight: 600; color: var(--text); }
.sr-preview { font-size: 11px; color: var(--text3); line-height: 1.4; }
.sr-empty { padding: 16px 14px; font-size: 13px; color: var(--text3); text-align: center; }

/* ── LAYOUT ───────────────────────────────────────────────── */
.layout { display: flex; padding-top: 54px; min-height: 100vh; }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: 54px; bottom: 0; left: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg);
  padding: 20px 0 40px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); }
.ns { padding: 0 14px; margin-bottom: 2px; }
.nst {
  font-size: 11px;
  font-weight: 600;
  color: var(--text4);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 8px 8px 4px;
}
.ni {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  text-decoration: none;
  transition: background .1s, color .1s;
}
.ni:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.ni.active { background: var(--accent-bg); color: var(--accent-dark); font-weight: 500; }
.ni.active .nd { background: var(--accent); }
.nd { width: 4px; height: 4px; border-radius: 50%; background: var(--border2); flex-shrink: 0; }
.ndiv { height: 1px; background: var(--border); margin: 10px 14px; }

/* ── CONTENT ──────────────────────────────────────────────── */
.content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.ci { max-width: 820px; margin: 0 auto; padding: 44px 44px 80px; }

/* ── SECTIONS ─────────────────────────────────────────────── */
.ds { padding-top: 44px; }
.ds:first-child { padding-top: 0; }
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-dark);
  font-weight: 500;
  letter-spacing: .05em;
  margin-bottom: 7px;
}
.section-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 10px;
}
.sdesc {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.75;
  margin-bottom: 20px;
  max-width: 620px;
}
.divider { height: 1px; background: var(--border); margin: 44px 0; }

/* ── SCREENSHOT ───────────────────────────────────────────── */
.screenshot-wrap {
  margin: 18px 0;
}
.screenshot {
  width: 100%;
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  background: var(--bg2);
  /* min-height prevents layout shift while image loads */
  min-height: 48px;
}
.screenshot-wrap .screenshot { margin: 0; }
.screenshot.hidden { display: none; }
.screenshot-caption {
  font-size: 11px;
  color: var(--text4);
  text-align: center;
  padding: 8px 12px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  letter-spacing: .03em;
}

/* ── CALLOUTS ─────────────────────────────────────────────── */
.callout {
  border-radius: 7px;
  padding: 12px 15px;
  margin: 16px 0;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border: 1px solid;
}
.c-info  { background: var(--accent-bg);  border-color: var(--accent-border); }
.c-tip   { background: var(--green-bg);   border-color: #6ee7b7; }
.c-warn  { background: var(--amber-bg);   border-color: #fcd34d; }
.c-note  { background: var(--blue-bg);    border-color: var(--blue-border); }
.c-icon  { font-size: 13px; flex-shrink: 0; margin-top: 1px; }
.c-body  { font-size: 13px; line-height: 1.65; }
.c-body strong { font-weight: 600; }
.c-body code {
  font-family: var(--mono);
  font-size: 11px;
  background: rgba(0,0,0,.05);
  padding: 1px 5px;
  border-radius: 3px;
}
.c-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 3px;
}
.cl-green { color: var(--green); }
.cl-blue  { color: var(--blue); }
.cl-amber { color: var(--amber); }

/* ── PROSE ────────────────────────────────────────────────── */
p { font-size: 14px; color: var(--text2); line-height: 1.78; margin-bottom: 13px; }
h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 24px 0 9px; }
h4 { font-size: 13px; font-weight: 600; color: var(--text); margin: 18px 0 7px; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg3);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--text);
  border: 1px solid var(--border);
}
strong { font-weight: 600; color: var(--text); }

/* ── CODE BLOCKS ──────────────────────────────────────────── */
.cb { background: #0f172a; border-radius: 8px; overflow: hidden; margin: 14px 0; }
.cb-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid #1e293b;
}
.cb-lang {
  font-family: var(--mono);
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.cb-copy {
  font-family: var(--mono);
  font-size: 10px;
  color: #64748b;
  cursor: pointer;
  border: none;
  background: none;
  padding: 2px 6px;
  border-radius: 3px;
}
.cb-copy:hover { color: #94a3b8; background: rgba(255,255,255,.06); }
.cb-body { padding: 14px; overflow-x: auto; }
.cb-body pre {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: #e2e8f0;
  margin: 0;
}
.cb-body pre .cm { color: #64748b; }
.cb-body pre .kw { color: #7dd3fc; }
.cb-body pre .fn { color: #a78bfa; }
.cb-body pre .st { color: #86efac; }
.term { background: #0f172a; border-radius: 8px; padding: 14px; margin: 14px 0; }
.term pre {
  font-family: var(--mono);
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.7;
  margin: 0;
}
.term .out { color: #94a3b8; }
.term .hi  { color: #7dd3fc; }
.term .cmd { color: #86efac; }

/* ── TABLES ───────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px; }
th {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text);
}
td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  color: var(--text2);
  vertical-align: top;
  line-height: 1.55;
}
td code { font-size: 11px; }

/* ── STEPS ────────────────────────────────────────────────── */
.steps { margin: 18px 0; }
.step { display: flex; gap: 14px; margin-bottom: 22px; }
.step-n {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}
.step-b { flex: 1; }
.step-t { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.step-d { font-size: 13px; color: var(--text2); line-height: 1.65; }

/* ── PIPELINE STRIP ───────────────────────────────────────── */
.pipe-strip {
  display: flex;
  align-items: stretch;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
}
.pipe-node {
  flex: 1;
  min-width: 90px;
  padding: 12px 10px;
  text-align: center;
  border-right: 1px solid var(--border);
  background: var(--bg2);
}
.pipe-node:last-child { border-right: none; }
.pipe-n   { font-family: var(--mono); font-size: 8px;  color: var(--text4); margin-bottom: 4px; }
.pipe-name{ font-size: 11px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.pipe-sub { font-size: 10px; color: var(--text3); line-height: 1.3; }

/* ── GATE LIST ────────────────────────────────────────────── */
.gate-list { margin: 14px 0; }
.gate-item {
  display: flex;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 7px;
  background: var(--bg);
}
.gate-item:hover { border-color: var(--border2); }
.g-body { flex: 1; }
.g-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.g-desc  { font-size: 12px; color: var(--text3); line-height: 1.55; }
.g-ex {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--red);
  margin-top: 6px;
  background: var(--red-bg);
  padding: 5px 9px;
  border-radius: 4px;
}
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid;
  flex-shrink: 0;
  align-self: flex-start;
}
.b-red   { background: var(--red-bg);    color: var(--red);   border-color: #fca5a5; }
.b-amber { background: var(--amber-bg);  color: var(--amber); border-color: #fcd34d; }
.b-blue  { background: var(--blue-bg);   color: var(--blue);  border-color: var(--blue-border); }
.b-green { background: var(--green-bg);  color: var(--green); border-color: #6ee7b7; }
.b-gray  { background: var(--bg3);       color: var(--text3); border-color: var(--border2); }

/* ── CARDS ────────────────────────────────────────────────── */
.cg2 { display: grid; grid-template-columns: 1fr 1fr;     gap: 12px; margin: 16px 0; }
.cg3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin: 16px 0; }
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 16px;
}
.card:hover { border-color: var(--border2); box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.card-ico  { font-size: 18px; margin-bottom: 9px; }
.card-t    { font-size: 13px; font-weight: 600; color: var(--text);  margin-bottom: 4px; }
.card-d    { font-size: 12px; color: var(--text3); line-height: 1.6; }
.card-lnk  { font-size: 11px; color: var(--accent-dark); margin-top: 8px; display: inline-block; }
.card-lnk:hover { text-decoration: underline; }

/* ── TICK LIST ────────────────────────────────────────────── */
.tl { list-style: none; margin: 10px 0; }
.tl li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text2);
  padding: 3px 0;
  line-height: 1.55;
}
.tl li::before { content: '✓'; color: var(--green); font-weight: 600; flex-shrink: 0; margin-top: 1px; }

/* ── PAGE NAVIGATION ──────────────────────────────────────── */
.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.pn-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  text-decoration: none;
  transition: border-color .1s, background .1s;
}
.pn-link:hover {
  border-color: var(--accent-border);
  background: var(--accent-bg);
  text-decoration: none;
}
.pn-dir   { font-size: 10px; color: var(--text4); font-family: var(--mono); letter-spacing: .04em; }
.pn-title { font-size: 13px; font-weight: 600; color: var(--text); }
.pn-desc  { font-size: 11px; color: var(--text3); }
.pn-link.next { text-align: right; }
.pn-placeholder { visibility: hidden; pointer-events: none; }

/* ── MOBILE ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { margin-left: 0; }
  .ci { padding: 28px 18px 60px; }
  .cg2, .cg3 { grid-template-columns: 1fr; }
  .pipe-strip { flex-direction: column; }
  .page-nav { grid-template-columns: 1fr; }
  .search-wrap { max-width: 200px; }
}
