/* ==========================================================
   UNLu / DCB — Sistemas Distribuidos y Programación Paralela
   Branding aligned with pptx-unlu palette
   ========================================================== */

:root {
  --navy: #1E3A5F;
  --dark-blue: #2C5282;
  --mid-blue: #3182CE;
  --light-blue: #EBF4FF;
  --white: #FFFFFF;
  --off-white: #F7FAFC;
  --gray: #718096;
  --dark-gray: #2D3748;
  --light-gray: #E2E8F0;
  --accent: #E53E3E;
  --green: #38A169;
  --orange: #DD6B20;
  --purple: #805AD5;

  --content-max: 880px;
  --sidebar-w: 280px;
  --header-h: 96px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--dark-gray);
  background: var(--off-white);
  -webkit-font-smoothing: antialiased;
}

/* ============ HEADER ============ */
.unlu-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--dark-blue) 100%);
  color: var(--white);
  border-bottom: 4px solid var(--mid-blue);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(30, 58, 95, 0.18);
}

.unlu-header .brand {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 32px 10px;
  max-width: 1400px;
  margin: 0 auto;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.unlu-header .brand:hover {
  opacity: 0.85;
}

.unlu-header .brand .logo {
  height: 56px;
  width: auto;
  flex-shrink: 0;
}

.unlu-header .brand .logo.unlu { height: 60px; }
.unlu-header .brand .logo.dcb  { height: 50px; }

.unlu-header .brand-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.unlu-header .institution {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.unlu-header .department {
  font-size: 13px;
  font-weight: 400;
  color: var(--light-blue);
  letter-spacing: 0.5px;
}

.unlu-header .course-bar {
  background: rgba(0, 0, 0, 0.22);
  padding: 8px 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13px;
  max-width: 1400px;
  margin: 0 auto;
}

.unlu-header .course-bar .course {
  font-weight: 600;
  color: var(--white);
}

.unlu-header .course-bar .year {
  background: var(--mid-blue);
  color: var(--white);
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.unlu-header .course-bar .instructor {
  color: var(--light-blue);
  margin-left: auto;
}

/* ============ LAYOUT ============ */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1400px;
  margin: 0 auto;
  gap: 0;
}

/* Allow grid items to shrink below their intrinsic content size, so wide
   children (pre, table, long URLs) trigger their own overflow-x instead of
   stretching the grid track. Without this, the layout grows horizontally
   on narrow viewports and breaks responsive design. */
.layout > * { min-width: 0; }

/* ============ SIDEBAR / TOC ============ */
.toc-sidebar {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 24px 18px 24px 28px;
  border-right: 1px solid var(--light-gray);
  background: var(--white);
  font-size: 14px;
}

.toc-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--mid-blue);
}

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

.toc-sidebar ul ul {
  padding-left: 14px;
  margin-top: 4px;
  border-left: 2px solid var(--light-gray);
}

.toc-sidebar li {
  margin: 4px 0;
}

