/* CloudBridge brand stylesheet — Montserrat, brand palette, document layout. */

@font-face {
  font-family: "Montserrat";
  src: url("/static/montserrat.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --cb-ink: #2d2926;
  --cb-blue: #5dc8f0;
  --cb-teal: #5fc8be;
  --cb-grey: #75787b;
  --cb-link: #0a7ea4;
  --cb-page: #ffffff;
  --cb-card: #ffffff;
  --cb-border: #e2e6e8;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.65;
  color: var(--cb-ink);
  background: var(--cb-page);
}

/* --- Chrome: header band, gradient strip, footer --- */

.cb-header {
  background: var(--cb-ink);
  padding: 1rem 1.25rem;
}

.cb-header a {
  display: inline-block;
}

.cb-header img {
  height: 2.2rem;
  width: auto;
  display: block;
}

.cb-strip {
  height: 4px;
  background: linear-gradient(90deg, var(--cb-teal), var(--cb-blue));
}

.cb-footer {
  background: var(--cb-ink);
  color: #cfd2d4;
  padding: 1.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
}

.cb-footer img {
  height: 1.6rem;
  width: auto;
}

/* --- Document body --- */

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0.5rem 0 1.5rem;
}

h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 2.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--cb-teal);
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 2rem;
}

/* Underline properties are set globally: every chrome anchor turns the underline
   off, so these only reach prose links and the hover-underlines chrome restores.
   The hover colour is scoped to section prose, because the chrome anchors keep
   their own hover treatments. */

a {
  color: var(--cb-link);
  text-decoration-color: rgba(10, 126, 164, 0.4);
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.15em;
  overflow-wrap: break-word;
}

main section a:not(.cb-hlink) {
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

main section a:not(.cb-hlink):hover,
main section a:not(.cb-hlink):focus-visible {
  color: var(--cb-link-strong);
  text-decoration-color: var(--cb-link-strong);
}

/* Perma-linkable titles: heading text links to its own anchor. */

section,
h2,
h3,
h4,
h5,
h6 {
  scroll-margin-top: 1rem;
}

.cb-hlink {
  color: inherit;
  text-decoration: none;
}

.cb-hlink:hover {
  text-decoration: underline;
  text-decoration-color: var(--cb-teal);
}

.cb-hlink:hover::after {
  content: " #";
  color: var(--cb-teal);
}

/* Section nav */

nav[aria-label="Contenido"] {
  background: #f5f8fa;
  border: 1px solid var(--cb-border);
  border-left: 4px solid var(--cb-teal);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2.5rem;
}

nav[aria-label="Contenido"] ol {
  margin: 0;
  padding-left: 1.25rem;
}

nav[aria-label="Contenido"] a {
  font-weight: 600;
  text-decoration: none;
}

nav[aria-label="Contenido"] a:hover {
  text-decoration: underline;
}

/* Index page course cards */

main > ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1rem;
}

main > ul > li > a {
  display: block;
  padding: 1.1rem 1.25rem;
  background: var(--cb-card);
  border: 1px solid var(--cb-border);
  border-radius: 10px;
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

main > ul > li > a:hover {
  border-color: var(--cb-teal);
  box-shadow: 0 2px 12px rgba(95, 200, 190, 0.18);
}

/* Code */

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: #eef1f3;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--cb-ink);
  color: #e8e8e8;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Code-copy buttons (markup injected by toggle.js) */

.cb-code {
  position: relative;
  margin: 1rem 0;
}

.cb-code > pre {
  margin: 0;
}

.cb-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  color: #e8e8e8;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.cb-code:hover .cb-copy,
.cb-copy:focus-visible {
  opacity: 1;
}

.cb-copy:hover {
  background: rgba(255, 255, 255, 0.22);
}

.cb-copy.cb-copied {
  color: var(--cb-ink);
  background: var(--cb-teal);
  border-color: var(--cb-teal);
  opacity: 1;
}

/* Thematic breaks: the header's gradient strip, shortened and tapered so it
   separates prose without competing with the section headings. */

hr {
  width: 100%;
  max-width: 18rem;
  height: 2px;
  margin: 2.75rem auto;
  border: 0;
  border-radius: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--cb-teal),
    var(--cb-blue),
    transparent
  );
}

