
/* Light Mode */
:root {
  --primary: #5a67d8;
  --secondary: #718096;
  --success: #48bb78;
  --background: #ffffff;
  --text: #2d3748;
  --border: #e2e8f0;
}

/* Dark Mode */
body.quarto-dark {
  --primary: #667eea;
  --primary-dark: #5a67d8;
  --primary-light: #a3bffa;

  --background: #1a202c;
  --background-secondary: #2d3748;
  --background-tertiary: #4a5568;

  --text: #f7fafc;
  --text-secondary: #cbd5e0;
  --text-muted: #a0aec0;

  --border: #4a5568;
  --border-light: #718096;

  --code-bg: #2d3748;
  --code-text: #e2e8f0;

  --link: #90cdf4;
  --link-hover: #63b3ed;

  --shadow: rgba(0, 0, 0, 0.3);
}

/* Transition */
body.quarto-dark {
  background-color: var(--background);
  color: var(--text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  background-color: var(--background);
  color: var(--text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Body */
html {
  overflow-y: scroll;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
  padding-right: 0 !important;
}

/* Navbar */
.navbar {
  background-color: #5a67d8;
  min-height: 60px;
  height: 60px;
}

.navbar-container {
  display: flex;
  align-items: center;
  height: 100%;
}

.navbar-brand img {
  max-height: 40px;
  width: auto;
}

.navbar .search-input {
  height: 32px;
  margin-top: auto;
  margin-bottom: auto;
}

.navbar-title,
.navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-nav .nav-link {
  position: relative;
  transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.navbar-nav .nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background: linear-gradient(90deg, #ffd700, #ffed4e);
  border-radius: 1px;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.navbar-nav .nav-link:hover::after {
  width: 100%;
}
.navbar-nav .nav-link:hover {
  color: #ffd700 !important;
}

.nav-link:hover {
  opacity: 0.8;
  transform: translateY(-2px);
  transition: all 0.2s ease-in-out;
}

/* Icons */
.navbar .quarto-navigation-tool,
.navbar .quarto-search-toggle,
.navbar .quarto-color-scheme-toggle {
  color: white;
}
.navbar .bi,
.navbar svg {
  fill: white;
  color: white;
}

#quarto-search .bi-search,
.quarto-search-toggle .bi-search {
  fill: white;
}

.quarto-search-pwa-close {
  color: white;
}

.navbar .quarto-color-scheme-toggle .bi,
.navbar .quarto-color-scheme-toggle svg {
  fill: white;
  color: white;
}

.quarto-color-scheme-toggle .bi::before {
  display: none;
}

.quarto-color-scheme-toggle .bi::after {
  display: inline-block;
  font-family: 'bootstrap-icons';
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 1.2rem;
  vertical-align: middle;
}

body.quarto-light .quarto-color-scheme-toggle .bi::after {
  content: "\F497";
  color: #ffffff;
}

body.quarto-dark .quarto-color-scheme-toggle .bi::after {
  content: "\F5A2";
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 202, 40, 0.5);
}

[data-theme="dark"] .navbar {
  background-color: var(--background-secondary);
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .nav-link {
  color: var(--text-secondary);
}
[data-theme="dark"] .nav-link:hover {
  color: var(--text);
  background-color: var(--background-tertiary);
}

/* Cards */
.quarto-listing .quarto-post {
  margin-bottom: 1em;
  padding-top: 0;
}

.quarto-post .card {
  border: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  transition: transform 0.3s ease; 
  border-radius: 12px;
}

.quarto-post .card:hover {
  transform: translateY(-5px);
}

.quarto-listing-container-default .metadata {
  width: 80px;
  flex-basis: 80px;
}

.quarto-listing-container-default .quarto-post .listing-author,
.quarto-listing-container-default .quarto-post .listing-date {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  font-family: sans-serif;
}

body.quarto-dark .quarto-listing-container-default .listing-author,
body.quarto-dark .quarto-listing-container-default .listing-date {
  color: #adb5bd;
}

/* Tex */
.math.display {
  background: rgba(90, 103, 216, 0.05);
  border-left: 4px solid #5a67d8;
  padding: 1rem 1rem;
  margin: 1.2rem 0;
  border-radius: 4px;

  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

.mjx-chtml.MJXc-display { margin: 0; }

mjx-container[display="true"] {
  width: 100%;
  margin: 1em 0;
  text-align: center;
}

/* Code Blocks */
pre.sourceCode, .cell-output pre {
  background: rgba(16, 185, 129, 0.05);
  border-left: 4px solid #10b981;
  padding: 1.5rem;
  margin: 0rem 0;
  border-radius: 4px;

  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
  font-size: 0.9em;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  box-sizing: border-box;
  width: 100%;
  position: relative;
}

.code-with-title { margin-top: 1.5rem; }
.code-title {
  background: #10b981;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px 4px 0 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.85em;
  font-weight: 600;
}
.code-title + pre {
  border-radius: 0 0 4px 4px;
  border-top: none;
  margin-top: 0;
}

pre.sourceCode button.code-copy,
.cell-output pre button.code-copy,
div.sourceCode button.code-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #f8f9fa;
  color: #495057;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75em;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  opacity: 0.8;
}
pre.sourceCode button.code-copy:hover,
.cell-output pre button.code-copy:hover,
div.sourceCode button.code-copy:hover {
  background: #e9ecef;
  border-color: #10b981;
  opacity: 1;
}

[data-theme="dark"] pre.sourceCode button.code-copy,
[data-theme="dark"] .cell-output pre button.code-copy,
[data-theme="dark"] div.sourceCode button.code-copy {
  background: #2d3748;
  color: #e2e8f0;
  border: 1px solid #4a5568;
}
[data-theme="dark"] pre.sourceCode button.code-copy:hover,
[data-theme="dark"] .cell-output pre button.code-copy:hover,
[data-theme="dark"] div.sourceCode button.code-copy:hover {
  background: #4a5568;
  border-color: #10b981;
}

[data-theme="dark"] pre,
[data-theme="dark"] code {
  background-color: var(--code-bg);
  color: var(--code-text);
  border-color: var(--border);
}

[data-theme="dark"] table {
  background-color: var(--background-secondary);
  border-color: var(--border);
}
[data-theme="dark"] th,
[data-theme="dark"] td { border-color: var(--border-light); }
[data-theme="dark"] thead { background-color: var(--background-tertiary); }

[data-theme="dark"] .card,
[data-theme="dark"] .navbar { box-shadow: 0 4px 6px var(--shadow); }

body.quarto-dark img[src$=".svg"] { filter: invert(1) hue-rotate(180deg) brightness(1.5); }

/* Image */
[data-theme="dark"] img { opacity: 0.9; filter: brightness(0.9) contrast(1.1); }

/* Mobile */
@media (max-width: 768px) {
  /* Navbar */
  .navbar { padding-top: 0.5rem; padding-bottom: 0.5rem; }

  .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
  }

  .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.3);
    background-color: #5a67d8;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    -webkit-tap-highlight-color: transparent;
  }

  .navbar-toggler:focus { box-shadow: 0 0 0 0.25rem rgba(255,255,255,0.4); outline: none; border-radius: 8px; }
  .navbar-toggler:-moz-focusring { outline: none; }

  .navbar-collapse { background-color: #5a67d8; padding: 10px; border-radius: 8px; margin-top: 10px; max-width: 160px; margin-right: auto; }

  .navbar-nav .nav-item { border-bottom: 1px solid rgba(255,255,255,0.3); }
  .navbar-nav .nav-item:last-child { border-bottom: none; }

  .quarto-listing-cols > div .listing-item img,
  .quarto-post .thumbnail img,
  .listing-item .thumbnail img {
    aspect-ratio: 9 / 4 !important;
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    margin-bottom: 10px;
  }

  /* Tex */
  .math.display,
  .katex-display,
  .mjx-container {
    text-align: left;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    display: block;
    width: 100%;
  }
  .math.display { padding-left: 10px !important; }

  /* Code Block */
  pre.sourceCode, code.sourceCode { white-space: pre; overflow-x: auto; word-break: normal; display: block; width: 100%; }

  pre.sourceCode::-webkit-scrollbar { height: 4px; }
  pre.sourceCode::-webkit-scrollbar-thumb { background: rgba(90, 103, 216, 0.5); border-radius: 10px; }

  /* Table */
  .quarto-container table, .table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-collapse: collapse; }
  .quarto-container table th, .quarto-container table td { white-space: nowrap; padding: 8px 12px; font-size: 0.85rem; }
}