/* Modern Notebook Styling - Black & Crimson */

:root {
  --primary: #dc143c;
  --primary-dark: #8b0a1a;
  --primary-light: #ff6b7a;
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #2a2a2a;
  --text-primary: #f5f5f5;
  --text-secondary: #d0d0d0;
  --border: #3a3a3a;
  --success: #00cc44;
  --warning: #ffaa00;
  --error: #ff5555;
  --radius: 8px;
  --radius-sm: 4px;
}

/* Notebook content wrapper */
.notebook-content {
  max-width: 100%;
  margin: 0 auto;
}

.notebook-content > * {
  margin-bottom: 16px;
}

/* Code Blocks */
code {
  background-color: var(--bg-secondary);
  color: #e0e7ff;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.95em;
}

pre {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
  line-height: 1.6;
  position: relative;
}

pre code {
  background: none;
  color: #cbd5e1;
  padding: 0;
  border-radius: 0;
  display: block;
  font-size: 0.9em;
}

pre,
code,
.highlight,
.highlight pre,
.output pre,
.output code,
.input_area pre,
.input_area code,
.jp-InputArea-editor,
.jp-OutputArea-output pre,
.jp-RenderedHTMLCommon pre,
.jp-RenderedHTMLCommon code {
  tab-size: 4;
  -moz-tab-size: 4;
}

pre,
.highlight pre,
.output pre,
.input_area pre,
.jp-OutputArea-output pre,
.jp-RenderedHTMLCommon pre {
  white-space: pre;
  word-break: normal;
  overflow-x: auto;
}

code,
.jp-RenderedHTMLCommon code {
  white-space: pre-wrap;
}

/* Python code highlighting */
.highlight {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9em;
  line-height: 1.6;
}

