/*
Theme Name: Astra Sleep Debt Child
Theme URI: https://sleepdebtcalculator.net/
Author: SEO Agency Ideal
Author URI: https://sleepdebtcalculator.net/
Description: Custom Astra child theme for Sleep Debt Calculator website with dark green design.
Version: 1.0
Template: astra
Text Domain: astra-sleepdebt-child
*/

@import url("../astra/style.css");

/* ====== Custom Global Styles ====== */
body {
  background-color: #0d0d0d;
  color: #d4d4d4;
  font-family: 'Poppins', sans-serif;
}
a {
  color: #7fff00;
  text-decoration: none;
}
a:hover {
  color: #9fff40;
}

/* Basic container used in templates */
.container {max-width:900px;margin:50px auto;padding:30px;background:#121418;border-radius:14px;box-shadow:0 4px 20px rgba(0,0,0,0.4);}
/* Utility */
.cta-btn {background:#7fff00;color:#000;padding:12px 30px;border-radius:8px;text-decoration:none;font-weight:600;display:inline-block;}
/* ===== Global Dark + Neon Theme ===== */

/* 🌐 General Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  overflow-x: hidden;
}

/* 🧱 Layout Containers */
.container, .section, .content, .main {
  width: 100%;
  max-width: 1200px;
  margin: auto;
  padding: 20px;
}

/* 📱 Mobile (max-width: 768px) */
@media (max-width: 768px) {

  /* Header Fix */
  header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  nav ul {
    flex-direction: column !important;
    align-items: center;
  }

  nav ul li {
    margin: 5px 0;
  }

  /* Calculator or Main Section */
  .calculator-container, .main-section {
    display: block;
    padding: 10px;
  }

  .calculator-container input,
  .calculator-container button {
    width: 100% !important;
    font-size: 16px;
    margin-bottom: 10px;
  }

  /* Blog Cards */
  .blog-cards {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  .blog-card img {
    width: 100%;
    height: auto;
  }

  /* Footer */
  footer {
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  footer .footer-columns {
    flex-direction: column;
  }
}

/* 💻 Tablets (min 769px - max 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .blog-cards {
    grid-template-columns: 1fr 1fr !important;
  }

  header nav ul {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* 🖥️ Desktop */
@media (min-width: 1025px) {
  .blog-cards {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
/* --- Universal Background Fix --- */
body {
  background-color: #000000; /* black background for all devices */
  color: #ffffff; /* white text for contrast */
}

/* --- Responsive consistency --- */
@media (max-width: 1024px) {
  body {
    background-color: #000000 !important;
  }
}

@media (max-width: 768px) {
  body {
    background-color: #000000 !important;
  }
}

@media (max-width: 480px) {
  body {
    background-color: #000000 !important;
  }
}

/* Ensure inner content area also uses same color scheme */
.site-content,
.ast-container {
  background-color: #000000 !important;
  color: #ffffff;
}
/* ==== Fix header logo & menu alignment ==== */
.header-container {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

.logo {
  margin-right: auto !important;
}

.menu-toggle {
  margin-left: auto !important;
}
/* === Blog Page Styles Only === */
body.blog, body.page-template-blog {
  background-color: #000 !important;
  color: #eee !important;
  font-family: 'Poppins', sans-serif;
}

<?php
/**
 * Template Name: Blog Page
 */
get_header();
?>

<style>
/* ====== Global Blog Styling ====== */
body.blog, body.page-template-blog {
  background-color: #000;
  color: #eee;
  font-family: 'Poppins', sans-serif;
}
<?php
/**
 * Template Name: Blog Page
 */
get_header();
?>

<style>
/* ====== Global Layout ====== */
body {
  background-color: #000;
  color: #f5f5f5;
  font-family: 'Poppins', sans-serif;
  margin: 0;
  padding: 0;
}

/* ====== Category Navigation Bar ====== */
.category-nav {
  background: #0d0d0d;
  border-bottom: 1px solid #222;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 25px;
  padding: 18px 10px;
}

.category-nav a {
  color: #9eff00;
  font-weight: 600;
  text-decoration: none;
  transition: 0.3s;
  font-size: 1rem;
}

.category-nav a:hover {
  color: #fff;
  text-shadow: 0 0 10px #7fff00;
}

/* ====== Blog Container ====== */
.blog-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 50px 20px 100px;
}

/* ====== Blog Header ====== */
.blog-header {
  text-align: center;
  margin-bottom: 50px;
}

.blog-header h1 {
  font-size: 2.5rem;
  color: #7fff00;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.blog-header p {
  color: #bdbdbd;
  font-size: 1.1rem;
}

/* ====== Blog Grid ====== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 35px;
  justify-content: center;
}

.blog-card {
  background: #111;
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}

.blog-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
}

.blog-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

/* ====== Blog Content ====== */
.blog-card-content {
  padding: 22px;
}

.blog-card-content h2 {
  font-size: 1.3rem;
  color: #7fff00;
  margin-bottom: 10px;
}

.blog-card-content p {
  color: #d3d3d3;
  font-size: 0.98rem;
  line-height: 1.6;
  margin-bottom: 15px;
}

.blog-card-content a.read-more {
  display: inline-block;
  background: #7fff00;
  color: #000;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.3s;
}

.blog-card-content a.read-more:hover {
  background: #adff2f;
}

/* ====== Responsive Adjustments ====== */
@media (max-width: 1024px) {
  .blog-header h1 {
    font-size: 2.2rem;
  }
}

@media (max-width: 768px) {
  .category-nav {
    gap: 15px;
    padding: 14px 8px;
  }

  .blog-grid {
    grid-template-columns: 1fr 1fr;
  }

  .blog-header h1 {
    font-size: 1.9rem;
  }
}

@media (max-width: 600px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
}
</style>

<!-- ====== Category Navigation Bar ====== -->
<div class="category-nav">
  <a href="<?php echo site_url('/category/health/'); ?>">Health</a>
  <a href="<?php echo site_url('/category/science/'); ?>">Science</a>
  <a href="<?php echo site_url('/category/lifestyle/'); ?>">Lifestyle</a>
  <a href="<?php echo site_url('/category/technology/'); ?>">Technology</a>
  <a href="<?php echo site_url('/category/wellness/'); ?>">Wellness</a>
  <a href="<?php echo site_url('/category/fitness/'); ?>">Fitness</a>
  <a href="<?php echo site_url('/blog/'); ?>">Blog</a>
</div>

<!-- ====== Blog Container ====== -->
<div class="blog-container">

  <div class="blog-header">
    <h1>📰 Sleep Debt Blog</h1>
    <p>Explore the latest insights, guides, and expert advice on health, science, and sleep wellness.</p>
  </div>

  <div class="blog-grid">
    <?php
    if (have_posts()) :
      while (have_posts()) : the_post(); ?>
        <div class="blog-card">
          <?php 
          if (has_post_thumbnail()) :
            the_post_thumbnail('medium_large');
          else : ?>
            <img src="https://via.placeholder.com/600x350?text=Sleep+Blog" alt="<?php the_title(); ?>">
          <?php endif; ?>

          <div class="blog-card-content">
            <h2><?php the_title(); ?></h2>
            <p><?php echo wp_trim_words(get_the_excerpt(), 20, '...'); ?></p>
            <a href="<?php the_permalink(); ?>" class="read-more">Read More</a>
          </div>
        </div>
      <?php endwhile;
    else : ?>
      <p style="text-align:center; color:#ccc;">No blog posts found.</p>
    <?php endif; ?>
  </div>
</div>

<?php get_footer(); ?>
.post-thumb img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 10px;
  transition: transform 0.3s ease;
}
.post-thumb img:hover {
  transform: scale(1.03);
}
<?php if ( has_post_thumbnail() ) : ?>
    <div class="post-featured-image">
        <?php the_post_thumbnail('full'); ?>
    </div>
<?php endif; ?>
