/* =========================================
   BASE STYLES (LIGHT MODE DEFAULT)
   ========================================= */

body {
  font-family: 'Inter', 'Open Sans', -apple-system, sans-serif;
  background-color: #fafafa;
  color: #222;
  margin: 2em auto;
  margin-bottom: 50px;
  max-width: 52em;
  padding: 0 1.5em;
  font-size: 17px;
  line-height: 1.7;
}

/* Editorial Serif Headings */
h1, h2, h3, h4, summary {
  font-family: 'Georgia', 'Times New Roman', serif;
  color: #111;
}

h1 { 
  font-size: 2.4rem; 
  margin-bottom: 0.2em; 
}

h2 { 
  font-size: 1.8rem; 
  border-bottom: 3px solid #f90; 
  display: inline-block; 
  padding-bottom: 5px; 
}

/* The #f90 Accent Links */
a:link, a:visited {
  color: #222;
  text-decoration: none;
  border-bottom: 2px dotted #f90; 
  transition: all 0.2s ease-in-out;
}

a:hover, a:active {
  color: #f90;
  border-bottom: 2px solid #f90; 
}

/* Highlight Color */
::selection {
  background-color: #f90;
  color: #fff;
}

/* Blockquotes */
blockquote {
  background: #fff;
  border-left: 6px solid #f90; 
  margin: 2em 0;
  padding: 1.2em 1.5em;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02); 
  font-style: italic;
}

/* Details and Summary Cards */
details {
  background: #fff;
  border: 1px solid #eaeaea;
  padding: 10px 20px;
  margin-bottom: 15px;
  border-radius: 6px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

details:hover {
  border-color: #f90;
  box-shadow: 0 4px 12px rgba(255, 153, 0, 0.08); 
}

summary {
  cursor: pointer;
  font-size: 1.3rem;
  font-weight: bold;
}

summary::marker {
  color: #f90; 
}

/* Header & Nav */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid #ddd;
  margin-bottom: 40px;
}

header b {
  font-family: 'Georgia', serif;
  font-size: 1.4rem;
}

.nav-links a {
  margin-left: 20px;
  font-weight: 600;
  border-bottom: none;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.nav-links a:hover {
  color: #f90;
}

/* Code Formatting (Updated for Light Mode) */
code {
  background-color: #f1f1f1; /* Soft light gray background */
  color: #c75c00; /* Darker orange for better contrast on light mode */
  font-family: monospace;
  padding: 3px 6px;
  border-radius: 4px;
}

pre {
  background-color: #111;
  padding: 15px;
  border-radius: 6px;
  overflow-x: auto;
  border-left: 4px solid #f90;
}

pre code {
  color: #eee; 
  background-color: transparent;
  padding: 0;
}

/* Accessible Images & Figures */
figure {
  margin: 2.5em 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border-radius: 6px; 
  border: 1px solid #eaeaea;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

figcaption {
  margin-top: 0.8em;
  font-size: 0.95rem;
  color: #555;
  font-style: italic;
  text-align: center;
  font-family: 'Georgia', 'Times New Roman', serif;
  max-width: 80%;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 2.5em 0;
}

.image-grid figure {
  margin: 0; 
}


/* =========================================
   DARK MODE (TRIGGERS AUTOMATICALLY)
   ========================================= */

@media (prefers-color-scheme: dark) {
  body {
    background-color: #141414;
    color: #e0e0e0;
  }
  
  h1, h2, h3, h4, summary {
    color: #ffffff;
  }
  
  a:link, a:visited {
    color: #e0e0e0;
  }
  
  blockquote, details {
    background: #1e1e1e;
    border-color: #333;
  }
  
  header {
    border-bottom-color: #333;
  }

  code {
    background-color: #000000;
    color: #f90; /* Bright orange returns for dark mode */
  }

  pre {
    background-color: #000000;
  }
  
  figure img {
    border-color: #333;
  }
  
  figcaption {
    color: #aaa;
  }
}