/* Notebook wrapper */
.notebook .article-content.markdown-body {
  background: #fffef5;
  background-image:
    linear-gradient(90deg, transparent 60px, #e8c4c4 60px, #e8c4c4 62px, transparent 62px),
    linear-gradient(#e8e4d9 1px, transparent 1px);
  background-size: 100% 32px;
  background-position: 0 12px;
  padding: 20px 40px 40px 80px !important;
  border: 1px solid #d4c9a8;
  border-radius: 4px;
  box-shadow:
    3px 3px 15px rgba(0,0,0,0.15),
    inset 0 0 60px rgba(255,252,235,0.4);
  position: relative;
  font-family: 'Georgia', 'Times New Roman', serif;
  line-height: 32px !important;
  color: #2c2c2c;
}

/* Spiral binding holes */
.notebook .article-content.markdown-body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 30px;
  width: 12px;
  height: 100%;
  background-image: radial-gradient(circle, #888 4px, transparent 4px);
  background-size: 12px 48px;
  background-position: center 20px;
  background-repeat: repeat-y;
}

/* Title styling */
.notebook .article-content.markdown-body h1 {
  font-family: 'Georgia', serif;
  color: #A31F34;
  border-bottom: 2px solid #A31F34;
  padding-bottom: 8px;
  margin-bottom: 24px;
  background: none !important;
  font-size: 1.8rem;
  line-height: 2;
}

/* Subheadings */
.notebook .article-content.markdown-body h2 {
  font-family: 'Georgia', serif;
  color: #4a3728;
  border-bottom: 1px dashed #c9b99a;
  padding-bottom: 4px;
  background: none !important;
  line-height: 2;
}

.notebook .article-content.markdown-body h3 {
  font-family: 'Georgia', serif;
  color: #5a4738;
  background: none !important;
  line-height: 2;
}

/* Paragraphs on lines */
.notebook .article-content.markdown-body p {
  line-height: 32px;
  margin-bottom: 0;
  padding: 0;
}

/* Lists */
.notebook .article-content.markdown-body ul,
.notebook .article-content.markdown-body ol {
  line-height: 32px;
}

.notebook .article-content.markdown-body li {
  line-height: 32px;
  margin: 0;
}

/* Code blocks - index card style */
.notebook .article-content.markdown-body pre {
  background: #f5f0e6 !important;
  border: 1px solid #d4c9a8;
  border-left: 3px solid #A31F34;
  border-radius: 2px;
  box-shadow: 1px 1px 4px rgba(0,0,0,0.08);
  margin: 16px 0;
}

/* Inline code */
.notebook .article-content.markdown-body code:not(pre code) {
  background: #f0ead6;
  border: 1px solid #d4c9a8;
  border-radius: 2px;
  padding: 1px 5px;
  color: #A31F34;
  font-size: 0.9em;
}

/* Blockquotes - sticky note style */
.notebook .article-content.markdown-body blockquote {
  background: #fff9c4;
  border: none;
  border-left: 4px solid #f9a825;
  padding: 12px 16px;
  margin: 16px 0;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.1);
  transform: rotate(-0.5deg);
  font-style: italic;
  line-height: 28px;
}

/* Links - red ink */
.notebook .article-content.markdown-body a {
  color: #A31F34;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-underline-offset: 3px;
}

/* Images */
.notebook .article-content.markdown-body img {
  border: 3px solid #d4c9a8;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.12);
  margin: 16px auto;
}

/* Tables */
.notebook .article-content.markdown-body table {
  border-collapse: collapse;
  background: #fffef5;
}

.notebook .article-content.markdown-body th {
  background: #f0ead6;
  border: 1px solid #d4c9a8;
  color: #A31F34;
}

.notebook .article-content.markdown-body td {
  border: 1px solid #d4c9a8;
}

/* Horizontal rule - torn edge */
.notebook .article-content.markdown-body hr {
  border: none;
  border-top: 2px dashed #c9b99a;
  margin: 24px 0;
}

/* Page curl effect bottom-right */
.notebook .article-content.markdown-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 30px 30px;
  border-color: transparent transparent var(--background-color, #f0f0f0) transparent;
  filter: drop-shadow(-2px -2px 3px rgba(0,0,0,0.1));
}

/* Dark mode adjustments */
[data-theme="dark"] .notebook .article-content.markdown-body {
  background: #2a2520;
  background-image:
    linear-gradient(90deg, transparent 60px, #5a3030 60px, #5a3030 62px, transparent 62px),
    linear-gradient(rgba(80,72,60,0.5) 1px, transparent 1px);
  background-size: 100% 32px;
  background-position: 0 12px;
  border-color: #4a4035;
  color: #d4c9b8;
  box-shadow:
    3px 3px 15px rgba(0,0,0,0.4),
    inset 0 0 60px rgba(40,35,28,0.4);
}

[data-theme="dark"] .notebook .article-content.markdown-body h1 {
  color: #e8a0a0;
  border-bottom-color: #e8a0a0;
}

[data-theme="dark"] .notebook .article-content.markdown-body h2 {
  color: #c9b99a;
  border-bottom-color: #5a5040;
}

[data-theme="dark"] .notebook .article-content.markdown-body pre {
  background: #332e28 !important;
  border-color: #4a4035;
}

[data-theme="dark"] .notebook .article-content.markdown-body blockquote {
  background: #3a3520;
  border-left-color: #b8860b;
  color: #c9b99a;
}

[data-theme="dark"] .notebook .article-content.markdown-body code:not(pre code) {
  background: #332e28;
  border-color: #4a4035;
  color: #e8a0a0;
}

[data-theme="dark"] .notebook .article-content.markdown-body a {
  color: #e8a0a0;
}

[data-theme="dark"] .notebook .article-content.markdown-body img {
  border-color: #4a4035;
}

[data-theme="dark"] .notebook .article-content.markdown-body th {
  background: #332e28;
  border-color: #4a4035;
  color: #e8a0a0;
}

[data-theme="dark"] .notebook .article-content.markdown-body td {
  border-color: #4a4035;
}

/* ===== Page Navigation ===== */
.nb-page-nav {
  display: flex;
  gap: 0;
  margin: 0 0 24px 0;
  padding: 0;
  border-bottom: 2px solid #d4c9a8;
  list-style: none;
  background: none !important;
  line-height: 1.4 !important;
}

.nb-page-nav a {
  display: block;
  padding: 8px 20px;
  color: #6b5b4d !important;
  text-decoration: none !important;
  font-family: 'Georgia', serif;
  font-size: 0.95rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  margin-bottom: -2px;
  transition: all 0.2s;
  cursor: pointer;
}

.nb-page-nav a:hover {
  background: #f5f0e6;
  color: #A31F34 !important;
}

.nb-page-nav a.active {
  background: #fffef5;
  color: #A31F34 !important;
  border-color: #d4c9a8;
  font-weight: bold;
}

.nb-page {
  display: none;
}

.nb-page.active {
  display: block;
}

/* Page footer navigation */
.nb-page-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 2px dashed #c9b99a;
}

.nb-page-footer a {
  color: #A31F34 !important;
  text-decoration: none !important;
  font-family: 'Georgia', serif;
  font-size: 0.9rem;
  padding: 6px 12px;
  border: 1px solid #d4c9a8;
  border-radius: 4px;
  background: #f5f0e6;
  transition: all 0.2s;
  cursor: pointer;
}

.nb-page-footer a:hover {
  background: #e8e0d0;
}

/* Dark mode page nav */
[data-theme="dark"] .nb-page-nav {
  border-bottom-color: #4a4035;
}

[data-theme="dark"] .nb-page-nav a {
  color: #a09080 !important;
}

[data-theme="dark"] .nb-page-nav a:hover {
  background: #332e28;
  color: #e8a0a0 !important;
}

[data-theme="dark"] .nb-page-nav a.active {
  background: #2a2520;
  color: #e8a0a0 !important;
  border-color: #4a4035;
}

[data-theme="dark"] .nb-page-footer a {
  color: #e8a0a0 !important;
  border-color: #4a4035;
  background: #332e28;
}

[data-theme="dark"] .nb-page-footer a:hover {
  background: #3a3530;
}

/* ===== Notebook Diagrams ===== */
.nb-diagram {
  margin: 24px 0;
  padding: 20px;
  background: #faf6eb;
  border: 1px solid #d4c9a8;
  border-radius: 6px;
  font-family: 'Georgia', serif;
  line-height: 1.6 !important;
}

.nb-diagram-title {
  font-weight: bold;
  font-size: 1.1rem;
  color: #A31F34;
  margin-bottom: 16px;
  text-align: center;
}

/* Flow box (Encoder / Decoder) */
.nb-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #2c2c2c;
  border-radius: 50px;
  padding: 6px 24px;
  font-weight: bold;
  font-size: 1rem;
  background: #fffef5;
  color: #2c2c2c;
  min-width: 100px;
}

