/* ==========================================================================
   Modern Glassmorphic Dark Design System for 3D Technical Articles
   Author: Khaled (3D Artist & Product Visualization Specialist)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-primary: #0a0c10;
  --bg-secondary: #12161f;
  --bg-tertiary: #1a202c;
  --surface-glass: rgba(18, 22, 31, 0.75);
  --surface-glass-border: rgba(255, 255, 255, 0.08);
  --surface-glass-hover: rgba(255, 255, 255, 0.04);
  
  /* Brand Accents */
  --accent-cyan: #00d2ff;
  --accent-blue: #3a7bd5;
  --accent-purple: #7928ca;
  --accent-gold: #f5a623;
  --accent-emerald: #10b981;
  --gradient-brand: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 50%, #7928ca 100%);
  --gradient-glow: radial-gradient(circle at 50% 0%, rgba(0, 210, 255, 0.15), transparent 70%);

  /* Text Colors */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-accent: #38bdf8;

  /* Typography */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-code: 'JetBrains Mono', monospace;

  /* Shadows & Glassmorphism */
  --glass-blur: blur(16px);
  --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 40px -10px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 210, 255, 0.1);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Layout */
  --max-width: 1280px;
  --article-width: 820px;
}

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

html {
  overflow-y: scroll;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background-color: var(--bg-primary);
  background-image: var(--gradient-glow);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Reading Progress Bar */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--gradient-brand);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s ease-out;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.8);
}

/* Top Navigation inside Articles */
:root.in-iframe .navbar,
:root.in-iframe footer.footer,
:root.in-iframe footer.site-footer {
  display: none !important;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--surface-glass-border);
  height: 64px;
  display: flex;
  align-items: center;
  font-size: 16px;
  line-height: 1.5;
}

.nav-container {
  width: 100%;
  max-width: 100%;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand, .brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 210, 255, 0.12);
  border: 1px solid rgba(0, 210, 255, 0.3);
  box-shadow: 0 0 14px rgba(0, 210, 255, 0.25);
  color: #00d2ff;
  flex-shrink: 0;
}

.site-links, .nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-links a, .nav-links a, .nav-link {
  padding: 7px 16px;
  border-radius: 10px;
  color: var(--text-muted);
  font-family: var(--font-body, sans-serif);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-links a:hover, .nav-links a:hover, .nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.site-links a.active, .nav-links a.active, .nav-link.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%) !important;
  box-shadow: 0 4px 14px rgba(0, 210, 255, 0.35) !important;
}

.btn-cta, .btn-primary {
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn-cta:hover, .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 210, 255, 0.5);
  color: #ffffff;
}

/* Article Container & Layout */
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
}

.page {
  padding: 48px 0 70px;
}

.article-page-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 28px 70px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.page-head h1 {
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: clamp(2.1rem, 3.4vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #ffffff;
}

.page-head h1 span {
  background: linear-gradient(135deg, #ffffff 30%, #00d2ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sub {
  color: var(--text-muted, #94a3b8);
  font-size: 1.02rem;
  line-height: 1.85;
  max-width: 68ch;
  margin-top: 12px;
}

.count {
  font-family: var(--font-body, sans-serif);
  font-size: 0.88rem;
  color: var(--accent-cyan, #00d2ff);
  white-space: nowrap;
  font-weight: 700;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding: 6px;
  background: rgba(14, 18, 28, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  width: max-content;
  max-width: 100%;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.fbtn {
  padding: 8px 18px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  font-family: var(--font-body, sans-serif);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.fbtn small {
  font-family: var(--font-body, sans-serif);
  font-size: 0.76rem;
  font-weight: 700;
  opacity: 0.85;
}

.fbtn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.fbtn.active {
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(0, 210, 255, 0.35);
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 3.5rem;
  align-items: start;
}

/* Header & Meta */
.article-header {
  margin-bottom: 2.5rem;
}

.article-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.25);
  color: var(--accent-cyan);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
}

.article-title {
  font-family: var(--font-heading);
  font-size: 2.85rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: 1.25rem;
}

.article-lead {
  font-size: 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.article-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--surface-glass-border);
  border-bottom: 1px solid var(--surface-glass-border);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.author-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  border: 2px solid var(--surface-glass-border);
  overflow: hidden;
  flex-shrink: 0;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Featured Hero Media */
.article-hero-media {
  margin: 2rem 0 3rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--surface-glass-border);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.article-hero-media img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s ease;
}

.article-hero-media:hover img {
  transform: scale(1.015);
}

.media-caption {
  padding: 0.85rem 1.25rem;
  background: rgba(18, 22, 31, 0.9);
  border-top: 1px solid var(--surface-glass-border);
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Typography & Content Styles */
.article-content h2 {
  font-family: var(--font-heading);
  font-size: 1.95rem;
  font-weight: 700;
  color: #ffffff;
  margin: 3rem 0 1.2rem;
  letter-spacing: -0.02em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-content h3 {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 600;
  color: #e2e8f0;
  margin: 2.2rem 0 0.85rem;
}

.article-content p {
  margin-bottom: 1.5rem;
  color: #cbd5e1;
}

.article-content strong {
  color: #ffffff;
  font-weight: 600;
}

.article-content ul, .article-content ol {
  margin: 1.25rem 0 1.75rem 1.75rem;
  color: #cbd5e1;
}

.article-content li {
  margin-bottom: 0.65rem;
}

/* Callout Boxes (Glassmorphic) */
.callout-box {
  background: var(--surface-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  border-left: 4px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-sm);
}

.callout-box.highlight {
  border-left-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.05);
}

.callout-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: #ffffff;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Data Comparison Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-glass-border);
  background: var(--surface-glass);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.98rem;
}

th {
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem 1.25rem;
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 600;
  border-bottom: 1px solid var(--surface-glass-border);
}

td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Technical Image Figures */
.article-figure {
  margin: 2.5rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--surface-glass-border);
  background: var(--bg-secondary);
}

.article-figure img {
  width: 100%;
  height: auto;
  display: block;
}

.article-figure figcaption {
  padding: 0.85rem 1.25rem;
  background: rgba(18, 22, 31, 0.8);
  font-size: 0.9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--surface-glass-border);
}

/* Sidebar / Table of Contents */
.article-sidebar {
  position: sticky;
  top: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  max-height: calc(100vh - 6.5rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 210, 255, 0.3) transparent;
  padding-right: 4px;
}

.article-sidebar::-webkit-scrollbar {
  width: 4px;
}
.article-sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 210, 255, 0.3);
  border-radius: 4px;
}

