/* Threat-model route CSS.
   Tokens (--bg-*, --ink-*, --line-*, --accent*) cascade from .cv-landing-home-v2-chrome
   (defined in desktop-v2-tokens.css, bundled in landing-home-v2-chrome.css).
   Spacing/radius/font-mono helpers come from theme-host.css (landing-base.css).
   Diagram viewer rules come from landing-diagram-viewer.css. */

.cv-threat-model-root {
  display: block;
  position: relative;
  isolation: isolate;
  background: var(--bg-2);
  color: var(--ink-0);
  font-family: "Inter Tight", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.cv-threat-model-root .tm-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: 56px;
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--cv-space-2xl) var(--cv-padding-x) var(--cv-space-3xl);
}

/* ---------- Hero ---------- */
.cv-threat-model-root .cv-tm-hero {
  position: relative;
  display: block;
  overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--line-2);
  contain: content;
}

.cv-threat-model-root .cv-tm-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(60% 50% at 75% 35%, oklch(0.30 0.06 var(--hue) / 0.30), transparent 70%),
    radial-gradient(70% 60% at 15% 85%, oklch(0.25 0.04 calc(var(--hue) + 40) / 0.20), transparent 70%),
    linear-gradient(180deg, var(--bg-0), var(--bg-2));
}

.cv-threat-model-root .cv-tm-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: 0.5;
  background-image:
    linear-gradient(var(--line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(80% 80% at 50% 30%, black 30%, transparent 90%);
  mask-image: radial-gradient(80% 80% at 50% 30%, black 30%, transparent 90%);
  pointer-events: none;
}

.cv-threat-model-root .cv-tm-hero .hero {
  max-width: 1320px;
  margin: 0 auto;
  padding: 72px var(--cv-padding-x) 56px;
}

.cv-threat-model-root .cv-tm-hero .breadcrumb {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 28px;
}

.cv-threat-model-root .cv-tm-hero .breadcrumb a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color var(--cv-duration) var(--cv-ease);
}

.cv-threat-model-root .cv-tm-hero .breadcrumb a:hover {
  color: var(--ink-0);
}

.cv-threat-model-root .cv-tm-hero .breadcrumb-sep {
  opacity: 0.45;
}

.cv-threat-model-root .cv-tm-hero .breadcrumb > span:last-child {
  color: var(--ink-0);
}

.cv-threat-model-root .cv-tm-hero .label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: oklch(0.18 0.012 250 / 0.4);
  border: 1px solid var(--line-1);
  border-radius: 100px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 24px;
}

.cv-threat-model-root .cv-tm-hero .label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.cv-threat-model-root .cv-tm-hero h1 {
  font-family: "Inter Tight", Inter, system-ui, sans-serif;
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink-0);
  margin: 0 0 20px;
  text-wrap: balance;
}

.cv-threat-model-root .cv-tm-hero .subtitle {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-1);
  max-width: 640px;
  margin: 0;
}

/* ---------- Sidebar ---------- */
.cv-threat-model-root .tm-sidebar-root {
  display: block;
  min-block-size: 0;
  contain: style;
  position: sticky;
  top: 88px;
  align-self: start;
  max-block-size: calc(100svh - 96px);
}

.cv-threat-model-root .desktop-sidebar {
  display: flex;
  flex-direction: column;
  block-size: 100%;
  max-block-size: 100%;
  gap: 12px;
  padding: 14px 12px;
  background: oklch(0.10 0.012 250 / 0.55);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  box-shadow:
    0 1px 0 oklch(0.97 0.005 250 / 0.04) inset,
    0 8px 24px oklch(0.06 0.012 250 / 0.32);
  overflow: hidden;
}

.cv-threat-model-root .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  transition: color var(--cv-duration) var(--cv-ease);
}

.cv-threat-model-root .back-link::before {
  content: '←';
  opacity: 0.7;
}

.cv-threat-model-root .back-link:hover {
  color: var(--ink-0);
  text-decoration: none;
}

.cv-threat-model-root .desktop-toc {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-1) transparent;
}

.cv-threat-model-root .desktop-toc::-webkit-scrollbar {
  width: 6px;
}

.cv-threat-model-root .desktop-toc::-webkit-scrollbar-thumb {
  background: var(--line-1);
  border-radius: 3px;
}

