/* Font Face Declarations */
@font-face {
  font-family: 'CommitMono';
  src: url('/fonts/CommitMono-400-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'CommitMono';
  src: url('/fonts/CommitMono-400-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'CommitMono';
  src: url('/fonts/CommitMono-700-Regular.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'CommitMono';
  src: url('/fonts/CommitMono-700-Italic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* Theme Variables - Light/Dark Mode */
:root {
  --font-sans: Satoshi, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'CommitMono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --bg-light: #f7f7f1;
  --surface: #f7f7f1;
  --text-dark: #2c2f33;
  --accent-orange: #ff6633;
  --accent-orange-hover: #ed5d2d;
  --danger: #9f2f1c;
  --success: #1f7a4d;
  --address-color: #6f42c1;
  --number-color: #005cc5;
  --border-dark: #2c2f33;
  --border-subtle: #d8d8cf;

  --bg-primary: var(--surface);
  --bg-secondary: var(--surface);
  --bg-tertiary: var(--bg-light);
  --bg-code: var(--surface);
  
  --text-primary: var(--text-dark);
  --text-secondary: var(--accent-orange);
  --text-muted: #3b3b3b;
  --text-light: #686868;
  
  --border-primary: var(--border-dark);
  --border-secondary: var(--border-subtle);
  
  --shadow: transparent;
  --shadow-hover: transparent;
}

/* Dark theme overrides */
[data-theme="dark"] {
  --bg-light: #202224;
  --surface: #202224;
  --bg-primary: var(--surface);
  --bg-secondary: var(--surface);
  --bg-tertiary: var(--bg-light);
  --bg-code: var(--surface);
  
  --text-dark: #e0e0e3;
  --text-primary: var(--text-dark);
  --text-secondary: #ff6633;
  --text-muted: #cfcfca;
  --text-light: #a8a8a2;
  
  --border-dark: #e0e0e3;
  --border-subtle: #595b5d;
  --border-primary: var(--border-dark);
  --border-secondary: var(--border-subtle);
  --address-color: #b08cff;
  --number-color: #78b7ff;
}

/* Global body styles */
body {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0;
  line-height: 1.45;
  transition: background-color 0.3s ease, color 0.3s ease;
}

html {
  scroll-behavior: smooth;
}

/* Global list styles */
li {
  /* color: var(--text-secondary); */
  transition: color 0.3s ease;
}

ul {
  list-style-type: none;
  padding-left: 1.5rem;
}

ul > li::before {
  content: "- ";
  color: var(--accent-orange);
  font-family: var(--font-mono);
  font-weight: 400;
  margin-right: 0.5rem;
  margin-left: -1rem;
}

ul > li:has(input[type="checkbox"])::before {
  content: none;
  margin-right: 0;
}

ol {
  padding-left: 1.5rem;
}

/* Global link styles */
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-underline-offset: 0.18em;
  transition: background-color 0.3s ease, color 0.3s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

a:hover {
  color: var(--accent-orange);
  background-color: transparent;
  text-decoration: underline;
  text-decoration-color: currentColor;
}

a:visited {
  text-decoration: none;
}

/* Report-specific styles for findings section */

.finding {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  margin: 2rem 0;
  overflow: hidden;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.finding h2 {
  background: var(--bg-secondary);
  margin: 0;
  padding: 1.5rem 2rem;
  border-bottom: 0.5px dashed var(--border-secondary);
  font-size: 28px;
  font-weight: 300;
  line-height: 1.2;
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.finding h2 code,
.finding h3 code {
  font-size: inherit;
  line-height: inherit;
}

.finding-meta {
  padding: 1rem 2rem;
  background: var(--bg-tertiary);
  border-bottom: 0.5px dashed var(--border-secondary);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

blockquote {
  margin: 0 !important;
  margin-block-start: 0 !important;
  margin-block-end: 0 !important;
  margin-inline-start: 0 !important;
  margin-inline-end: 0 !important;
  padding: 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  transition: border-color 0.3s ease, color 0.3s ease;
}

.findings-h2 {
  color: var(--text-primary);
  font-size: 32px;
  font-weight: 300;
  line-height: 1.2;
  margin: 0 0 2rem;
}

.finding-meta p {
  margin: 0.25rem 0;
  font-weight: 300;
}

.severity-high {
  color: var(--danger);
}

.severity-medium {
  color: var(--accent-orange);
}

.severity-low {
  color: var(--success);
}

.severity-info {
  color: var(--number-color);
}

.finding-content {
  padding: 0 0 2rem;
}

.finding-content h2 {
  border-bottom: 1px solid var(--border-dark);
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 300;
  line-height: 1.2;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.75rem;
}

.finding-content h2:first-child {
  margin-top: 0;
}

.finding-content h3 {
  color: var(--text-primary);
  border-bottom: 0.5px dashed var(--border-secondary);
  padding-bottom: 0.5rem;
  margin: 2rem 0 1rem 0;
  font-size: 18px;
  font-weight: 300;
  line-height: 1.3;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.finding-content h3:first-child {
  margin-top: 0;
}

.finding-content h4 {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.3;
  margin: 1.5rem 0 0.75rem;
  transition: color 0.3s ease;
}

.finding-content h5 {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  margin: 1.25rem 0 0.5rem;
  transition: color 0.3s ease;
}

.finding-content p {
  line-height: 1.45;
  color: var(--text-muted);
  font-weight: 300;
  margin: 0.75rem 0;
  transition: color 0.3s ease;
}

.finding-content a {
  color: inherit;
  text-decoration-color: var(--border-dark);
}

.finding-content a:hover {
  color: var(--accent-orange-hover);
  text-decoration-color: currentColor;
}

.finding-content a:hover code,
.finding-content a:hover code *,
.finding-content code a:hover,
.finding-content code a:hover * {
  color: var(--accent-orange-hover);
}

.finding-content img {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  box-sizing: border-box;
  display: block;
  height: auto;
  margin: 1rem 0;
  max-width: 100%;
}

.finding-content p > img:only-child {
  margin: 0;
}

.finding-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.45;
  margin: 1rem 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.finding-content code {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Global inline code styling */
code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  background: none;
  border: 0.5px solid var(--border-secondary);
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
  position: relative;
}

/* code:not(pre code):hover {
  background-color: transparent;
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 1px var(--accent-orange);
  color: var(--text-primary);
} */

.price-address {
  color: var(--address-color);
  font-family: var(--font-mono);
  font-size: 13px;
}

.price-number {
  color: var(--number-color);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Copied tooltip */
.code-copied::after {
  content: "Copied!";
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
  animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; }
  10%, 90% { opacity: 1; }
}

/* Astro code block styling - same as blockquotes */
.astro-code {
  padding: 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  transition: border-color 0.3s ease, background-color 0.3s ease;
  overflow-x: auto;
  max-width: 100%;
  background-color: var(--bg-primary) !important;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Force bg-primary for all Shiki themes */
.astro-code,
.astro-code span {
  background-color: var(--bg-primary) !important;
}

/* Shiki dark theme support - based on official Astro docs */
[data-theme="dark"] .astro-code,
[data-theme="dark"] .astro-code span {
  color: var(--shiki-dark) !important;
  background-color: var(--bg-primary) !important;
  /* Optional: apply font styles */
  font-style: var(--shiki-dark-font-style) !important;
  font-weight: var(--shiki-dark-font-weight) !important;
  text-decoration: var(--shiki-dark-text-decoration) !important;
}

.finding-content ul, .finding-content ol {
  /* padding-left: 1.5rem; */
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.finding-content li {
  margin: 0.35rem 0;
  line-height: 1.45;
  font-weight: 300;
}

.finding-content li:has(input[type="checkbox"]) {
  padding-left: 22px;
  position: relative;
}

.finding-content li > p {
  margin: 0.35rem 0;
}

.finding-content li > p:has(> input[type="checkbox"]) {
  display: inline;
}

.finding-content li > p:first-child,
.finding-content li > input[type="checkbox"] + p {
  display: inline;
  margin: 0;
}

.finding-content input[type="checkbox"] {
  appearance: none;
  background: transparent;
  border: 1px solid var(--accent-orange);
  border-radius: 4px;
  box-sizing: border-box;
  display: inline-grid;
  height: 14px;
  left: 0;
  margin: 0;
  place-content: center;
  position: absolute;
  top: 3px;
  width: 14px;
}

.finding-content input[type="checkbox"]::before {
  border-bottom: 1.5px solid var(--accent-orange);
  border-right: 1.5px solid var(--accent-orange);
  content: "";
  height: 6px;
  opacity: 0;
  transform: rotate(45deg) translate(-1px, -1px);
  width: 3px;
}

.finding-content input[type="checkbox"]:checked::before {
  opacity: 1;
}

.finding-content table {
  border-collapse: collapse;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  margin: 1.5rem 0;
  max-width: 100%;
  overflow-x: auto;
  width: max-content;
}

.finding-content th,
.finding-content td {
  border-bottom: 0.5px dashed var(--border-secondary);
  padding: 0.65rem 0.75rem;
  text-align: left;
  white-space: nowrap;
}

.finding-content th {
  color: var(--text-muted);
  font-weight: 300;
}

.finding-content tr:last-child td {
  border-bottom: 0;
}

/* Responsive design */
@media (max-width: 768px) {
  .finding h2 {
    padding: 1rem 1.5rem;
    font-size: 1.25rem;
  }
  
  .finding-meta,
  .finding-content {
    padding: 1rem 1.5rem;
  }
}

/* Table of Contents styling */
.toc-container {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-secondary);
  /* border-radius: 6px; */
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.toc-container h2 {
  margin: 0 0 1rem 0;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 300;
  transition: color 0.3s ease;
}

.toc-container ul {
  margin: 0;
  padding-left: 1rem;
}

/* Override asterisk for special lists */
.toc-container ul > li::before {
  content: none;
}

.toc-container li {
  line-height: 1.4;
  margin: 0.35rem 0;
}

.toc-container a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.toc-container a:hover,
.toc-container a.is-active {
  background-color: transparent;
  color: var(--accent-orange);
  text-decoration: underline;
  text-decoration-color: currentColor;
}

.toc-container a:visited {
  text-decoration: none;
}

/* TOC heading level indentation */
.toc-container .toc-level-2 {
  margin-left: 0;
}

.toc-container .toc-level-3 {
  margin-left: 1.5rem;
}


@media print {
  .report-layout {
    display: block !important;
  }

  .toc-container {
    display: none !important;
  }

  html, body {
    margin: 0;
    padding: 0;
  }

  .finding, .finding-content {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  pre.astro-code {
    break-inside: avoid;
    page-break-inside: avoid;
    overflow: visible !important;
  }

  pre.astro-code code {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  pre.astro-code .line {
    break-inside: avoid;
    page-break-inside: avoid;
  }
/* 
  h2 {
    break-before: page;
    page-break-before: always;
  } */

  h2[id] {
    break-before: page;
    page-break-before: always;
    padding-top: 12mm;

  }

  .toc-container h2 {
    break-before: auto;
    page-break-before: auto;
  }

  /* h2:first-of-type {
    break-before: auto;
    page-break-before: auto;
  } */
}

@media print {
  pre.astro-code {
    overflow-x: visible !important;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  pre.astro-code code {
    white-space: inherit !important;
  }
}



@page {
  size: A4;
  margin: 0;
}

@media print {
  body > * { display: none !important; }
  main.report-content { display: block !important; }

  main.report-content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  @page { margin: 0; }
  html, body { margin: 0; padding: 0; }
}
