:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #f59e0b;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--background);
  color: var(--text-main);
  line-height: 1.7;
  word-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

/* Header & Title */
header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: white;
  padding: 20px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 -10px 20px -10px rgba(0,0,0,0.2);
}

header::before {
  content: "";
  position: absolute;
  top: -50%; left: -25%; width: 150%; height: 150%;
  background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: pulse 15s infinite alternate ease-in-out;
  pointer-events: none;
}

@keyframes pulse {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.1) translate(5%, 5%); }
}

header h1 {
  font-family: 'Caveat', cursive;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  color: white;
  margin-bottom: 4px;
  position: relative;
  text-shadow: 1px 2px 4px rgba(0,0,0,0.3);
  display: inline-block;
  transform: rotate(-1.5deg);
}

header p {
  font-size: 1.1rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.9);
  position: relative;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  font-style: italic;
}

/* Navigation */
nav {
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0 20px;
}

nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
}

nav ul li a {
  display: block;
  padding: 16px 20px;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

nav ul li a:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--surface);
  min-width: 220px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 0;
}

.dropdown-content a {
  padding: 10px 20px;
  font-size: 0.9rem;
  border: none !important;
}

.dropdown:hover .dropdown-content {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Main Layout */
main {
  width: 95%;
  max-width: 1300px;
  margin: 40px auto;
  padding: 0 20px;
}

.post-feed {
  display: flex;
  flex-direction: column;
  gap: 60px;
}

article {
  background-color: var(--surface);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

h1, h2, h3 {
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 20px;
}

article h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

article h1 a:hover {
  text-decoration: underline;
  opacity: 0.8;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-meta::before {
  content: "";
  width: 24px;
  height: 2px;
  background-color: var(--secondary);
}

/* Content Styles */
.content {
  font-size: 1.125rem;
  color: #334155;
}

.content p {
  margin-bottom: 24px;
}

.content blockquote {
  border-left: 4px solid var(--primary);
  background-color: var(--primary-light);
  margin: 32px 0;
  padding: 24px 32px;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--primary-dark);
}

.content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 40px auto;
  display: block;
  box-shadow: var(--shadow-md);
}

.wp-caption {
  text-align: center;
  margin: 40px auto;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 100%;
}

.wp-caption img {
  margin-bottom: 12px;
}

/* Archive List */
.archive-list {
  list-style: none;
}

.archive-list li {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  transition: background-color 0.2s;
  border-radius: 8px;
}

.archive-list li:hover {
  background-color: var(--primary-light);
}

.archive-list .date {
  font-size: 0.9rem;
  color: var(--text-muted);
  min-width: 140px;
  font-weight: 500;
}

.archive-list a {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.15rem;
}

.archive-list a:hover {
  color: var(--primary);
}

/* Tables */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.content th, .content td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.content th {
  background-color: var(--background);
  font-weight: 600;
}

.content tr:last-child td {
  border-bottom: none;
}

.content tr:nth-child(even) {
  background-color: #fafafa;
}

/* Code Blocks */
.content pre {
  background-color: #1e293b;
  color: #f1f5f9;
  padding: 24px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 32px 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
}

.content code {
  background-color: #f1f5f9;
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
}

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

/* Media Containers */
.video-container {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  margin: 40px auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background-color: #000;
}

.interactive-container, 
.current-sim, 
.quiz-container {
  width: 100% !important;
  flex: 1 1 100%; /* Add flex-grow and flex-basis for flex parents */
  max-width: 100% !important;
  margin: 40px auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background-color: #f1f5f9;
  min-height: 400px;
}

.interactive-container,
.canvas-container,
.circuit-diagram {
  height: auto;
  min-height: 400px;
  max-width: 100%;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.interactive-container {
  height: 800px;
}

/* Specific support for canvas-based simulations */
.current-sim canvas, .quiz-container canvas {
  max-width: 100%;
  height: auto !important;
  display: block;
  margin: 10px auto;
  background: white;
  border: 1px solid var(--border-color);
}

.video-container iframe,
.interactive-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.pdf-container {
  background-color: var(--primary-light);
  padding: 32px;
  border-radius: var(--radius);
  margin: 40px 0;
  border: 1px solid var(--primary);
}

/* Forms & UI */
.content input, .content button {
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-size: 1rem;
}

.content button {
  background-color: var(--primary);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  border: none;
}

.content button:hover {
  background-color: var(--primary-dark);
}

/* Footer */
footer {
  background-color: var(--surface);
  border-top: 1px solid var(--border-color);
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

footer p {
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  header h1 { font-size: 2.25rem; }
  article { padding: 24px; }
  article h1 { font-size: 2rem; }
  .archive-list li { flex-direction: column; align-items: flex-start; }
  .archive-list .date { margin-bottom: 8px; }
}

@media (max-width: 600px) {
  nav ul { flex-direction: column; }
  nav ul li a { text-align: center; padding: 12px; }
  .dropdown-content { position: static; transform: none; width: 100%; box-shadow: none; border: none; background: transparent; }
}

/* Custom Scrollbar for Code Blocks */
.content pre::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.content pre::-webkit-scrollbar-track {
  background: #1e1e1e;
  border-radius: 0 8px 8px 0;
}

.content pre::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 5px;
}

.content pre::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* MathJax custom styling */
.MathJax_Display {
  margin: 2em 0 !important;
}

