/* LinuxPedia - Pure CSS (No installation or build tools needed) */
:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --code-bg: #1e293b;
  --code-text: #f8fafc;
  
  /* Category Badge Colors */
  --badge-hacking: #ef4444;
  --badge-linux: #10b981;
  --badge-cyber: #0ea5e9;
  --badge-foss: #8b5cf6;
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #131c2e;
  --bg-header: #101726;
  --border: #1e293b;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --code-bg: #070a10;
  --code-text: #f8fafc;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(16px, 3.5vw, 28px);
}

/* Header & Nav */
header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 65px;
  gap: 12px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-img {
  height: 40px;
  width: auto;
  border-radius: 8px;
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.logo:hover .logo-img {
  transform: scale(1.05);
}

/* Adaptable Logo Styling for Dark & Light Mode */
[data-theme="dark"] .logo-img {
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.25);
}

[data-theme="light"] .logo-img {
  background: #000000;
  border: 1px solid #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.logo-text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.3px;
  color: var(--text-main);
  white-space: nowrap;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.social-btn:hover {
  color: var(--text-main);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.social-btn.instagram:hover {
  color: #E1306C;
  border-color: #E1306C;
  background: rgba(225, 48, 108, 0.1);
}

.social-btn.facebook:hover {
  color: #1877F2;
  border-color: #1877F2;
  background: rgba(24, 119, 242, 0.1);
}

.social-btn.youtube:hover {
  color: #ff0000;
  border-color: #ff0000;
  background: rgba(255, 0, 0, 0.1);
}

.social-btn.email:hover {
  color: #ea4335;
  border-color: #ea4335;
  background: rgba(234, 67, 53, 0.1);
}

.theme-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.theme-btn:hover {
  border-color: var(--primary);
}

/* Hero / Header Intro */
.hero {
  text-align: center;
  padding: clamp(32px, 5vw, 55px) clamp(16px, 3vw, 24px) clamp(20px, 3vw, 35px);
}

.hero-logo-wrapper {
  margin-bottom: 16px;
}

.hero-logo {
  width: clamp(76px, 11vw, 96px);
  height: clamp(76px, 11vw, 96px);
  border-radius: 18px;
  display: inline-block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-logo:hover {
  transform: translateY(-3px) scale(1.02);
}

[data-theme="dark"] .hero-logo {
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 25px rgba(14, 165, 233, 0.35);
}

[data-theme="light"] .hero-logo {
  background: #000000;
  border: 2px solid #0f172a;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.hero h1 {
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}

.hero p {
  color: var(--text-muted);
  font-size: clamp(0.96rem, 1.8vw, 1.15rem);
  max-width: 650px;
  margin: 0 auto clamp(20px, 3vw, 28px);
  line-height: 1.6;
}

/* Search Bar */
.search-box {
  max-width: 520px;
  width: 100%;
  margin: 0 auto clamp(24px, 3.5vw, 36px);
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 13px 20px;
  border-radius: 25px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: clamp(0.92rem, 1.5vw, 1rem);
  outline: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* Category Filter Bar */
.categories {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: clamp(28px, 4vw, 42px);
}

.cat-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 15px;
  border-radius: 20px;
  font-size: clamp(0.82rem, 1.3vw, 0.88rem);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.cat-btn:hover, .cat-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Posts List */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(18px, 2.5vw, 28px);
  margin-bottom: clamp(40px, 6vw, 70px);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 12px;
  margin: 10px 0 40px;
}

.empty-state-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  display: inline-block;
}

.empty-state h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.96rem;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: clamp(20px, 3vw, 26px);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .post-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 12px;
  align-self: flex-start;
}
.badge-hacking { background: rgba(239, 68, 68, 0.15); color: var(--badge-hacking); }
.badge-linux { background: rgba(16, 185, 129, 0.15); color: var(--badge-linux); }
.badge-cyber { background: rgba(14, 165, 233, 0.15); color: var(--badge-cyber); }
.badge-foss { background: rgba(139, 92, 246, 0.15); color: var(--badge-foss); }

.post-card h2 {
  font-size: clamp(1.18rem, 1.8vw, 1.35rem);
  margin-bottom: 10px;
  line-height: 1.35;
  font-weight: 700;
}

.post-card h2 a:hover {
  color: var(--primary);
}

.post-card p {
  color: var(--text-muted);
  font-size: clamp(0.92rem, 1.4vw, 0.98rem);
  margin-bottom: 20px;
  flex-grow: 1;
  line-height: 1.6;
}

.post-date {
  font-size: clamp(0.78rem, 1.2vw, 0.84rem);
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: auto;
}

/* Single Post View */
.article-container {
  max-width: 820px;
  width: 100%;
  margin: clamp(24px, 4vw, 36px) auto clamp(40px, 6vw, 70px);
  padding: 0 clamp(16px, 3.5vw, 24px);
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.post-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.3rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 12px 0;
}

.post-header .meta {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.post-content {
  font-size: clamp(1rem, 1.6vw, 1.08rem);
  line-height: 1.8;
}

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

.post-content h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.6rem);
  margin: 2.2rem 0 1rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.post-content h3 {
  font-size: clamp(1.15rem, 2vw, 1.3rem);
  margin: 1.6rem 0 0.8rem;
}

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

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

/* Code & Terminal Styling */
.terminal {
  background: var(--code-bg);
  border-radius: 8px;
  margin: 1.5rem 0;
  overflow: hidden;
  border: 1px solid var(--border);
}

.terminal-header {
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: monospace;
  font-size: 0.75rem;
  color: #94a3b8;
}

.terminal-dots {
  display: flex;
  gap: 5px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }

.copy-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: monospace;
  font-size: 0.75rem;
}