/* Code highlighting colors */
.highlight .k { color: #ff6b7a; font-weight: 500; } /* Keywords */
.highlight .n { color: #f5f5f5; } /* Names */
.highlight .s { color: #7fff7f; } /* Strings */
.highlight .s1 { color: #7fff7f; } /* Strings */
.highlight .s2 { color: #7fff7f; } /* Strings */
.highlight .m { color: #ffcc00; } /* Numbers */
.highlight .mf { color: #ffcc00; } /* Float numbers */
.highlight .mi { color: #ffcc00; } /* Integer numbers */
.highlight .c { color: #888888; } /* Comments */
.highlight .c1 { color: #888888; } /* Single line comments */
.highlight .c2 { color: #888888; } /* Multi-line comments */
.highlight .o { color: #ff6b7a; } /* Operators */
.highlight .nb { color: #64b5ff; } /* Built-ins */
.highlight .nc { color: #ff7adc; } /* Classes */
.highlight .nf { color: #64b5ff; } /* Functions */

/* Headings */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  scroll-margin-top: 100px;
}

h1 {
  font-size: 2.25rem;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 12px;
}

h2 {
  font-size: 1.875rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-top: 32px;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.1rem;
}

h6 {
  font-size: 1rem;
}

/* Paragraphs and text */
p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 14px;
  font-size: 1.05em;
}

/* Lists */
ul, ol {
  color: var(--text-secondary);
  margin-left: 24px;
  margin-bottom: 16px;
  line-height: 1.9;
}

li {
  margin-bottom: 10px;
}

li p {
  margin-bottom: 8px;
}

ul ul, ol ol {
  margin-top: 8px;
  margin-bottom: 8px;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 16px;
  margin-left: 0;
  margin-right: 0;
  color: var(--text-secondary);
  font-style: italic;
  background-color: rgba(220, 20, 60, 0.08);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

blockquote p {
  margin-bottom: 0;
}

/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table thead {
  background-color: var(--bg-secondary);
  border-bottom: 2px solid var(--primary);
}

table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
}

table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

table tbody tr:hover {
  background-color: rgba(220, 20, 60, 0.08);
}

table tbody tr:last-child td {
  border-bottom: none;
}

.post-header table {
  width: auto;
  max-width: 100%;
  display: inline-table;
  margin: 10px 0;
  font-size: 0.92rem;
}

.post-header table th,
.post-header table td {
  padding: 6px 10px;
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
  border-bottom: 1px dotted rgba(220, 20, 60, 0.3);
}

a:hover {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}

/* Inline code within text */
p code, li code, td code, h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
  background-color: var(--bg-secondary);
  color: #86efac;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

/* Strong and emphasis */
strong {
  color: var(--text-primary);
  font-weight: 600;
}

em {
  color: var(--text-primary);
  font-style: italic;
}

/* Horizontal rules */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* Images */
.post img, .notebook-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 16px 0;
  display: block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Figure elements */
figure {
  margin: 20px 0;
  text-align: center;
}

figure img {
  margin: 0 auto;
}

figcaption {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 8px;
  font-style: italic;
}

/* Post content styling */
.post-content {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Jupyter notebook cell styling */
.cell {
  background-color: transparent;
  border: none;
  margin-bottom: 16px;
}

.cell-markdown {
  margin-bottom: 20px;
}

.cell-code {
  margin-bottom: 16px;
}

.cell-output {
  background-color: rgba(220, 20, 60, 0.08);
  border-left: 3px solid var(--primary);
  padding: 12px;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.95em;
  line-height: 1.6;
}

.error {
  background-color: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--error);
  padding: 12px;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9em;
}

.warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-left: 3px solid var(--warning);
  padding: 12px;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  color: #fcd34d;
}

.success {
  background-color: rgba(16, 185, 129, 0.1);
  border-left: 3px solid var(--success);
  padding: 12px;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  color: #a7f3d0;
}

/* Output cells */
.output {
  background-color: rgba(220, 20, 60, 0.08);
  border-left: 3px solid var(--primary);
  padding: 12px;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

/* Pre-formatted output */
.output pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  margin: 0;
}

.output code {
  background: none;
  color: var(--text-secondary);
  padding: 0;
}

/* Post meta and tags */
.post-meta {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 16px 0;
}

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.category-tags-link {
  display: inline-block;
  background-color: var(--bg-secondary);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--primary);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.category-tags-link:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Post title */
.post-title {
  color: var(--text-primary) !important;
  font-size: 2.5rem !important;
  margin-bottom: 12px !important;
}

.page-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-style: italic;
  margin-bottom: 16px;
}

/* Math content */
.math {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  overflow-x: auto;
  font-size: 1.05em;
}

.katex {
  font-size: 1.1em;
}

/* Definition lists */
dt {
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 12px;
}

dd {
  color: var(--text-secondary);
  margin-left: 24px;
  margin-bottom: 12px;
}

/* Code fences with language specification */
.language-python,
.language-java,
.language-javascript,
.language-bash,
.language-sql {
  position: relative;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  h1 {
    font-size: 1.75rem;
    padding-bottom: 8px;
  }

  h2 {
    font-size: 1.5rem;
    padding-bottom: 6px;
  }

  h3 {
    font-size: 1.25rem;
  }

  pre {
    padding: 12px;
    font-size: 0.85em;
  }

  table {
    font-size: 0.9rem;
  }

  table th, table td {
    padding: 8px;
  }

  .post-title {
    font-size: 2rem !important;
  }

  p {
    font-size: 1rem;
  }
}

/* Print styles */
@media print {
  pre {
    border: 1px solid #ccc;
    background: white;
    color: black;
  }

  a {
    color: #00f;
  }

  code {
    background: white;
    color: black;
  }
}

/* Modern Scrollbar Styling */
html {
  scroll-behavior: smooth;
}

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 10px;
  border: 2px solid var(--bg-primary);
  transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
  box-shadow: 0 0 12px rgba(220, 20, 60, 0.4);
}

/* Firefox scrollbar */
* {
  scrollbar-color: var(--primary) var(--bg-primary);
  scrollbar-width: thin;
}

/* Smooth transitions */
a, .category-tags-link {
  transition: all 0.2s ease;
}
