/* SEDI Implementation Guide — custom styles for MkDocs Material */

:root {
  --md-primary-fg-color: #1e3a5f;
  --md-primary-fg-color--light: #126dc4;
  --md-primary-fg-color--dark: #08355e;
  --md-accent-fg-color: #126dc4;
  --md-typeset-a-color: #126dc4;
}

/* Wider content area for tables */
.md-content {
  max-width: 100%;
}

.md-typeset {
  font-size: 1rem;
  line-height: 1.65;
  color: #334155;
}

/* Headings */
.md-typeset h1 {
  font-weight: 700;
  color: #08355e;
  border-bottom: 2px solid #08355e;
  padding-bottom: 0.3em;
  margin-bottom: 0.8em;
}

.md-typeset h2 {
  font-weight: 600;
  color: #08355e;
  border-bottom: 1px solid #cbd5e0;
  padding-bottom: 0.2em;
  margin-top: 2em;
}

.md-typeset h3 {
  font-weight: 600;
  color: #1e3a5f;
  margin-top: 1.5em;
}

.md-typeset h4 {
  font-weight: 600;
  color: #1e3a5f;
}

/* ── Tables ─────────────────────────────────────────────── */

/* Scroll wrapper so wide tables don't blow out the page */
.md-typeset__scrollwrap {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.md-typeset table:not([class]) {
  font-size: 0.875rem;
  line-height: 1.45;
  border-collapse: collapse;
  display: table;
  width: 100%;
  table-layout: auto;
  border: 1px solid #cbd5e0;
}

.md-typeset table:not([class]) th {
  background-color: #08355e;
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  text-align: left;
  padding: 0.55em 0.7em;
  white-space: nowrap;
  border: 1px solid #062847;
  position: sticky;
  top: 0;
  z-index: 1;
}

.md-typeset table:not([class]) td {
  padding: 0.5em 0.7em;
  border: 1px solid #e2e8f0;
  vertical-align: top;
  max-width: 36em;
  overflow: visible;
  position: relative;
}

/* Give the first column (Req ID) a fixed width so it doesn't squish */
.md-typeset table:not([class]) td:first-child,
.md-typeset table:not([class]) th:first-child {
  white-space: nowrap;
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  min-width: 8em;
}

/* All table cells wrap text; min-width prevents extreme squishing */
.md-typeset table:not([class]) td {
  white-space: normal;
  word-break: break-word;
  min-width: 5em;
}

/* Last column in wide tables gets more room */
.md-typeset table:not([class]) td:last-child {
  min-width: 8em;
}

/* Scroll hint for wide tables on mobile */
@media (max-width: 960px) {
  .md-typeset table:not([class]) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .md-typeset__scrollwrap::after {
    opacity: 1;
  }
}

.md-typeset table:not([class]) tr:nth-child(even) td {
  background-color: #f7fafc;
}

.md-typeset table:not([class]) tr:hover td {
  background-color: #edf2f7;
}

/* Subtle scroll hint shadow on table containers */
.md-typeset__scrollwrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2em;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.8));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.md-typeset__scrollwrap:hover::after {
  opacity: 1;
}

/* Inline code */
.md-typeset code {
  background-color: #edf2f7;
  color: #1e3a5f;
  border: 1px solid #e2e8f0;
  padding: 0.1em 0.3em;
  font-size: 0.85em;
  border-radius: 2px;
}

/* Blockquotes: statutory text */
.md-typeset blockquote {
  border-left: 4px solid #126dc4;
  background-color: #e8f0f8;
  padding: 0.8em 1.2em;
  margin: 1em 0;
  color: #334155;
  font-style: normal;
  font-size: 0.95rem;
}

/* Nav sidebar */
.md-nav__item--nested > .md-nav {
  display: block !important;
}

.md-sidebar--primary .md-nav__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #566573;
}

.md-sidebar--primary .md-nav__link {
  font-size: 0.8rem;
}

/* Header bar */
.md-header {
  background-color: #e8f0f8;
  color: #1e3a5f;
  border-bottom: 1px solid #cbd5e0;
  --md-primary-bg-color: #1e3a5f;
}