.toc-sidebar a {
  color: var(--dark-gray);
  text-decoration: none;
  display: block;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.toc-sidebar a:hover {
  background: var(--light-blue);
  color: var(--navy);
}

.toc-sidebar > ul > li > a {
  font-weight: 600;
  color: var(--navy);
}

/* ============ MAIN CONTENT ============ */
.content {
  padding: 40px 56px 80px;
  max-width: calc(var(--content-max) + 112px);
  background: var(--white);
  min-height: calc(100vh - var(--header-h));
}

.content > h1:first-child {
  margin-top: 0;
}

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4, h5, h6 {
  color: var(--navy);
  font-weight: 700;
  line-height: 1.3;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

h1 {
  font-size: 32px;
  border-bottom: 3px solid var(--mid-blue);
  padding-bottom: 12px;
  margin: 0 0 24px;
}

h2 {
  font-size: 24px;
  margin: 40px 0 16px;
  padding-left: 14px;
  border-left: 5px solid var(--mid-blue);
}

h3 {
  font-size: 19px;
  margin: 32px 0 12px;
  color: var(--dark-blue);
}

h4 {
  font-size: 16px;
  margin: 24px 0 10px;
  color: var(--dark-blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

p {
  margin: 12px 0;
}

strong { color: var(--navy); font-weight: 700; }

a {
  color: var(--mid-blue);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
  overflow-wrap: anywhere;
  word-break: break-word;
}

a:hover { border-bottom-color: var(--mid-blue); }

/* Don't break navigation buttons / pills (they have short labels) */
.back-to-menu,
.tp-card .tp-num,
.banner-pill,
.toc-btn,
.page-prev-next a,
.flow-step,
.unlu-header .brand,
.unlu-footer a {
  overflow-wrap: normal;
  word-break: normal;
}

/* ============ LISTS ============ */
ul, ol { padding-left: 24px; margin: 12px 0; }
li { margin: 6px 0; }
li > p { margin: 4px 0; }

ul li::marker { color: var(--mid-blue); }
ol li::marker { color: var(--navy); font-weight: 700; }

/* ============ CODE ============ */
code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--light-blue);
  color: var(--navy);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--light-gray);
  /* Allow long inline code (URLs, identifiers) to break on narrow viewports */
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Inline code inside pre keeps its no-wrap behavior (pre handles overflow-x) */
pre code, pre code.sourceCode { overflow-wrap: normal; word-break: normal; }

pre {
  background: #1A1A2E;
  color: #E2E8F0;
  padding: 18px 22px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.55;
  border-left: 4px solid var(--mid-blue);
  margin: 18px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: none;
  font-size: inherit;
}

/* Pandoc highlight (skylighting / tango-ish) overrides for dark bg */
pre.sourceCode { background: #1A1A2E; }
code.sourceCode > span { color: #E2E8F0; }
.sourceCode .kw { color: #FF79C6; }   /* keywords */
.sourceCode .dt { color: #8BE9FD; }   /* data types */
.sourceCode .st { color: #F1FA8C; }   /* strings */
.sourceCode .co { color: #6272A4; font-style: italic; }
.sourceCode .dv, .sourceCode .fl { color: #BD93F9; }
.sourceCode .fu { color: #50FA7B; }   /* functions */
.sourceCode .op { color: #FF79C6; }
.sourceCode .va { color: #F8F8F2; }
.sourceCode .cf { color: #FF79C6; }   /* control flow */
.sourceCode .bu { color: #8BE9FD; }   /* built-in */
.sourceCode .at { color: #50FA7B; }
.sourceCode .er { color: #FF5555; }

/* ============ TABLES ============ */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  overflow: hidden;
}

th {
  background: var(--navy);
  color: var(--white);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

tr:nth-child(even) td { background: var(--off-white); }
tr:hover td { background: var(--light-blue); }

/* ============ BLOCKQUOTE ============ */
blockquote {
  margin: 18px 0;
  padding: 14px 22px;
  background: var(--light-blue);
  border-left: 5px solid var(--mid-blue);
  color: var(--dark-gray);
  border-radius: 0 6px 6px 0;
}

blockquote p { margin: 6px 0; }

/* ============ HORIZONTAL RULES ============ */
hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--mid-blue), transparent);
  margin: 36px 0;
}

/* ============ IMAGES ============ */
img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ============ FOOTER ============ */
.unlu-footer {
  background: var(--navy);
  color: var(--light-blue);
  padding: 24px 32px;
  text-align: center;
  font-size: 13px;
  border-top: 4px solid var(--mid-blue);
}

.unlu-footer a { color: var(--light-blue); }

/* ============ INDEX / LANDING ============ */
.tp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.tp-card {
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-left: 5px solid var(--mid-blue);
  border-radius: 8px;
  padding: 22px;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.tp-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(30, 58, 95, 0.15);
  border-left-color: var(--accent);
  border-bottom-color: transparent;
}

.tp-card .tp-num {
  display: inline-block;
  background: var(--navy);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.tp-card h3 {
  margin: 6px 0 8px;
  font-size: 17px;
  color: var(--navy);
}

.tp-card .tp-desc {
  font-size: 13px;
  color: var(--gray);
  line-height: 1.5;
  margin: 0;
}

.tp-card .tp-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--light-gray);
  font-size: 12px;
  color: var(--gray);
  display: flex;
  justify-content: space-between;
}

.coming-soon {
  opacity: 0.55;
  border-left-color: var(--gray);
  cursor: not-allowed;
  pointer-events: none;
}

.coming-soon .tp-num { background: var(--gray); }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .toc-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--light-gray);
    padding: 18px 24px;
  }
  /* !important needed to override inline style="padding:..." on index.html */
  .content { padding: 28px 24px 60px !important; }
  .unlu-header .brand { padding: 12px 20px 8px; }
  .unlu-header .institution { font-size: 16px; }
  .unlu-header .department { font-size: 12px; }
  .unlu-header .course-bar { padding: 8px 20px; font-size: 12px; }
  .unlu-header .course-bar .instructor { margin-left: 0; width: 100%; }
  h1 { font-size: 26px; }
  h2 { font-size: 21px; }
  /* Tables: allow horizontal scroll when too wide for viewport */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 560px) {
  .unlu-header .brand .logo.unlu { height: 44px; }
  .unlu-header .brand .logo.dcb  { height: 38px; }
  .unlu-header .brand-text { font-size: 13px; }
  .unlu-header .institution { font-size: 14px; }
  .unlu-header .department { font-size: 11px; line-height: 1.25; }
  .unlu-header .brand { gap: 12px; padding: 10px 14px 6px; }
  .unlu-header .brand .logo.dcb { height: 34px; }
  .unlu-header .course-bar {
    padding: 6px 14px; font-size: 11px; gap: 10px;
    flex-direction: column; align-items: flex-start;
  }
  .unlu-header .course-bar .instructor { margin-left: 0; }
  /* !important needed to override inline style="padding:..." on index.html */
  .content { padding: 20px 14px 40px !important; }
  /* Headings shrink for narrow screens */
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }
  details.section-collapsible > summary { font-size: 18px; padding-left: 12px; }
  /* TOC sidebar narrower padding on small screens */
  .toc-sidebar { padding: 14px 16px; }
  /* Inline TOC tighter padding */
  .toc-inline { padding: 12px 14px; margin: 16px 0 24px; }
  /* Code blocks: smaller font */
  pre { padding: 14px 16px; font-size: 12.5px; }
  /* Make sidebar FAB smaller */
  .sidebar-toggle-btn.sidebar-show { width: 42px; height: 42px; bottom: 16px; left: 16px; font-size: 18px; }
  /* Floating breadcrumb spacing */
  .page-breadcrumb { font-size: 11px; flex-wrap: wrap; }
  /* Page nav top: tighten */
  .page-nav-top { gap: 8px; margin-bottom: 14px; padding-bottom: 10px; }
  .back-to-menu { font-size: 12px; padding: 7px 12px; }
  /* TP cards / index landing: ensure they breathe */
  .tp-grid { grid-template-columns: 1fr; gap: 14px; }
  .tp-card { padding: 18px; }
  .tp-card .tp-meta { flex-direction: column; gap: 4px; align-items: flex-start; }
  /* Footer */
  .unlu-footer { padding: 18px 14px; font-size: 12px; line-height: 1.5; }
}

/* ============ SIDEBAR TOGGLE ============ */
.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.toc-header .toc-title { margin: 0; }

.sidebar-toggle-btn {
  font-family: inherit;
  cursor: pointer;
  background: white;
  border: 1px solid var(--light-gray);
  color: var(--gray);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: all 0.12s ease;
}
.sidebar-toggle-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Floating "show" button — bottom-left FAB, only visible when sidebar is hidden.
   Lives ABOVE the sticky header (which is z-index 100). */
.sidebar-toggle-btn.sidebar-show {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 200;
  display: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 20px;
  color: white;
  background: var(--mid-blue);
  border: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}
.sidebar-toggle-btn.sidebar-show:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
}
.sidebar-toggle-btn.sidebar-show.visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* When sidebar is hidden, collapse the layout grid */
.layout.sidebar-hidden { grid-template-columns: 1fr !important; }
.layout.sidebar-hidden .toc-sidebar { display: none; }

/* ============ INLINE TOC (Índice del documento) ============ */
.toc-inline {
  background: #f7faff;
  border: 1px solid var(--light-gray);
  border-left: 4px solid var(--mid-blue);
  border-radius: 6px;
  padding: 14px 20px;
  margin: 20px 0 32px;
  font-size: 14px;
}
.toc-inline > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--navy);
  font-size: 15px;
  padding: 4px 0;
  list-style: none;
  user-select: none;
}
.toc-inline > summary::-webkit-details-marker { display: none; }
.toc-inline > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  color: var(--accent);
  transition: transform 0.15s ease;
}
.toc-inline[open] > summary::before { transform: rotate(90deg); }
.toc-inline ul {
  margin: 12px 0 4px;
  padding-left: 20px;
  list-style: none;
}
.toc-inline ul ul { margin: 4px 0; padding-left: 14px; }
.toc-inline li { margin: 4px 0; }
.toc-inline a {
  color: var(--dark-blue);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.toc-inline a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.toc-inline > ul > li > a { font-weight: 600; }

.toc-controls {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--light-gray);
  font-size: 12px;
}
.toc-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray);
  background: transparent;
  border: 0;
  border-bottom: 1px dotted var(--gray);
  padding: 0 0 1px 0;
  margin: 0;
  cursor: pointer;
  line-height: 1.4;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.toc-btn:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  border-bottom-style: solid;
}
.toc-btn::before {
  display: inline-block;
  margin-right: 4px;
  font-size: 11px;
  color: inherit;
  vertical-align: baseline;
}
.toc-btn[data-action="expand-all"]::before { content: '＋'; }
.toc-btn[data-action="collapse-all"]::before { content: '−'; }

/* ============ COLLAPSIBLE H2 SECTIONS ============ */
details.section-collapsible {
  margin: 40px 0 16px;
}
details.section-collapsible > summary {
  cursor: pointer;
  list-style: none;
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  padding: 6px 0 6px 14px;
  border-left: 5px solid var(--mid-blue);
  position: relative;
  user-select: none;
}
details.section-collapsible > summary::-webkit-details-marker { display: none; }
details.section-collapsible > summary::after {
  content: '▾';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--gray);
  transition: transform 0.15s ease;
}
details.section-collapsible:not([open]) > summary::after {
  transform: translateY(-50%) rotate(-90deg);
}
details.section-collapsible > summary:hover {
  color: var(--accent);
  border-left-color: var(--accent);
}
details.section-collapsible:not([open]) > summary {
  border-left-color: var(--gray);
  margin-bottom: 0;
}
/* Avoid double-margin on first h3 inside details */
details.section-collapsible > h3:first-of-type,
details.section-collapsible > p:first-of-type {
  margin-top: 16px;
}

/* ============ PRINT ============ */
@media print {
  .unlu-header { position: static; box-shadow: none; }
  .toc-sidebar, .toc-inline { display: none; }
  .layout { grid-template-columns: 1fr; }
  .content { padding: 0; max-width: 100%; }
  pre { box-shadow: none; }
  body { background: white; font-size: 11pt; }
  a { color: var(--navy); }
  /* Force all collapsibles open when printing */
  details.section-collapsible { display: block !important; }
  details.section-collapsible > summary { list-style: none; pointer-events: none; }
  details.section-collapsible > summary::after { display: none; }
}

/* ============ PAGE NAV (back to menu) ============ */
.page-nav-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--light-gray);
}

