/* ============ base ============ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; }

/* Hide before tailwind/vue loads */
[v-cloak] { display: none; }

/* ============ TOC ============ */
#toc-nav a {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: 0.5rem;
  color: #a1a1aa;
  border-left: 2px solid transparent;
  transition: all .15s ease;
}
#toc-nav a:hover {
  background: rgba(124, 58, 237, .08);
  color: #ddd6fe;
}
#toc-nav a.active {
  background: rgba(124, 58, 237, .15);
  border-left-color: #a78bfa;
  color: #ddd6fe;
}
#toc-nav .toc-sub {
  padding-left: 1rem;
  font-size: 12.5px;
  color: #71717a;
}
#toc-nav .toc-sub:hover {
  color: #c4b5fd;
}

/* ============ Markdown content ============ */
.md {
  color: #e4e4e7;
  line-height: 1.65;
  font-size: 15.5px;
}
.md > * + * { margin-top: 1rem; }

.md h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
  scroll-margin-top: 6rem;
}
.md h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: #ddd6fe;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  scroll-margin-top: 6rem;
}
.md h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #c4b5fd;
  margin-top: 1.5rem;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.md h2:first-child, .md h3:first-child, .md h4:first-child {
  margin-top: 0;
}

.md strong, .md b {
  color: #fafafa;
  font-weight: 600;
}

.md p {
  color: #d4d4d8;
}

.md ul, .md ol {
  padding-left: 1.5rem;
  color: #d4d4d8;
}
.md ul { list-style: disc; }
.md ol { list-style: decimal; }
.md li::marker { color: #8b5cf6; }
.md li + li { margin-top: 0.3rem; }
.md li ul, .md li ol { margin-top: 0.35rem; }

.md a {
  color: #c4b5fd;
  text-decoration: underline;
  text-decoration-color: rgba(196,181,253,.4);
  text-underline-offset: 3px;
}
.md a:hover { color: #fff; text-decoration-color: #c4b5fd; }

.md code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.88em;
  background: rgba(124, 58, 237, .14);
  color: #f0abfc;
  padding: 0.12rem 0.4rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(124, 58, 237, .22);
}

.md pre {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: #0c0c10;
  border: 1px solid #262635;
  border-left: 3px solid #8b5cf6;
  padding: 1rem 1.2rem;
  border-radius: 0.6rem;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
  color: #ddd6fe;
  white-space: pre;
}
.md pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.md blockquote {
  border-left: 3px solid #a78bfa;
  background: rgba(139, 92, 246, .07);
  padding: 0.9rem 1.1rem;
  border-radius: 0 0.5rem 0.5rem 0;
  color: #ddd6fe;
  font-style: normal;
}
.md blockquote p { color: inherit; margin: 0; }
.md blockquote p + p { margin-top: 0.5rem; }

.md table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.2rem 0;
  background: #111118;
  border-radius: 0.6rem;
  overflow: hidden;
  border: 1px solid #262635;
  font-size: 13.5px;
}
.md th, .md td {
  padding: 0.55rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #1d1d29;
}
.md th {
  background: rgba(124, 58, 237, .08);
  font-weight: 600;
  color: #ddd6fe;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.md td { color: #d4d4d8; }
.md tr:last-child td { border-bottom: 0; }
.md tbody tr:hover { background: rgba(124, 58, 237, .04); }

.md hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, #33334a 30%, #33334a 70%, transparent);
  margin: 2.5rem 0;
}

/* ============ Case card ============ */
.caso-card {
  background: linear-gradient(180deg, rgba(23, 23, 33, .55) 0%, rgba(8, 8, 11, 0) 100%);
  border: 1px solid #262635;
  border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 3rem;
  scroll-margin-top: 5.5rem;
}
.caso-card .caso-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #262635;
}
.caso-card .caso-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: #fff;
  line-height: 1.15;
}
.caso-card .caso-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: #f0abfc;
  background: rgba(217, 70, 239, .08);
  border: 1px solid rgba(217, 70, 239, .25);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.caso-card .caso-short {
  color: #a1a1aa;
  font-size: 15px;
  margin-top: 0.6rem;
  max-width: 60ch;
  line-height: 1.55;
}

/* Open in Xolver button */
.btn-xolver {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: 0.55rem;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #a78bfa 45%, #ec4899 100%);
  box-shadow: 0 0 22px rgba(139, 92, 246, 0.32);
  transition: transform .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn-xolver:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
}

/* Tabs context / answer */
.caso-tabs {
  display: inline-flex;
  background: #111118;
  border: 1px solid #262635;
  border-radius: 0.6rem;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
}
.caso-tab {
  font-size: 13.5px;
  font-weight: 600;
  color: #a1a1aa;
  padding: 0.45rem 0.95rem;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: all .15s ease;
  background: transparent;
  border: none;
  font-family: inherit;
}
.caso-tab.active {
  background: rgba(124, 58, 237, .18);
  color: #ddd6fe;
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .35);
}
.caso-tab:not(.active):hover { color: #e4e4e7; }

/* Subtle "details" disclosure when not used */
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============ print ============ */
@media print {
  body { background: #fff !important; color: #111 !important; }
  header, aside, #toc-toggle, .btn-xolver, .caso-tabs { display: none !important; }
  main { max-width: 100% !important; }
  .md, .md p, .md li, .md td, .md th, .md strong { color: #111 !important; }
  .md h2, .md h3, .md h4 { color: #111 !important; page-break-after: avoid; }
  .md pre { background: #f5f5f5 !important; color: #111 !important; border-color: #ccc !important; }
  .md table { border-color: #ccc !important; background: #fff !important; }
  .md th, .md td { border-color: #ddd !important; background: #fff !important; color: #111 !important; }
  .md blockquote { background: #f9f7ff !important; color: #444 !important; }
  .caso-card { border-color: #ccc !important; page-break-before: always; }
  .tab-pane { display: block !important; }
  .tab-pane + .tab-pane { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #ddd; }
  a { color: #4c1d95 !important; text-decoration: none !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #666; }
}

/* ============ scrollbar (webkit) ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0c0c10; }
::-webkit-scrollbar-thumb { background: #33334a; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #4c1d95; }

/* Mobile TOC */
@media (max-width: 767px) {
  #toc.open { display: block !important; }
}