/* The seam between two section files: the same rule, given more room above so
   it reads as a chapter break rather than a paragraph one. The following `h2`
   supplies the space below through its own collapsing margin. */

hr.cb-section-break {
  margin: 3.5rem auto 0;
}

/* Tables */

table {
  border-collapse: collapse;
}

th,
td {
  border: 1px solid var(--cb-border);
  padding: 0.4rem 0.8rem;
}

/* Course→session→section tree */

.cb-tree {
  list-style: none;
  padding: 0;
}

.cb-tree a {
  text-decoration: none;
}

.cb-tree a:hover {
  text-decoration: underline;
}

.cb-tree ul {
  list-style: none;
  padding-left: 1.25rem;
  margin: 0.35rem 0 0.5rem;
}

details.cb-tree-course {
  display: block;
  background: var(--cb-card);
  border: 1px solid var(--cb-border);
  border-radius: 10px;
  padding: 0 1.25rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

details.cb-tree-course:hover {
  border-color: var(--cb-teal);
  box-shadow: 0 2px 12px rgba(95, 200, 190, 0.18);
}

details.cb-tree-course > summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--cb-ink);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 1.1rem 0;
}

details.cb-tree-course[open] > ul {
  padding-bottom: 1rem;
}

details.cb-tree-course > summary::before {
  content: "▸";
  font-size: 0.75rem;
  color: var(--cb-grey);
  transition: transform 0.15s ease;
  display: inline-block;
  width: 0.9rem;
  text-align: center;
}

details.cb-tree-course[open] > summary::before {
  transform: rotate(90deg);
}

details.cb-tree-course > summary::-webkit-details-marker {
  display: none;
}

.cb-tree-session > a {
  font-weight: 600;
  text-decoration: none;
}

.cb-tree li {
  margin: 0.3rem 0;
}

/* Session footer nav */

.cb-session-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--cb-border);
}

.cb-session-nav a {
  font-weight: 600;
  text-decoration: none;
}

.cb-session-nav a:hover {
  text-decoration: underline;
}

.cb-prev {
  grid-column: 1;
  justify-self: start;
}

.cb-up {
  grid-column: 2;
  justify-self: center;
}

.cb-next {
  grid-column: 3;
  justify-self: end;
}

/* Solution cards */

.solucion {
  margin: 1.25rem 0;
  border: 1px solid var(--cb-border);
  border-left: 4px solid var(--cb-teal);
  border-radius: 8px;
  overflow: hidden;
}

.solucion-toggle {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 600;
  color: #ffffff;
  background: var(--cb-teal);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.solucion-toggle:hover {
  background: #4fb3aa;
}

.solucion-cuerpo {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--cb-border);
}

/* Warning admonitions */

.cb-warning {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  position: relative;
  background: #fdf6e3;
  border: 1px solid #f0d9a0;
  border-left: 4px solid #d97706;
  border-radius: 8px;
}

.cb-warning::before {
  content: "⚠";
  position: absolute;
  left: 1rem;
  top: 0.8rem;
  font-size: 1.2rem;
  line-height: 1;
  color: #d97706;
}

.cb-warning > :first-child {
  margin-top: 0;
}

.cb-warning > :last-child {
  margin-bottom: 0;
}

/* Information admonitions */

.cb-info {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  position: relative;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
}

.cb-info::before {
  content: "ℹ";
  position: absolute;
  left: 1rem;
  top: 0.8rem;
  font-size: 1.2rem;
  line-height: 1;
  color: #2563eb;
}

.cb-info > :first-child {
  margin-top: 0;
}

.cb-info > :last-child {
  margin-bottom: 0;
}

/* Extra (collapsible deep-dive) blocks */

