/* =====================================================================
   CPV Verkenner (/cpv/): the SHELL around the D3 sunburst tool.
   Loads after site.css. Tool JS and data are untouched; only frame,
   chrome colours and type. Keep the ids (#ip, #hc, #sb, #sbTitle,
   #search, #sResults, #tip, #ip-title-row, #topTitle) and the inline
   text-transform on .hc-label (the JS finds the header by it).
   ===================================================================== */

/* like live: the tool sits directly on a white page (white keeps the
   sunburst's tans readable); the side panel is the one card */
.cpv-page { background: var(--white); padding: 20px 0 72px; }
.cpv-main, .cpv-main *, .cpv-tip, .cpv-tip * { margin: 0; padding: 0; }
/* live width + column positions (Codex 7): 1072 px content, 18 px gap
   -> panel ~414 px at x = 184 on a 1440 screen, wheel 640 px */
.cpv-main {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start;
  max-width: 1072px; margin: 0 auto;
}
.cpv-side { flex: 1; min-width: 180px; }
.cpv-stage { flex: 0 0 auto; width: min(640px, 100%, 90vh); }

/* side panel */
#ip { background: var(--paper); border-radius: 14px; padding: 18px 18px 18px; }
#ip-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
#topTitle {
  font-family: var(--display); font-size: 24px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em;
  color: var(--navy); white-space: nowrap; text-decoration: none; cursor: pointer;
}
#topTitle span { color: var(--accent) !important; }
/* language switcher (label is built by the JS with inline styles) */
#ip-title-row label { position: relative !important; padding: 7px 9px !important; min-width: 0; border: 1px solid var(--line) !important; border-radius: var(--r-btn) !important; background: var(--white) !important; color: var(--muted) !important; }
#ip-title-row label:hover { border-color: var(--navy-soft) !important; color: var(--navy) !important; }
#ip-title-row label > svg { flex: 0 0 auto; }
#langSwitcher {
  position: absolute !important; inset: 0;
  width: 100% !important; height: 100% !important;
  opacity: 0 !important;
  cursor: pointer; border: 0; padding: 0;
  font-size: 0 !important; color: transparent !important;
}

/* search */
.cpv-search { margin-bottom: 10px; }
#search {
  width: 100%; height: 48px; padding: 0 14px 0 42px; border: 1px solid var(--line); border-radius: var(--r-btn);
  font: 16px var(--sans); background: var(--white) no-repeat 14px center / 18px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%235E6975' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8.5' cy='8.5' r='5.5'/%3E%3Cpath d='m13 13 4 4'/%3E%3C/svg%3E");
  color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
#search::placeholder { color: var(--faint); }
#search:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(15, 42, 74, .12); }
/* results: compact rows like live (Codex 6 / Opus F3), 180 px like live
   (4 full rows for "bouw", 5 for "909"). Every row keeps full strength (R4-5):
   the scroll hint is a soft shadow along the bottom edge, drawn in the
   background (behind the text). The "local" paper cover rides at the end of
   the content and hides the shadow once the list is at its end, so a list
   that does not scroll has no shadow. */
#sResults {
  max-height: 180px; overflow-y: auto; margin-top: 6px; font-size: 12px; word-spacing: .04em;
  background:
    linear-gradient(rgba(246, 243, 238, 0), var(--paper) 60%) center bottom / 100% 18px no-repeat local,
    radial-gradient(farthest-side at 50% 100%, rgba(15, 42, 74, .22), rgba(15, 42, 74, 0)) center bottom / 100% 12px no-repeat scroll,
    var(--paper);
}
#sResults:not(:empty) { border-bottom: 1px solid var(--line); }
#sResults .hit { padding: 5px 7px; border-top: 1px solid var(--line); cursor: pointer; display: flex; gap: 7px; align-items: baseline; border-radius: 4px; }
#sResults .hit:hover { background: var(--canvas-deep); }
#sResults .hit code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; color: var(--muted); flex-shrink: 0; min-width: 60px; word-spacing: normal; }
#sResults .hit span { color: var(--ink); line-height: 1.35; }

/* hierarchy card */
#hc { margin-top: 14px; background: var(--white); border-radius: 12px; box-shadow: 0 0 0 1px var(--line); padding: 12px 14px; font-family: var(--sans); word-spacing: .07em; }
.hc-head { display: flex; align-items: center; margin-bottom: 8px; }
.hc-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .1em; }

/* stage: same box sizes as before (the card-height JS compares tops) */
#sbTitle { text-align: center; font-size: 14.5px; line-height: 1.35; color: var(--ink); padding: 4px 12px; min-height: 20px; margin-bottom: 8px; }
#sb { width: 100%; display: block; touch-action: pan-y; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
/* Block touch scroll only on actual interactive elements (arcs + centre dot), so empty SVG area still lets the page scroll */
#sb path, #sb circle { touch-action: none; }
#dotTap { pointer-events: none; fill: transparent; cursor: pointer; }
#sb path { shape-rendering: geometricPrecision; }
#sb text { pointer-events: none; user-select: none; }
.animating #sb path { pointer-events: none !important; }
#skel { display: flex; align-items: center; justify-content: center; height: 520px; color: var(--muted); font-size: 14px; }

/* hover tip */
.cpv-tip {
  background: rgba(15, 42, 74, .96); color: #fff; font-size: 14px; padding: 10px 14px; border-radius: 10px; max-width: 360px;
  line-height: 1.4; box-shadow: 0 10px 30px -8px rgba(6, 20, 38, .45); font-family: var(--sans);
}

@media (max-width: 920px) {
  .cpv-main { margin: 0 var(--gut); }
}
@media (max-width: 640px) {
  .cpv-page { padding: 16px 0 56px; }
  /* tighten the gutters so the sunburst fills the viewport */
  .cpv-main { margin: 0; padding: 4px 5px !important; gap: 12px !important; }
  #ip { padding: 12px 12px !important; }
  #topTitle { font-size: 22px; }
  #hc { margin-top: 12px; }
  #dotTap { pointer-events: all; }
}
