/* Encyclopedia styling - matches academic.html aesthetic */

/* Inter font weight override for encyclopedia */
.encyclopedia-page {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #000;
}

/* Main content container matching academic page */
.encyclopedia-page .container {
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

/* Typography hierarchy matching academic page */
.encyclopedia-page h1 {
  font-size: 2.5rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  margin: 2rem 0 1rem !important;
  letter-spacing: -0.03em !important;
  text-align: left !important;
  background: none !important;
  -webkit-text-fill-color: inherit !important;
  color: #000 !important;
}

.encyclopedia-page h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0.5rem 0 0.25rem;
  padding-top: 0;
  color: #000;
}

.encyclopedia-page h2:after {
  display: none; /* Remove underline from main.css */
}

.encyclopedia-page h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #000;
}

.encyclopedia-page p {
  margin: 0.5rem 0;
  font-size: 16px;
  line-height: 1.7;
}

/* Lead paragraph */
.encyclopedia-page .lead {
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0.25rem 0 0.5rem;
  font-weight: 400;
}

/* Links matching academic style */
.encyclopedia-page a {
  color: #003d82;
  text-decoration: none;
  font-weight: 400;
  border-bottom: 1px solid #003d82;
  transition: opacity 0.2s;
}

.encyclopedia-page a:hover {
  opacity: 0.7;
  border-bottom-width: 2px;
  text-decoration: none;
}

/* Code/formulas */
.encyclopedia-page code, 
.encyclopedia-page .formula {
  font-family: 'IBM Plex Mono', 'SF Mono', Monaco, monospace;
  background: #f5f5f5;
  padding: 0.2rem 0.4rem;
  font-size: 0.9em;
}

/* Details/Summary for expandable content */
.encyclopedia-page details {
  margin: 1rem 0;
  border-left: 4px solid #000;
  padding-left: 1rem;
}

.encyclopedia-page summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
  list-style: none;
}

.encyclopedia-page summary::-webkit-details-marker {
  display: none;
}

.encyclopedia-page summary::before {
  content: '→ ';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.2s;
}

.encyclopedia-page details[open] summary::before {
  transform: rotate(90deg);
}

/* Lists */
.encyclopedia-page ul, 
.encyclopedia-page ol {
  margin: 1rem 0 1rem 2rem;
}

.encyclopedia-page li {
  margin: 0.5rem 0;
}

/* Hero section specific styling */
.encyclopedia-page .hero-section {
  padding: 1rem 0 !important;
  text-align: center;
}

.encyclopedia-page .hero-section h1 {
  margin: 0 0 1rem;
}

.encyclopedia-page .subtitle {
  font-size: 1.1rem;
  color: #666;
  margin: 0 0 2rem;
}

/* Figure styling for hero images */
.encyclopedia-page .hero-figure {
  margin: 2rem auto 0;
  text-align: center;
}

.encyclopedia-page .hero-figure img {
  max-width: 100%;
  height: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  border-radius: 8px;
}

.encyclopedia-page .hero-figure figcaption {
  font-size: 0.95rem;
  color: #666;
  margin-top: 0.5rem;
}

/* Section spacing override - ULTRA MINIMAL - v3 */
.encyclopedia-page section {
  padding: 0 !important;
  margin: 0 !important;
}

.encyclopedia-page .hero-section {
  padding: 0.25rem 0 !important;
  margin: 0 !important;
}

/* Override any conflicting main.css rules */
main.encyclopedia-page section {
  padding: 0 !important;
  margin: 0 !important;
}

main.encyclopedia-page .hero-section {
  padding: 0.25rem 0 !important;
  margin: 0 !important;
}

/* Even more specific override for content-page + encyclopedia-page combo */
main.content-page.encyclopedia-page section {
  padding: 0 !important;
  margin: 0 !important;
}

main.content-page.encyclopedia-page .hero-section {
  padding: 0.25rem 0 !important;
  margin: 0 !important;
}