details.cb-extra {
  margin: 1.25rem 0;
  border: 1px solid var(--cb-border);
  border-left: 4px solid var(--cb-grey);
  border-radius: 8px;
  overflow: hidden;
}

details.cb-extra > summary {
  padding: 0.7rem 1rem;
  font-weight: 600;
  color: var(--cb-ink);
  background: #f5f6f7;
  cursor: pointer;
  list-style: none;
  transition: background 0.15s ease;
}

details.cb-extra > summary::-webkit-details-marker {
  display: none;
}

details.cb-extra > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.5rem;
  color: var(--cb-grey);
  transition: transform 0.15s ease;
}

details.cb-extra[open] > summary::before {
  transform: rotate(90deg);
}

details.cb-extra > summary:hover {
  background: #eceeef;
}

.cb-extra-cuerpo {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--cb-border);
}

/* Scroll-to-top button — only appears in wide viewports (margin space available) */

#cb-top-btn,
#cb-back-btn {
  position: fixed;
  bottom: 2rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--cb-teal);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 2.5rem;
  text-align: center;
  text-decoration: none;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

#cb-top-btn:hover,
#cb-back-btn:hover {
  background: #4fb3aa;
}

@media (min-width: 56rem) {
  #cb-top-btn.cb-top-visible,
  #cb-back-btn.cb-top-visible {
    display: block;
    opacity: 1;
  }
}

/* Slideshow entry link on session pages */

.cb-slides-link {
  margin: 0 0 1.5rem;
}

.cb-slides-link a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  background: var(--cb-teal);
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s ease;
}

.cb-slides-link a:hover {
  background: #4fb3aa;
  text-decoration: none;
}

/* Mermaid diagrams: centered, with no code-block chrome. Before mermaid.js runs,
   the raw source is hidden to avoid a flash of diagram text. */
pre.mermaid {
  position: relative;
  background: none;
  border: none;
  padding: 0;
  margin: 1.75rem 0;
  text-align: center;
  visibility: hidden;
}
pre.mermaid[data-processed="true"] {
  visibility: visible;
}
pre.mermaid svg {
  max-width: 100%;
  height: auto;
}

/* Maximize button, top-right of each rendered diagram. */
.cb-diagram-zoom {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--cb-ink, #2d2926);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 0.4rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}
pre.mermaid:hover .cb-diagram-zoom,
.cb-diagram-zoom:focus {
  opacity: 1;
}

/* Full-viewport overlay shared by guide and slides. */
.cb-diagram-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  background: rgba(20, 18, 16, 0.92);
  cursor: zoom-out;
}
.cb-diagram-overlay.cb-open {
  display: flex;
}
.cb-diagram-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cb-diagram-stage svg {
  max-width: 100%;
  max-height: 100%;
}

/* Live toasts (SSE notifications), bottom-right, newest on top of the stack. */
.cb-toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 11000;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  max-width: min(360px, 90vw);
  pointer-events: none;
}
.cb-toast {
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
  border-left: 4px solid #888;
  background: #2d2926;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.cb-toast.cb-toast-in {
  opacity: 1;
  transform: translateY(0);
}
.cb-toast-pod {
  font-weight: 700;
}
.cb-toast-body {
  opacity: 0.9;
}
.cb-toast-ok {
  border-left-color: #3fb950;
}
.cb-toast-fail {
  border-left-color: #f85149;
}
.cb-toast-info {
  border-left-color: var(--cb-teal, #5fc8be);
}

/* ---------------------------------------------------------------------------
   App widget theme overrides for the guide (light theme).
   Structural rules are in cb-widgets.css (loaded before this file).
   --------------------------------------------------------------------------- */

/* The guide's reading surface is slightly larger than slides; keep spacing
   comfortable at document scale. */
.cb-app {
  margin: 1.25rem 0;
}

.cb-app-btn {
  font-size: 0.95rem;
}

.cb-app-status,
.cb-app-value {
  color: var(--cb-grey, #75787b);
}