.md-header__title {
  color: #1e3a5f;
}

.md-header .md-logo,
.md-header .md-search__icon,
.md-header .md-icon {
  color: #1e3a5f;
}

/* Publication banner styling */
.pub-banner {
  background: linear-gradient(to right, rgba(8,53,94,0.92) 0%, rgba(8,53,94,0.78) 40%, rgba(18,109,196,0.72) 100%),
              url('../assets/hero.webp') center 70%/cover no-repeat;
  color: white;
  padding: 3em 2em;
  margin: -0.8em -0.8em 2em -0.8em;
  border-radius: 0;
}

.pub-banner h1 {
  color: white !important;
  border-bottom: none !important;
  margin: 0 0 0.3em 0;
  font-size: 1.6em;
}

.pub-banner .headerlink,
.pub-banner h1 .headerlink,
.pub-banner a.headerlink {
  display: none !important;
}

.pub-banner .pub-subtitle {
  font-size: 1.1em;
  opacity: 0.95;
  margin-bottom: 1em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.pub-banner .pub-meta {
  font-size: 0.85em;
  opacity: 0.85;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ── Control type badges ───────────────────────────────── */
/* Badges are rendered via data-control attr on the <span> after each h4.
   The span sits OUTSIDE the heading so it doesn't pollute anchor slugs. */

.control-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: "Fira Code", monospace;
  letter-spacing: 0.04em;
  padding: 0.15em 0.45em;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 0.5em;
  position: relative;
  top: -1px;
  cursor: help;
  text-decoration: none;
}

/* Tooltip */
.control-badge[title] {
  position: relative;
}
.control-badge[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 6px);
  background: #1a202c;
  color: #fff;
  font-size: 0.65rem;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  letter-spacing: normal;
  padding: 0.4em 0.7em;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.control-badge[title]:hover::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 2px);
  border: 4px solid transparent;
  border-bottom-color: #1a202c;
  z-index: 10;
  pointer-events: none;
}

.control-badge.auto {
  background-color: #c6f6d5;
  color: #22543d;
  border: 1px solid #9ae6b4;
}

.control-badge.expt {
  background-color: #e0e7ff;
  color: #3730a3;
  border: 1px solid #a5b4fc;
}

.control-badge.admn {
  background-color: #e2e8f0;
  color: #3b4c5e;
  border: 1px solid #cbd5e0;
}

/* Keep badge colors when heading is targeted */
.md-typeset h4:target .control-badge.auto {
  background-color: #c6f6d5;
  color: #22543d;
}
.md-typeset h4:target .control-badge.expt {
  background-color: #e0e7ff;
  color: #3730a3;
}
.md-typeset h4:target .control-badge.admn {
  background-color: #e2e8f0;
  color: #3b4c5e;
}

/* ── Review status badges ──────────────────────────────── */

.review-badge {
  display: inline-block;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.15em 0.45em;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 0.4em;
  background-color: #7c3aed;
  color: #fff;
  border: none;
  cursor: help;
  position: relative;
  top: -1px;
}

.review-badge[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 6px);
  background: #1a202c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 400;
  padding: 0.4em 0.7em;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.review-badge[title]:hover::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 2px);
  border: 4px solid transparent;
  border-bottom-color: #1a202c;
  z-index: 10;
  pointer-events: none;
}

.md-typeset h4:target .review-badge {
  background-color: #7c3aed;
  color: #fff;
}

/* ── Deep-check verdict indicators ─────────────────────── */

/* ── Deep-check slide-in panel ──────────────────────────── */

#dc-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 480px;
  height: 100vh;
  background: #fff;
  border-left: 1px solid #e2e8f0;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 100;
  transition: right 0.25s ease;
  display: flex;
  flex-direction: column;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.85rem;
}

#dc-panel.dc-panel-open {
  right: 0;
}

.dc-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8em 1.2em;
  background: #e8f0f8;
  color: #1e3a5f;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.dc-panel-close {
  background: none;
  border: none;
  color: #1e3a5f;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 0.3em;
  opacity: 0.7;
}

