/* ============================================
   ARTICLE PAGE STYLES
   ============================================ */

/* Header and navigation reuse shared styles from style.css */

/* Main Container - Article */
.article-container {
  position: relative;
  width: 1446px;
  flex: 1;
  margin: 0 auto;
  background: #FFFFFF;
  overflow: visible;
  padding-bottom: 200px; /* Extra space for scrolling */
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Smooth anchor scrolling */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px; /* Space above anchored sections */
}

/* Article Title */
.article-title {
  position: absolute;
  width: 849px;
  min-height: 64px;
  left: calc(25% + 46.5px);
  top: calc(81px + 207px); /* header height (81px) + original offset (207px) */
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 500;
  font-size: 56px;
  line-height: 64px;
  color: #00040D;
  margin: 0;
  transition: font-size 0.3s ease, line-height 0.3s ease;
  cursor: pointer;
}

.article-title.sticky {
  position: fixed;
  top: 0;
  width: 849px;
  font-size: 36px;
  line-height: 44px;
  z-index: 1000;
  background: #FFFFFF;
  padding: 16px 0;
  /* left is recalculated via JavaScript */
}

.article-title .highlight {
  color: #2C5DFE;
}

/* Author Name */
.article-author {
  position: absolute;
  left: calc(25% + 48.5px);
  /* top is positioned via JS relative to article-title */
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 99.985%;
  color: #00040D;
  white-space: pre;
  margin: 0;
}

/* Article Content */
.article-content {
  position: absolute;
  width: 849px;
  min-height: 268px;
  left: calc(25% + 46.5px);
  /* top is positioned via JS relative to article-author */
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
  color: #000014;
  margin: 0;
  padding-bottom: 100px; /* Extra scroll space */
}

.article-content p {
  display: block;
  margin-block-start: 1em;
  margin-block-end: 1em;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  unicode-bidi: isolate;
}

/* Article Section Headings - subsection titles inside the article */
.article-content .article-section-heading {
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 32px;
  color: #000014;
  margin: 0;
  margin-top: 24px;
  margin-bottom: 8px;
  scroll-margin-top: 80px;
}

.article-content .article-section-heading:first-child {
  margin-top: 0;
}

/* Markdown defaults */
.article-content h2,
.article-content h3 {
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 32px;
  color: #000014;
  margin: 0;
  margin-top: 24px;
  margin-bottom: 8px;
}

.article-content h2:first-child,
.article-content h3:first-child {
  margin-top: 0;
}

.article-content ul,
.article-content ol {
  margin: 0;
  margin-bottom: 16px;
  padding-left: 24px;
}

.article-content li {
  margin-bottom: 8px;
  line-height: 24px;
}

.article-content a {
  color: #2C5DFE;
  text-decoration: none;
}

.article-content a:hover {
  text-decoration: underline;
}

.article-content code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  background-color: rgba(44, 93, 254, 0.1);
  padding: 2px 4px;
  border-radius: 2px;
}

.article-content pre {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  background-color: rgba(44, 93, 254, 0.1);
  padding: 16px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0;
  margin-bottom: 16px;
}

.article-content pre code {
  background-color: transparent;
  padding: 0;
}

.article-content [id^="ref-"] {
  scroll-margin-top: 80px;
}

/* Article Features List (Left Side) - sticky menu */
.article-features {
  position: absolute;
  width: 304px;
  left: 80px;
  top: calc(81px + 453px); /* header height (81px) + original offset (453px) */
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 16px;
  margin: 0;
  z-index: 100;
}

.article-features.sticky {
  position: fixed;
  top: 0;
  width: 304px;
  /* left is recalculated via JavaScript */
}

.article-features .feature-link {
  display: block;
  text-decoration: none;
  color: rgba(0, 4, 13, 0.5);
  cursor: pointer;
  margin: 0;
  padding-top: 12px;
  padding-bottom: 12px;
  line-height: 24px;
  min-height: 48px;
  box-sizing: border-box;
  transition: color 0.2s ease;
}

.article-features .feature-link:hover {
  opacity: 0.7;
}

/* Highlight the active navigation item */
.article-features .feature-link.active {
  color: #00040D;
}

/* Footer uses the shared styles from style.css */

/* Background SVG - riverlab */
.article-background-svg {
  position: absolute;
  width: 1063.13px;
  height: 2688px;
  left: -862px;
  top: 50px;
  z-index: -1;
}

.article-background-svg svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============================================
   RESPONSIVE LAYOUT
   ============================================ */

/* Mobile Menu Button */
.mobile-menu-button {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  background: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: 4px;
  padding: 8px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.mobile-menu-button:hover {
  opacity: 0.7;
}

.mobile-menu-button .hamburger-icon {
  width: 24px;
  height: 24px;
  color: #00040D;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-menu-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 80vw;
  z-index: 1000;
  background: #FFFFFF;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.mobile-menu.active {
  transform: translateX(0);
}

.mobile-menu-content {
  padding: 80px 20px 20px;
}

.article-features-mobile {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 16px;
}

.article-features-mobile .feature-link {
  display: block;
  text-decoration: none;
  color: rgba(0, 4, 13, 0.5);
  cursor: pointer;
  margin: 0;
  padding-top: 12px;
  padding-bottom: 12px;
  line-height: 24px;
  min-height: 48px;
  box-sizing: border-box;
  transition: color 0.2s ease;
}

.article-features-mobile .feature-link:hover {
  opacity: 0.7;
}

.article-features-mobile .feature-link.active {
  color: #00040D;
}

/* Adapt layout for laptops and smaller desktops (<1446px) */
@media (max-width: 1440px) {
  .article-container {
    width: 100%;
    padding: 0 40px;
  }

  /* Keep sidebar locked to the left (fixed 80px + width 304px = 384px total) */
  /* Content shifts left to fit within remaining width */
  
  .article-features {
    left: 40px; /* Move menu closer to the edge */
  }

  /* Content offset: 40px (left) + 304px (menu) + 40px (gap) = 384px */
  .article-title,
  .article-author,
  .article-content {
    left: 384px;
    width: calc(100% - 384px - 40px); /* Remaining width after gutter */
  }
}

/* Responsive rules for tablets and phones */
@media (max-width: 1024px) {
  /* Container */
  .article-container {
    width: 100%;
    padding-left: 20px;
    padding-right: 20px;
  }
  
  /* Title */
  .article-title {
    width: 100%;
    left: 20px;
    font-size: 48px;
    line-height: 56px;
  }
  
  .article-title.sticky {
    left: 20px;
    width: calc(100% - 40px);
    font-size: 32px;
    line-height: 40px;
  }
  
  /* Content */
  .article-content {
    width: 100%;
    left: 20px;
  }
  
  /* Author */
  .article-author {
    left: 20px;
  }
  
  /* Hide the sidebar menu on tablets and phones */
  .article-features {
    display: none;
  }
  
  /* Show mobile menu toggle */
  .mobile-menu-button {
    display: block;
  }
  
  /* Reveal the mobile slide-out menu */
  .mobile-menu {
    display: block;
  }
  
  .mobile-menu-overlay {
    display: block;
  }
  
  /* Header and navigation still reuse the shared styles */
}

@media (max-width: 768px) {
  /* Title */
  .article-title {
    font-size: 36px;
    line-height: 44px;
  }
  
  .article-title.sticky {
    font-size: 28px;
    line-height: 36px;
  }
  
  /* Header and navigation still reuse the shared styles */
  
  /* Author */
  .article-author {
    font-size: 16px;
  }
  
  /* Content */
  .article-content {
    font-size: 18px;
    line-height: 28px;
  }
}
