/* ╔══════════════════════════════════════════════════════════════╗
   ║  style.base.css — Foundation Layout, spacing & typography   ║
   ║                                                              ║
   ║  All themes inherit from this file.  Themes only override:   ║
   ║    • CSS custom-property colour palette                      ║
   ║    • Font family overrides                                   ║
   ║    • Decorative tweaks (e.g terminal label, borders)         ║
   ║                                                              ║
   ║  Theme toggle: cycle class="theme-<name>" on <html>           ║
   ╚══════════════════════════════════════════════════════════════╝ */

:root {
  /* ── Default: Dark Green (Star) ──────────────────────────────── */
  --bg-primary:     #0a0a0a;
  --bg-secondary:   #121212;
  --bg-card:        #1a1a1a;
  --text-primary:   #e8e8e8;
  --text-secondary: #a0a0a0;
  --accent:         #00ff88;
  --accent-dim:     rgba(0,255,136,.25);
  --border:         #333333;

  --font-monospace: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ═══ Layout ══════════════════════════════════════════════════════ */

*          { box-sizing: border-box; }
html       { scroll-behavior: smooth; }

body {
  margin: 0; padding: 0;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent); border-bottom: 1px solid var(--accent-dim);
  text-decoration: none; transition: color .2s, border-color .2s;
}
a:hover { border-bottom-color: var(--accent); }

.container { max-width: 900px; margin: 0 auto; padding: 3rem 2rem; }

/* ═══ Header ══════════════════════════════════════════════════════ */

header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem; margin-bottom: 3rem;
  position: relative;
}
header::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0;
  height: 1px; background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.site-title {
  font-size: 1.75rem; font-weight: 600;
  letter-spacing: -.03em; color: var(--text-primary); margin: 0;
}
.site-tagline {
  color: var(--text-secondary); font-size: .85rem;
  margin-top: .5rem; font-family: var(--font-monospace);
}

/* ═══ Navigation ═══════════════════════════════════════════════════ */

nav {
  margin-top: 1.5rem; padding-top: 1rem;
  border-top: 1px solid var(--border);
}
nav a {
  color: var(--text-secondary); margin-right: 1.5rem;
  font-size: .85rem; font-family: var(--font-monospace);
  border: none; transition: color .2s;
}
nav a:hover { color: var(--accent); }

/* ═══ Typography ═══════════════════════════════════════════════════ */

.prose { font-size: 1.1rem; }

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--text-primary); margin-top: 2.5rem; margin-bottom: 1.25rem;
  font-weight: 600; letter-spacing: -.025em;
}
.prose h1 {
  font-size: 2.25rem; border-bottom: 1px solid var(--border);
  padding-bottom: 1rem; letter-spacing: -.03em;
}
.prose h2 { font-size: 1.625rem; }
.prose h3 { font-size: 1.375rem; }
.prose p  { margin-bottom: 1.5rem; }

.prose ul, .prose ol { margin-bottom: 1.5rem; padding-left: 1.5rem; }
.prose li  { margin-bottom: .75rem; }

.prose code {
  font-family: var(--font-monospace); font-size: .9em;
  background: var(--bg-card); padding: .2em .4em; border-radius: 4px;
  border: 1px solid var(--border); color: var(--accent);
}

.prose pre {
  background: var(--bg-secondary); padding: 1.5rem; border-radius: 6px;
  overflow-x: auto; border: 1px solid var(--border); margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.prose pre code { background: none; padding: 0; border: none; color: var(--text-primary); }

.prose blockquote {
  border-left: 3px solid var(--accent); padding-left: 1rem;
  margin: 1.5rem 0; color: var(--text-secondary); font-style: italic;
}

.prose table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.prose th, .prose td { padding: .75rem; border: 1px solid var(--border); text-align: left; }
.prose th  { background: var(--bg-secondary); font-weight: 600; }

.prose img, .prose video {
  max-width: 100%; display: block; height: auto;
  border: 1px solid var(--border); border-radius: 4px; margin: 1.5rem 0;
  cursor: zoom-in; transition: opacity .15s;
}
.prose img:hover, .prose video:hover { opacity: .85; }

/* ═══ Post meta ════════════════════════════════════════════════════ */

.post-meta {
  color: var(--text-secondary); font-size: .85em;
  font-family: var(--font-monospace); margin-bottom: 1.5rem;
}

/* ═══ Home post-list ═══════════════════════════════════════════════ */

.post-list { list-style: none; padding: 0; }
.post-list li {
  margin-bottom: .75rem; padding: .75rem;
  border: 1px solid var(--border); border-left: 3px solid var(--accent-dim);
  border-radius: 0; transition: background .2s;
}
.post-list li:hover { background: var(--bg-card); }
.post-list a { font-size: 1rem; font-weight: 500; border-bottom: none; }
.post-list time {
  white-space: nowrap; color: var(--text-secondary);
  font-size: .85rem; font-family: var(--font-monospace); margin-left: 1rem;
}

/* ═══ Card component ══════════════════════════════════════════════ */

.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  margin: 1.5rem 0; padding: 1.5rem;
}

/* ═══ Footer ══════════════════════════════════════════════════════ */

footer {
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary); font-size: .85rem; text-align: center;
}

/* ═══ Lightbox ════════════════════════════════════════════════════ */

.lightbox-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.85); z-index: 1000;
  cursor: zoom-out; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.lightbox-overlay.active { display: flex; }
.lightbox-overlay img, .lightbox-overlay video {
  max-width: 92vw; max-height: 92vh; object-fit: contain;
  border-radius: 8px; animation: zoomIn .25s ease;
}
.lightbox-close {
  position: fixed; top: 1rem; right: 1rem;
  width: 44px; height: 44px; background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2); border-radius: 50%;
  color: #fff; font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s; z-index: 1001;
}
.lightbox-close:hover { background: rgba(255,255,255,.25); }

@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes zoomIn { from { transform: scale(.9); opacity: 0 }
                    to { transform: scale(1);  opacity: 1 } }

/* ═══ Responsive ══════════════════════════════════════════════════ */

@media (max-width: 600px) {
  .container { padding: 1rem; }
  .prose { font-size: 1rem; }
  .prose h1 { font-size: 1.75rem; }
  .prose pre { padding: 1rem; }
}

/* ═══ Theme toggle button ═══════════════════════════════════════ */

.theme-toggle-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.theme-toggle-btn:hover {
  transform: scale(1.1);
  background: var(--accent-dim);
}
