@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&display=swap');

/* ═══════════════════════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════════════════════ */
:root {
  --bg:           #ffffff;
  --surface:      #ffffff;
  --border:       #d8d4cc;
  --border-light: #e8e4dc;
  --text:         #0d2040;
  --text-muted:   #6b6660;

  --col-market:    #0a2a5c;  /* deep navy blue   */
  --col-govern:    #2a1a5c;  /* deep indigo      */
  --col-track:     #005c3a;  /* deep emerald     */
  --col-exam-plan: #4a1a5c;  /* deep violet      */
  --col-sme:       #5c3300;  /* deep amber       */
  --col-exam-dev:  #5c1a1a;  /* deep red         */
  --col-insight:   #004a5c;  /* deep cyan        */
  --col-ext:       #3d5c00;  /* deep olive       */
  --col-int:       #005c52;  /* deep teal        */
  --col-gtm:       #5c1a3a;  /* deep rose        */
  --col-cand-s:    #1a3a5c;  /* deep steel blue  */
  --col-partner:   #5c5000;  /* deep gold        */
  --col-engage:    #c2410c;  /* burnt orange     */

  --tactical-color:  #c0392b;
  --strategic-color: #2c5f8a;

  --cell-radius: 5px;
  --col-gap:     6px;
  --row-gap:     4px;
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 28px 20px 48px;
}

/* ═══════════════════════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════════════════════ */
.page-header {
  max-width: 1760px;
  margin: 0 0 24px 0;
}
.page-header h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}
.page-header p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  max-width: 680px;
}

/* ═══════════════════════════════════════════════════════════
   OUTER LAYOUT
   col1: left Y-axis (40px) | col2: framework (1fr) | col3: right spacer (40px)
   row1: top corner labels  | row2: framework (1fr) | row3: bottom corner labels
═══════════════════════════════════════════════════════════ */
.outer {
  max-width: 1760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  grid-template-rows: auto 1fr auto;
  gap: 0;
  zoom: 1.35;
}

/* Framework occupies centre cell */
.framework {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: row;
  gap: var(--col-gap);
  align-items: stretch;
}

/* ── Corner / axis labels ── */
.corner {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  user-select: none;
  display: flex;
  align-items: center;
  padding: 4px 0;
  writing-mode: vertical-rl;
}

.corner.tr { grid-column: 3; grid-row: 1; }
.corner.bl { grid-column: 1; grid-row: 1; }

/* Left axis — spans all 3 rows */
.axis-left {
  grid-column: 1;
  grid-row: 1 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Tactical (red) — top portion */
.corner.tl {
  flex: 1;
  color: var(--tactical-color);
  transform: rotate(180deg);
  writing-mode: vertical-rl;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 0;
}

/* Strategic (blue) — bottom portion */
.corner.br {
  flex: 1;
  color: var(--strategic-color);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 0;
}

.side-left  { grid-column: 1; grid-row: 2; }
.side-right { grid-column: 3; grid-row: 2; }

/* ═══════════════════════════════════════════════════════════
   COLUMNS
═══════════════════════════════════════════════════════════ */
.col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 0;
}

/* Tactical zone — cells press DOWN onto column header */
.zone-tactical {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--row-gap);
  padding-bottom: var(--row-gap);
  flex-shrink: 0;
}

/* Strategic zone — cells press UP from column header */
.zone-strategic {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: var(--row-gap);
  padding-top: var(--row-gap);
  flex-shrink: 0;
}

/* Column header */
.col-header {
  padding: 10px 6px;
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.3;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}
.col-header .new-badge {
  position: absolute;
  top: -7px; right: 3px;
  background: #777;
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════════════
   CELLS
═══════════════════════════════════════════════════════════ */
.cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--cell-radius);
  padding: 5px 6px;
  font-size: 10px;
  line-height: 1.3;
  color: var(--text);
  text-align: center;
  position: relative;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
}
.cell:hover {
  box-shadow: 0 3px 14px rgba(0,0,0,0.13);
  transform: translateY(-1px);
  z-index: 20;
  border-color: #999;
}
.cell.empty {
  background: transparent;
  border: 1px dashed var(--border-light);
  opacity: 0.25;
  min-height: 22px;
  pointer-events: none;
}

