/* ==============================================
   OPTIMIZED BLOG POST CSS - RESPONSIVE
   ============================================== */

/* Root Variables - Easier theme management */
:root {
  --bg-primary: #0b0f14;
  --bg-secondary: #0e141b;
  --bg-tertiary: #111823;
  --text-primary: #e7eef6;
  --text-secondary: #c8d5e5;
  --text-muted: #9fb3c8;
  --accent-blue: #4da3ff;
  --accent-blue-light: #7dd3fc;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --border: #1c2633;
  --shadow: 0 8px 28px rgba(0,0,0,.4);
  
  /* Spacing scale */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
}

/* ==============================================
   BASE STYLES
   ============================================== */

.post-theme1 {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow-x: hidden;
}

/* ==============================================
   TYPOGRAPHY - FLUID & RESPONSIVE
   ============================================== */

.post-theme1 .pf-header h1 {
  line-height: 1.2;
  margin: 0 0 0.5em;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  letter-spacing: -0.02em;
  font-weight: 700;
  word-wrap: break-word;
}

.post-theme1 .lead {
  color: var(--text-secondary);
  margin: var(--space-md) 0 var(--space-xl);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  line-height: 1.6;
}

.post-theme1 a { 
  color: var(--accent-blue);
  transition: color 0.2s ease;
}

.post-theme1 a:hover { 
  color: var(--accent-blue-light);
  text-decoration: underline;
}

.post-theme1 h2 {
  margin: var(--space-2xl) 0 var(--space-lg);
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  border-left: 3px solid var(--accent-blue);
  padding-left: var(--space-md);
  font-weight: 600;
  line-height: 1.3;
}

.post-theme1 h3 {
  margin: var(--space-xl) 0 var(--space-sm);
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  color: var(--text-secondary);
  font-weight: 600;
  line-height: 1.4;
}

/* ==============================================
   CONTENT - PARAGRAPHS & LISTS
   ============================================== */

.post-theme1 p {
  font-size: clamp(0.95rem, 2vw, 1.125rem);
  line-height: 1.75;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
  word-wrap: break-word;
}

.post-theme1 li {
  font-size: clamp(0.95rem, 2vw, 1.125rem);
  line-height: 1.7;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  word-wrap: break-word;
}

.post-theme1 ul,
.post-theme1 ol {
  padding-left: var(--space-lg);
  margin: var(--space-lg) 0;
}

.post-theme1 blockquote {
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.7;
  margin: var(--space-xl) 0;
  padding: var(--space-lg) var(--space-xl);
  border-left: 4px solid var(--accent-blue);
  background: rgba(77, 163, 255, 0.1);
  border-radius: var(--radius-sm);
  font-style: italic;
}

/* ==============================================
   CARDS & GRID SYSTEM
   ============================================== */

.post-theme1 .card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(14px, 3vw, 20px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-theme1 .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0,0,0,.3);
}