.nb-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.nb-flow-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nb-arrow {
  font-size: 1.4rem;
  color: #A31F34;
  font-weight: bold;
  flex-shrink: 0;
}

.nb-label {
  font-size: 0.92rem;
  color: #4a3728;
  padding: 4px 10px;
  background: #f5f0e6;
  border: 1px dashed #c9b99a;
  border-radius: 4px;
  line-height: 1.5 !important;
}

.nb-label strong {
  color: #A31F34;
}

.nb-highlight {
  background: #fff3cd;
  border: 1px solid #f9a825;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: bold;
  color: #6b5b00;
}

.nb-green {
  background: #e8f5e9;
  border-color: #4caf50;
  color: #2e7d32;
}

.nb-branch {
  border-left: 3px solid #A31F34;
  padding-left: 16px;
  margin: 8px 0 8px 20px;
}

.nb-branch-item {
  padding: 4px 0;
  font-size: 0.92rem;
  color: #4a3728;
  line-height: 1.6 !important;
}

.nb-connector {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin: 16px 0;
}

.nb-connector-line {
  width: 2px;
  background: #A31F34;
  min-height: 40px;
  flex-shrink: 0;
  margin-left: 50px;
}

.nb-note {
  font-size: 0.85rem;
  color: #888;
  font-style: italic;
  margin-top: 4px;
}

