/* Notebook Blog UI Styles */

:root {
  /* Paper Mode (Light) */
  --note-bg: #faf7f2;
  --note-line: #e2dfd8;
  --note-text: #1f2937;
  --note-ink: #1d4ed8;       /* Blue pen for titles */
  --note-red-pen: #dc2626;   /* Red pen for annotations */
  --note-code-bg: #f3f4f6;
  --note-code-text: #1e293b;
}

[data-theme="dark"] {
  /* Slate/Terminal Mode (Dark) */
  --note-bg: #0f172a;
  --note-line: #1e293b;
  --note-text: #e2e8f0;
  --note-ink: #38bdf8;       /* Bright blue pen */
  --note-red-pen: #f87171;   /* Soft red pen */
  --note-code-bg: #020617;
  --note-code-text: #38bdf8;
}

body {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  background-color: var(--note-bg);
  color: var(--note-text);
  /* The Notebook Lines Background */
  background-image: repeating-linear-gradient(
    transparent,
    transparent 31px,
    var(--note-line) 31px,
    var(--note-line) 32px
  );
  background-attachment: local;
  line-height: 32px; /* Lock line-height to exactly match the background lines */
  transition: background-color 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

/* Margin offset for mobile vs desktop */
.notebook-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 20px 100px 80px; /* Leave left padding for a red margin line */
  position: relative;
}

/* Red Margin Line on the Left */
.notebook-container::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 60px;
  width: 2px;
  background-color: var(--note-red-pen);
  opacity: 0.3;
}

/* Navigation controls */
.blog-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 64px;
}

.nav-controls {
  display: flex;
  gap: 16px;
  align-items: center;
}

[data-lang="en"] .lang-id { display: none; }
[data-lang="id"] .lang-en { display: none; }

.back-link {
  font-family: 'JetBrains Mono', monospace;
  color: var(--note-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.back-link:hover {
  color: var(--note-ink);
}

.theme-btn, .lang-btn {
  background: none;
  border: none;
  color: var(--note-text);
  cursor: pointer;
  padding: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
}

[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }


/* Typography */
h1 {
  font-family: 'Caveat', cursive;
  font-size: 4rem;
  color: var(--note-ink);
  line-height: 1.2;
  margin-top: 32px;
  margin-bottom: 32px;
  transform: rotate(-1deg);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

h2 {
  font-family: 'Caveat', cursive;
  font-size: 2.5rem;
  color: var(--note-ink);
  line-height: 1.2;
  margin-top: 64px;
  margin-bottom: 0px; /* The next paragraph handles line-height */
  transform: rotate(-0.5deg);
}

p {
  font-size: 1.1rem;
  margin: 0 0 32px 0; /* Multiples of 32px to align with background lines */
}

strong {
  font-weight: 700;
}

/* Code Blocks */
pre {
  background-color: var(--note-code-bg);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--note-line);
  overflow-x: auto;
  margin: 0 0 32px 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--note-code-text);
  line-height: 1.5; /* override global lock for code */
}

/* Inline code */
p code {
  background-color: var(--note-code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Margin Notes */
.margin-note {
  position: absolute;
  right: -180px;
  width: 150px;
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: var(--note-red-pen);
  line-height: 1.2;
  transform: rotate(3deg);
}

.margin-note.left {
  right: auto;
  left: -200px;
  transform: rotate(-3deg);
}

/* Relative positioning context for paragraphs that have margin notes */
.has-note {
  position: relative;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  /* Pull margin notes inline on smaller screens */
  .margin-note {
    position: static;
    display: inline-block;
    width: auto;
    background: rgba(255, 255, 0, 0.1);
    transform: rotate(0);
    padding: 0 10px;
    margin: 10px 0;
    border-left: 2px solid var(--note-red-pen);
  }
}

@media (max-width: 768px) {
  .notebook-container {
    padding: 32px 20px 64px 40px; /* Smaller left margin */
  }
  .notebook-container::before {
    left: 20px;
  }
  h1 {
    font-size: 3rem;
  }
}