.copy-btn:hover {
  background: var(--primary);
}

pre {
  margin: 0;
  padding: clamp(12px, 2.5vw, 18px);
  overflow-x: auto;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(0.82rem, 1.5vw, 0.92rem);
  color: var(--code-text);
  line-height: 1.55;
  -webkit-overflow-scrolling: touch;
}

code:not(pre code) {
  font-family: monospace;
  background: rgba(2, 132, 199, 0.1);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Callout Box */
.notice {
  background: rgba(2, 132, 199, 0.08);
  border-left: 4px solid var(--primary);
  padding: 15px 18px;
  border-radius: 6px;
  margin: 1.5rem 0;
}

.notice.warning {
  background: rgba(239, 68, 68, 0.08);
  border-left-color: #ef4444;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 30px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 40px;
}

.footer-socials {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.footer-contact {
  margin-top: 10px;
  font-size: 0.9rem;
}

.footer-contact a {
  color: var(--primary);
  font-weight: 600;
}

.footer-contact a:hover {
  text-decoration: underline;
}

.footer-links {
  margin-top: 14px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: underline;
  transition: color 0.15s ease;
  margin: 0 4px;
}

.footer-links a:hover {
  color: var(--primary);
}

/* Floating Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
}

[data-theme="dark"] .back-to-top {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Responsive Breakpoints: Mobile, Tablet, Laptop, and Desktop
   ========================================================================== */

/* Laptop / Desktop Wide Display (3 balanced columns) */
@media (min-width: 1024px) {
  .posts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Small Laptop / Tablet Landscape */
@media (max-width: 900px) {
  .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  }
}

/* Tablet Portrait & Large Phones */
@media (max-width: 768px) {
  .nav-wrapper {
    height: 60px;
  }
  .social-btn {
    width: 34px;
    height: 34px;
  }
  .theme-btn {
    padding: 5px 10px;
    font-size: 0.82rem;
  }
}

/* Standard Mobile Phones (Single Column Cards, Compact Header) */
@media (max-width: 640px) {
  .nav-wrapper {
    height: 60px;
    gap: 8px;
  }
  .logo {
    gap: 8px;
  }
  .logo-img {
    height: 35px;
  }
  .logo-text {
    font-size: 1.15rem;
  }
  .nav-right {
    gap: 8px;
  }
  .social-links {
    gap: 5px;
  }
  .social-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
  }
  .social-btn svg {
    width: 16px;
    height: 16px;
  }
  .theme-btn {
    padding: 5px 8px;
    font-size: 0.78rem;
  }
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .categories {
    gap: 6px;
  }
  .cat-btn {
    padding: 6px 11px;
    font-size: 0.8rem;
  }
}

/* Compact Mobile Screens */
@media (max-width: 440px) {
  .container {
    padding: 0 14px;
  }
  .logo-text {
    font-size: 1.05rem;
  }
  .social-links {
    gap: 4px;
  }
  .social-btn {
    width: 30px;
    height: 30px;
  }
  .social-btn svg {
    width: 15px;
    height: 15px;
  }
  .theme-btn {
    padding: 4px 7px;
    font-size: 0.75rem;
  }
}

/* Ultra-Compact Mobile Screens (360px and below) */
@media (max-width: 360px) {
  .logo-text {
    font-size: 0.95rem;
  }
  .social-links {
    gap: 3px;
  }
  .social-btn {
    width: 28px;
    height: 28px;
  }
  .social-btn svg {
    width: 14px;
    height: 14px;
  }
}
