/* site51 — MarketDesk. Hidden-service Q&A help-desk. Dark technical palette
   carried over from earlier site51 work; visual structure rebuilt around
   question cards rather than the registry/dossier convention. */
:root {
  --bg:        #0a1424;
  --bg-2:      #0e1b2e;
  --panel:     #122238;
  --panel-2:   #182d49;
  --line:      #1f3756;
  --line-2:    #284464;
  --ink:       #e8eef7;
  --ink-2:     #c5d0e0;
  --muted:     #7a8aa3;
  --muted-2:   #5d6e89;
  --cyan:      #22d3ee;
  --cyan-dim:  #0e9aaf;
  --amber:     #fbbf24;
  --amber-dim: #b78410;
  --rose:      #f43f5e;
  --emerald:   #34d399;
  --shadow:    0 6px 28px rgba(0, 0, 0, .45);
  --radius:    4px;
}
*, *:before, *:after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.7 ui-sans-serif, -apple-system, "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink-2);
  background: var(--bg);
  background-image:
    radial-gradient(900px 600px at 80% -10%, rgba(34, 211, 238, .08), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(251, 191, 36, .05), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--cyan); text-decoration: none; border-bottom: 1px dashed rgba(34,211,238,.4); }
a:hover { color: var(--amber); border-bottom-color: var(--amber); }
code, pre { font-family: ui-monospace, "JetBrains Mono", Menlo, Monaco, Consolas, monospace; background: rgba(34,211,238,.08); padding: 1px 5px; border-radius: 3px; font-size: .92em; color: var(--cyan); }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 22px; }

/* ===========================================================================
   Layout: left vertical rail + main stage. Deliberately not a sticky top bar.
   Rail = 240px on desktop; stage flexes the rest. Mobile collapses the rail
   into an off-canvas drawer toggled by a checkbox-hack hamburger.
   =========================================================================== */
body { display: flex; align-items: stretch; min-height: 100vh; }
.stage {
  flex: 1; min-width: 0;
  margin-left: 240px;     /* match .rail width */
}