.post-theme1 .pf-grid {
  display: grid;
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

@media (min-width: 768px) {
  .post-theme1 .pf-grid { 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* ==============================================
   TAGS & BADGES
   ============================================== */

.post-theme1 .pf-tags { 
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.post-theme1 .badge {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: #0b1b2a;
  color: #cde6ff;
  border: 1px solid #163047;
  font-size: clamp(0.8rem, 1.5vw, 0.9rem);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.post-theme1 .badge:hover {
  background: #163047;
  transform: scale(1.05);
}

/* ==============================================
   IMAGES & FIGURES
   ============================================== */

.post-theme1 figure { 
  margin: var(--space-xl) 0;
  width: 100%;
}

.post-theme1 figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.post-theme1 .pf-hero img { 
  background: #0a0f16;
  padding: clamp(8px, 2vw, 12px);
  border-radius: var(--radius-md);
}

.post-theme1 figcaption { 
  color: var(--text-muted);
  font-size: clamp(0.85rem, 1.5vw, 0.9rem);
  margin-top: var(--space-sm);
  text-align: center;
  padding: 0 var(--space-sm);
}

.post-theme1 .pf-gallery {
  display: grid;
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

@media (min-width: 640px) {
  .post-theme1 .pf-gallery { 
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

/* ==============================================
   LISTS - NOTES, STEPS, CHECKLIST
   ============================================== */

.post-theme1 .note {
  background: rgba(245, 158, 11, .08);
  border: 1px solid rgba(245, 158, 11, .3);
  color: #ffd89b;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
}

.post-theme1 .steps { 
  counter-reset: stp;
  margin: var(--space-xl) 0;
}

.post-theme1 .steps li {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

/* Enhanced check list */
.post-theme1 .pf-check,
.prose-dark .pf-check {
  list-style: none;
  padding-left: 0;
  margin: var(--space-xl) 0;
}

.post-theme1 .pf-check li,
.prose-dark .pf-check li {
  margin: var(--space-lg) 0;
  padding-left: 2.5rem;
  position: relative;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  line-height: 1.7;
  color: var(--text-primary);
}

.post-theme1 .pf-check li::before,
.prose-dark .pf-check li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--success);
  font-weight: bold;
  font-size: 1.3em;
}

/* ==============================================
   TABLES - RESPONSIVE
   ============================================== */

.post-theme1 .pf-table,
.prose-dark .pf-table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
  display: block;
  border-radius: var(--radius-md);
  margin: var(--space-2xl) 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.post-theme1 .pf-table thead,
.post-theme1 .pf-table tbody,
.prose-dark .pf-table thead,
.prose-dark .pf-table tbody {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.post-theme1 .pf-table th,
.post-theme1 .pf-table td,
.prose-dark .pf-table th,
.prose-dark .pf-table td {
  border: 1px solid var(--border);
  padding: clamp(0.7rem, 2vw, 1.2rem);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  line-height: 1.6;
  word-wrap: break-word;
}

.post-theme1 .pf-table thead th,
.prose-dark .pf-table thead th {
  background: #0f1823;
  color: #d9e6f7;
  font-weight: 600;
  font-size: clamp(0.95rem, 2.2vw, 1.15rem);
  position: sticky;
  top: 0;
  z-index: 10;
}

.post-theme1 .pf-table tbody td,
.prose-dark .pf-table tbody td {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.post-theme1 .pf-table tbody tr:nth-child(even) td,
.prose-dark .pf-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

/* Mobile table optimization */
@media (max-width: 640px) {
  .post-theme1 .pf-table,
  .prose-dark .pf-table {
    font-size: 0.85rem;
  }
  
  .post-theme1 .pf-table th,
  .post-theme1 .pf-table td,
  .prose-dark .pf-table th,
  .prose-dark .pf-table td {
    padding: 0.6rem 0.5rem;
    min-width: 100px;
  }
}

/* ==============================================
   FAQ / DETAILS - ACCORDION
   ============================================== */

.post-theme1 .pf-faq,
.prose-dark .pf-faq {
  margin: var(--space-2xl) 0;
}

.post-theme1 .pf-faq details,
.prose-dark .pf-faq details {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  margin-bottom: var(--space-lg);
  transition: all 0.3s ease;
}

.post-theme1 .pf-faq summary,
.prose-dark .pf-faq summary {
  cursor: pointer;
  color: #d2e6ff;
  font-weight: 600;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  line-height: 1.5;
  padding: var(--space-sm) 0;
  outline: none;
  user-select: none;
  display: flex;
  align-items: center;
}

.post-theme1 .pf-faq summary::marker {
  font-size: 1.2em;
}

.post-theme1 .pf-faq summary:hover,
.prose-dark .pf-faq summary:hover {
  color: var(--accent-blue-light);
}

.post-theme1 .pf-faq details[open],
.prose-dark .pf-faq details[open] {
  border-color: #244761;
  box-shadow: inset 0 0 0 1px #1a354a, 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.post-theme1 .pf-faq details[open] > div,
.prose-dark .pf-faq details[open] > div {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ==============================================
   SECTIONS
   ============================================== */

.prose-dark section {
  margin: var(--space-2xl) 0;
  padding: clamp(1.5rem, 3vw, 2rem);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.prose-dark section h2:first-child {
  margin-top: 0;
}

/* ==============================================
   TEXT ENHANCEMENTS
   ============================================== */

.prose-dark strong {
  color: #f9fafb;
  font-weight: 600;
}

.prose-dark em {
  color: var(--accent-blue-light);
  font-style: italic;
}

.post-theme1 *::selection,
.prose-dark *::selection {
  background: #1f3e66;
  color: #fff;
}

/* ==============================================
   ARTICLE CONTENT BASE
   ============================================== */

.article-content {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.75;
  font-size: clamp(0.95rem, 2vw, 1.125rem);
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: var(--radius-md);
  max-width: 100%;
  overflow-x: hidden;
}

/* ==============================================
   RESPONSIVE BREAKPOINTS
   ============================================== */

/* Small devices (landscape phones) */
@media (max-width: 576px) {
  :root {
    --space-xs: 0.375rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.25rem;
    --space-2xl: 1.5rem;
  }
  
  .post-theme1 {
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }
  
  .post-theme1 .pf-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }
  
  .post-theme1 .lead {
    margin: 0.75rem 0 1rem;
    font-size: 1rem;
  }
  
  .post-theme1 h2 {
    margin: 1.25rem 0 0.75rem;
    padding-left: 0.5rem;
    font-size: 1.25rem;
    border-left-width: 2px;
  }
  
  .post-theme1 h3 {
    margin: 1rem 0 0.5rem;
    font-size: 1.1rem;
  }
  
  .post-theme1 p,
  .post-theme1 li {
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 1rem;
  }
  
  .post-theme1 blockquote {
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.95rem;
  }
  
  .post-theme1 .card {
    padding: 0.875rem;
    border-radius: 8px;
  }
  
  .post-theme1 .pf-grid {
    gap: 0.875rem;
    margin: 1rem 0;
  }
  
  .post-theme1 .pf-tags {
    gap: 0.375rem;
    margin-top: 0.5rem;
  }
  
  .post-theme1 .badge {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }
  
  .post-theme1 figure {
    margin: 1rem -0.5rem;
  }
  
  .post-theme1 figure img {
    border-radius: 8px;
  }
  
  .post-theme1 .pf-gallery {
    gap: 0.75rem;
    margin: 1rem 0;
  }
  
  .post-theme1 .note {
    padding: 0.875rem;
    margin: 1rem 0;
    font-size: 0.9rem;
  }
  
  .post-theme1 .pf-check li {
    padding-left: 2rem;
    margin: 0.75rem 0;
    font-size: 0.95rem;
  }
  
  .post-theme1 .pf-table {
    /*margin: 1.25rem -0.5rem;*/
    border-radius: 6px;
  }
  
  .post-theme1 .pf-faq details {
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    border-radius: 8px;
  }
  
  .post-theme1 .pf-faq summary {
    font-size: 1rem;
    padding: 0.375rem 0;
  }
  
  .post-theme1 .pf-faq details[open] > div {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    font-size: 0.9rem;
  }
  
  .prose-dark section {
    padding: 1rem;
    margin: 1.25rem 0;
    border-radius: 8px;
  }
  
  .article-content {
    padding: 0.75rem;
    border-radius: 0;
  }
  
  /* Remove excessive spacing on mobile */
  .post-theme1 ul,
  .post-theme1 ol {
    padding-left: 1.25rem;
    margin: 1rem 0;
  }
  
  /* Tighter table on mobile */
  .post-theme1 .pf-table th,
  .post-theme1 .pf-table td {
    padding: 0.5rem 0.375rem;
    font-size: 0.85rem;
    min-width: 80px;
  }
}

/* Medium devices (tablets) */
@media (min-width: 768px) and (max-width: 991px) {
  .post-theme1 .pf-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large devices (desktops) */
@media (min-width: 992px) {
  .post-theme1 .pf-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .post-theme1 .pf-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Extra large devices */
@media (min-width: 1200px) {
  .article-content,
  .post-theme1 {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ==============================================
   UTILITIES
   ============================================== */

.post-theme1 .pf-toc {
  margin-top: var(--space-lg);
}

.post-theme1 .pf-illo {
  margin-top: var(--space-lg);
}

.post-theme1 .pf-footnote {
  margin-top: var(--space-xl);
  color: var(--text-muted);
  font-size: clamp(0.85rem, 1.5vw, 0.95rem);
}

/* Main content images */
.main-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
}

/* Mobile container optimization */
@media (max-width: 768px) {
  /* Remove container padding on mobile */
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  /* Article container - maximize width */
  article.container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  /* Post content wrapper */
  .prose,
  .prose-lg {
    padding-left: 0;
    padding-right: 0;
  }
  
  /* Card sections should use less padding */
  .post-theme1 .card,
  .prose-dark section {
    margin-left: 0.25rem;
    margin-right: 0.25rem;
  }
}

/* ==============================================
   PRINT STYLES
   ============================================== */

@media print {
  .post-theme1,
  .article-content {
    background: white;
    color: black;
    box-shadow: none;
  }
  
  .post-theme1 a {
    color: #0066cc;
    text-decoration: underline;
  }
  
  .post-theme1 .card {
    border: 1px solid #ccc;
    break-inside: avoid;
  }
}