.back-to-articles-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  color: var(--text-main);
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.back-to-articles-btn:hover {
  background: rgba(0, 210, 255, 0.12);
  border-color: rgba(0, 210, 255, 0.4);
  color: #00d2ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 210, 255, 0.25);
}

.sidebar-card {
  background: var(--surface-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--surface-glass-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.92rem;
}

.toc-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  display: block;
  line-height: 1.4;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
}

.toc-link:hover, .toc-link.active {
  color: var(--accent-cyan);
  border-left-color: var(--accent-cyan);
  transform: translateX(4px);
}

/* CTA Sidebar Card */
.cta-sidebar {
  background: linear-gradient(145deg, rgba(0, 210, 255, 0.08), rgba(121, 40, 202, 0.08));
  border: 1px solid rgba(0, 210, 255, 0.25);
  text-align: center;
}

.cta-sidebar h4 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: #ffffff;
  margin-bottom: 0.6rem;
}

.cta-sidebar p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.btn-full {
  display: block;
  width: 100%;
  text-align: center;
}

/* FAQ Accordion Section */
.faq-section {
  margin: 3.5rem 0;
  border-top: 1px solid var(--surface-glass-border);
  padding-top: 2.5rem;
}

.faq-item {
  background: var(--surface-glass);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
}

.faq-question {
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.1rem;
  color: #ffffff;
  user-select: none;
  transition: background 0.2s ease;
}

.faq-question:hover {
  background: rgba(255, 255, 255, 0.03);
}

.faq-answer {
  padding: 0 1.5rem 1.25rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* Author Box at Bottom */
.author-profile-box {
  background: var(--surface-glass);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 4rem 0 2rem;
  display: flex;
  gap: 1.75rem;
  align-items: center;
}

.author-big-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  border: 3px solid rgba(0, 210, 255, 0.45);
  box-shadow: 0 0 25px rgba(0, 210, 255, 0.25);
  overflow: hidden;
}

.author-big-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.author-details h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.author-details .author-role {
  color: var(--accent-cyan);
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.author-details p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0;
}

/* Footer */
.footer {
  border-top: 1px solid var(--surface-glass-border);
  background: rgba(10, 12, 16, 0.95);
  padding: 3rem 1.5rem;
  margin-top: 6rem;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .article-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .article-title {
    font-size: 2.1rem;
  }
  .article-sidebar {
    grid-template-columns: 1fr;
  }
  .author-profile-box {
    flex-direction: column;
    text-align: center;
  }
  .nav-links {
    display: none;
  }
}

/* Back to Articles Navigation Bar */
.back-nav-bar {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
}

.back-to-articles-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: var(--radius-full, 9999px);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #94a3b8);
  font-family: var(--font-body, sans-serif);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.back-to-articles-btn:hover {
  background: rgba(0, 210, 255, 0.12);
  border-color: rgba(0, 210, 255, 0.4);
  color: #ffffff;
  transform: translateX(-4px);
  box-shadow: 0 4px 18px rgba(0, 210, 255, 0.2);
}

.back-to-articles-btn svg {
  transition: transform 0.2s ease;
}

.back-to-articles-btn:hover svg {
  transform: translateX(-3px);
}

/* Category Filter Pills (Articles Hub) */
.categories-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 1.5rem 0 2rem;
}

.category-btn {
  padding: 8px 18px;
  border-radius: var(--radius-full, 9999px);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted, #94a3b8);
  font-family: var(--font-body, sans-serif);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.22s ease;
  backdrop-filter: blur(8px);
}

.category-btn:hover {
  background: rgba(0, 210, 255, 0.1);
  border-color: rgba(0, 210, 255, 0.35);
  color: #ffffff;
  transform: translateY(-2px);
}

.category-btn.active {
  background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(0, 210, 255, 0.4);
}
