/* Chapter 9, Learning Depth: figure-specific styles (shared .sim styles live in demos.css) */

.ld-plot,
.ld-loss,
.ld-gd,
.ld-rf {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: rgba(207, 185, 125, 0.06);
  touch-action: none;
}

.ld-loss {
  margin-top: 0.5rem;
}

.ld-gd {
  cursor: grab;
}

.ld-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  opacity: 0.8;
}

.ld-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0.35rem;
  border-radius: 50%;
  vertical-align: -1px;
}

.ld-legend .ld-dot-train { background: #cfb97d; }
.ld-legend .ld-dot-val { border: 1.5px solid currentColor; opacity: 0.7; }
.ld-legend .ld-line-pred { width: 18px; height: 3px; border-radius: 2px; background: #a78a3b; vertical-align: 3px; }
.ld-legend .ld-line-true { width: 18px; height: 0; border-radius: 0; border-top: 2px dashed currentColor; opacity: 0.5; vertical-align: 3px; }

/* U-Net diagram */

.ld-unet {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1rem;
  align-items: start;
}

.ld-unet svg {
  display: block;
  width: 100%;
  height: auto;
}

.ld-unet canvas {
  display: block;
  width: 100%;
  border-radius: 12px;
  image-rendering: auto;
}

.ld-unet__caption {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  opacity: 0.75;
  text-align: center;
}

.ld-unet__block {
  stroke-width: 1.5;
  cursor: pointer;
  transition: filter 150ms ease, stroke-width 150ms ease;
}

.ld-unet__block--enc { fill: rgba(207, 185, 125, 0.35); stroke: #a78a3b; }
.ld-unet__block--dec { fill: rgba(140, 41, 129, 0.25); stroke: #8c2981; }
.ld-unet__block--mid { fill: rgba(222, 73, 104, 0.35); stroke: #de4968; }

.ld-unet__block:hover,
.ld-unet__block:focus,
.ld-unet__block.is-hot {
  stroke-width: 3;
  outline: none;
  filter: brightness(1.15);
}

.ld-unet__label,
.ld-unet__title,
.ld-unet__note {
  fill: currentColor;
  font-family: "Nunito Sans", sans-serif;
  text-anchor: middle;
}

.ld-unet__label { font-size: 11px; opacity: 0.7; }
.ld-unet__title { font-size: 13px; font-weight: 800; opacity: 0.8; }
.ld-unet__note { font-size: 12px; opacity: 0.7; }

.ld-unet__arrow {
  fill: none;
  stroke: currentColor;
  stroke-opacity: 0.35;
  stroke-width: 1.5;
}

.ld-unet__skip {
  fill: none;
  stroke: #cfb97d;
  stroke-width: 2.5;
  stroke-dasharray: 6 4;
}

/* Depth viewer */

.ld-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  margin: 0.8rem 0 0;
}

.ld-metrics span {
  padding: 0.25rem 0.7rem;
  border: 1px solid rgba(207, 185, 125, 0.4);
  border-radius: 999px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.ld-metrics b {
  margin-right: 0.3rem;
  color: #a78a3b;
}

html[data-theme="dark"] .ld-metrics b {
  color: #d6bd72;
}

.ld-probe {
  min-height: 1.4em;
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
}

.ld-pair canvas {
  cursor: crosshair;
  touch-action: none;
}

/* Coded aperture */

.ld-coded-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1rem;
  align-items: start;
}

.ld-coded {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: #000;
}

.ld-psfs {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

.ld-blurplot {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  border-radius: 10px;
  background: rgba(207, 185, 125, 0.06);
}

.ld-side-title {
  margin: 0 0 0.4rem;
  font-family: "Nunito Sans", sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

@media (max-width: 700px) {
  .ld-unet,
  .ld-coded-grid {
    grid-template-columns: 1fr;
  }
}