/* Target section elements directly with multiple class specificity */
.content-page.encyclopedia-page section,
.encyclopedia-page section.hero-section {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.content-page.encyclopedia-page .hero-section {
  padding-top: 0.25rem !important;
  padding-bottom: 0.25rem !important;
}

/* Ultra minimal spacing applied - sections have 0 padding/margin */

/* Sidebar styling for encyclopedia index */
.encyclopedia-page .enc-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.encyclopedia-page .enc-sidebar {
  border-right: 1px solid #e0e0e0;
  padding-right: 1rem;
}

.encyclopedia-page .enc-sidebar h3 {
  font-size: 1rem;
  margin: 0 0 .5rem 0;
  color: #555;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.encyclopedia-page .enc-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem 0;
}

.encyclopedia-page .enc-sidebar li {
  margin: 0;
}

.encyclopedia-page .enc-sidebar a {
  display: block;
  padding: .4rem 0;
  color: #333;
  border-bottom: none;
  font-weight: 400;
}

.encyclopedia-page .enc-sidebar a:hover {
  color: #003d82;
  border-bottom: 1px solid #003d82;
}

/* Mobile responsive */
@media (max-width: 900px) {
  .encyclopedia-page .enc-layout {
    grid-template-columns: 1fr;
  }
  
  .encyclopedia-page .enc-sidebar {
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 0 1rem 0;
    margin-bottom: 1rem;
  }
}

@media (max-width: 600px) {
  .encyclopedia-page .container {
    padding: 1rem;
  }
  
  .encyclopedia-page h1 { 
    font-size: 1.75rem; 
  }
  
  .encyclopedia-page h2 { 
    font-size: 1.35rem; 
  }
}

/* Math Note Styling for Encyclopedia Pages */
math-note, .math-note {
  display: block;
  margin: 1.5rem 0;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, #fff5f7 0%, #fff0f4 100%);
  border: 2px solid rgba(255, 0, 110, 0.2);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(255, 0, 110, 0.08);
  font-size: 1.1em;
  text-align: center;
  position: relative;
}

math-note::before, .math-note::before {
  content: "Formula";
  position: absolute;
  top: -8px;
  left: 20px;
  background: var(--color-accent);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

math-note .mjx-container, .math-note .mjx-container {
  margin: 0 !important;
}

/* Ensure inline math doesn't break layout */
.mjx-container[jax="CHTML"] {
  display: inline-block !important;
  vertical-align: middle;
}

.mjx-container[jax="CHTML"][display="true"] {
  display: block !important;
  text-align: center;
  margin: 1em 0 !important;
}

/* Enhanced Encyclopedia Hero */
.encyclopedia-hero {
  background: linear-gradient(135deg, #fff5f7 0%, #fff0f4 100%);
  padding: 2.5rem 2rem;
  border-radius: 20px;
  border: 2px solid rgba(255, 0, 110, 0.15);
  box-shadow: 0 8px 32px rgba(255, 0, 110, 0.1);
  margin-bottom: 2rem;
  position: relative;
}

.encyclopedia-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.4) 100%);
  border-radius: 18px;
  pointer-events: none;
}

.encyclopedia-hero > * {
  position: relative;
  z-index: 1;
}

/* Enhanced section styling */
.encyclopedia-entry section {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.encyclopedia-entry section:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.encyclopedia-entry section h2 {
  color: var(--color-primary);
  font-weight: 700;
  margin-bottom: 1rem;
  position: relative;
}

.encyclopedia-entry section h2::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

/* Meta badges enhancement */
.meta-badges {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.category-badge,
.difficulty-badge {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 2px solid;
}

.category-badge {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  color: #1565c0;
  border-color: #2196f3;
}

.difficulty-badge {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  color: #e65100;
  border-color: #ff9800;
}

.tags {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* Enhanced collapsible sections */
details {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  margin: 1rem 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

details[open] {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

details summary {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--color-primary);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transition: background 0.2s ease;
}

details summary:hover {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

details[open] summary {
  background: linear-gradient(135deg, #fff5f7 0%, #fff0f4 100%);
  color: var(--color-accent);
  border-bottom-color: rgba(255, 0, 110, 0.2);
}

details > div {
  padding: 1.5rem;
}

/* Enhanced template reading area */
.template-reading {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 2rem;
  position: relative;
}

/* Breadcrumbs */
.enc-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--color-text-muted);
}

.enc-breadcrumbs a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.enc-breadcrumbs a:hover {
  color: var(--color-accent);
}

.enc-breadcrumbs .sep {
  opacity: 0.6;
}

/* Button enhancements for encyclopedia */
.encyclopedia-entry .template-btn {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  color: white;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(255, 0, 110, 0.3);
  margin: 0.5rem 0.5rem 0.5rem 0;
}

.encyclopedia-entry .template-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 0, 110, 0.4);
  text-decoration: none;
  color: white;
}