.page-nav-bottom {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 2px solid var(--light-gray);
  text-align: center;
}

.back-to-menu {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease;
}

.back-to-menu:hover {
  background: var(--accent);
  color: #fff;
}

.banner-pill {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
  letter-spacing: 0.6px;
}

/* ============ BREADCRUMB (template.html, top of every page) ============ */
.page-breadcrumb {
  font-size: 12px;
  color: var(--gray);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}
.page-breadcrumb a {
  color: var(--gray);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.page-breadcrumb a:hover {
  color: var(--mid-blue);
  border-bottom-color: var(--mid-blue);
}
.page-breadcrumb .sep {
  color: var(--gray);
  opacity: 0.55;
  font-weight: 400;
}
.page-breadcrumb .current {
  color: var(--navy);
  font-weight: 700;
}

/* ============ PAGE PREV / NEXT NAV (template.html, bottom of body) ============ */
.page-prev-next {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  margin: 48px 0 16px;
}
.page-prev-next .prev-link,
.page-prev-next .next-link {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid var(--navy);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 64px;
}
.page-prev-next .prev-link { justify-content: flex-start; text-align: left; }
.page-prev-next .next-link { justify-content: flex-end;   text-align: right; }
.page-prev-next a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.18);
}
.page-prev-next .arrow {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.page-prev-next .nav-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.page-prev-next .nav-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  opacity: 0.75;
}
.page-prev-next .nav-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 560px) {
  .page-prev-next { flex-direction: column; gap: 10px; }
  .page-prev-next .prev-link,
  .page-prev-next .next-link {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
  .page-prev-next .next-link { flex-direction: row-reverse; }
}

/* ============ FLOW DIAGRAM (index.html — visual chronological flow) ============ */
.flow-diagram {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0 36px;
  padding: 18px;
  background: var(--off-white);
  border: 1px solid var(--light-gray);
  border-radius: 10px;
}
.flow-step {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 14px 12px;
  border-radius: 8px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  border: 2px solid transparent;
}
.flow-step .step-num {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.flow-step .step-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}
.flow-step .step-status {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: 0.2px;
}
.flow-step.open {
  background: var(--navy);
  color: #fff;
  border-color: var(--mid-blue);
}
.flow-step.open .step-num,
.flow-step.open .step-name { color: #fff; }
.flow-step.open .step-status { color: var(--light-blue); }
.flow-step.open:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(30, 58, 95, 0.22);
  border-color: var(--accent);
}
.flow-step.closed {
  background: var(--light-gray);
  color: var(--dark-gray);
  border-color: var(--light-gray);
  opacity: 0.85;
}
.flow-step.closed .step-num { color: var(--navy); }
.flow-step.closed .step-name { color: var(--dark-gray); }
.flow-step.closed .step-status { color: var(--green); }
.flow-step.closed:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
  border-color: var(--gray);
  opacity: 1;
}
.flow-arrow {
  align-self: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--mid-blue);
  flex-shrink: 0;
  user-select: none;
}
.flow-arrow-strong {
  font-size: 28px;
  color: #15803d;
}