.dc-panel-close:hover {
  opacity: 1;
}

.dc-panel-body {
  overflow-y: auto;
  padding: 1em 1.2em;
  flex: 1;
}

.dc-verdict-header {
  padding: 0.6em 0.8em;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.8em;
}

.dc-verdict-label {
  font-size: 1rem;
}

.dc-stale-warn {
  font-size: 0.7rem;
  font-weight: 500;
  margin-left: 0.5em;
  opacity: 0.8;
}

.dc-meta {
  display: flex;
  gap: 1.5em;
  font-size: 0.75rem;
  color: #566573;
  margin-bottom: 1em;
  padding-bottom: 0.5em;
  border-bottom: 1px solid #e2e8f0;
}

.dc-section {
  margin-bottom: 1em;
}

.dc-section h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e3a5f;
  margin: 0 0 0.4em 0;
  padding: 0;
  background: none;
  border: none;
}

.dc-issue {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #475569;
  padding: 0.5em 0.7em;
  background: #f7fafc;
  border-left: 3px solid #e2e8f0;
  border-radius: 2px;
  margin-bottom: 0.5em;
}

.dc-suggestion {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #334155;
  padding: 0.5em 0.7em;
  background: #ebf8ff;
  border-left: 3px solid #126dc4;
  border-radius: 2px;
}

.dc-details {
  margin-top: 1em;
  font-size: 0.75rem;
}

.dc-details summary {
  cursor: pointer;
  color: #566573;
  font-weight: 600;
  padding: 0.3em 0;
}

.dc-details summary:hover {
  color: #475569;
}

.dc-input-section {
  margin-top: 0.5em;
}

.dc-input-section label {
  display: block;
  font-weight: 600;
  color: #475569;
  font-size: 0.7rem;
  margin-bottom: 0.2em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dc-input-section pre {
  background: #1a202c;
  color: #e2e8f0;
  padding: 0.6em 0.8em;
  border-radius: 3px;
  font-size: 0.7rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.dc-actions {
  display: flex;
  gap: 0.5em;
  margin-top: 1em;
  padding-top: 0.8em;
  border-top: 1px solid #e2e8f0;
}

.dc-copy, .dc-raw {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.75rem;
  padding: 0.4em 0.8em;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
}

.dc-copy {
  background: #08355e;
  color: #fff;
  border: none;
}

.dc-copy:hover {
  background: #126dc4;
}

.dc-raw {
  background: #f7fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.dc-raw:hover {
  background: #e2e8f0;
}

@media (max-width: 600px) {
  #dc-panel {
    width: 100%;
    right: -100%;
  }
}

.dc-report-link {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.7rem;
  color: #566573;
  cursor: pointer;
  padding: 0.3em 0.8em;
  margin: -0.5em 0 1em 0;
  border-left: 3px solid #e2e8f0;
  transition: background 0.15s, border-color 0.15s;
}

.dc-report-link:hover {
  background: #f7fafc;
  border-left-color: #126dc4;
  color: #475569;
}

.dc-report-link.dc-pass {
  border-left-color: #9ae6b4;
}

.dc-report-link.dc-flag {
  border-left-color: #f6e05e;
}

.dc-report-link.dc-fail {
  border-left-color: #feb2b2;
}

.dc-report-link.dc-stale {
  border-left-color: #cbd5e0;
  opacity: 0.7;
}

.dc-report-icon {
  margin-right: 0.3em;
}

.dc-report-text {
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.dc-verdict[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 6px);
  background: #1a202c;
  color: #fff;
  font-size: 0.65rem;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 400;
  padding: 0.4em 0.7em;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.dc-verdict[title]:hover::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 2px);
  border: 4px solid transparent;
  border-bottom-color: #1a202c;
  z-index: 10;
  pointer-events: none;
}

/* ── Requirement cards ──────────────────────────────────── */