/* Properties list */
.nb-props {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.nb-prop {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #2e7d32;
}

/* Dark mode diagrams */
[data-theme="dark"] .nb-diagram {
  background: #2e2a24;
  border-color: #4a4035;
}

[data-theme="dark"] .nb-box {
  border-color: #d4c9b8;
  background: #3a3530;
  color: #d4c9b8;
}

[data-theme="dark"] .nb-arrow {
  color: #e8a0a0;
}

[data-theme="dark"] .nb-label {
  color: #c9b99a;
  background: #332e28;
  border-color: #4a4035;
}

[data-theme="dark"] .nb-label strong {
  color: #e8a0a0;
}

[data-theme="dark"] .nb-highlight {
  background: #3a3520;
  border-color: #b8860b;
  color: #e8c840;
}

[data-theme="dark"] .nb-green {
  background: #1b3a1b;
  border-color: #4a7a4a;
  color: #8bc48b;
}

[data-theme="dark"] .nb-branch {
  border-left-color: #e8a0a0;
}

[data-theme="dark"] .nb-branch-item {
  color: #c9b99a;
}

[data-theme="dark"] .nb-connector-line {
  background: #e8a0a0;
}

[data-theme="dark"] .nb-prop {
  background: #1b3a1b;
  border-color: #4a7a4a;
  color: #8bc48b;
}

[data-theme="dark"] .nb-diagram-title {
  color: #e8a0a0;
}
