/* SPELL Learn — Documentation CSS */
/* Microsoft Learn style, white background, SPELL identity */

:root {
  --sidebar-width: 280px;
  --toc-width: 220px;
  --top-bar-height: 48px;
  --accent: #1a6bcc;
  --accent-hover: #1558ad;
  --accent-light: #e8f0fb;
  --bg: #ffffff;
  --bg-sidebar: #f4f4f4;
  --bg-code: #f6f8fa;
  --bg-code-border: #e8ecf0;
  --border: #e0e0e0;
  --text: #201f1e;
  --text-muted: #616161;
  --text-light: #8a8a8a;
  --heading: #1a1a1a;
  --link: #1a6bcc;
  --link-hover: #1558ad;
  --radius: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ========== Top Bar ========== */
.learn-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top-bar-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  color: var(--text-muted);
  line-height: 0;
}
.sidebar-toggle:hover { background: var(--bg-sidebar); }
.sidebar-toggle svg { width: 20px; height: 20px; }

.top-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.top-brand img { display: block; }

.top-sep {
  color: var(--border);
  font-weight: 300;
  font-size: 1.2rem;
}

.top-docs-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}
.top-docs-link:hover { color: var(--accent); text-decoration: none; }

.top-spacer { flex: 1; }

.top-site-link {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.top-site-link:hover { color: var(--accent); text-decoration: none; }

/* ========== Layout ========== */
.learn-layout {
  display: flex;
  margin-top: var(--top-bar-height);
  min-height: calc(100vh - var(--top-bar-height));
}

/* ========== Sidebar ========== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--top-bar-height);
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.sidebar-inner { padding: 20px 0 40px; }

.sidebar-section-title {
  font-family: 'Barlow Condensed', 'IBM Plex Sans', sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 20px 6px;
  margin-top: 4px;
}

.sidebar-section-title:first-child { padding-top: 6px; }

.sidebar-nav-item {
  display: block;
  padding: 7px 20px;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.4;
  border-left: 3px solid transparent;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.sidebar-nav-item:hover {
  background: rgba(26,107,204,0.06);
  color: var(--accent);
  text-decoration: none;
}

.sidebar-nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 998;
}
.sidebar-overlay.visible { display: block; }

/* ========== Main Content ========== */
.learn-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  max-width: 800px;
  padding: 36px 48px 80px;
}

/* ========== Breadcrumb ========== */
.breadcrumb {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); text-decoration: none; }
.breadcrumb .sep { color: var(--border); margin: 0 2px; }
.breadcrumb .current { color: var(--text); }

/* ========== Article TOC (right) ========== */
.article-toc {
  float: right;
  width: var(--toc-width);
  margin: 0 0 24px 32px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.8125rem;
}

.article-toc-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.article-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-toc li { margin: 0; }

.article-toc a {
  display: block;
  padding: 4px 0 4px 10px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  line-height: 1.4;
  transition: color 0.1s, border-color 0.1s;
}

.article-toc a:hover {
  color: var(--accent);
  border-left-color: var(--accent);
  text-decoration: none;
}

.article-toc a.toc-active {
  color: var(--accent);
  font-weight: 500;
  border-left-color: var(--accent);
}

/* ========== Page Headings ========== */
h1 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--heading);
  line-height: 1.2;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  clear: right;
}

h2 {
  font-family: 'Barlow Condensed', 'IBM Plex Sans', sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 0.01em;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

h2:first-of-type { margin-top: 32px; }

h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--heading);
  margin-top: 28px;
  margin-bottom: 10px;
}

h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

/* ========== Prose ========== */
p { margin-bottom: 16px; line-height: 1.7; }

p:last-child { margin-bottom: 0; }

ul, ol {
  margin: 0 0 16px 24px;
  line-height: 1.7;
}
li { margin-bottom: 4px; }
li:last-child { margin-bottom: 0; }

strong { font-weight: 600; }
em { font-style: italic; }

code {
  font-family: 'IBM Plex Mono', 'Consolas', monospace;
  font-size: 0.875em;
  background: var(--bg-code);
  border: 1px solid var(--bg-code-border);
  padding: 1px 5px;
  border-radius: 3px;
  color: #c7254e;
}