/* ── Cell selection states (link system) ── */
.cell.selected {
  outline: 2.5px solid #0d2040;
  outline-offset: 1px;
  z-index: 30;
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(13,32,64,0.22);
}
.cell.predecessor {
  background: #fff3cd !important;
  border-color: #d4a017 !important;
  outline: 2px solid #d4a017;
  outline-offset: 1px;
  z-index: 25;
}
.cell.successor {
  background: #d1f5e8 !important;
  border-color: #0f6e56 !important;
  outline: 2px solid #0f6e56;
  outline-offset: 1px;
  z-index: 25;
}
.cell.dimmed {
  opacity: 0.22;
  filter: grayscale(0.4);
}

/* ═══════════════════════════════════════════════════════════
   TOOLTIPS
═══════════════════════════════════════════════════════════ */
.cell[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1814;
  color: #f7f6f3;
  font-size: 11px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 6px;
  width: 230px;
  white-space: normal;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.28);
  font-weight: 400;
  text-align: left;
}
.zone-tactical .cell[data-tip]:hover::after {
  top: calc(100% + 6px);
  bottom: auto;
}
.zone-strategic .cell[data-tip]:hover::after {
  bottom: calc(100% + 6px);
  top: auto;
}

/* ═══════════════════════════════════════════════════════════
   LINK PANEL
═══════════════════════════════════════════════════════════ */
#link-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 290px;
  background: #ffffff;
  border: 1px solid #d8d4cc;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  z-index: 200;
  overflow: hidden;
  display: none;
}
#link-panel.visible { display: block; }

#lp-header {
  background: #0d2040;
  color: #fff;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#lp-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  max-width: 220px;
}
#lp-close {
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: rgba(255,255,255,0.7);
  background: none;
  border: none;
  padding: 0;
  margin-left: 8px;
}
#lp-close:hover { color: #fff; }

.lp-section {
  padding: 10px 14px;
  border-bottom: 1px solid #e8e4dc;
}
.lp-section:last-child { border-bottom: none; }

.lp-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.lp-label.pred { color: #b08000; }
.lp-label.succ { color: #0f6e56; }
.lp-label.none { color: #999; }

.lp-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  border-radius: 4px;
  padding: 3px 4px;
  transition: background 0.12s;
}
.lp-item:hover { background: #f4f2ee; }

.lp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}
.lp-dot.pred { background: #d4a017; }
.lp-dot.succ { background: #0f6e56; }

.lp-item-text { color: #0d2040; line-height: 1.35; }

.lp-hint {
  font-size: 10.5px;
  color: #999;
  padding: 8px 14px;
  line-height: 1.5;
}

#lp-legend {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-bottom: 1px solid #e8e4dc;
  font-size: 10.5px;
  color: #666;
  align-items: center;
}
.leg-item { display: flex; align-items: center; gap: 5px; }
.leg-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════ */
.footer-section {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 48px;
  align-items: start;
  font-family: 'DM Sans', sans-serif;
}
.footer-section .f-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
}
.footer-section h4 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.footer-section p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  max-width: 42ch;
}
.footer-section ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}
.footer-section ul li a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: border-color 0.2s;
}
.footer-section ul li a:hover { border-color: var(--text); }
.footer-section ul li { color: var(--text-muted); }

.footer-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 12px 22px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.2s, background 0.2s;
}
.footer-cta:hover {
  transform: translateY(-1px);
  background: #000;
}
.footer-cta .arrow {
  display: inline-block;
  transition: transform 0.2s;
}
.footer-cta:hover .arrow { transform: translateX(3px); }

.copyright {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  padding-bottom: 48px;
}
