/* ====================================================
   Business Model Canvas — bc-bmd
   Canonical Strategyzer layout + tag rendering + side panel
   Brand tokens come from style.css.
   ==================================================== */

/* ---- Top nav surface tabs ---- */
.surface-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}
.surface-nav a {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 3px;
  transition: all 0.12s ease;
}
.surface-nav a:hover {
  color: var(--ink);
  border-color: var(--line);
}
.surface-nav a.active {
  color: var(--ink);
  background: var(--bg-soft);
  border-color: var(--line);
}

/* ---- Canvas page header ---- */
.canvas-header {
  padding: 28px 0 12px;
  background: var(--bg);
}
.canvas-header h1 {
  font-family: var(--sans-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--ink);
}
.canvas-header .subtitle {
  font-size: 14px;
  color: var(--mute);
  margin: 0 0 14px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  font-size: 12px;
  color: var(--mute);
}
.legend-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.legend-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mute);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}
.legend-dot.testing-active { background: #2d8a3e; }
.legend-dot.testing-partial { background: var(--brand-gold); }
.legend-dot.testing-gap { background: var(--line); border: 1px solid var(--mute); }
.legend-swatch {
  display: inline-block;
  width: 16px;
  height: 10px;
  border: 1px solid var(--mute);
  border-radius: 2px;
}
.legend-swatch.dashed { border-style: dashed; opacity: 0.55; }
.legend-swatch.gold { border-color: var(--brand-gold); border-width: 1.5px; }

/* ---- The canvas itself ---- */
.canvas-section {
  padding: 4px 0 28px;
  background: var(--bg);
}
.canvas-frame {
  margin: 0 var(--shell-pad);
  border: 2px solid var(--ink);
  background: var(--bg-card);
}
.canvas-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: minmax(280px, 1fr) minmax(280px, 1fr);
  background: var(--ink);
  gap: 2px;
  position: relative;
}
.canvas-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--ink);
  gap: 2px;
  border-top: 2px solid var(--ink);
}

.block {
  background: var(--bg-card);
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.block-bottom {
  background: var(--bg-card);
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  max-height: 280px;
}
.block-title {
  font-family: var(--sans-display);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin: 0 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex: none;
}
.block-title .count {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0;
}
.block-title-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 11px;
}
.block-link {
  font-size: 10px;
  font-weight: 600;
  color: var(--brand-gold);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border: 1px solid var(--brand-gold);
  border-radius: 3px;
  transition: all 0.12s ease;
  white-space: nowrap;
}
.block-link:hover {
  background: var(--brand-gold);
  color: var(--ink);
}

/* 4-column Strategyzer (VP column dropped; replaced by small floating diamond CTA below) */
.block-key-partners            { grid-column: 1; grid-row: 1 / 3; }
.block-key-activities          { grid-column: 2; grid-row: 1; }
.block-key-resources           { grid-column: 2; grid-row: 2; }
.block-customer-relationships  { grid-column: 3; grid-row: 1; }
.block-channels                { grid-column: 3; grid-row: 2; }
.block-customer-segments       { grid-column: 4; grid-row: 1 / 3; }

/* ---- VP diamond floater ---- */
/* Small clickable diamond positioned absolutely at the intersection of
   KA / KR / CR / CH (centre of canvas-grid). Sits on top of the grid as
   a small button. Strong drop shadow separates it from the underlying
   block content without needing to carve a halo through the grid gaps.
   Hard-coded dark text on gold so it reads in both light + dark modes. */
