/* ===== CSS Variables (matching homepage) ===== */
:root {
    --bg: #fafaf9;
    --bg-secondary: #f5f5f4;
    --bg-tertiary: #e7e5e4;
    --text: #1c1917;
    --text-secondary: #57534e;
    --muted: #78716c;
    --link: #0369a1;
    --link-hover: #0284c7;
    --accent: #0f766e;
    --accent-light: #14b8a6;
    --border: rgba(0,0,0,0.1);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: 0.15s ease;
    --code-bg: #1e1e1e;
    --code-green: #4ec9b0;
    --code-blue: #569cd6;
    --code-orange: #ce9178;
}
[data-theme='dark'] {
    --bg: #0c0c0c;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #262626;
    --text: #e5e5e5;
    --text-secondary: #a3a3a3;
    --muted: #737373;
    --link: #38bdf8;
    --link-hover: #7dd3fc;
    --accent: #2dd4bf;
    --accent-light: #5eead4;
    --border: rgba(255,255,255,0.1);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.5);
    --code-bg: #0d0d0d;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-size: 18px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--link-hover); }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { 
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700; 
    line-height: 1.2; 
    letter-spacing: -0.02em;
    margin-top: 2em;
    margin-bottom: 0.75em;
}
h2 { font-size: 1.75em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
h3 { font-size: 1.4em; }
.content-container p { margin: 1.5em 0; }

/* ===== Links ===== */
.content-container p a, .content-container li a { text-decoration: underline; text-underline-offset: 2px; }

/* ===== Header ===== */
.intro-header { 
    margin-top: 64px;
    margin-bottom: 3rem; 
}
.intro-header .site-heading h1,
.intro-header .site-heading .subheading {
    color: #ffffff !important;
    text-shadow: 0 2px 20px rgba(0,0,0,0.5) !important;
}
.intro-header .site-heading h1 {
    font-size: 2.5em;
    letter-spacing: -0.03em;
    font-weight: 800;
    margin-top: 0;
}
@media (min-width: 768px) {
    .intro-header .site-heading h1 { font-size: 3.2em; }
}
hr.small { border-color: var(--accent); border-width: 2px; max-width: 80px; }

/* ===== Content Area ===== */
.content-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 24px;
}

/* ===== Code Blocks ===== */
pre, code { 
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    font-size: 0.875em;
}
code {
    background: var(--bg-tertiary) !important;
    color: var(--text) !important;
    padding: 0.2em 0.4em;
    border-radius: 4px;
}
[data-theme='dark'] code {
    background: var(--bg-tertiary) !important;
    color: var(--text) !important;
}
pre {
    background: var(--code-bg) !important;
    border-radius: var(--radius) !important;
    border: 1px solid var(--border);
    margin: 1.5em 0;
    overflow: hidden;
}
pre code {
    display: block;
    padding: 1.25em 1.5em !important;
    overflow-x: auto;
    line-height: 1.6;
    background: transparent !important;
    color: #e5e5e5 !important;
    border-radius: 0;
}

/* ===== Blockquotes ===== */
blockquote {
    border-left: 4px solid var(--accent);
    margin: 1.5em 0;
    padding: 0.5em 0 0.5em 1.5em;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--bg-secondary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ===== Images ===== */
img { 
    max-width: 100%; 
    height: auto; 
    border-radius: var(--radius-sm);
}
.img-thumbnail {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ===== Tables ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.95em;
}
th, td {
    padding: 0.75em 1em;
    border: 1px solid var(--border);
    text-align: left;
}
th { background: var(--bg-secondary); font-weight: 600; }
tr:hover { background: var(--bg-secondary); }

/* ===== Footer ===== */
.footer {
    padding: 60px 0;
    text-align: center;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}
.footer-social {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}
.footer-social a {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-size: 1.25rem;
    color: var(--text-secondary) !important;
    transition: all var(--transition);
    text-decoration: none !important;
}
.footer-social a:hover {
    background: var(--link);
    color: white !important;
    transform: translateY(-2px);
}
.footer-text {
    color: var(--muted);
    font-size: 0.875rem;
}

/* ===== Related Posts ===== */
.related-posts { 
    margin-top: 3rem; 
    padding-top: 2rem; 
    border-top: 1px solid var(--border); 
}
.related-posts h2 { 
    border-bottom: none; 
    margin-top: 0; 
    text-align: center;
    margin-bottom: 2rem;
}
.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}
.related-box { 
    border: 1px solid var(--border); 
    padding: 0;
    border-radius: var(--radius); 
    background: var(--bg); 
    color: var(--text);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}
.related-box:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.related-posts a { text-decoration: none !important; }
[data-theme='dark'] .related-box { 
    border-color: var(--border); 
    background: var(--bg-secondary); 
}
.related-box img { 
    width: 100%; 
    height: 180px; 
    object-fit: cover;
    border-radius: 0;
}
.related-box .title { 
    font-weight: 700; 
    margin-top: 0;
    padding: 1em 1em 0;
    font-size: 1.05em;
    line-height: 1.4;
    color: var(--text) !important;
}
.related-box .subheading { 
    color: var(--muted); 
    font-size: 0.9em;
    padding: 0.25em 1em;
    line-height: 1.5;
}
.related-box .post-meta { 
    font-size: 0.85em; 
    padding: 0.5em 1em 1em;
    color: var(--muted);
}

/* ===== Utilities ===== */
::selection { background: var(--link); color: white; }
::-moz-selection { background: var(--link); color: white; }

/* ===== Header Permalinks ===== */
.headerlink {
    font-size: 0.6em;
    margin-left: 0.5em;
    opacity: 0;
    text-decoration: none !important;
    color: var(--muted) !important;
    vertical-align: middle;
    transition: opacity var(--transition);
}
h1:hover .headerlink,
h2:hover .headerlink,
h3:hover .headerlink,
h4:hover .headerlink,
.headerlink:focus {
    opacity: 0.5;
}
.headerlink:hover {
    opacity: 1 !important;
    color: var(--link) !important;
}

/* ===== Print Styles ===== */
@media print {
    .navbar, .footer, .related-posts, #theme-toggle { display: none !important; }
    body { font-size: 12pt; }
    pre { white-space: pre-wrap; word-wrap: break-word; }
}
.intro-header {
  background-color: #777777;
  background: no-repeat center center;
  background-attachment: scroll;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;
  -o-background-size: cover;
  margin-bottom: 50px;
  position: relative;
}
.intro-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}
.intro-header > * {
  position: relative;
  z-index: 2;
}
.intro-header .site-heading {
  padding: 100px 0 50px;
  color: white;
}
@media only screen and (min-width: 768px) {
  .intro-header .site-heading {
    padding: 150px 0;
  }
}
.intro-header .site-heading {
  text-align: center;
}
.intro-header .site-heading h1 {
  margin-top: 0;
  font-size: 50px;
}
.intro-header .site-heading .subheading {
  font-size: 24px;
  line-height: 1.1;
  display: block;
  font-family: 'Nunito', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 300;
  margin: 10px 0 0;
}
@media only screen and (min-width: 768px) {
  .intro-header .site-heading h1 {
    font-size: 80px;
  }
}