// Road-tree for the on-device-training chapter.
//
// Pure CSS asset plugin: the tree itself is raw HTML written inline in
// content/genai/rsi/on-device-training/README.md (div.odt-roadmap). This plugin
// only ships the stylesheet, so the CSS is served as a proper <link> instead
// of an inline <style> block (which HonKit would wrap in <p>).
//
// Structure:
//   .odt-roadmap
//     .odt-root-wrap > .odt-root          root node
//     .odt-branches                       horizontal trunk line (::before)
//       .odt-lanes
//         .odt-lane [.odt-lane-cpu|-gpu|-npu|-sig]   vertical stub (::before)
//           .odt-lane-head                lane title + subtitle
//           .odt-card                     one work per card
//             .odt-card-head > .odt-name + .odt-year
//             .odt-tags > .odt-tag .odt-t-*           feature tags
//             .odt-note                   one-line takeaway

.odt-roadmap {
  margin: 1.4em 0 1.8em;
  font-size: 13px;
}

.odt-root-wrap {
  text-align: center;
  position: relative;
  margin-bottom: 18px;
}

.odt-root {
  display: inline-block;
  background: #1e293b;
  color: #fff;
  font-weight: 600;
  padding: 6px 24px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.odt-root small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  opacity: 0.75;
}

.odt-root-wrap::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -18px;
  width: 1px;
  height: 18px;
  background: #94a3b8;
  transform: translateX(-50%);
}

.odt-branches {
  position: relative;
}

.odt-branches::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12.5%;
  right: 12.5%;
  border-top: 1px solid #94a3b8;
}

.odt-lanes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.odt-lane {
  min-width: 0;
  position: relative;
  padding-top: 16px;
}

.odt-lane::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 16px;
  background: #94a3b8;
  transform: translateX(-50%);
}

.odt-lane-head {
  font-weight: 600;
  text-align: center;
  margin-bottom: 10px;
  padding: 6px 4px;
  border-radius: 8px;
  font-size: 13.5px;
}

.odt-lane-head span {
  display: block;
  font-weight: 400;
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}

.odt-lane-cpu .odt-lane-head { background: #fef3c7; color: #92400e; }
.odt-lane-gpu .odt-lane-head { background: #dbeafe; color: #1e40af; }
.odt-lane-npu .odt-lane-head { background: #ede9fe; color: #5b21b6; }
.odt-lane-sig .odt-lane-head { background: #fce7f3; color: #9d174d; }

.odt-card {
  position: relative;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #64748b;
  border-radius: 10px;
  padding: 8px 10px 9px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s, box-shadow 0.15s;
}

.odt-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

/* whole card clickable -> official paper page (stretched link) */
a.odt-stretch {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  border-radius: 10px;
}

a.odt-stretch:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* keep the [n] reference superscripts clickable above the stretched link */
.odt-card sup.cite {
  position: relative;
  z-index: 2;
}

.odt-year {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  transition: color 0.15s;
}

.odt-card:hover .odt-year {
  color: #3b82f6;
}

.odt-lane-cpu .odt-card { border-left-color: #f59e0b; }
.odt-lane-gpu .odt-card { border-left-color: #3b82f6; }
.odt-lane-npu .odt-card { border-left-color: #8b5cf6; }
.odt-lane-sig .odt-card { border-left-color: #ec4899; }

.odt-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  row-gap: 2px;
}

.odt-name {
  font-weight: 700;
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.odt-year {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  transition: color 0.15s;
  margin-left: auto;
}

.odt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0;
}

.odt-tag {
  font-size: 10.5px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 9px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.odt-note {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.odt-t-blue   { background: #dbeafe; color: #1d4ed8; }
.odt-t-amber  { background: #fef3c7; color: #92400e; }
.odt-t-green  { background: #dcfce7; color: #15803d; }
.odt-t-purple { background: #ede9fe; color: #6d28d9; }
.odt-t-red    { background: #fee2e2; color: #b91c1c; }
.odt-t-teal   { background: #ccfbf1; color: #0f766e; }
.odt-t-pink   { background: #fce7f3; color: #be185d; }
.odt-t-gray   { background: #f1f5f9; color: #334155; }

/* <=4-column layout keeps the org-chart trunk; narrower widths reflow the
   lanes into a 2x2 grid and then a single column, without connectors */
@media (max-width: 1200px) {
  .odt-branches::before,
  .odt-lane::before,
  .odt-root-wrap::after { display: none; }
  .odt-lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .odt-lanes { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  .odt-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: none;
  }
  .odt-note { color: #cbd5e1; }
  .odt-year { color: #94a3b8; }
  .odt-branches::before,
  .odt-lane::before,
  .odt-root-wrap::after { background: #475569; }
  .odt-t-gray { background: #334155; color: #e2e8f0; }
}
