/* Shared styling for the distributed-training-framework note series. */

.blog-post-layout > .blog-sidebar,
.blog-post-layout > .blog-post-content {
  min-width: 0;
}

.blog-post-content .post-series-nav {
  flex-wrap: wrap;
}

.blog-post-content .katex-display {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.2rem;
}

.note-figure {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 1.4rem 0;
  padding: 1rem 1.1rem;
  text-align: center;
}

.note-figure svg {
  height: auto;
  max-width: 100%;
}

.note-figure figcaption {
  color: var(--ink-muted);
  font-size: 0.84rem;
  font-style: italic;
  margin-top: 0.65rem;
}

.key-eq {
  background: rgba(10, 143, 106, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 1.1rem 0;
  overflow-x: auto;
  padding: 0.65rem 1rem;
}

.dt-source {
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(58, 123, 213, 0.08), rgba(10, 143, 106, 0.05));
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-2);
  border-radius: 10px;
  display: grid;
  gap: 0.35rem;
  margin: 1.2rem 0;
  padding: 0.85rem 1rem;
}

.dt-source strong {
  color: var(--brand-2);
  font-family: "Syne", sans-serif;
}

.dt-source p {
  color: var(--ink-muted);
  font-size: 0.88rem;
  margin: 0;
}

.dt-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.85rem 0;
}

.dt-controls label {
  color: var(--ink-muted);
  font: 700 0.8rem/1.4 "Manrope", sans-serif;
}

.dt-controls input[type="range"] {
  accent-color: var(--brand);
  min-width: 150px;
}

.dt-controls strong {
  color: var(--brand);
  font: 800 0.85rem/1.3 "Syne", sans-serif;
  min-width: 3.2rem;
}

.dt-metrics {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1rem 0;
}

.dt-metrics.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dt-metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
  padding: 0.78rem;
  text-align: center;
}

.dt-metric strong {
  color: var(--brand);
  display: block;
  font: 800 1.05rem/1.25 "Syne", sans-serif;
  overflow-wrap: anywhere;
}

.dt-metric span {
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.dt-status {
  background: rgba(10, 143, 106, 0.05);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-muted);
  font-size: 0.86rem;
  min-height: 2.5rem;
  padding: 0.7rem 0.85rem;
  text-align: left;
}

.dt-two-col {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1rem 0;
}

.dt-three-col {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1rem 0;
}

.dt-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
  padding: 0.9rem 1rem;
}

.dt-panel h3 {
  color: var(--brand);
  font-family: "Syne", sans-serif;
  margin: 0 0 0.35rem;
}

.dt-panel p:last-child {
  margin-bottom: 0;
}

.dt-definition {
  background: linear-gradient(135deg, rgba(10, 143, 106, 0.07), rgba(58, 123, 213, 0.05));
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  margin: 1.1rem 0;
  padding: 0.85rem 1rem;
}

.dt-definition > strong:first-child {
  color: var(--brand);
  font-family: "Syne", sans-serif;
}

.dt-warning {
  background: rgba(201, 138, 43, 0.08);
  border: 1px solid rgba(201, 138, 43, 0.32);
  border-radius: 10px;
  margin: 1rem 0;
  padding: 0.8rem 1rem;
}

.dt-table-wrap {
  margin: 1rem 0;
  max-width: 100%;
  overflow-x: auto;
}

.dt-table {
  border-collapse: collapse;
  font-size: 0.86rem;
  width: 100%;
}

.dt-table th,
.dt-table td {
  border: 1px solid var(--line);
  padding: 0.6rem;
  text-align: left;
  vertical-align: top;
}

.dt-table th {
  background: rgba(10, 143, 106, 0.08);
  color: var(--brand);
  font-family: "Syne", sans-serif;
}

.dt-table td code,
.dt-table th code {
  font-size: 0.92em;
}

.dt-algorithm {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 1.1rem 0;
  overflow: hidden;
}

.dt-algorithm-title {
  background: #1a2b22;
  color: #d4e8dc;
  font: 800 0.94rem/1.4 "Syne", sans-serif;
  padding: 0.8rem 1rem;
}

.dt-algorithm-body {
  padding: 0.8rem 1rem 1rem;
}

.dt-algorithm-line {
  align-items: baseline;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  padding: 0.36rem 0;
}

.dt-algorithm-line.indent {
  border-left: 3px solid var(--brand);
  margin-left: 0.6rem;
  padding-left: 0.75rem;
}

.dt-algorithm-number {
  color: var(--ink-muted);
  font: 700 0.72rem/1.4 "Manrope", sans-serif;
  text-align: right;
}

.dt-algorithm-keyword {
  color: var(--brand-2);
  font-weight: 800;
}

.dt-steps {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 1.1rem 0;
  overflow: hidden;
}

