/* Blueprint overlay (package c). Paper-white sheet, navy ink, brand palette (navy #1e3a5f,
 * blue #3d6bb4, sky #b8d0ec). The z-index contract lives in studio-foundation.css: #blueprint is 4,
 * .tools/.hint are 6, so the toolbar always sits above the sheet. Only transform/opacity animate. */
.blueprint {
  --bp-paper: #f8fafc; --bp-ink: #1e3a5f; --bp-dim: #35566d; --bp-hover: #6d93c9; --bp-select: #3d6bb4;
  --bp-lean: #e8f0f7; --bp-lean-closed: #dfe8f1; --bp-hatch: #c7ced4; --bp-mezz: #345f92; --bp-line: #dbe4ee;
  background: var(--bp-paper); overflow: hidden; color: var(--bp-ink);
  font: 400 12px/1.5 Inter, Arial, sans-serif;
}
.bp-stage { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.bp-stage:active { cursor: grabbing; }
.bp-svg-host { position: absolute; inset: 0; }
.bp-svg { display: block; pointer-events: none; }
.bp-a11y { position: absolute; inset: 0; pointer-events: none; }
.bp-key { position: absolute; margin: 0; padding: 0; border: 0; background: none; opacity: 0; pointer-events: none; }
.bp-key:focus-visible { opacity: 1; outline: 2px solid var(--bp-select); outline-offset: 0; border-radius: 4px; }

/* ---- what the toolbar shows while the blueprint is open ------------------------------------- */
html.studio-blueprint .tools > :not(#blueprint-toggle):not(#frame):not(#blueprint-print):not(#blueprint-open-full):not(#blueprint-share) { display: none; }
html.studio-blueprint .tools { flex-wrap: nowrap; }
html.studio-blueprint .addon-tray, html.studio-blueprint .addon-instruction,
html.studio-blueprint .addon-drag-ghost, html.studio-blueprint .scene-title { display: none !important; }
@media (pointer: coarse) { html.studio-blueprint .tools button, html.studio-blueprint .tools a { min-height: 44px; padding-inline: 12px; } }
.bp-open-full, .bp-share { font-size: 11px; padding: 8px; border: 0; border-radius: 7px; background: #fff; color: var(--bp-ink); text-decoration: none; cursor: pointer; }
.bp-open-full:hover, .bp-share:hover { background: #e8eff7; }
.bp-open-full:active, .bp-share:active { transform: scale(.97); }
.bp-open-full:focus-visible, .bp-share:focus-visible { outline: 3px solid #68a8ed; outline-offset: 2px; }
.bp-open-full[hidden], .bp-share[hidden] { display: none !important; }

/* ---- ink ------------------------------------------------------------------------------------ */
.bp-svg text { text-anchor: middle; dominant-baseline: central; fill: var(--bp-dim); }
.bp-wall-solid { stroke: var(--bp-ink); stroke-width: 3px; fill: none; }
.bp-wall-open { stroke: #8aa2b8; stroke-width: 1px; stroke-dasharray: 2 3; fill: none; }
.bp-wall-line { stroke: var(--bp-ink); stroke-width: 3px; fill: none; }
.bp-slab { fill: url(#bp-hatch-concrete); stroke: none; }
#bp-hatch-concrete line, #bp-hatch-mezz line { stroke: var(--bp-hatch); stroke-width: 1px; }
.bp-post { fill: var(--bp-ink); stroke: none; }
.bp-post-lean { fill: #57748f; }
.bp-post-mezz { fill: var(--bp-mezz); }
.bp-area .bp-vis { fill: transparent; stroke: none; }
.bp-add .bp-vis { fill: var(--bp-lean); stroke: #cfdce9; stroke-width: 1px; }
.bp-add.is-enclosed .bp-vis { fill: var(--bp-lean-closed); }
.bp-mezz-fill { fill: url(#bp-hatch-mezz); stroke: none; }
.bp-stall .bp-vis { fill: #d4a56a38; stroke: #8a6a3f; stroke-width: 1px; }
.bp-stall.is-tack .bp-vis { fill: #1e3a5f2e; stroke: #1e3a5f; }
.bp-stall.is-wash .bp-vis { fill: #3d6bb42e; stroke: #3d6bb4; }
.bp-stall.is-feed .bp-vis { fill: #b08d573a; stroke: #8a6a3f; }
.bp-aisle { fill: #e9edf1; stroke: none; }
.bp-lead-post { fill: #7a5a33; stroke: #3b2a16; stroke-width: .8px; }
.bp-stall-label { fill: #3b2a16; font-weight: 600; }
.bp-stall-label.is-aisle { fill: #6b7f8e; font-weight: 500; letter-spacing: .04em; }
.bp-mezz .bp-vis { fill: none; stroke: var(--bp-mezz); stroke-width: 1.6px; stroke-dasharray: 10 4; }
.bp-mezz.is-inactive .bp-vis { stroke-dasharray: 3 4; stroke-opacity: .55; }
.bp-guard { stroke: var(--bp-mezz); stroke-width: 1px; stroke-dasharray: 1 2; }
.bp-mezz-wall { stroke: var(--bp-mezz); stroke-width: 3px; stroke-linecap: butt; }
.bp-mezz-wall.is-lower { stroke-width: 2.5px; stroke-dasharray: 5 3; opacity: .85; }
.bp-stair .bp-vis { fill: #eef3f9; stroke: var(--bp-mezz); stroke-width: 1.2px; }
.bp-treads { stroke: var(--bp-mezz); stroke-width: .8px; }
.bp-stair .bp-treads line { stroke: var(--bp-mezz); stroke-width: .8px; }
.bp-up { stroke: var(--bp-mezz); stroke-width: 1.4px; }
.bp-up-head { fill: var(--bp-mezz); stroke: none; }
.bp-flight { fill: none; stroke: var(--bp-mezz); stroke-width: .8px; }
.bp-landing { fill: #dfe8f3; stroke: var(--bp-mezz); stroke-width: 1px; }
/* an inside stair: the stairwell cut in the deck, drawn as a heavier dashed outline over the hatch */
.bp-stair.is-inside .bp-vis { fill: #f4f7fb; }
.bp-well { fill: none; stroke: var(--bp-mezz); stroke-width: 1.8px; stroke-dasharray: 5 3; }
.bp-jamb { stroke: var(--bp-ink); stroke-width: 2px; fill: none; }
.bp-jamb-dot { fill: var(--bp-ink); stroke: none; }
.bp-leaf { stroke: var(--bp-ink); stroke-width: 1.6px; fill: none; }
.bp-dash { stroke-dasharray: 5 3; }
.bp-swing { stroke: #7f96ac; stroke-width: 1px; fill: none; stroke-dasharray: 3 3; }
.bp-track { stroke: #7f96ac; stroke-width: 1px; fill: none; }
.bp-glass { stroke: var(--bp-ink); stroke-width: 1px; fill: none; }
.bp-opening.is-unfit .bp-vis { stroke-dasharray: 2 3; stroke-opacity: .5; }
.bp-dim-line { stroke: var(--bp-dim); stroke-width: 1px; fill: none; }
.bp-dim-tick { stroke: var(--bp-dim); stroke-width: 1px; fill: none; }
.bp-label-bg { fill: var(--bp-paper); fill-opacity: .92; stroke: none; }
.bp-label-t { fill: var(--bp-dim); font-weight: 600; }
.bp-label-sub { fill: #6b829a; font-weight: 500; }
.bp-face-label .bp-label-t { fill: #6b829a; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.bp-bubble .bp-label-bg { fill: #eef4fa; fill-opacity: 1; }
.bp-bubble .bp-label-t { fill: #6b829a; font-weight: 600; }
.bp-tag-shape { fill: #fff; stroke: var(--bp-ink); stroke-width: 1.2px; }
.bp-tag-no { fill: var(--bp-ink); font-weight: 700; }
.bp-tag-dot { fill: var(--bp-ink); stroke: #fff; stroke-width: 1px; }
.bp-chrome-bg { fill: var(--bp-paper); fill-opacity: .88; stroke: none; }
/* Compact sheets reserve the plate's height in the fit, so nothing legitimate is behind it: paint
   it solid there so a stray post or hatch can never show through the scale bar or the badge. */
.bp-svg[data-detail="compact"] .bp-chrome-bg { fill-opacity: 1; }
.bp-scale path { stroke: var(--bp-dim); stroke-width: 1px; fill: none; }
.bp-scale-fill { fill: var(--bp-dim); fill-opacity: .18; stroke: none; }
.bp-front-badge path { stroke: var(--bp-dim); stroke-width: 1.4px; fill: none; }
.bp-front-badge text { text-anchor: start; fill: #6b829a; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }

/* ---- hover, selection, focus ---------------------------------------------------------------- */
@media (hover: hover) {
  .bp-t.is-hover .bp-vis { stroke: var(--bp-hover); }
  .bp-t.is-hover.bp-area .bp-vis { fill: #6d93c92e; }
}
.bp-t.is-selected .bp-vis { stroke: var(--bp-select); stroke-width: 4px; }
.bp-t.is-selected.bp-area .bp-vis { fill: #3d6bb42e; stroke: var(--bp-select); stroke-width: 2px; }
.bp-t.is-selected.bp-post .bp-vis, .bp-post.is-selected .bp-vis { fill: var(--bp-select); stroke: var(--bp-select); stroke-width: 2px; }
.bp-t.is-focus .bp-vis { stroke: #4d8ecc; stroke-opacity: 1; }

/* ---- title, legend panel and schedule ------------------------------------------------------- */
.bp-title {
  position: absolute; left: var(--bp-left, 18px); top: 14px; padding: 7px 12px; border-radius: 10px;
  background: #ffffffdb; border: 1px solid #fff; box-shadow: 0 6px 18px #1e3a5f14; font-size: 12px; pointer-events: none;
}
.bp-title b { font: 600 13px Montserrat, Inter, sans-serif; }
.bp-title-dims { color: #5c7489; margin-left: 6px; }
.bp-panel-toggle {
  position: absolute; right: 14px; top: 14px; min-height: 36px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid #fff; background: #ffffffe8; color: var(--bp-ink); font-weight: 650; font-size: 12px;
  box-shadow: 0 6px 18px #1e3a5f18; cursor: pointer; touch-action: manipulation;
}
.bp-panel-toggle:hover { background: #eaf1fa; }
.bp-panel-toggle:active { transform: scale(.97); }
.bp-panel-toggle:focus-visible { outline: 3px solid #68a8ed; outline-offset: 2px; }
.bp-panel {
  position: absolute; right: 14px; top: 58px; width: 240px; max-height: calc(100% - 96px); overflow: auto;
  overscroll-behavior: contain; border-radius: 14px; border: 1px solid #fff; background: #ffffffef;
  box-shadow: 0 14px 40px #1e3a5f22; opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.bp-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }
.bp-panel-body { padding: 12px 13px 15px; }
.bp-h { font: 600 12px Montserrat, Inter, sans-serif; margin: 12px 0 7px; color: var(--bp-ink); }
.bp-panel-body > .bp-h:first-child { margin-top: 0; }
.bp-legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 11px; color: #46607a; }
.bp-swatch { flex: 0 0 22px; height: 12px; display: block; }
.bp-swatch svg { width: 22px; height: 12px; display: block; overflow: visible; }
.bp-swatch-add { fill: var(--bp-lean); stroke: #cfdce9; stroke-width: 1px; }
.bp-swatch-add.is-enclosed { fill: var(--bp-lean-closed); }
.bp-swatch-mezz { fill: none; stroke: var(--bp-mezz); stroke-width: 1.2px; stroke-dasharray: 5 3; }
.bp-swatch-stair { fill: #eef3f9; stroke: var(--bp-mezz); stroke-width: 1px; }
.bp-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.bp-table th { text-align: left; font-weight: 700; color: #6b829a; border-bottom: 1px solid var(--bp-line); padding: 3px 4px 4px 0; }
.bp-table td { vertical-align: top; padding: 4px 4px 4px 0; border-bottom: 1px solid #eef2f7; color: #3c566e; }
.bp-row { cursor: pointer; }
.bp-row:hover td { background: #eef4fa; }
.bp-row.is-unfit td { color: #8a5a2a; }
.bp-row em { font-style: normal; font-weight: 600; }
.bp-empty { font-size: 11px; color: #6b829a; margin: 0; }

/* ---- phones: the legend becomes a chip that opens to half the height ------------------------ */
@media (max-width: 650px), (max-width: 1000px) and (max-height: 500px) {
  /* The feature tree's collapsed chip owns the top-left corner on phones, so the title sits
     between it and the Legend chip and clips rather than wrapping. */
  .bp-title { left: calc(var(--bp-left, 16px) + 40px); right: 108px; top: 10px; font-size: 11px; padding: 6px 9px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bp-title b { font-size: 11px; }
  .bp-panel-toggle { right: 10px; top: 10px; min-height: 44px; }
  .bp-panel { left: 10px; right: 10px; top: 62px; width: auto; max-height: 50%; }
}

/* ---- print: only the sheet, black on white, hatches instead of colour ----------------------- */
.bp-print-head, .bp-print-foot { display: none; }
@media print {
  html, body { height: auto !important; overflow: visible !important; background: #fff; }
  header, #building-controls, #toggle-controls, .tools, .hint, .addon-tray, .addon-instruction, .addon-drag-ghost,
  .scene-title, #viewport-status, #scene, #loading, #selection-chip, .studio-overlay, #feature-tree, #studio-toast,
  .bp-title, .bp-panel-toggle, .bp-a11y { display: none !important; }
  main { display: block !important; height: auto !important; }
  #viewport { height: auto !important; overflow: visible !important; }
  html.inspector-open #building-controls { transform: none !important; }
  .blueprint, .blueprint[hidden] { display: block !important; position: static; background: #fff; overflow: visible; }
  /* The drawing has to join the page flow, or the head, legend and footer would stack on top of it. */
  .bp-stage { position: relative; inset: auto; height: auto; touch-action: auto; }
  .bp-svg-host { position: static; inset: auto; }
  /* A fixed sheet height keeps the head, drawing, legend and schedule on one page for a plain barn. */
  .bp-svg { width: 100%; height: 5.5in; break-inside: avoid; }
  .bp-print-head, .bp-print-foot { display: block; }
  .bp-brand { font: 700 15px Montserrat, Inter, sans-serif; letter-spacing: -.02em; }
  .bp-head-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 10px; color: #35566d; margin: 3px 0 6px; }
  .bp-print-head { border-bottom: 1px solid #1e3a5f; padding-bottom: 5px; margin-bottom: 6px; }
  .bp-print-foot { border-top: 1px solid #1e3a5f; margin-top: 6px; padding-top: 5px; }
  .bp-disclaimer { font-size: 9.5px; color: #35566d; margin: 0; }
  .bp-panel { position: static; opacity: 1; transform: none; pointer-events: auto; width: auto; max-height: none;
    overflow: visible; border: 0; box-shadow: none; background: none; break-before: auto; margin-top: 8px; }
  .bp-panel-body { padding: 0; column-count: 2; column-gap: 18px; }
  .bp-table { font-size: 8.5px; }
  .bp-legend-row { font-size: 9px; padding: 0; }
  .bp-h { margin: 4px 0 3px; font-size: 10px; }
  .blueprint { --bp-paper: #ffffff; --bp-ink: #000000; --bp-dim: #222222; --bp-lean: #ffffff; --bp-lean-closed: #f0f0f0; --bp-hatch: #999999; --bp-mezz: #000000; }
  .bp-label-bg { fill: #fff; fill-opacity: 1; }
  .bp-add .bp-vis { fill: none; stroke: #777; }
  .bp-add.is-enclosed .bp-vis { fill: url(#bp-hatch-mezz); stroke: #555; }
  .bp-t.is-selected .bp-vis { stroke: #000; stroke-width: 3px; }
}
@page { size: letter landscape; margin: .4in; }

@media (prefers-reduced-motion: reduce) {
  .bp-panel { transition: none; }
  .bp-panel-toggle:active, .bp-open-full:active, .bp-share:active { transform: none; }
}
/* Mezzanine corner grips: grab and drag to resize the deck. */
.bp-mezz-grip { fill: #fff; stroke: var(--bp-mezz); stroke-width: 2px; pointer-events: none; }
.bp-mezz-preview { fill: rgba(61,107,180,.12); stroke: var(--bp-mezz); stroke-width: 2px; stroke-dasharray: 6 3; pointer-events: none; }
