/* CSS Custom Properties (Variables) */
:root {
  /* Colors */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-secondary: #6b7280;
  --color-success: #10b981;
  --color-muted: #9ca3af;

  /* Gray Scale */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Blue Scale */
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-900: #1e3a8a;

  /* Green Scale */
  --green-200: #bbf7d0;
  --green-900: #14532d;

  /* Spacing */
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;
  --spacing-5: 1.25rem;
  --spacing-6: 1.5rem;
  --spacing-8: 2rem;
  --spacing-12: 3rem;
  --spacing-md: 1rem;
  --spacing-sm: 0.5rem;
  --spacing-3xl: 3rem;

  /* Typography */
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --line-height-sm: 1.25rem;
  --line-height-base: 1.5rem;
  --line-height-lg: 1.75rem;
  --line-height-2xl: 2rem;
  --line-height-relaxed: 1.625;

  /* Borders */
  --border-radius: 0.25rem;
  --border-radius-full: 9999px;
  --border-radius-lg: 0.5rem;
  --border-subtle: var(--gray-700);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Reset and Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
  color: var(--gray-100);
  background-color: var(--gray-900);
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--spacing-4);
}

.max-w-4xl {
  max-width: 56rem;
}

.max-w-none {
  max-width: none;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

/* Flexbox */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-col {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: var(--spacing-2);
}

.gap-4 {
  gap: var(--spacing-4);
}

.gap-6 {
  gap: var(--spacing-6);
}

/* Grid */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Spacing */
.mb-2 { margin-bottom: var(--spacing-2); }
.mb-3 { margin-bottom: var(--spacing-3); }
.mb-4 { margin-bottom: var(--spacing-4); }
.mb-6 { margin-bottom: var(--spacing-6); }
.mb-8 { margin-bottom: var(--spacing-8); }
.mr-2 { margin-right: var(--spacing-2); }
.mt-1 { margin-top: var(--spacing-1); }
.mt-3 { margin-top: var(--spacing-3); }
.mt-8 { margin-top: var(--spacing-8); }
.mt-12 { margin-top: var(--spacing-12); }

.p-4 { padding: var(--spacing-4); }
.p-6 { padding: var(--spacing-6); }
.px-2 { padding-left: var(--spacing-2); padding-right: var(--spacing-2); }
.px-3 { padding-left: var(--spacing-3); padding-right: var(--spacing-3); }
.px-6 { padding-left: var(--spacing-6); padding-right: var(--spacing-6); }
.py-1 { padding-top: var(--spacing-1); padding-bottom: var(--spacing-1); }
.py-3 { padding-top: var(--spacing-3); padding-bottom: var(--spacing-3); }
.pb-2 { padding-bottom: var(--spacing-2); }
.pt-8 { padding-top: var(--spacing-8); }

/* Typography */
.text-sm {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.text-lg {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
}

.text-xl {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-lg);
}

.text-2xl {
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-2xl);
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.leading-relaxed {
  line-height: var(--line-height-relaxed);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* Colors */
.text-white { color: #ffffff; }
.text-gray-100 { color: var(--gray-100); }
.text-gray-200 { color: var(--gray-200); }
.text-gray-300 { color: var(--gray-300); }
.text-gray-400 { color: var(--gray-400); }
.text-blue-200 { color: var(--blue-200); }
.text-blue-300 { color: var(--blue-300); }
.text-blue-400 { color: var(--blue-400); }
.text-green-200 { color: var(--green-200); }
.text-secondary { color: var(--color-secondary); }
.text-muted { color: var(--color-muted); }

.bg-gray-700 { background-color: var(--gray-700); }
.bg-gray-800 { background-color: var(--gray-800); }
.bg-blue-600 { background-color: var(--blue-600); }
.bg-blue-700 { background-color: var(--blue-700); }
.bg-blue-900 { background-color: var(--blue-900); }
.bg-green-900 { background-color: var(--green-900); }

/* Borders */
.border { border: 1px solid var(--gray-700); }
.border-t { border-top: 1px solid var(--gray-700); }
.border-b-2 { border-bottom: 2px solid var(--blue-400); }
.border-gray-700 { border-color: var(--gray-700); }
.border-blue-400 { border-color: var(--blue-400); }

.rounded { border-radius: var(--border-radius); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.rounded-full { border-radius: var(--border-radius-full); }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Lists */
.list-disc { list-style-type: disc; }
.list-inside { list-style-position: inside; }
.space-y-1 > :not([hidden]) ~ :not([hidden]) {
  margin-top: var(--spacing-1);
}

/* Display */
.hidden { display: none; }

/* Sizing */
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }

/* Text Decoration */
.underline { text-decoration: underline; }

/* Transitions */
.transition,
.transition-colors {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover States */
.hover\:bg-blue-700:hover { background-color: var(--blue-700); }
.hover\:text-blue-300:hover { color: var(--blue-300); }
.hover\:underline:hover { text-decoration: underline; }

/* Responsive Design */
@media (min-width: 640px) {
  .sm\:mt-0 { margin-top: 0; }
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-start { align-items: flex-start; }
  .sm\:justify-between { justify-content: space-between; }
  .sm\:text-right { text-align: right; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Prose Styles (for content) */
.prose {
  color: var(--gray-300);
  max-width: none;
  font-size: var(--font-size-base);
  line-height: 1.7;
}

.prose-lg {
  font-size: var(--font-size-lg);
  line-height: 1.7777778;
}

.prose-invert {
  color: var(--gray-300);
}

.prose h1 {
  color: var(--gray-100);
  font-weight: 700;
  font-size: 2.25em;
  margin-top: 0;
  margin-bottom: 0.8888889em;
  line-height: 1.1111111;
}

.prose h2 {
  color: var(--gray-100);
  font-weight: 600;
  font-size: 1.5em;
  margin-top: 2em;
  margin-bottom: 1em;
  line-height: 1.3333333;
}

.prose h3 {
  color: var(--gray-100);
  font-weight: 600;
  font-size: 1.25em;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  line-height: 1.6;
}

.prose p {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
}

.prose a {
  color: var(--blue-400);
  text-decoration: none;
  font-weight: 500;
}

.prose a:hover {
  text-decoration: underline;
}

.prose strong {
  color: var(--gray-100);
  font-weight: 600;
}

.prose ul, .prose ol {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-left: 1.625em;
}

.prose ul {
  list-style-type: disc;
}

.prose ol {
  list-style-type: decimal;
}

.prose li {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.prose blockquote {
  font-weight: 500;
  font-style: italic;
  color: var(--gray-300);
  border-left: 0.25rem solid var(--gray-600);
  margin-top: 1.6em;
  margin-bottom: 1.6em;
  padding-left: 1em;
}

.prose code {
  color: var(--gray-100);
  font-weight: 600;
  font-size: 0.875em;
  background-color: var(--gray-800);
  padding: 0.2rem 0.4rem;
  border-radius: var(--border-radius);
}

.prose pre {
  color: var(--gray-200);
  background-color: var(--gray-800);
  overflow-x: auto;
  font-weight: 400;
  font-size: 0.875em;
  line-height: 1.7142857;
  margin-top: 1.7142857em;
  margin-bottom: 1.7142857em;
  border-radius: 0.375rem;
  padding: 0.8571429em 1.1428571em;
}

.prose pre code {
  background-color: transparent;
  border-width: 0;
  border-radius: 0;
  padding: 0;
  font-weight: inherit;
  color: inherit;
  font-size: inherit;
  font-family: inherit;
  line-height: inherit;
}

/* Component Styles */
.nav-link {
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: 500;
  color: var(--gray-500);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--blue-600);
}

.nav-link.active {
  background-color: #eff6ff;
  color: var(--blue-600);
}

.tag-button {
  margin-right: var(--spacing-2);
  margin-bottom: var(--spacing-2);
  display: inline-block;
  cursor: pointer;
  border-radius: var(--border-radius-full);
  background-color: var(--gray-100);
  padding: 0.25rem 0.75rem;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--gray-700);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
}

.tag-button:hover {
  background-color: #dbeafe;
  color: #1d4ed8;
}

.tag-button.active {
  background-color: var(--blue-600);
  color: white;
}

.tag-button.active:hover {
  background-color: var(--blue-700);
}

.essay-card {
  margin-bottom: var(--spacing-6);
  border-radius: var(--border-radius-lg);
  background-color: white;
  padding: var(--spacing-6);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  transition: box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.essay-card:hover {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Dark theme overrides for cards in dark mode */
.dark-theme .essay-card {
  background-color: var(--gray-800);
  color: var(--gray-100);
}

.dark-theme .tag-button {
  background-color: var(--gray-700);
  color: var(--gray-200);
}

.dark-theme .tag-button:hover {
  background-color: var(--gray-600);
  color: var(--gray-100);
}

.dark-theme .nav-link.active {
  background-color: var(--gray-800);
  color: var(--blue-400);
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  border-radius: var(--border-radius-lg);
  text-decoration: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
}

.btn-primary {
  background-color: var(--blue-600);
  color: white;
}

.btn-primary:hover {
  background-color: var(--blue-700);
}

.btn-secondary {
  background-color: var(--gray-700);
  color: var(--gray-200);
}

.btn-secondary:hover {
  background-color: var(--gray-600);
}

/* Link Styles */
.link {
  color: var(--blue-400);
  text-decoration: none;
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
}

.link-muted {
  color: var(--gray-400);
  text-decoration: none;
}

.link-muted:hover {
  color: var(--gray-300);
  text-decoration: underline;
}

/* Tag Styles */
.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--border-radius-full);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.tag-primary {
  background-color: var(--blue-900);
  color: var(--blue-200);
}

.tag-success {
  background-color: var(--green-900);
  color: var(--green-200);
}

/* Content Structure */
.content-list {
  /* Add any specific styles for content lists */
}

.content-item {
  /* Add any specific styles for content items */
}

.content-item-header {
  /* Add any specific styles for content item headers */
}

.content-item-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin-bottom: var(--spacing-2);
}

.content-item-meta {
  color: var(--gray-400);
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-3);
}

.content-item-excerpt {
  color: var(--gray-300);
  line-height: 1.6;
  margin-bottom: var(--spacing-4);
}

.content-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.content-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-2);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: var(--spacing-12) 0;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  color: var(--gray-100);
  margin-bottom: var(--spacing-4);
}

.hero-subtitle {
  font-size: var(--font-size-lg);
  color: var(--gray-400);
  max-width: 600px;
  margin: 0 auto;
}

/* Site Structure */
.site-header {
  /* background: rgba(17, 24, 39, 0.8); */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(75, 85, 99, 0.3);
  padding: var(--spacing-4) 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--gray-100);
  text-decoration: none;
  margin-right: var(--spacing-8);
  transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-title:hover {
  color: #c0c0c0;
}

.site-nav {
  display: flex;
  gap: var(--spacing-4);
}

.site-footer {
  background: transparent;
  border-top: 1px solid var(--gray-700);
  padding: var(--spacing-8) 0;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-6);
}

.social-link {
  color: var(--gray-400);
  text-decoration: none;
  transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link:hover {
  color: var(--blue-400);
}

.main-content {
  min-height: calc(100vh - 200px);
  padding: var(--spacing-8) 0;
}

/* Three.js Hero */
.three-hero {
  height: 50vh;
  min-height: 400px;
  position: relative;
}

/* Section Titles */
.subsection-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--gray-200);
}

/* Utility Classes */
.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--spacing-4);
}
