/*
Theme Name: Stackbyte
Theme URI: https://stackbyte.io
Author: Stackbyte
Author URI: https://stackbyte.io
Description: A clean, minimal dark/light theme for stackbyte.io — blog, tools showcase, and newsletter.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: stackbyte
*/

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   CSS VARIABLES — LIGHT MODE (default)
   Applied to html element so data-theme works on every page
   ============================================================ */
html, :root {
  --bg:          #f5f4ff;
  --bg2:         #ffffff;
  --bg3:         #eeecff;
  --border:      rgba(90,50,220,0.12);
  --text:        #0f0a2e;
  --muted:       #6655aa;
  --accent:      #4f28f5;
  --accent2:     #00b894;
  --accent3:     #ff6b35;
  --tag-bg:      rgba(79,40,245,0.10);
  --card-shadow: 0 4px 20px rgba(79,40,245,0.10);
  --card-hover:  0 10px 32px rgba(79,40,245,0.18);
}

/* ============================================================
   DARK MODE — toggled via [data-theme="dark"] on <html>
   ============================================================ */
html[data-theme="dark"] {
  --bg:          #09080f;
  --bg2:         #110f1e;
  --bg3:         #1a1730;
  --border:      rgba(130,100,255,0.15);
  --text:        #f0eeff;
  --muted:       #9988cc;
  --accent:      #7c5cff;
  --accent2:     #00e0a0;
  --accent3:     #ff7e45;
  --tag-bg:      rgba(124,92,255,0.15);
  --card-shadow: 0 4px 20px rgba(0,0,0,0.40);
  --card-hover:  0 10px 32px rgba(124,92,255,0.25);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ============================================================
   LAYOUT
   ============================================================ */
.site-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.container    { max-width: 1100px; margin: 0 auto; padding: 0 48px; width: 100%; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  transition: background 0.3s;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}

.nav-logo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.5px;
  text-decoration: none;
}
.nav-logo span { color: var(--accent2); }

.nav-right { display: flex; align-items: center; gap: 32px; }

.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
  text-decoration: none;
}
.nav-links a:hover { color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  width: 44px; height: 24px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.3s;
}
.theme-toggle-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.3s, background 0.3s;
}
[data-theme="dark"] .theme-toggle-knob {
  transform: translateX(20px);
  background: var(--accent2);
}

/* Mobile nav toggle */
.nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 22px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  padding: 11px 26px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(79,40,245,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(79,40,245,0.45); }

.btn-ghost {
  display: inline-block;
  background: transparent;
  color: var(--accent) !important;
  padding: 11px 26px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--accent);
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.2s, color 0.2s;
}
.btn-ghost:hover { background: var(--accent); color: #fff !important; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 90px 0 72px;
  max-width: 680px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--tag-bg);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 28px;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.hero-tag::before {
  content: '';
  width: 7px; height: 7px;
  background: var(--accent2);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.hero h1 {
  font-size: 52px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -2px;
  margin-bottom: 20px;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
  position: relative;
}
.hero h1 em::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
}

.hero p {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.85;
  margin-bottom: 36px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section { padding: 64px 0; border-top: 1px solid var(--border); }

.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent2);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 500;
}
.section-title {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -1px;
  margin-bottom: 6px;
}
.section-sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 36px;
}

/* ============================================================
   BLOG CARDS (index + archive)
   ============================================================ */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.blog-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  display: block;
  text-decoration: none !important;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--card-shadow);
  color: var(--text);
}
.blog-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--card-hover);
}

.blog-card-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

.blog-tag {
  background: var(--tag-bg);
  color: var(--accent);
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--accent);
  font-weight: 500;
  opacity: 0.9;
}

.blog-date { color: var(--muted); font-size: 11px; }

.blog-card h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.4px;
  margin-bottom: 8px;
  line-height: 1.4;
  color: var(--text);
}

.blog-card p { font-size: 13px; color: var(--muted); line-height: 1.7; }

.blog-card-footer {
  margin-top: 18px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   SINGLE POST
   ============================================================ */
.post-header { padding: 64px 0 40px; max-width: 740px; }

.post-header .blog-card-meta { margin-bottom: 20px; }

.post-title {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -1.5px;
  line-height: 1.15;
  margin-bottom: 16px;
}

.post-meta { color: var(--muted); font-size: 13px; margin-bottom: 32px; }

.post-featured-image {
  width: 100%;
  border-radius: 14px;
  margin-bottom: 48px;
  border: 1px solid var(--border);
}

.post-content {
  max-width: 680px;
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
  padding-bottom: 64px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.post-content h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.6px; margin: 40px 0 16px; color: var(--text); }
.post-content h3 { font-size: 19px; font-weight: 600; margin: 32px 0 12px; color: var(--text); }
.post-content p  { margin-bottom: 20px; }
.post-content ul,
.post-content ol { padding-left: 24px; margin-bottom: 20px; }
.post-content li { margin-bottom: 6px; }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 28px 0;
  background: var(--bg3);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-style: italic;
}
.post-content pre {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  margin-bottom: 20px;
}
.post-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}
.post-content pre code { background: none; padding: 0; color: var(--text); }
.post-content a { color: var(--accent); text-decoration: underline; }
.post-content img { border-radius: 10px; margin: 24px 0; }

/* Post navigation */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 64px;
}
.post-nav a {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  flex: 1;
  transition: border-color 0.2s;
}
.post-nav a:hover { border-color: var(--accent); }
.post-nav .nav-prev { text-align: left; }
.post-nav .nav-next { text-align: right; }
.post-nav span { display: block; font-size: 11px; color: var(--accent2); font-family: 'JetBrains Mono', monospace; margin-bottom: 4px; letter-spacing: 1px; }

/* ============================================================
   TOOLS SECTION
   ============================================================ */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.tool-card:hover {
  border-color: var(--accent2);
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0,184,148,0.18);
}

.tool-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(79,40,245,0.25);
}

.tool-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.3px; }
.tool-card p  { font-size: 13px; color: var(--muted); line-height: 1.65; margin-bottom: 16px; }

.tool-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent2);
  letter-spacing: 0.8px;
  font-weight: 500;
}
.tool-status.live::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--accent2);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

/* ============================================================
   NEWSLETTER BOX
   ============================================================ */
.newsletter-box {
  background: linear-gradient(135deg, var(--bg2) 60%, var(--bg3));
  border: 1.5px solid var(--accent);
  border-radius: 16px;
  padding: 48px;
  max-width: 580px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-hover);
}
.newsletter-box::after {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: 0.12;
  pointer-events: none;
}

.newsletter-box h3 { font-size: 24px; font-weight: 600; letter-spacing: -0.6px; margin-bottom: 8px; }
.newsletter-box p  { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

.email-row { display: flex; gap: 10px; }

.email-input {
  flex: 1;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 11px 16px;
  color: var(--text);
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.email-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,40,245,0.12);
}
.email-input::placeholder { color: var(--muted); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-copy {
  font-size: 12px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}
.footer-links { display: flex; gap: 20px; list-style: none; }
.footer-links a { font-size: 12px; color: var(--muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .container { padding: 0 20px; }
  .hero h1   { font-size: 36px; letter-spacing: -1px; }
  .post-title { font-size: 28px; }
  .nav-links { display: none; }
  .nav-mobile-toggle { display: block; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 20px;
    gap: 16px;
  }
  .email-row { flex-direction: column; }
  .newsletter-box { padding: 28px; }
  .post-nav { flex-direction: column; }
  .blog-grid,
  .tools-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 16px; text-align: center; }
}