/* ---- left rail ---- */
.rail {
  width: 240px; flex-shrink: 0;
  position: fixed; left: 0; top: 0; bottom: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 22px 0 16px;
  display: flex; flex-direction: column;
  overflow-y: auto;
  z-index: 40;
}
.rail::-webkit-scrollbar { width: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

.rail-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px 18px; border: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px; color: var(--ink);
}
.rail-brand:hover { border: 0; color: var(--cyan); }
.rail-brand:hover { border-bottom: 1px solid var(--line); }
.rail-ico {
  width: 32px; height: 32px; border-radius: 5px;
  background: linear-gradient(135deg, var(--cyan-dim), #0a3b54);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,.08);
  flex-shrink: 0;
}
.rail-ico svg { display: block; }
.rail-name { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.rail-name .rb1 {
  font-family: ui-monospace, monospace; font-weight: 700;
  font-size: 15px; letter-spacing: -.01em; color: var(--ink);
}
.rail-name .rb2 {
  font-size: 10px; font-weight: 600; color: var(--cyan);
  letter-spacing: .14em; text-transform: uppercase; margin-top: 3px;
}

.rail-nav { flex: 1; }
.rail-h {
  font-family: ui-monospace, monospace; font-size: 10px;
  color: var(--muted); letter-spacing: .16em; text-transform: uppercase;
  font-weight: 700; padding: 16px 20px 6px; margin: 0;
  border-top: 1px dashed var(--line); margin-top: 8px;
}
.rail-list { list-style: none; padding: 0; margin: 0; }
.rail-list li { margin: 0; }
.rail-list a {
  display: flex; gap: 10px; align-items: center;
  padding: 7px 20px;
  font-family: ui-monospace, monospace; font-size: 13px;
  color: var(--ink-2); border: 0;
  border-left: 2px solid transparent;
  line-height: 1.3;
}
.rail-list a:hover {
  background: rgba(34,211,238,.06); color: var(--cyan);
  border-left-color: var(--cyan-dim);
}
.rail-list a.on {
  background: rgba(34,211,238,.10); color: var(--amber);
  border-left-color: var(--amber);
}
.rail-list .rk {
  color: var(--muted-2); font-weight: 700;
  display: inline-block; min-width: 14px;
}
.rail-list a.on .rk { color: var(--amber); }
.rail-list a:hover .rk { color: var(--cyan); }

.rail-foot {
  padding: 14px 20px; margin-top: 10px;
  border-top: 1px solid var(--line);
  font-family: ui-monospace, monospace; font-size: 10px;
  color: var(--muted); letter-spacing: .08em; text-transform: uppercase;
}

/* hamburger (mobile only) */
.rail-toggle-cb { display: none; }
.rail-burger {
  display: none;
  position: fixed; top: 12px; right: 12px;
  width: 40px; height: 40px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 4px; z-index: 60;
  align-items: center; justify-content: center; flex-direction: column;
  gap: 4px;
}
.rail-burger span {
  display: block; width: 18px; height: 2px;
  background: var(--cyan); border-radius: 1px;
  transition: transform .15s, opacity .15s;
}

/* ---- intro band ---- */
.intro { padding: 56px 0 20px; border-bottom: 1px solid var(--line); }
.intro h1 {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 38px; line-height: 1.18; margin: 0 0 18px;
  color: var(--ink); letter-spacing: -.015em; font-weight: 700;
  max-width: 880px;
}
.intro h1 .accent { color: var(--cyan); }
.intro .lede { font-size: 17px; color: var(--ink-2); max-width: 760px; margin: 0; }

/* ---- generic section ---- */
section { padding: 38px 0; }
section + section { border-top: 1px solid var(--line); }
section h2 {
  font-family: ui-monospace, monospace;
  font-size: 22px; margin: 0 0 8px; color: var(--ink); font-weight: 700;
  display: flex; align-items: center; gap: 12px;
}
section h2:before {
  content: ""; width: 18px; height: 2px; background: var(--cyan);
  display: inline-block;
}
section h3 { font-size: 17px; margin: 26px 0 8px; color: var(--ink); font-family: ui-monospace, monospace; font-weight: 700; }
section p { color: var(--ink-2); }
section .sub { color: var(--muted); margin-bottom: 22px; max-width: 760px; font-size: 14px; }

/* ---- trail / breadcrumb ---- */
.trail { margin: 0 0 22px; font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.trail ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.trail li { display: inline-flex; align-items: center; }
.trail li:not(:last-child):after { content: '/'; margin-left: 6px; color: var(--muted-2); }
.trail a { color: var(--muted); border: 0; }
.trail a:hover { color: var(--cyan); }
.trail li[aria-current] { color: var(--ink); }

/* ---- topic cards (home: marketplace + subject hubs) ---- */
.topic-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px; margin-top: 6px;
}
.topic-card {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--cyan-dim);
  border-radius: var(--radius);
  display: flex; gap: 14px; padding: 14px 16px;
  text-decoration: none; border-bottom: 1px solid var(--line); /* override default a */
  transition: border-left-color .15s, transform .15s, border-color .15s;
}
.topic-card:hover { border-left-color: var(--amber); transform: translateY(-2px); border-color: var(--line-2); }
.topic-card.subj { border-left-color: var(--amber); }
.topic-card.subj:hover { border-left-color: var(--cyan); }
.tc-logo {
  width: 40px; height: 40px; flex-shrink: 0;
  background: rgba(255,255,255,.04); border: 1px solid var(--line-2);
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px;
}
.tc-logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.tc-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.tc-name {
  font-family: ui-monospace, monospace; font-weight: 700;
  font-size: 15px; color: var(--ink); line-height: 1.2;
}
.tc-meta { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }
.tc-count {
  font-family: ui-monospace, monospace; font-size: 11px;
  color: var(--cyan); margin-top: auto; padding-top: 6px;
  letter-spacing: .04em; font-weight: 700;
}
.topic-card:hover .tc-count { color: var(--amber); }

/* ---- question card (used in topic hubs, related, home featured) ---- */
.q-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px; margin-top: 10px;
}
.q-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px 14px;
  display: flex; flex-direction: column; gap: 8px;
  text-decoration: none; border-bottom: 1px solid var(--line);
  transition: border-color .15s, transform .15s;
}
.q-card:hover { border-color: var(--cyan-dim); transform: translateY(-2px); }
.q-topic {
  font-family: ui-monospace, monospace; font-size: 10px;
  color: var(--amber); letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700;
}
.q-text {
  font-family: ui-monospace, monospace; font-size: 15px;
  color: var(--ink); font-weight: 700; line-height: 1.35;
}
.q-blurb { font-size: 13px; color: var(--muted); line-height: 1.5; }
.q-cta {
  margin-top: 6px; padding-top: 8px;
  border-top: 1px solid var(--line-2);
  font-family: ui-monospace, monospace; font-size: 11px;
  color: var(--cyan); letter-spacing: .04em; font-weight: 700;
}
.q-card:hover .q-cta { color: var(--amber); }