/* ========== Notes / Callouts ========== */
.note, .warning, .tip, .info {
  margin: 24px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 4px solid;
  font-size: 0.9375rem;
}
.note { background: var(--accent-light); border-color: var(--accent); }
.warning { background: #fff8e6; border-color: #f59e0b; }
.tip { background: #f0fdf4; border-color: #22c55e; }
.info { background: #f8f9fa; border-color: #8a8a8a; }
.note strong, .warning strong, .tip strong, .info strong { display: block; margin-bottom: 4px; }

/* ========== Tables ========== */
.table-wrap { overflow-x: auto; margin: 24px 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  background: var(--bg-sidebar);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(26,107,204,0.02); }

td code { font-size: 0.8125rem; }

/* ========== Code Blocks ========== */
.code-block-wrap {
  position: relative;
  margin: 24px 0;
}

.code-label {
  display: inline-flex;
  align-items: center;
  background: #e8ecf0;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--bg-code-border);
  border-bottom: none;
}

pre.spell-code {
  background: var(--bg-code);
  border: 1px solid var(--bg-code-border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin: 0;
  font-family: 'IBM Plex Mono', 'Consolas', monospace;
  font-size: 0.875rem;
  line-height: 1.65;
  scrollbar-width: thin;
}

pre.spell-code::-webkit-scrollbar { height: 4px; }
pre.spell-code::-webkit-scrollbar-track { background: transparent; }
pre.spell-code::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

pre.spell-code code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--text);
}

.code-block-wrap:not(:has(.code-label)) pre.spell-code {
  border-radius: var(--radius);
}

pre.spell-code code .ck  { color: #1a6bcc; font-weight: 600; } /* keyword azul */
pre.spell-code code .cn  { color: #1a7a3a; font-weight: 500; } /* nome verde */
pre.spell-code code .cp  { color: #7c3aed; }                    /* propriedade roxa */
pre.spell-code code .cv  { color: #374151; }                    /* valor cinza-escuro */
pre.spell-code code .cm  { color: #9ca3af; font-style: italic; } /* comentário */
pre.spell-code code .cnota { color: #c05621; font-style: italic; } /* nota arquiteto laranja */
pre.spell-code code .cs  { color: #c7254e; }                    /* string */
pre.spell-code code .co  { color: #6b7280; }                    /* operator */

/* Copy button */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  z-index: 1;
}

.code-block-wrap:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { color: #16a34a; border-color: #16a34a; background: #f0fdf4; }

/* ========== Prev/Next Navigation ========== */
.prev-next {
  display: flex;
  gap: 16px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  clear: both;
}

.prev-next-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.prev-next-item:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.prev-next-item.next { align-items: flex-end; text-align: right; }

.prev-next-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.prev-next-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--accent);
}

/* ========== inicio.html special layout ========== */
.learn-start-page {
  padding-top: var(--top-bar-height);
  min-height: 100vh;
  background: var(--bg);
}

.start-hero {
  background: linear-gradient(135deg, #f0f4fd 0%, #ffffff 60%);
  border-bottom: 1px solid var(--border);
  padding: 64px 40px 56px;
  text-align: center;
}

.start-hero-logo {
  margin-bottom: 24px;
}

.start-hero-logo img {
  height: 48px;
}

.start-hero h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.75rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 0.01em;
  border: none;
  padding: 0;
  margin-bottom: 16px;
}

.start-hero p {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

.start-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 40px 80px;
}

.start-section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.start-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 56px;
}

.start-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  cursor: pointer;
}

.start-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.start-card-icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 4px;
}

.start-card-section {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.start-card h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--heading);
  border: none;
  padding: 0;
  margin: 0;
  font-family: 'IBM Plex Sans', sans-serif;
  letter-spacing: normal;
}

.start-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.start-card-links {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.start-card-links span {
  font-size: 0.8125rem;
  color: var(--accent);
  display: block;
}

.start-card:hover .start-card-links span {
  text-decoration: underline;
}

/* Start top bar (no sidebar) */
.start-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top-bar-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

/* ========== Responsive ========== */

/* Tablet — hide TOC */
@media (max-width: 1200px) {
  .article-toc { display: none; }
  h1 { clear: none; }
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 999;
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle { display: flex; }

  .learn-content {
    margin-left: 0;
    padding: 24px 20px 60px;
  }

  h1 { font-size: 1.625rem; }
  h2 { font-size: 1.25rem; }

  .prev-next { flex-direction: column; }

  .start-hero { padding: 40px 20px; }
  .start-hero h1 { font-size: 2rem; }
  .start-content { padding: 32px 20px 60px; }
  .start-cards-grid { grid-template-columns: 1fr; }

  .top-site-link { display: none; }
}

/* Print */
@media print {
  .learn-top-bar, .sidebar, .article-toc, .prev-next { display: none; }
  .learn-content { margin-left: 0; padding: 0; }
  h2 { page-break-after: avoid; }
  pre { page-break-inside: avoid; }
}
