/* Program drilldown (overview panel): beginner view of the current program.
   Layout per row: fixed 20px [+] column | icon badge + kind word | text.
   Children nest inside .dd-kids (collapsed by default) with a dashed guide
   line under the parent badge. Tokens come from briora-theme.css. */

.dd-panel { padding: 10px 14px 24px; overflow-y: auto; }
.dd-state { color: var(--br-muted); font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.dd-state-failed { color: var(--br-raspberry); }
.dd-retry { margin-left: 6px; }

/* hourglass flip while a generation is running */
.dd-hourglass { display: inline-block; font-size: 15px; animation: dd-hourglass 2s ease-in-out infinite; }
@keyframes dd-hourglass {
  0%, 40% { transform: rotate(0deg); }
  50%, 90% { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}

/* user edits leave the last generated view visible but dimmed behind a cover
   offering a manual refresh (regeneration costs tokens — never automatic) */
.dd-stale { position: relative; }
.dd-cover {
  position: absolute; inset: 0; background: rgba(255, 255, 255, 0.8);
  display: flex; justify-content: center; padding-top: 60px; z-index: 2;
}
.dd-cover-msg {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  height: fit-content; position: sticky; top: 60px;
  background: var(--br-paper); border: 1px solid var(--br-hairline); border-radius: 10px;
  padding: 18px 24px; font-size: 13.5px; color: var(--br-ink);
  box-shadow: 0 2px 10px rgba(16, 32, 48, 0.08);
}
.dd-cover-msg .bi { font-size: 22px; color: var(--br-muted); }

.dd-title { font-size: 19px; font-weight: 700; margin: 4px 0 4px; }
.dd-essence { font-size: 14.5px; line-height: 1.55; margin: 0 0 14px; }

.dd-sec {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--br-muted); padding: 18px 0 4px; border-bottom: 1px solid var(--br-ink);
  margin-bottom: 6px;
}

.dd-node > .dd-row { border-top: 1px dashed var(--br-hairline); }
.dd-node:first-child > .dd-row, .dd-kids .dd-node > .dd-row { border-top: 0; }

.dd-row { display: grid; grid-template-columns: 20px 200px 1fr; column-gap: 14px; padding: 7px 0; }
/* cells hug the row's TOP edge — tall rows (pseudo blocks, math lines) grow
   downwards while button, badge and first text line stay aligned */
.dd-c1, .dd-c2, .dd-c3 { min-width: 0; align-self: start; }

/* pseudo-code rows span from right after the [+] column to the row's edge */
.dd-row-code .dd-c3 { grid-column: 2 / -1; }

/* [+]/[−] control: always in the first column, never indented */
.dd-expbtn {
  width: 18px; height: 18px; padding: 0; margin-top: 8px; display: inline-flex;
  align-items: center; justify-content: center; border: 1px solid var(--br-hairline);
  background: var(--br-paper); border-radius: 3px; color: var(--br-muted);
  font-family: var(--bs-font-monospace); font-size: 12px; line-height: 1; cursor: pointer;
}
.dd-expbtn:hover { color: var(--br-bluegray); border-color: var(--br-bluegray); }

.dd-c2 { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.dd-badge {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.dd-badge .bi { color: #fff; font-size: 16px; line-height: 1; }
.dd-badge-sub { width: 28px; height: 28px; }
.dd-badge-sub .bi { font-size: 13px; }
.dd-klabel {
  flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; white-space: nowrap;
}

.dd-c3 { display: flex; flex-direction: column; padding-top: 7px; }
.dd-text { font-size: 13.5px; line-height: 1.5; }
.dd-strong { font-weight: 600; }
.dd-math { font-size: 12px; font-style: italic; color: var(--br-muted); margin-top: 1px; }
.dd-vrow .dd-cname { font-family: var(--bs-font-monospace); font-size: 11px; color: var(--br-plum-ink); }
.dd-minor { color: var(--br-faint); font-style: italic; }
.dd-minor .dd-cname { color: var(--br-faint); }
.dd-grouplbl { font-size: 11.5px; font-weight: 600; color: var(--br-muted); }

/* collapsed children container + dashed bracket under the parent badge */
.dd-kids { position: relative; }
.dd-kids::before {
  content: ""; position: absolute; top: 2px; bottom: 6px; left: var(--dd-gx, 50px);
  border-left: 1px dashed var(--br-hairline);
}

pre.dd-pseudo {
  background: var(--br-tint-plum); border-radius: 3px; padding: 7px 10px;
  margin: 2px 0 4px; font-family: var(--bs-font-monospace); font-size: 11.5px;
  line-height: 1.6; overflow-x: auto; color: var(--br-plum-ink); white-space: pre;
  /* paint above the .dd-kids::before guide line the widened block now crosses */
  position: relative;
}

.dd-swatch {
  display: inline-block; width: 13px; height: 13px; border-radius: 3px;
  border: 1px solid var(--br-hairline); margin-left: 7px; vertical-align: -2px;
}
.dd-pinchip {
  display: inline-block; background: var(--br-raspberry); color: #fff;
  border-radius: 6px; padding: 1px 7px; margin-left: 7px; font-size: 10px;
  font-weight: 700; letter-spacing: .05em; vertical-align: 1px;
}