.dt-step {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 2rem minmax(0, 1fr);
  padding: 0.85rem 1rem;
}

.dt-step:last-child {
  border-bottom: 0;
}

.dt-step > strong {
  align-items: center;
  background: var(--brand);
  border-radius: 50%;
  color: white;
  display: flex;
  font: 800 0.78rem/1 "Syne", sans-serif;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.dt-step p {
  margin: 0.1rem 0 0.35rem;
}

.dt-step p:last-child {
  margin-bottom: 0;
}

.dt-flow {
  align-items: stretch;
  display: grid;
  gap: 0.55rem;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  margin: 1rem 0;
}

.dt-flow-node {
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 86px;
  padding: 0.7rem;
  text-align: center;
}

.dt-flow-node strong {
  color: var(--brand);
  font-family: "Syne", sans-serif;
}

.dt-flow-node span {
  color: var(--ink-muted);
  font-size: 0.74rem;
  margin-top: 0.25rem;
}

.dt-flow-arrow {
  align-items: center;
  color: var(--brand-2);
  display: flex;
  font-size: 1.35rem;
  font-weight: 800;
}

.dt-takeaway {
  align-items: center;
  background: #1a2b22;
  border-radius: 12px;
  color: #d4e8dc;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: auto minmax(0, 1fr);
  margin: 1.2rem 0;
  padding: 1rem;
}

.dt-takeaway > strong {
  color: #8ee0bd;
  font: 800 0.82rem/1.3 "Syne", sans-serif;
  text-transform: uppercase;
}

.dt-takeaway p {
  margin: 0;
}

.dt-svg {
  display: block;
  height: auto;
  max-width: 100%;
  width: 100%;
}

.dt-scroll {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.dt-scroll > svg {
  max-width: none;
  min-width: 640px;
}

.dt-legend {
  align-items: center;
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.76rem;
  gap: 0.8rem;
  justify-content: center;
  margin: 0.65rem 0;
}

.dt-legend span {
  align-items: center;
  display: inline-flex;
  gap: 0.3rem;
}

.dt-swatch {
  border-radius: 3px;
  display: inline-block;
  height: 10px;
  width: 16px;
}

.dt-swatch.green { background: #0a8f6a; }
.dt-swatch.blue { background: #3a7bd5; }
.dt-swatch.gold { background: #c98a2b; }
.dt-swatch.red { background: #b83a3a; }
.dt-swatch.gray { background: #9eaaa4; }
.dt-swatch.violet { background: #7a5cc4; }

.dt-roadmap {
  display: grid;
  gap: 0.7rem;
  margin: 1.2rem 0;
}

.dt-roadmap-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 0.8rem 1rem;
}

.dt-roadmap-item a {
  font: 800 1rem/1.35 "Syne", sans-serif;
}

.dt-roadmap-item p {
  color: var(--ink-muted);
  font-size: 0.87rem;
  margin: 0.3rem 0 0;
}

.dt-roadmap-item .dt-chapters {
  color: var(--brand-2);
  display: block;
  font: 700 0.72rem/1.4 "Manrope", sans-serif;
  margin-top: 0.35rem;
}

.dt-code {
  background: #1a2b22;
  border-radius: 10px;
  color: #d4e8dc;
  font: 500 0.82rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  margin: 1.1rem 0;
  overflow-x: auto;
  padding: 0.9rem 1rem;
  white-space: pre;
}

.dt-code .c { color: #8fa89b; }
.dt-code .k { color: #8ee0bd; }

@media (max-width: 680px) {
  .dt-metrics,
  .dt-metrics.four,
  .dt-two-col,
  .dt-three-col {
    grid-template-columns: 1fr;
  }

  .dt-flow {
    grid-template-columns: 1fr;
  }

  .dt-flow-arrow {
    justify-content: center;
    transform: rotate(90deg);
  }

  .dt-table {
    font-size: 0.78rem;
    table-layout: fixed;
  }

  .dt-table th,
  .dt-table td {
    overflow-wrap: anywhere;
    padding: 0.45rem 0.35rem;
  }

  .dt-step,
  .dt-takeaway {
    grid-template-columns: 1fr;
  }

  .dt-controls input[type="range"] {
    flex: 1 1 140px;
    min-width: 120px;
  }
}

.dt-roadmap-item.pending {
  border-left-color: var(--line);
  opacity: 0.72;
}

.dt-roadmap-item .dt-pending {
  color: var(--ink-muted);
  font: 800 1rem/1.35 "Syne", sans-serif;
}

.dt-roadmap-item .dt-soon {
  background: rgba(201, 138, 43, 0.14);
  border-radius: 999px;
  color: #8a5f18;
  font: 700 0.66rem/1 "Manrope", sans-serif;
  margin-left: 0.45rem;
  padding: 0.2rem 0.45rem;
  vertical-align: middle;
}