.cv-threat-model-root .tm-sidebar-link {
  display: block;
  position: relative;
  padding: 7px 10px 7px 12px;
  border-radius: 6px;
  color: var(--ink-2);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition:
    color var(--cv-duration) var(--cv-ease),
    background var(--cv-duration) var(--cv-ease);
}

.cv-threat-model-root .tm-sidebar-link:hover {
  color: var(--ink-0);
  background: oklch(0.22 0.012 250 / 0.5);
  text-decoration: none;
}

.cv-threat-model-root .tm-sidebar-link--active {
  color: var(--accent);
  background: oklch(0.22 0.012 250 / 0.35);
  box-shadow: inset 2px 0 0 var(--accent);
}

.cv-threat-model-root .mobile-sidebar {
  display: none;
}

.cv-threat-model-root .mobile-toc {
  display: flex;
  gap: 2px;
  white-space: nowrap;
  margin: 0;
  padding: 0 var(--cv-padding-x);
  list-style: none;
}

.cv-threat-model-root .mobile-link {
  padding: 8px 10px;
  font-size: 10px;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.cv-threat-model-root .mobile-link.tm-sidebar-link--active {
  color: var(--accent);
  background: transparent;
  box-shadow: none;
  border-bottom-color: var(--accent);
}

/* ---------- Sections ---------- */
.cv-threat-model-root .tm-content-root {
  display: block;
  min-width: 0;
  overflow: hidden;
  contain: layout style;
}

.cv-threat-model-root .cv-tm-section {
  display: block;
  scroll-margin-top: 96px;
  overflow: hidden;
  contain: layout style;
}

.cv-threat-model-root .cv-tm-section__shell {
  padding: 40px 0;
  border-bottom: 1px solid var(--line-2);
}

.cv-threat-model-root .cv-tm-section__shell:last-child {
  border-bottom: none;
}

.cv-threat-model-root .cv-tm-section h2 {
  font-family: "Inter Tight", Inter, system-ui, sans-serif;
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.018em;
  color: var(--ink-0);
  margin: 0 0 18px;
}

.cv-threat-model-root .cv-tm-section__overview {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink-1);
  max-width: 720px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.cv-threat-model-root .cv-tm-section__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 7px 14px;
  background: oklch(0.18 0.012 250 / 0.4);
  border: 1px solid var(--line-1);
  border-radius: 100px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
  transition:
    color var(--cv-duration) var(--cv-ease),
    border-color var(--cv-duration) var(--cv-ease),
    background var(--cv-duration) var(--cv-ease);
}

.cv-threat-model-root .cv-tm-section__toggle:hover {
  color: var(--ink-0);
  border-color: var(--accent-dim);
  background: oklch(0.22 0.012 250 / 0.55);
}

.cv-threat-model-root .cv-tm-section__toggle-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  transition: transform var(--cv-duration) var(--cv-ease);
}

.cv-threat-model-root .cv-tm-section__toggle-icon--open {
  transform: rotate(180deg);
}

.cv-threat-model-root .cv-tm-section__details {
  display: grid;
  grid-template-rows: 0fr;
  transition:
    grid-template-rows 300ms var(--cv-ease),
    margin 300ms var(--cv-ease);
  margin-top: 0;
}

.cv-threat-model-root .cv-tm-section__details--open {
  grid-template-rows: 1fr;
  margin-top: 24px;
}

.cv-threat-model-root .cv-tm-section__details-inner {
  overflow: hidden;
  opacity: 0;
  transition: opacity 300ms var(--cv-ease);
  visibility: hidden;
}

.cv-threat-model-root .cv-tm-section__details--open .cv-tm-section__details-inner {
  opacity: 1;
  visibility: visible;
}

.cv-threat-model-root .cv-tm-section__details-static {
  margin-top: 24px;
}

.cv-threat-model-root .tm-content-root p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-1);
  overflow-wrap: break-word;
  word-break: break-word;
}

.cv-threat-model-root .tm-content-root p:last-child {
  margin-bottom: 0;
}

.cv-threat-model-root .detail-title {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.cv-threat-model-root .detail-title--spaced {
  margin-top: 28px;
}

/* ---------- Tables ---------- */
.cv-threat-model-root .cv-tm-table {
  display: block;
  margin: 14px 0;
}

.cv-threat-model-root .cv-tm-table .table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: oklch(0.14 0.012 250 / 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cv-threat-model-root .cv-tm-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cv-threat-model-root .cv-tm-table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-1);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  color: var(--ink-2);
}