/* Ejercitación 3 — Blockchain (módulo nuevo, naranja para diferenciarla) */
.flow-step-blockchain {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
  border-color: #f59e0b !important;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}
.flow-step-blockchain .step-num,
.flow-step-blockchain .step-name { color: #fff !important; }
.flow-step-blockchain .step-status { color: #fde68a !important; }
.flow-step-blockchain:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.40);
  border-color: #fbbf24 !important;
}

/* TPC — el destino final (verde, más grande visualmente) */
.flow-step-tpc {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%) !important;
  border-color: #22c55e !important;
  flex-basis: 220px !important;
  box-shadow: 0 2px 10px rgba(21, 128, 61, 0.30);
  position: relative;
}
.flow-step-tpc .step-num,
.flow-step-tpc .step-name { color: #fff !important; }
.flow-step-tpc .step-num { font-size: 14px; }
.flow-step-tpc .step-name { font-size: 14px; font-weight: 600; }
.flow-step-tpc .step-status { color: #bbf7d0 !important; }
.flow-step-tpc:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(21, 128, 61, 0.40);
  border-color: #4ade80 !important;
}
@media (max-width: 720px) {
  .flow-diagram { flex-direction: column; align-items: stretch; }
  .flow-step { max-width: none; }
  .flow-arrow {
    transform: rotate(90deg);
    font-size: 20px;
    margin: 0 auto;
  }
}

/* ---- "Próximamente" / next-up variant ----
   For practices that are visible/linkable but not yet the active deliverable.
   Used by both flow-step and tp-card. Muted accent vs the active entrega. */
.flow-step.open.next-up {
  background: var(--mid-blue);
  border-color: var(--accent);
  border-style: dashed;
}
.flow-step.open.next-up .step-status { color: #fff; opacity: 0.92; }

.tp-card.next-up {
  border-left-color: var(--accent);
  border-left-style: dashed;
  background: var(--off-white);
}
.tp-card.next-up .tp-num {
  background: var(--accent);
  color: var(--navy);
}
