/* Cloudy Blog — Portfolio Hybrid Theme
 * Combines portfolio header/nav styling with blog reading layout
 */

/* ─── Fonts ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

/* ─── Color Variables ─── */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --accent-dark: #1d4ed8;
  --border: #334155;
  --card-shadow: 0 10px 40px rgba(0,0,0,0.3);
  --transition: all 0.3s ease;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;
  --line-height: 1.75;
}

[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-hover: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-dark: #1e40af;
  --border: #e2e8f0;
  --card-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ─── Reset & Base ─── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: var(--line-height);
  transition: var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Header / Nav ─── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: var(--transition);
}

[data-theme="light"] .header {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition);
}

.nav-logo:hover {
  color: var(--accent-light);
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-light);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  font-size: 1rem;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

/* Mobile menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ─── Main Content ─── */
.main-content {
  padding-top: 100px; /* space for fixed header */
  min-height: 100vh;
}

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

/* ─── Hero / Post Header ─── */
.post-hero {
  padding: 3rem 0 2rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.post-hero h1 {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 1rem;
  transition: var(--transition);
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-light);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: var(--transition);
}

.tag:hover {
  background: var(--accent);
  color: white;
}

/* ─── Post Content ─── */
.post-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.post-content p {
  margin-bottom: 1.5rem;
}

.post-content h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 3rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
  display: inline-block;
}

.post-content h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.post-content a {
  color: var(--accent-light);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: var(--transition);
}

.post-content a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent-light);
}

.post-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.post-content em {
  font-style: italic;
  color: var(--text-primary);
}

.post-content ul,
.post-content ol {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.75rem;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--text-muted);
}

/* ─── References ─── */
.post-content .refs {
  list-style: none;
  padding-left: 0;
}

.post-content .refs li {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  position: relative;
}

.post-content .refs li::before {
  content: attr(data-num);
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
}

.post-content .refs .arx a {
  border-bottom: none;
  font-weight: 500;
}

/* ─── Citations ─── */
.citation {
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
  margin-left: 2px;
}

.citation a {
  color: var(--accent-light);
  text-decoration: none;
  border-bottom: none;
  transition: var(--transition);
}

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

/* ─── Back Link ─── */
.back-link {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.back-link a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: var(--transition);
  border-bottom: 1px solid transparent;
}

.back-link a:hover {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

/* ─── Footer ─── */
.footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .nav {
    padding: 0 1rem;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 1rem 2rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .nav-links.active {
    display: flex;
  }
  .mobile-menu-btn {
    display: block;
  }
  .container {
    padding: 0 1.25rem;
  }
  .post-hero h1 {
    font-size: 1.8rem;
  }
  .post-content {
    font-size: 1rem;
  }
  .post-content h2 {
    font-size: 1.3rem;
  }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--surface-hover);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ─── Selection ─── */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
}

[data-theme="light"] ::selection {
  background: rgba(37, 99, 235, 0.2);
}