/* ---- topic hub page ---- */
.topic-head {
  display: flex; gap: 22px; flex-wrap: wrap;
  padding-bottom: 22px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.topic-logo {
  width: 80px; height: 80px; flex-shrink: 0;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.topic-logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.topic-h1 {
  font-family: ui-monospace, monospace; font-weight: 700;
  font-size: 26px; color: var(--ink); margin: 0 0 8px;
  letter-spacing: -.01em;
}
.topic-lede { color: var(--ink-2); margin: 0; max-width: 640px; }

/* long-form intro on topic hubs and home — body copy for SEO */
.topic-intro {
  max-width: 760px;
  margin: 18px 0 30px;
}
.topic-intro p {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.78;
}

/* ---- answer page ---- */
.answer { max-width: 820px; }
.answer-head {
  padding-bottom: 18px; margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.answer-topic {
  display: inline-block; font-family: ui-monospace, monospace;
  font-size: 11px; color: var(--amber); letter-spacing: .12em;
  text-transform: uppercase; font-weight: 700; margin-bottom: 12px;
}
.answer-topic a { color: var(--cyan); border: 0; }
.answer-topic a:hover { color: var(--amber); }
.q-h1 {
  font-family: ui-monospace, monospace; font-weight: 700;
  font-size: 28px; line-height: 1.25; color: var(--ink);
  margin: 0 0 12px; letter-spacing: -.01em;
}
.answer-stamp {
  font-family: ui-monospace, monospace; font-size: 11px;
  color: var(--muted); letter-spacing: .08em; text-transform: uppercase;
}
.answer-body h2 {
  font-family: ui-monospace, monospace; font-weight: 700;
  font-size: 18px; color: var(--ink); margin: 30px 0 8px;
  display: flex; align-items: center; gap: 10px;
}
.answer-body h2:before {
  content: ""; width: 12px; height: 2px; background: var(--amber);
  display: inline-block;
}
.answer-body p { margin: 10px 0; color: var(--ink-2); font-size: 15px; line-height: 1.7; }
.answer-body p ul { margin: 8px 0 0; padding-left: 20px; }
.answer-body ul { padding-left: 20px; color: var(--ink-2); }
.answer-body li { margin: 4px 0; }

/* coin pills row inside an answer */
.coin-row { margin: 14px 0 16px !important; display: flex; flex-wrap: wrap; gap: 6px; }
.coin-pill {
  display: inline-block;
  font-family: ui-monospace, monospace; font-weight: 700;
  font-size: 12px; padding: 5px 12px; border-radius: 3px;
  background: rgba(251,191,36,.1); color: var(--amber);
  border: 1px solid rgba(251,191,36,.3); letter-spacing: .08em;
}

/* onion list inside answers and topic hubs */
.onion-list {
  list-style: none; padding: 0; margin: 12px 0 18px;
  display: grid; gap: 6px;
}
.onion-list li {
  display: flex; gap: 12px; align-items: baseline;
  background: var(--bg-2); border: 1px solid var(--line);
  border-left: 3px solid var(--cyan-dim);
  border-radius: 3px; padding: 10px 14px;
  font-family: ui-monospace, monospace; font-size: 12.5px;
}
.onion-list li:hover { border-left-color: var(--amber); }
.onion-list .oi { color: var(--muted-2); font-size: 10px; font-weight: 700; }
.onion-list .ohref {
  color: var(--ink-2); border: 0;
  word-break: break-all; user-select: all;
  border-bottom: 1px dashed transparent;
}
.onion-list .ohref:hover { color: var(--amber); border-bottom-color: var(--amber-dim); }

/* "Related" block at the bottom of answer pages */
.related {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px; margin: 24px 0 0;
}

/* index page (all answers list) */
.ix-h3 {
  margin: 28px 0 8px !important;
  font-family: ui-monospace, monospace; font-size: 16px;
}
.ix-h3 a { color: var(--cyan); border: 0; }
.ix-h3 a:hover { color: var(--amber); }
.ix-list { list-style: none; padding: 0 0 0 10px; margin: 0; }
.ix-list li { margin: 2px 0; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.ix-list li:last-child { border-bottom: 0; }
.ix-list a { font-size: 14px; color: var(--ink-2); border: 0; }
.ix-list a:hover { color: var(--amber); }

/* ---- footer ---- */
.foot {
  margin-top: 40px; padding: 28px 0 36px;
  border-top: 1px solid var(--line);
  font-family: ui-monospace, monospace;
  font-size: 12px; color: var(--muted); letter-spacing: .04em;
}
.foot a { color: var(--muted); border-bottom: 1px dashed var(--line-2); }
.foot a:hover { color: var(--cyan); border-color: var(--cyan-dim); }
.foot .row { display: flex; gap: 22px; flex-wrap: wrap; align-items: baseline; }

/* ---- mobile-rail backdrop (only visible when drawer is open) ---- */
.rail-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 35;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}

/* ===========================================================================
   Responsive: collapse rail to off-canvas drawer below 880px.
   Mobile-first touch targets, tighter padding, slimmed font sizes.
   =========================================================================== */
@media (max-width: 880px) {
  body { display: block; }
  .stage { margin-left: 0; padding-top: 56px; /* room for burger */ }
  .wrap { padding: 0 16px; }

  .rail {
    transform: translateX(-100%);
    transition: transform .22s ease;
    width: 270px;
    box-shadow: 0 0 30px rgba(0,0,0,.55);
  }
  .rail-toggle-cb:checked ~ .rail { transform: translateX(0); }
  .rail-toggle-cb:checked ~ .rail-backdrop { display: block; }
  .rail-burger { display: inline-flex; }
  .rail-toggle-cb:checked ~ .rail-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .rail-toggle-cb:checked ~ .rail-burger span:nth-child(2) { opacity: 0; }
  .rail-toggle-cb:checked ~ .rail-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  /* Intro/section spacing tightened */
  .intro      { padding: 28px 0 16px; }
  .intro h1   { font-size: 22px; line-height: 1.25; }
  .intro .lede{ font-size: 15px; }
  section     { padding: 26px 0; }
  section h2  { font-size: 18px; }
  .sub        { font-size: 13px; }

  /* Topic head: logo stacks above text */
  .topic-head { gap: 14px; padding-bottom: 16px; margin-bottom: 14px; align-items: flex-start; }
  .topic-logo { width: 56px; height: 56px; padding: 6px; }
  .topic-h1   { font-size: 19px; }
  .topic-lede { font-size: 14px; }

  /* Answer head */
  .q-h1            { font-size: 19px; line-height: 1.3; }
  .answer-body p   { font-size: 14px; line-height: 1.65; }
  .answer-body h2  { font-size: 16px; margin: 22px 0 6px; }
  .answer-stamp    { font-size: 10px; }

  /* Cards: shrink grid min-width so single column fits cleanly */
  .topic-row { grid-template-columns: 1fr; gap: 8px; }
  .q-grid    { grid-template-columns: 1fr; gap: 10px; }
  .related   { grid-template-columns: 1fr; gap: 8px; }
  .topic-card { padding: 12px 14px; }
  .q-card     { padding: 14px 16px 12px; }
  .q-text     { font-size: 14px; }
  .q-blurb    { font-size: 12.5px; }

  /* Onion lists: smaller mono + tighter padding */
  .onion-list li  { font-size: 10.5px; padding: 8px 10px; gap: 8px; }
  .onion-list .oi { font-size: 9px; }

  /* Index page (all answers) */
  .ix-list a { font-size: 13px; }

  /* Coins */
  .coin-pill { font-size: 11px; padding: 4px 9px; }

  /* Trail */
  .trail { font-size: 11px; margin-bottom: 16px; }

  /* Footer */
  .foot .row { gap: 10px; font-size: 11px; }
  .foot .row span[style] { margin-left: 0 !important; }
}

/* very small screens */
@media (max-width: 420px) {
  .wrap { padding: 0 12px; }
  .intro h1 { font-size: 20px; }
  .q-h1 { font-size: 18px; }
  .topic-h1 { font-size: 17px; }
  .onion-list li { font-size: 10px; }
  section h2 { font-size: 16px; }
}