.vp-diamond-floater {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  /* drop-shadow filter applies to the clipped shape (not the bounding rect) */
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35))
          drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
  transition: filter 0.15s ease, transform 0.15s ease;
}
.vp-diamond-shape {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 60px;
  height: 60px;
  background: var(--brand-gold);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  font-family: var(--sans-display);
  /* Hard-coded dark text — gold background is fixed regardless of theme */
  color: #1a1a18;
  pointer-events: auto;
}
.vp-diamond-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}
.vp-diamond-arrow {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.vp-diamond-floater:hover {
  transform: translate(-50%, -50%) scale(1.15);
  filter: drop-shadow(0 5px 14px rgba(0, 0, 0, 0.4))
          drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.vp-diamond-floater:focus-visible {
  outline: none;
  filter: drop-shadow(0 0 0 3px var(--ink))
          drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}

/* ---- Tags ---- */
.tags {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  /* Subtle scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.tags::-webkit-scrollbar { width: 6px; }
.tags::-webkit-scrollbar-track { background: transparent; }
.tags::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.tags::-webkit-scrollbar-thumb:hover { background: var(--mute); }

.tag {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 7px 10px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  font-family: var(--sans-body);
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.08s, background 0.12s;
  width: 100%;
  min-width: 0;
  flex: none;
  text-align: left;
  font-weight: 400;
  color: var(--body);
  /* Always two visual lines of title space (locked height) */
  min-height: calc(14px + 2 * 1.35em);
}
.tag:hover {
  border-color: var(--ink);
  background: var(--bg-soft);
  transform: translateY(-1px);
}
.tag:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 2px;
}
.tag.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}
.tag.is-active .tag-code,
.tag.is-active .tag-status-dot {
  /* invert what needs inverting */
}
.tag-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  border: 1px solid var(--mute);
  flex: none;
  margin-top: 4px;
}
.tag-code {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 10px;
  color: var(--mute);
  letter-spacing: 0;
  flex: none;
  margin-top: 2px;
}
.tag.is-active .tag-code { color: var(--bg-soft); }
.tag-title {
  font-weight: 500;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
  /* Clamp to exactly 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

/* Testing status dot */
.tag.testing-active-path .tag-status-dot {
  background: #2d8a3e;
  border-color: #2d8a3e;
}
.tag.testing-partial-path .tag-status-dot {
  background: var(--brand-gold);
  border-color: #c9a82e;
}
.tag.testing-testing-gap .tag-status-dot {
  background: transparent;
  border-color: var(--mute);
}

/* Lifecycle status visuals */
.tag.lifecycle-refined {
  border-color: var(--brand-gold);
  border-width: 1.5px;
}
.tag.lifecycle-invalidated,
.tag.lifecycle-superseded {
  border-style: dashed;
  opacity: 0.55;
}

/* Critical-now corner indicator */
.tag.critical-now::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  background: var(--brand-red);
  border-radius: 50%;
}
.tag.critical-now {
  position: relative;
  padding-right: 14px;
}

/* Empty block placeholder */
.tags-empty {
  font-size: 12px;
  color: var(--mute);
  font-style: italic;
  padding: 6px 0;
}

/* ---- Supporting strip ---- */
.supporting-section {
  padding: 32px 0 40px;
  background: var(--bg);
}
.supporting-heading {
  font-family: var(--sans-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mute);
  margin: 0 var(--shell-pad) 12px;
}
.supporting-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 0 var(--shell-pad);
}
.block-mini {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  max-height: 360px;
}
.block-mini .tags {
  flex: 1;
  overflow-y: auto;
}

/* ---- VP block compact variant ---- */
.tags.compact { gap: 5px; }
.tags.compact .tag {
  padding: 5px 8px 5px 7px;
  font-size: 11px;
  line-height: 1.3;
  min-height: calc(10px + 2 * 1.3em);
}
.tags.compact .tag-code { font-size: 9px; margin-top: 1px; }
.tags.compact .tag-status-dot { width: 7px; height: 7px; margin-top: 3px; }
.tags.compact .tag-title { font-weight: 500; line-height: 1.3; }

