/* ============================================
   CSS Variables - Technical Minimal Theme
   ============================================ */
:root {
  /* Colors - Dark Theme */
  --color-bg: #0a0a0a;
  --color-text: #e4e4e7;
  --color-text-muted: #a1a1aa;
  --color-accent: #3b82f6;
  --color-border: #27272a;
  --color-code-bg: #18181b;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Monaco', 'Cascadia Code', 'Consolas', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Content Zoom / Font Size scaling for wide screens */
  --content-font-size: 1rem;
}

@media (min-width: 1920px) {
  :root {
    --content-font-size: 1.125rem;
    /* 18px */
  }
}

@media (min-width: 2560px) {
  :root {
    --content-font-size: 1.25rem;
    /* 20px */
  }
}

:root {

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* Light mode override (optional - keeping dark-only for now) */
/* Light mode override controlled by data-theme attribute */
[data-theme="light"] {
  --color-bg: #ffffff;
  --color-text: #18181b;
  --color-text-muted: #71717a;
  --color-accent: #2563eb;
  --color-border: #e4e4e7;
  --color-code-bg: #f4f4f5;

  /* Additional overrides for IDE components in light mode based on dark mode vars */
  --color-activity-bar: #f3f3f3;
  --color-sidebar: #f3f3f3;
}

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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   Typography
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--color-text);
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.1rem;
}

h6 {
  font-size: 1rem;
}

p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

a {
  color: var(--color-accent);
  text-decoration: underline;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--color-text);
}

strong,
b {
  font-weight: 600;
}

em,
i {
  font-style: italic;
}

/* ============================================
   Code & Pre-formatted Text
   ============================================ */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-code-bg);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  background: transparent;
  padding: 0;
  border: none;
  font-size: inherit;
}

/* ============================================
   Lists
   ============================================ */
ul,
ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

ul ul,
ol ol,
ul ol,
ol ul {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* ============================================
   Blockquotes
   ============================================ */
blockquote {
  border-left: 4px solid var(--color-accent);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--color-text-muted);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ============================================
   Horizontal Rules
   ============================================ */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

/* ============================================
   Tables
   ============================================ */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

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

th {
  font-weight: 600;
  background: var(--color-code-bg);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:hover {
  background: var(--color-code-bg);
}

/* ============================================
   Images & Media
   ============================================ */
img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
}

figure {
  margin: 1.5rem 0;
}

figcaption {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* ============================================
   Form Elements (if needed in future)
   ============================================ */
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  background: var(--color-code-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  transition: border-color var(--transition-base);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* ============================================
   Accessibility
   ============================================ */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Ensure sufficient contrast for screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   Selection
   ============================================ */
::selection {
  background: var(--color-accent);
  color: var(--color-bg);
}

::-moz-selection {
  background: var(--color-accent);
  color: var(--color-bg);
}

/* ============================================
   Scrollbar (Webkit)
   ============================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ============================================
   Prose Content (for blog posts)
   ============================================ */
.post-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.post-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.post-content h4,
.post-content h5,
.post-content h6 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.post-content a {
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 2px;
}

.post-content a:hover {
  text-decoration-thickness: 2px;
}

.post-content img {
  margin: 2rem auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  body {
    background: white;
    color: black;
  }

  a {
    text-decoration: underline;
    color: black;
  }

  pre,
  code {
    background: #f5f5f5;
    border: 1px solid #ccc;
  }

  .site-header,
  .site-footer,
  .back-link {
    display: none;
  }
}

/* ============================================
   Responsive Typography
   ============================================ */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.35rem;
  }

  pre {
    padding: 1rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }
}

/* ============================================
   View Transitions (Astro)
   ============================================ */
@view-transition {
  navigation: auto;
}

/* Smooth fade transition for page navigation */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
}