:root {
  /* Industrial gunmetal palette */
  --gunmetal: #2a3439;
  --dark-gunmetal: #1c2326;
  --steel: #4a5568;
  --light-steel: #718096;
  --slate: #cbd5e0;
  --off-white: #f7fafc;
  --white: #ffffff;
  --bg-gray: #e2e8f0;
  --accent-orange: #d97706;
  --dark-text: #1a202c;
  --medium-text: #2d3748;
  --light-text: #718096;
  --border-color: #cbd5e0;
  --shadow-color: rgba(26, 32, 44, 0.1);
  --code-bg: #1c2326;
  --code-text: #e2e8f0;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-gray);
  min-height: 100%;
}

body {
  font-family: 'Space Grotesk', 'Rajdhani', 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.7;
  color: var(--dark-text);
  background: var(--bg-gray);
  margin: 0;
  padding: 0;
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* More visible grid pattern overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(var(--slate) 1px, transparent 1px),
    linear-gradient(90deg, var(--slate) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 2;
}

.site-header {
  background: var(--white);
  border-bottom: 3px solid var(--gunmetal);
  box-shadow: 0 2px 8px var(--shadow-color);
  padding: 1.5rem 0;
  margin-bottom: 3rem;
  position: relative;
  backdrop-filter: blur(10px);
  z-index: 100;
}

.site-title h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.site-title h1 a {
  color: var(--gunmetal);
  text-decoration: none;
  transition: color 0.3s ease;
  display: inline-block;
}

.site-title h1 a:hover {
  color: var(--accent-orange);
}

.site-title p {
  margin: 0;
  color: var(--light-text);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.5px;
}

.site-nav {
  margin-top: 1rem;
}

.site-nav a {
  margin-right: 1.5rem;
  color: var(--medium-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
  display: inline-block;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.site-nav a:hover {
  color: var(--gunmetal);
  border-bottom-color: var(--gunmetal);
}

.page-content {
  margin-bottom: 4rem;
  min-height: 60vh;
  position: relative;
  z-index: 2;
}

.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  color: var(--light-text);
  text-align: center;
  font-size: 0.9rem;
  background: var(--bg-gray);
  position: relative;
  z-index: 2;
}

/* Post styles */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--gunmetal);
}

.post-title {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--gunmetal);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.post-meta {
  color: var(--light-text);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin-bottom: 2rem;
  padding: 1.75rem;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--gunmetal);
  border-radius: 2px;
  box-shadow: 0 2px 8px var(--shadow-color);
  transition: all 0.3s ease;
  position: relative;
}

.post-list li:hover {
  box-shadow: 0 4px 16px rgba(26, 32, 44, 0.15);
  transform: translateY(-2px);
  border-left-color: var(--accent-orange);
}

.post-list li:last-child {
  margin-bottom: 0;
}

.post-list h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  position: relative;
  z-index: 1;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.post-list h3 a {
  text-decoration: none;
  color: var(--gunmetal);
  transition: color 0.3s ease;
}

.post-list h3 a:hover {
  color: var(--accent-orange);
}

.post-excerpt {
  color: var(--medium-text);
  margin-top: 0.75rem;
  position: relative;
  z-index: 1;
  line-height: 1.6;
}

/* Markdown elements */
a {
  color: var(--gunmetal);
  text-decoration: none;
  transition: color 0.3s ease;
  border-bottom: 1px solid var(--slate);
}

a:hover {
  color: var(--accent-orange);
  border-bottom-color: var(--accent-orange);
}

blockquote {
  border-left: 4px solid var(--gunmetal);
  color: var(--medium-text);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--off-white);
  font-style: italic;
  border-radius: 0 2px 2px 0;
}

code {
  background: var(--off-white);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 0.9em;
  margin: 0;
  padding: 0.2em 0.4em;
  color: var(--gunmetal);
}

pre {
  background: var(--code-bg);
  border: 2px solid var(--dark-gunmetal);
  border-radius: 4px;
  font-size: 0.9em;
  line-height: 1.5;
  overflow: auto;
  padding: 1.25rem;
  position: relative;
  margin: 1.5rem 0;
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--code-text);
  font-size: 1em;
}

hr {
  height: 2px;
  margin: 2.5rem 0;
  overflow: hidden;
  background: var(--gunmetal);
  border: 0;
}

img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--shadow-color);
  transition: all 0.3s ease;
}

img:hover {
  box-shadow: 0 4px 16px rgba(26, 32, 44, 0.15);
  transform: scale(1.01);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--gunmetal);
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h2 {
  border-bottom: 2px solid var(--slate);
  padding-bottom: 0.5rem;
  margin-top: 2.5rem;
}

p {
  margin-bottom: 1.25rem;
}

ul, ol {
  margin-bottom: 1.25rem;
  padding-left: 2rem;
}

li {
  margin-bottom: 0.5rem;
}

li::marker {
  color: var(--gunmetal);
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
}

th, td {
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  text-align: left;
}

th {
  background: var(--off-white);
  font-weight: 700;
  color: var(--gunmetal);
}

tr:hover {
  background: var(--off-white);
}

/* MathJax Specific Tweaks to prevent layout shifts */
.MathJax {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  color: var(--gunmetal) !important;
  font-weight: 500;
}

/* Post content styling */
.post-content {
  background: var(--white);
  padding: 2rem;
  border-radius: 2px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px var(--shadow-color);
}

/* Responsive design */
@media (max-width: 768px) {
  .site-title h1 {
    font-size: 1.5rem;
  }
  
  .site-title p {
    font-size: 0.9rem;
  }
  
  .post-title {
    font-size: 2rem;
  }
  
  .post-list li {
    padding: 1.25rem;
  }
  
  .post-content {
    padding: 1.5rem;
  }
}

/* Selection styling */
::selection {
  background: var(--gunmetal);
  color: var(--white);
}

::-moz-selection {
  background: var(--gunmetal);
  color: var(--white);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--off-white);
  border: 1px solid var(--border-color);
}

::-webkit-scrollbar-thumb {
  background: var(--steel);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gunmetal);
}

/* Accessibility - Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--gunmetal);
  color: var(--white);
  padding: 0.5rem 1rem;
  text-decoration: none;
  font-weight: 600;
  z-index: 9999;
  border-radius: 0 0 4px 0;
}

.skip-to-main:focus {
  top: 0;
}