/* ---- Side panel ---- */
.sidepanel {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}
.sidepanel[data-open="true"] {
  pointer-events: auto;
}
.sidepanel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 18, 0.4);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.sidepanel[data-open="true"] .sidepanel-backdrop {
  opacity: 1;
}
.sidepanel-content {
  position: absolute;
  top: 0;
  right: 0;
  width: min(540px, 92vw);
  height: 100vh;
  background: var(--bg-card);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidepanel[data-open="true"] .sidepanel-content {
  transform: translateX(0);
}
.sidepanel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.sidepanel-code {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--mute);
  letter-spacing: 0.02em;
}
.sidepanel-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--mute);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 3px;
  transition: background 0.12s, color 0.12s;
}
.sidepanel-close:hover {
  background: var(--bg-soft);
  color: var(--ink);
}
.sidepanel-body {
  padding: 18px 22px 32px;
  flex: 1;
}
.sidepanel-block-name {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-gold);
  font-weight: 700;
  margin: 0 0 8px;
}
.sidepanel-title {
  font-family: var(--sans-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 12px;
  line-height: 1.3;
}
.sidepanel-statement {
  font-size: 15px;
  line-height: 1.55;
  color: var(--body);
  margin: 0 0 18px;
}
.sidepanel-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 11px;
  color: var(--mute);
  background: var(--bg);
}
.badge em {
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
}
.badge.crit-critical-now { border-color: var(--brand-red); }
.badge.crit-critical-now em { color: var(--brand-red); }
.badge.testing-active-path { border-color: #2d8a3e; }
.badge.testing-active-path em { color: #2d8a3e; }
.badge.testing-partial-path em { color: #b08800; }
.badge.lifecycle-invalidated em,
.badge.lifecycle-superseded em { color: var(--mute); }
.badge.lifecycle-refined em { color: var(--brand-gold); }

.sidepanel-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.sidepanel-section h3 {
  font-family: var(--sans-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mute);
  margin: 0 0 10px;
  font-weight: 700;
}
.sidepanel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidepanel-list .empty {
  font-size: 13px;
  color: var(--mute);
  font-style: italic;
}
.finding-row {
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 4px;
  border-left: 3px solid var(--line);
}
.finding-row.kind-confirm { border-left-color: #2d8a3e; }
.finding-row.kind-disconfirm { border-left-color: var(--brand-red); }
.finding-row.kind-mixed {
  border-left-color: var(--brand-gold);
}
.finding-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.finding-code {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 11px;
  color: var(--mute);
}
.finding-kind {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 2px;
  font-weight: 600;
}
.finding-kind.kind-confirm { background: rgba(45, 138, 62, 0.12); color: #1d6228; }
.finding-kind.kind-disconfirm { background: rgba(237, 41, 57, 0.10); color: #b21d2c; }
.finding-kind.kind-mixed { background: rgba(250, 224, 66, 0.18); color: #806600; }
.finding-strength {
  font-size: 10px;
  color: var(--mute);
  font-family: var(--mono);
}
.finding-statement {
  font-size: 13px;
  line-height: 1.5;
  color: var(--body);
  margin: 4px 0 0;
}
.finding-rationale {
  font-size: 12px;
  line-height: 1.5;
  color: var(--mute);
  margin: 4px 0 0;
  font-style: italic;
}

.session-row {
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: 4px;
}
.session-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.session-code {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 11px;
  color: var(--mute);
}
.session-date {
  font-size: 11px;
  color: var(--mute);
}
.session-title {
  font-size: 13px;
  color: var(--body);
  line-height: 1.4;
}

.sidepanel-meta {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--mute);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidepanel-meta strong {
  color: var(--body);
  font-weight: 500;
}
.sidepanel-pivot {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--brand-gold);
  background: rgba(250, 224, 66, 0.08);
  font-size: 12px;
  line-height: 1.5;
  color: var(--body);
  border-radius: 0 4px 4px 0;
}
.sidepanel-pivot-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mute);
  font-weight: 600;
  margin-bottom: 4px;
}
.sidepanel-gap {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--bg-soft);
  font-size: 12px;
  line-height: 1.5;
  color: var(--body);
  border-radius: 4px;
}
.sidepanel-gap-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mute);
  font-weight: 600;
  margin-bottom: 4px;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .canvas-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  .canvas-grid .block {
    grid-column: auto !important;
    grid-row: auto !important;
    min-height: 180px;
  }
  .canvas-bottom {
    grid-template-columns: 1fr;
  }
  .supporting-strip {
    grid-template-columns: 1fr;
  }
  /* Diamond moves to top-right corner over the grid since the intersection
     no longer means anything in a 2-col layout */
  .vp-diamond-floater {
    top: 12px;
    left: auto;
    right: 12px;
    transform: none;
    width: 56px;
    height: 56px;
  }
  .vp-diamond-shape { width: 56px; height: 56px; }
  .vp-diamond-floater:hover {
    transform: scale(1.12);
  }
}
@media (max-width: 640px) {
  .canvas-grid {
    grid-template-columns: 1fr;
  }
  .canvas-frame {
    margin: 0 12px;
  }
  .supporting-strip {
    margin: 0 12px;
  }
}