.cv-threat-model-root .cv-tm-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  line-height: 1.55;
  color: var(--ink-1);
  vertical-align: top;
}

.cv-threat-model-root .cv-tm-table tr:last-child td {
  border-bottom: none;
}

.cv-threat-model-root .cv-tm-table tr:hover td {
  background: oklch(0.18 0.012 250 / 0.35);
}

.cv-threat-model-root .cv-tm-table td:first-child {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

/* ---------- Boxes ---------- */
.cv-threat-model-root .warning-box {
  padding: 14px 18px;
  background: oklch(0.7 0.13 70 / 0.08);
  border: 1px solid oklch(0.7 0.13 70 / 0.32);
  border-left: 3px solid oklch(0.78 0.15 70);
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-1);
}

.cv-threat-model-root .info-box {
  padding: 14px 18px;
  background: oklch(0.55 0.14 var(--hue) / 0.12);
  border: 1px solid oklch(0.55 0.14 var(--hue) / 0.32);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-1);
}

.cv-threat-model-root .info-box--spaced {
  margin-top: 16px;
}

/* ---------- Lists ---------- */
.cv-threat-model-root .list,
.cv-threat-model-root .rec-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cv-threat-model-root .list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-1);
}

.cv-threat-model-root .list li::before {
  content: '—';
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.6;
}

.cv-threat-model-root .check-list li::before {
  content: '✓';
  color: oklch(0.8 0.13 150);
  opacity: 0.9;
}

/* ---------- Recommendations ---------- */
.cv-threat-model-root .rec-item {
  padding: 12px 16px;
  background: oklch(0.14 0.012 250 / 0.55);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-1);
}

.cv-threat-model-root .badge-critical,
.cv-threat-model-root .badge-important,
.cv-threat-model-root .badge-rec {
  padding: 3px 9px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 4px;
}

.cv-threat-model-root .badge-critical {
  border: 1px solid oklch(0.55 0.18 25 / 0.5);
  color: oklch(0.78 0.18 25);
}

.cv-threat-model-root .badge-important {
  border: 1px solid oklch(0.55 0.15 70 / 0.5);
  color: oklch(0.8 0.16 70);
}

.cv-threat-model-root .badge-rec {
  border: 1px solid oklch(0.55 0.13 150 / 0.5);
  color: oklch(0.8 0.13 150);
}

/* ---------- Scenario cards ---------- */
.cv-threat-model-root .scenario-card {
  padding: 20px 22px;
  margin-bottom: 14px;
  background: oklch(0.14 0.012 250 / 0.55);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 1px 0 oklch(0.97 0.005 250 / 0.04) inset,
    0 8px 24px oklch(0.06 0.012 250 / 0.22);
}

.cv-threat-model-root .scenario-card:last-child {
  margin-bottom: 0;
}

.cv-threat-model-root .scenario-title {
  font-family: "Inter Tight", Inter, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-0);
  letter-spacing: -0.008em;
}

.cv-threat-model-root .scenario-row {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-1);
}

.cv-threat-model-root .scenario-label {
  width: 90px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.cv-threat-model-root .scenario-result {
  margin-top: 12px;
  padding: 10px 14px;
  background: oklch(0.10 0.012 250 / 0.55);
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--accent-soft);
}

/* ---------- Buttons ---------- */
.cv-threat-model-root .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  background: var(--ink-0);
  color: var(--bg-0);
  border: 1px solid var(--ink-0);
  border-radius: 9px;
  font-family: "Inter Tight", Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1;
  text-decoration: none;
  transition:
    background var(--cv-duration) var(--cv-ease),
    transform var(--cv-duration) var(--cv-ease);
}

.cv-threat-model-root .btn:hover {
  background: oklch(0.92 0.01 250);
  color: var(--bg-0);
  text-decoration: none;
  transform: translateY(-1px);
}

.cv-threat-model-root .btn--ghost {
  background: oklch(0.14 0.012 250 / 0.55);
  border-color: var(--line-1);
  color: var(--ink-1);
}

