/*
 * IMPACT-VIS Custom Theme
 * Academic, minimal, accessibility-focused styling for Quarto site
 * Target: Publication-quality documentation for Genome Biology
 */

/* ========================================================================
   Color Palette
   ======================================================================== */
$primary-color: #2e5090;        /* Professional blue */
$primary-light: #4a7bc8;        /* Lighter blue for hover states */
$accent-color: #d62728;         /* Alert/warning red */
$success-color: #2ca02c;        /* Green for success */
$text-dark: #2c3e50;            /* Dark gray for body text */
$text-light: #7f8c8d;           /* Light gray for secondary text */
$border-light: #ecf0f1;         /* Light gray for borders */
$border-dark: #bdc3c7;          /* Medium gray for borders */
$code-bg: #f8f9fa;              /* Light gray for code blocks */
$background: #ffffff;           /* White background */

/* ========================================================================
   Typography
   ======================================================================== */
:root {
  --bs-body-font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --bs-body-font-size: 16px;
  --bs-body-line-height: 1.6;
  --bs-body-color: #{$text-dark};
  --bs-body-bg: #{$background};
  
  --bs-heading-font-family: inherit;
  --bs-heading-font-weight: 600;
  --bs-heading-line-height: 1.3;
  --bs-heading-color: #{$primary-color};
  
  --bs-code-color: #{$text-dark};
  --bs-code-bg: #{$code-bg};
}

body {
  font-family: var(--bs-body-font-family);
  font-size: var(--bs-body-font-size);
  line-height: var(--bs-body-line-height);
  color: var(--bs-body-color);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  color: var(--bs-heading-color);
  font-weight: var(--bs-heading-font-weight);
  line-height: var(--bs-heading-line-height);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: 2.2rem;
  border-bottom: 3px solid #{$primary-color};
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.8rem;
  margin-top: 2rem;
}

h3 {
  font-size: 1.4rem;
}

h4 {
  font-size: 1.1rem;
}

/* ========================================================================
   Code Styling
   ======================================================================== */
code {
  color: var(--bs-code-color);
  background-color: var(--bs-code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
}

pre {
  background-color: var(--bs-code-bg);
  border: 1px solid #{$border-light};
  border-radius: 5px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

pre code {
  background-color: transparent;
  border: none;
  padding: 0;
  color: inherit;
}

/* Syntax highlighting */
.highlight {
  background-color: var(--bs-code-bg);
}

/* ========================================================================
   Links & Navigation
   ======================================================================== */
a {
  color: #{$primary-color};
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #{$primary-light};
  text-decoration: underline;
}

a:visited {
  color: #6c5494;
}

/* Navbar styling */
.navbar {
  background-color: #{$background};
  border-bottom: 2px solid #{$border-light};
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.navbar-brand {
  color: #{$primary-color} !important;
  font-weight: 700;
  font-size: 1.2rem;
}

/* Navbar logo sizing - increased by 200% */
.navbar-brand img {
  max-height: 60px;
  width: auto;
}

/* Sidebar navigation */
.sidebar-nav {
  padding-left: 0.5rem;
}

.sidebar-nav .nav-link {
  color: var(--bs-body-color);
  border-left: 3px solid transparent;
  padding-left: 1rem;
  transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #{$primary-color};
  border-left-color: #{$primary-color};
  background-color: rgba(46, 80, 144, 0.05);
}

/* ========================================================================
   Tables
   ======================================================================== */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

th {
  background-color: #{$border-light};
  color: #{$text-dark};
  font-weight: 600;
  padding: 0.75rem;
  text-align: left;
  border: 1px solid #{$border-dark};
}

td {
  padding: 0.75rem;
  border: 1px solid #{$border-light};
}

tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.5);
}

tbody tr:hover {
  background-color: rgba(46, 80, 144, 0.03);
}

/* Special handling for tables with long code fields */
table td:first-child code,
table th:first-child {
  max-width: 300px;
  display: inline-block;
  word-break: break-all;
  white-space: normal;
}

table td:first-child {
  max-width: 350px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ========================================================================
   Callouts (Quarto)
   ======================================================================== */
.callout {
  margin: 1.5rem 0;
  padding: 1rem;
  border-left: 4px solid;
  border-radius: 5px;
  background-color: rgba(255, 255, 255, 0.5);
}

.callout-note {
  border-left-color: #{$primary-color};
  background-color: rgba(46, 80, 144, 0.05);
}

.callout-note .callout-title {
  color: #{$primary-color};
  font-weight: 600;
}

.callout-warning {
  border-left-color: #{$accent-color};
  background-color: rgba(214, 39, 40, 0.05);
}

.callout-warning .callout-title {
  color: #{$accent-color};
  font-weight: 600;
}

.callout-important {
  border-left-color: #e67e22;
  background-color: rgba(230, 126, 34, 0.05);
}

.callout-important .callout-title {
  color: #e67e22;
  font-weight: 600;
}

.callout-tip {
  border-left-color: #{$success-color};
  background-color: rgba(44, 160, 44, 0.05);
}

.callout-tip .callout-title {
  color: #{$success-color};
  font-weight: 600;
}

/* ========================================================================
   Lists
   ======================================================================== */
ul, ol {
  margin: 1rem 0;
  padding-left: 2rem;
  line-height: 1.8;
}

li {
  margin: 0.5rem 0;
}

/* ========================================================================
   Blockquotes
   ======================================================================== */
blockquote {
  border-left: 4px solid #{$primary-color};
  margin: 1.5rem 0;
  padding: 0.5rem 1rem;
  color: #{$text-light};
  background-color: rgba(46, 80, 144, 0.02);
  font-style: italic;
}

/* ========================================================================
   Figures & Images
   ======================================================================== */
img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  margin: 1.5rem 0;
}

figure {
  margin: 2rem 0;
  text-align: center;
}

figcaption {
  font-size: 0.9rem;
  color: #{$text-light};
  margin-top: 0.5rem;
  font-style: italic;
}

/* ========================================================================
   Math Equations
   ======================================================================== */
.math.inline {
  margin: 0 0.2rem;
}

.math.display {
  margin: 1.5rem 0;
  padding: 1rem;
  background-color: var(--bs-code-bg);
  border-left: 4px solid #{$primary-color};
  border-radius: 3px;
}

/* ========================================================================
   Buttons & Forms
   ======================================================================== */
button,
.btn {
  background-color: #{$primary-color};
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-weight: 500;
}

button:hover,
.btn:hover {
  background-color: #{$primary-light};
}

button:active,
.btn:active {
  opacity: 0.8;
}

/* ========================================================================
   Responsive Design
   ======================================================================== */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.4rem;
  }
  
  h3 {
    font-size: 1.1rem;
  }
  
  table {
    font-size: 0.85rem;
  }
  
  th, td {
    padding: 0.5rem;
  }
}

/* ========================================================================
   Accessibility
   ======================================================================== */
/* High contrast mode support */
@media (prefers-contrast: more) {
  body {
    color: #000000;
  }
  
  a {
    text-decoration: underline;
  }
  
  h1, h2, h3, h4, h5, h6 {
    color: #000000;
    font-weight: 700;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Focus states for keyboard navigation */
a:focus,
button:focus,
.btn:focus {
  outline: 3px solid #{$primary-color};
  outline-offset: 2px;
}

/* ========================================================================
   Print Styles
   ======================================================================== */
@media print {
  body {
    background-color: white;
  }
  
  a {
    color: #{$primary-color};
    text-decoration: underline;
  }
  
  .navbar,
  .sidebar,
  nav {
    display: none;
  }
  
  main {
    width: 100%;
    margin: 0;
  }
}