/* h4 = requirement ID headings (SEDI-BOR-01, etc.) */
.md-typeset h4 {
  font-weight: 700;
  color: #08355e;
  font-size: 0.95rem;
  margin-top: 2em;
  padding: 0.5em 0.8em;
  background-color: #edf2f7;
  border-left: 4px solid #08355e;
  border-radius: 2px;
  scroll-margin-top: 4rem;
  transition: background-color 0.2s, border-left-color 0.2s;
}

/* Highlight the targeted requirement card on anchor jump */
.md-typeset h4:target {
  background-color: #126dc4;
  color: #fff !important;
  border-left-color: #08355e;
}

/* Horizontal rules between requirement cards */
.md-typeset hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 2em 0;
}

/* Bold labels within requirement cards */
.md-typeset strong {
  color: #1e293b;
}

/* ── ToC styling ───────────────────────────────────────── */

/* Left nav: active page */
.md-nav__link--active {
  font-weight: 700 !important;
  color: #08355e !important;
  border-left: 3px solid #126dc4;
  padding-left: 0.5em;
}

/* Right-side on-page ToC: keep entries compact */
.md-sidebar--secondary .md-nav__link {
  font-size: 0.7rem;
  line-height: 1.25;
  padding-top: 0.12em;
  padding-bottom: 0.12em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.md-sidebar--secondary .md-nav__link--active {
  font-weight: 700 !important;
  color: #126dc4 !important;
}

/* Footer */
.md-footer {
  background-color: #e8f0f8;
  color: #1e3a5f;
}

.md-footer-meta {
  padding: 1.5em 0;
}

.md-footer-meta .md-copyright {
  display: none;
}

/* ── AI-generated content marker ───────────────────────── */
/* Remove individual notices after human review and sign-off */

:root {
  --md-admonition-icon--ai-generated: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1.07A7.001 7.001 0 0 1 14 23h-4a7.001 7.001 0 0 1-6.93-4H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2zm-4 13a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm8 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"/></svg>');
}

.md-typeset .admonition.ai-generated,
.md-typeset details.ai-generated {
  border-color: #7c3aed;
}

.md-typeset .ai-generated > .admonition-title,
.md-typeset details.ai-generated > summary {
  background-color: rgba(124, 58, 237, 0.1);
}

.md-typeset .ai-generated > .admonition-title::before,
.md-typeset details.ai-generated > summary::before {
  background-color: #7c3aed;
  -webkit-mask-image: var(--md-admonition-icon--ai-generated);
  mask-image: var(--md-admonition-icon--ai-generated);
}

/* ── Statute citation links ────────────────────────────── */

.statute-link {
  color: #126dc4 !important;
  text-decoration: underline !important;
  text-decoration-style: solid !important;
  text-underline-offset: 2px;
  cursor: pointer;
}

.statute-link:hover {
  color: #08355e !important;
  background-color: rgba(18, 109, 196, 0.08);
  border-radius: 2px;
  padding: 0 1px;
}

/* Inside blockquotes (lighter background) */
blockquote .statute-link {
  color: #08355e !important;
  text-decoration-color: #126dc4 !important;
}

/* Inside heading cards (blue background) */
.md-typeset h4 .statute-link {
  color: inherit !important;
  text-decoration-color: rgba(255,255,255,0.5) !important;
}

.md-typeset h4:target .statute-link {
  color: inherit !important;
}

/* ── Parameter-definition markers ────────────────────── */

.md-typeset em.param,
.md-typeset a.param {
  font-style: normal;
  font-weight: 600;
  background: #eef4fb;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  border-bottom: 2px dotted #126dc4;
  text-decoration: none;
  color: inherit;
}

.md-typeset a.param:hover {
  background: #dce8f7;
  border-bottom-color: #0d5299;
}

/* ── Keyboard focus ───────────────────────────────────── */

:focus-visible {
  outline: 2px solid #126dc4;
  outline-offset: 2px;
}

.control-badge:focus-visible,
.review-badge:focus-visible {
  outline: 2px solid #126dc4;
  outline-offset: 1px;
  border-radius: 3px;
}

/* ── Reduced motion ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Open external links in new tab via JS */