.cv-threat-model-root .btn--ghost:hover {
  background: oklch(0.22 0.012 250 / 0.6);
  border-color: var(--accent-dim);
  color: var(--ink-0);
}

.cv-threat-model-root .ctas {
  margin-top: 20px;
}

/* ---------- Disclosure ---------- */
.cv-threat-model-root .disclosure-email {
  display: inline-block;
  margin-top: 16px;
  padding: 9px 16px;
  background: oklch(0.14 0.012 250 / 0.55);
  border: 1px solid var(--line-1);
  border-radius: 100px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  transition:
    border-color var(--cv-duration) var(--cv-ease),
    color var(--cv-duration) var(--cv-ease);
}

.cv-threat-model-root .disclosure-email:hover {
  border-color: var(--accent-dim);
  color: var(--accent-soft);
  text-decoration: none;
}

/* ---------- Diagrams ---------- */
.cv-threat-model-root .diagram-block {
  display: block;
  margin: 20px 0;
}

.cv-threat-model-root .diagram-loading {
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: oklch(0.14 0.012 250 / 0.45);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  color: var(--ink-2);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .cv-threat-model-root .cv-tm-hero .hero {
    padding: 48px var(--cv-padding-x) 36px;
  }

  .cv-threat-model-root .cv-tm-hero .subtitle {
    font-size: 15px;
  }

  .cv-threat-model-root .tm-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    padding: 0 0 var(--cv-space-2xl);
  }

  .cv-threat-model-root .tm-sidebar-root {
    position: sticky;
    top: 0;
    z-index: 10;
    max-block-size: none;
    background: var(--bg-2);
  }

  .cv-threat-model-root .desktop-sidebar {
    display: none;
  }

  .cv-threat-model-root .mobile-sidebar {
    display: block;
    position: relative;
    top: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    background: oklch(0.10 0.012 250 / 0.7);
    border-bottom: 1px solid var(--line-2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .cv-threat-model-root .mobile-sidebar::-webkit-scrollbar {
    display: none;
  }

  .cv-threat-model-root .cv-tm-section {
    scroll-margin-top: 56px;
  }

  .cv-threat-model-root .cv-tm-section__shell {
    padding: 28px var(--cv-padding-x);
  }

  .cv-threat-model-root .cv-tm-section h2 {
    font-size: clamp(20px, 5vw, 26px);
    margin-bottom: 14px;
  }

  .cv-threat-model-root .cv-tm-section__overview {
    font-size: 14px;
  }

  .cv-threat-model-root .cv-tm-section__details--open,
  .cv-threat-model-root .cv-tm-section__details-static {
    margin-top: 18px;
  }

  .cv-threat-model-root .cv-tm-section__details-inner,
  .cv-threat-model-root .warning-box,
  .cv-threat-model-root .info-box,
  .cv-threat-model-root .scenario-result {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .cv-threat-model-root .cv-tm-table .table-wrapper {
    -webkit-overflow-scrolling: touch;
  }

  .cv-threat-model-root .cv-tm-table table {
    font-size: 12px;
  }

  .cv-threat-model-root .cv-tm-table th {
    padding: 8px 12px;
    font-size: 10px;
    white-space: normal;
  }

  .cv-threat-model-root .cv-tm-table td {
    padding: 8px 12px;
    font-size: 12px;
  }

  .cv-threat-model-root .cv-tm-table td:first-child {
    font-size: 11px;
  }

  .cv-threat-model-root .warning-box,
  .cv-threat-model-root .info-box {
    padding: 10px 14px;
    font-size: 12.5px;
  }

  .cv-threat-model-root .scenario-card {
    padding: 16px;
  }

  .cv-threat-model-root .scenario-row {
    flex-direction: column;
    gap: 4px;
  }

  .cv-threat-model-root .scenario-label {
    width: auto;
  }

  .cv-threat-model-root .scenario-result {
    font-size: 11px;
  }

  .cv-threat-model-root .rec-item {
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    font-size: 13px;
  }

  .cv-threat-model-root .list li {
    font-size: 13px;
  }

  .cv-threat-model-root .disclosure-email {
    font-size: 12px;
    padding: 8px 14px;
  }

  .cv-threat-model-root .ctas {
    flex-direction: column;
  }

  .cv-threat-model-root .ctas .btn {
    width: 100%;
    text-align: center;
  }
}

