/* Software Factory Security Framework (SF²) - Custom Styling */

/* ============================================
   TABLE ENHANCEMENTS FOR COMPARISON MATRICES
   ============================================ */

/* Enhanced table styling for framework comparison matrices */
.md-typeset table:not([class]) {
  font-size: 0.85rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
}

.md-typeset table:not([class]) thead {
  background-color: var(--md-primary-fg-color);
  color: white;
  font-weight: 600;
}

.md-typeset table:not([class]) th {
  padding: 0.8rem;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--md-primary-fg-color--dark);
}

.md-typeset table:not([class]) td {
  padding: 0.6rem;
  vertical-align: top;
  border: 1px solid var(--md-default-fg-color--lightest);
}

/* Zebra striping for better readability */
.md-typeset table:not([class]) tbody tr:nth-child(even) {
  background-color: var(--md-code-bg-color);
}

.md-typeset table:not([class]) tbody tr:hover {
  background-color: var(--md-accent-fg-color--transparent);
}

/* ============================================
   PRIORITY AND RISK LEVEL INDICATORS
   ============================================ */

/* Priority/risk level cell highlighting */
/* Enhanced with text indicators for accessibility */
.critical,
td.critical,
.md-typeset table td:has(.critical) {
  background-color: #ffebee !important;
  font-weight: 500;
  border-left: 4px solid #f44336;
}

.critical::before {
  content: "[CRITICAL] ";
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75em;
  letter-spacing: 0.05em;
}

.high,
td.high,
.md-typeset table td:has(.high) {
  background-color: #fff3e0 !important;
  border-left: 4px solid #ff9800;
}

.high::before {
  content: "[HIGH] ";
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75em;
  letter-spacing: 0.05em;
}

.medium,
td.medium,
.md-typeset table td:has(.medium) {
  background-color: #e8f5e9 !important;
  border-left: 4px solid #4caf50;
}

.medium::before {
  content: "[MEDIUM] ";
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75em;
  letter-spacing: 0.05em;
}

.low,
td.low,
.md-typeset table td:has(.low) {
  background-color: #f5f5f5 !important;
}

.low::before {
  content: "[LOW] ";
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75em;
  letter-spacing: 0.05em;
}

/* ============================================
   STRATEGIC POSITIONING QUADRANT STYLING
   ============================================ */

.quadrant-visionaries,
.visionaries {
  border-left: 4px solid #4CAF50;
  padding-left: 0.75rem !important;
}

.quadrant-leaders,
.leaders {
  border-left: 4px solid #2196F3;
  padding-left: 0.75rem !important;
}

.quadrant-niche,
.niche-players {
  border-left: 4px solid #FFC107;
  padding-left: 0.75rem !important;
}

.quadrant-challengers,
.challengers {
  border-left: 4px solid #F44336;
  padding-left: 0.75rem !important;
}

/* ============================================
   ADMONITION ENHANCEMENTS
   ============================================ */

/* Executive Insight admonition */
.admonition.executive-insight {
  border-left: 0.4rem solid #1976d2;
}

.admonition.executive-insight > .admonition-title {
  background-color: rgba(25, 118, 210, 0.1);
}

.admonition.executive-insight > .admonition-title::before {
  content: "💼";
  margin-right: 0.4rem;
}

/* Strategic Opportunity admonition */
.admonition.strategic {
  border-left: 0.4rem solid #7c4dff;
}

.admonition.strategic > .admonition-title {
  background-color: rgba(124, 77, 255, 0.1);
}

.admonition.strategic > .admonition-title::before {
  content: "🎯";
  margin-right: 0.4rem;
}

/* ============================================
   PRINT OPTIMIZATION
   ============================================ */

@media print {
  /* Prevent page breaks inside tables */
  .md-typeset table {
    page-break-inside: avoid;
  }

  /* Prevent page breaks inside admonitions */
  .admonition {
    page-break-inside: avoid;
    border: 1px solid #ccc;
  }

  /* Remove navigation and header in print */
  .md-header,
  .md-tabs,
  .md-sidebar {
    display: none !important;
  }

  /* Optimize table printing */
  .md-typeset table:not([class]) {
    font-size: 0.75rem;
  }

  .md-typeset table:not([class]) th,
  .md-typeset table:not([class]) td {
    padding: 0.4rem;
  }

  /* Ensure links are visible in print */
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  /* Don't show link URLs for internal anchors */
  a[href^="#"]:after {
    content: "";
  }
}

/* ============================================
   RESPONSIVE TABLE HANDLING
   ============================================ */

@media screen and (max-width: 76.1875em) {
  /* Make tables scrollable on smaller screens */
  .md-typeset table:not([class]) {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ============================================
   STEWARDSHIP AREA BADGES
   ============================================ */

.stewardship-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0.2rem;
}

.stewardship-supply-chain {
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ef5350;
}

.stewardship-process {
  background-color: #e3f2fd;
  color: #1565c0;
  border: 1px solid #42a5f5;
}

.stewardship-runtime {
  background-color: #f3e5f5;
  color: #6a1b9a;
  border: 1px solid #ab47bc;
}

.stewardship-third-party {
  background-color: #fff3e0;
  color: #e65100;
  border: 1px solid #ff9800;
}

.stewardship-learning {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #66bb6a;
}

/* ============================================
   FRAMEWORK RELATIONSHIP INDICATORS
   ============================================ */

.framework-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin: 0.1rem;
}

.framework-nist {
  background-color: #1e3a8a;
  color: white;
}

.framework-owasp {
  background-color: #7c3aed;
  color: white;
}

.framework-bsimm {
  background-color: #059669;
  color: white;
}

/* ============================================
   INVESTMENT TYPE INDICATORS
   ============================================ */

.investment-bau {
  color: #dc2626;
  font-weight: 500;
}

.investment-scaling {
  color: #2563eb;
  font-weight: 500;
}

.investment-platform {
  color: #7c3aed;
  font-weight: 500;
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Enhanced focus indicators for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
  outline: 3px solid #2196F3;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.3);
}

/* Skip to main content link for keyboard users */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: #2196F3;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 9999;
  font-weight: 600;
}

.skip-to-main:focus {
  top: 0;
  outline: 3px solid #FFC107;
  outline-offset: 2px;
}

/* Ensure links are distinguishable without color alone */
.md-typeset a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.md-typeset a:hover {
  text-decoration-thickness: 2px;
}

/* Screen reader only text utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
  .md-typeset table:not([class]) {
    border: 2px solid currentColor;
  }

  .md-typeset table:not([class]) th,
  .md-typeset table:not([class]) td {
    border: 2px solid currentColor;
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
