/* ===================================================================
   Halogenius Ideas - Blog Stylesheet
   =================================================================== */

/* --- 1. Global & Layout --- */
:root {
  --primary: #0066ff;
  --secondary: #7b42f6;
  --accent: #00d4ff;
  --neutral-dark: #1a1a2e;
  --neutral-light: #f8f9fa;
  --gradient: linear-gradient(90deg, var(--primary), var(--secondary));
  --font-body: "Inter", sans-serif;
  --font-heading: "Poppins", sans-serif;
  --hg-border-radius: 8px;
  --hg-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --hg-shadow-md: 0 4px 10px rgba(26, 26, 46, 0.1);
  --hg-shadow-lg: 0 10px 25px rgba(26, 26, 46, 0.15);
  --hg-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.hg-container {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}
.hg-container-medium {
  max-width: 900px;
}
.hg-container-narrow {
  max-width: 800px;
}

.hg-section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--neutral-dark);
}

/* --- 2. Blog Archive (index.php) --- */
.hg-archive-header {
  text-align: center;
  padding: 3rem 0;
  margin: 3rem 0;
  background-color: var(--neutral-light);
  margin-top: 4rem;
}

.hg-archive-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: 0.5rem;
}

.hg-archive-description {
  font-size: 1.125rem;
  color: var(--text-secondary, #555);
  max-width: 600px;
  margin: 0 auto;
}

.hg-blog-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}
@media (min-width: 992px) {
  .hg-blog-layout {
    grid-template-columns: 1fr 320px;
  }

  .hg-container {
    padding-bottom: 1.5rem;
  }
}

/* Post Grid */
.hg-posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 600px) {
  .hg-posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 992px) {
  .hg-main-content .hg-posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hg-related-posts .hg-posts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
/* @media (min-width: 1400px) {
  .hg-main-content .hg-posts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
} */

/* Post Card */
.hg-post-card {
  background: #fff;
  border-radius: var(--hg-border-radius);
  box-shadow: var(--hg-shadow-md);
  transition: var(--hg-transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hg-post-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--hg-shadow-lg);
}

.hg-card-image-link {
  display: block;
  aspect-ratio: 16 / 9;
}
.hg-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}
.hg-post-card:hover .hg-card-image {
  transform: scale(1.05);
}
.hg-card-image-placeholder {
  width: 100%;
  height: 100%;
  background: var(--gradient);
}
.hg-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.hg-card-header {
  margin-bottom: 1rem;
}
.hg-card-categories a {
  background: var(--gradient);
  color: #fff;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.hg-card-title {
  margin: 0.75rem 0 0;
  font-size: 1.25rem;
  line-height: 1.3;
}
.hg-card-title a {
  color: var(--neutral-dark);
  text-decoration: none;
}
.hg-card-title a:hover {
  color: var(--primary);
}

.hg-card-excerpt {
  color: var(--text--secondary, #555);
  flex-grow: 1;
  margin-bottom: 1rem;
  line-height: 1.6;
}
.hg-card-footer {
  border-top: 1px solid #eef;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: flex-start;
  font-size: 0.875rem;
  color: var(--text-secondary, #555);
}

@media (min-width: 1024px) {
  .hg-card-footer {
    flex-direction: column;
    justify-content: start;
  }
}
.hg-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hg-card-author a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
}
.hg-card-author img {
  border-radius: 50%;
}

/* Pagination */
.pagination .nav-links {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}
.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 600;
  transition: all 0.2s ease;
} /* Style as per previous response */

/* Sidebar */
.hg-sidebar .widget {
  background: #fff;
  padding: 1.5rem;
  border-radius: var(--hg-border-radius);
  box-shadow: var(--hg-shadow-sm);
  margin-bottom: 2rem;
}
/* .hg-sidebar .widget-title { 
    
 } */

/* --- 3. Single Post (single.php) --- */
.hg-single-header {
  background: var(--neutral-dark);
  color: #fff;
  text-align: center;
  padding: 7rem 1rem;
}
.hg-single-categories a {
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
}
.hg-single-title {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  margin: 0.5rem 0 1.5rem;
  color: #fff;
}

@media (max-width: 768px) {
  .hg-single-title {
    font-size: clamp(2rem, 5vw, 4rem);
  }
}

@media (max-width: 480px) {
  .hg-single-title {
    font-size: clamp(1.75rem, 5vw, 4rem);
  }
}

.hg-single-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding-top: 3rem;
}
@media (min-width: 1024px) {
  .hg-single-layout {
    grid-template-columns: 60px 1fr;
  }
}

.hg-floating-share {
  display: none;
} /* Hide on mobile */
@media (min-width: 1024px) {
  .hg-floating-share {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 120px;
    align-self: start;
  }
  /* Icon styles for share links... */
}

/* Entry Content */
.entry-content {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--neutral-dark);
}
/* ... (All rich content styles for h2, h3, blockquote, code blocks, etc. from previous response) ... */

/* Table of Contents */
.hg-toc {
  /* Style the TOC as per previous response */
}

/* Post Reactions */
.hg-post-reactions {
  margin: 3rem 0;
  padding: 2rem 0;
  border-top: 1px solid #eef;
  border-bottom: 1px solid #eef;
}
.hg-reactions-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}
.hg-reaction-btn {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 50px;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--hg-transition);
}
.hg-reaction-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}
.hg-reaction-btn.reacted {
  border-color: var(--accent);
  background-color: #f0fcff;
}
.hg-reaction-icon {
  font-size: 1.25rem;
}
.hg-reaction-label {
  font-weight: 600;
}
.hg-reaction-count {
  background: #eee;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Author Box */
.hg-author-box {
  display: flex;
  gap: 1.5rem;
  background: var(--neutral-light);
  padding: 2rem;
  border-radius: var(--hg-border-radius);
  margin: 3rem 0;
}
.hg-author-avatar img {
  border-radius: 50%;
}

/* Related Posts */
.hg-related-posts {
  margin: 3rem 0;
}
.hg-related-posts .hg-posts-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* Comments */
.comments-area {
  margin: 3rem 0;
}
.comments-area {
  margin-top: var(--space-xl);
}
.comments-title,
.comment-reply-title {
  font-size: 1.8rem;
}
.comment-list {
  list-style: none;
  padding: 0;
  margin-top: var(--space-lg);
}
.comment-list .comment {
  background: var(--background-secondary);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  border: 1px solid var(--border-color);
}
.comment-list .children {
  list-style: none;
  padding-left: var(--space-lg);
}
.comment-author {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
}
.comment-author .avatar {
  border-radius: 50%;
}
.comment-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}
.comment-content {
  margin-top: var(--space-sm);
}
.reply {
  text-align: right;
}
.comment-reply-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

#commentform {
  margin-top: var(--space-lg);
  background: var(--background-secondary);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: 4rem;
}
#commentform input[type="text"],
#commentform input[type="email"],
#commentform textarea {
  width: 100%;
  margin-bottom: var(--space-md);
}
#commentform .form-submit .submit {
  display: inline-block;
  padding: 15px 35px !important;
  border-radius: 50px !important;
  margin-top: 2rem;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  text-align: center;
  cursor: pointer;
  border: none;
  background-color: var(--accent) !important;
  color: var(--neutral-dark) !important;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3) !important;
}

#commentform .form-submit .submit:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.5) !important;
}

/* --- 4. Print Styles --- */
/* @media print {
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }
  header,
  footer,
  .hg-sidebar,
  .hg-floating-share,
  .hg-post-reactions,
  .hg-author-box,
  .hg-related-posts,
  .comments-area {
    display: none !important;
  }
} */

@media print {
  body {
    background: #fff;
    color: #000;
  }
  .page-content {
    padding: 0;
  }
  header,
  footer,
  .halogenius-blog-container,
  .blog-layout-container aside,
  .floating-social-share,
  .post-reactions,
  .inline-social-share,
  .author-bio-box,
  .related-posts-section,
  .comments-area {
    display: none;
  }
  .halogenius-single-post,
  .single-post-layout-container,
  .post-content-column {
    display: block;
    max-width: 100%;
    padding: 0;
    margin: 0;
  }
  .single-post-header {
    background: none;
    color: #000;
    text-align: left;
    padding: 0;
  }
  .single-post-header .single-post-title {
    color: #000;
  }
  .single-post-meta,
  .post-meta-categories {
    display: block;
    text-align: left;
  }
  .single-post-featured-image {
    display: none;
  }
  .entry-content a {
    color: #000;
    text-decoration: underline;
  }
}

/* == Styling for the Featured Posts Widget (Shortcode) == */
.hg-featured-posts-widget {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hg-featured-posts-widget li {
  padding: 0.75rem 0;
  border-bottom: 1px solid #eef; /* A light border */
}

/* Remove the border from the very last item */
.hg-featured-posts-widget li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Remove padding from the very first item */
.hg-featured-posts-widget li:first-child {
  padding-top: 0;
}

.hg-featured-posts-widget li a {
  color: var(--neutral-dark);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.hg-featured-posts-widget li a:hover {
  color: var(--primary); /* Use your primary brand color on hover */
}

/* Add this entire block to your /assets/css/blog.css file */

/* ===================================================================
   5. Pagination Styling
   =================================================================== */
.navigation.pagination {
  margin: 3rem; /* Spacing above the pagination */
  display: flex;
  justify-content: center;
}

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem; /* Space between each button */
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  border: 2px solid var(--border-color, #eef);
  border-radius: var(--hg-border-radius, 8px);
  background-color: #fff;
  color: var(--text-secondary, #555);
  font-family: var(--font-heading);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
}

.pagination .page-numbers:hover,
.pagination .page-numbers:focus {
  transform: translateY(-3px);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--hg-shadow-md);
}

/* Style for the current page item */
.pagination .page-numbers.current {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 102, 255, 0.3);
  cursor: default;
}

/* Remove hover effect from the current page item */
.pagination .page-numbers.current:hover {
  color: #fff; /* Keep text white */
}

/* Style for the 'Next' and 'Previous' arrows */
.pagination .next.page-numbers,
.pagination .prev.page-numbers {
  padding: 0;
}

.pagination .next svg,
.pagination .prev svg {
  width: 22px;
  height: 22px;
  fill: currentColor; /* The SVG color will match the link color */
}

/* ===================================================================
   6. Sidebar Search Form Styling
   =================================================================== */
.wp-block-search {
  margin-bottom: 1rem;
}

/* The main container that holds the input and button */
.wp-block-search .wp-block-search__inside-wrapper {
  display: flex;
  align-items: center;
  border: 2px solid var(--border-color, #eef);
  border-radius: 50px; /* Large radius for a "pill" shape */
  background-color: #fff;
  transition: all 0.2s ease;
  padding: 0;
  position: relative;
}

/* Add a focus ring to the entire wrapper when the input is focused */
.wp-block-search .wp-block-search__inside-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.15);
}

/* Style for the input field itself */
.wp-block-search__input {
  flex-grow: 1; /* Take up all available space */
  border: none !important; /* Override default borders */
  background: transparent !important; /* Make it see-through */
  padding: 0.75rem 1.25rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--neutral-dark);
  outline: none; /* Remove the default browser outline */
  box-shadow: none !important; /* Override theme's shadow on inputs */
}

/* Placeholder text color */
.wp-block-search__input::placeholder {
  color: var(--text-secondary, #aaa);
  opacity: 1;
}

/* Style for the search button */
.wp-block-search__button {
  border: none !important;
  background: transparent !important;
  padding: 0.6rem 1rem 0.6rem 0.5rem;
  cursor: pointer;
  border-radius: 0 50px 50px 0;
  box-shadow: none !important; /* Override theme buttons */
  align-self: stretch;
  height: auto;
}

/* The SVG icon inside the button */
.wp-block-search__button .search-icon {
  fill: var(--text-secondary, #555);
  transition: fill 0.2s ease;
}

.wp-block-search__button:hover .search-icon,
.wp-block-search__button:focus .search-icon {
  fill: var(--primary);
}

/* ===================================================================
   7. Math Captcha Plugin Styling
   =================================================================== */

/* --- Main Container for the Captcha --- */
.math-captcha-form {
  background-color: var(--neutral-light);
  border: 1px solid var(--border-color, #eef);
  border-radius: var(--hg-border-radius, 8px);
  border-top: 3px solid var(--accent); /* Brand accent */
  padding: 1.5rem;
  margin-top: 1.5rem; /* Space it out from the field above */
}

/* --- The Main Label "Are you a robot?" --- */
.math-captcha-form label {
  display: block; /* Puts it on its own line */
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--neutral-dark);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

/* --- The wrapper for the math problem itself --- */
.math-captcha-form > span:first-of-type {
  display: flex;
  align-items: center;
  flex-wrap: wrap; /* Allows it to stack on small screens */
  gap: 0.75rem; /* Consistent spacing between text and input */
  font-size: 1rem;
  color: var(--text-secondary);
}

/* --- The Input Field --- */
.math-captcha-form .mc-input {
  border: 2px solid var(--border-color, #eef);
  border-radius: var(--hg-border-radius, 8px);
  background-color: #fff;
  padding: 0.5rem;
  width: 60px; /* Give it a specific, compact width */
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--neutral-dark);
  text-align: center;
  box-shadow: none !important;
  transition: all 0.2s ease;
}

/* --- Focus state for the input field --- */
.math-captcha-form .mc-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.15); /* Matches your search bar focus */
}

.math-captcha-form input[type="text"].mc-input {
  margin-bottom: 0 !important;
}

/* 
 * --- Hide the "Powered By" Branding ---
 * This targets the <br> tag and the <span> that immediately follows it.
 * Using "!important" is a good practice here to ensure we override any
 * inline styles or plugin styles.
*/
/* .math-captcha-form br,
.math-captcha-form br + span {
  display: none !important;
} */

/* ===================================================================
   8. Social Share Icons Styling
   =================================================================== */

/* --- Floating Sidebar Icons --- */
.hg-floating-share {
  /* Existing styles from before */
  display: none;
}
@media (min-width: 1024px) {
  .hg-floating-share {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 120px;
    align-self: start;
  }
}

.hg-share-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.hg-share-link:hover {
  transform: scale(1.15) rotate(5deg);
  box-shadow: var(--hg-shadow-md);
  color: #fff;
}

/* Social Brand Colors */
.hg-share-twitter {
  background-color: #1da1f2;
}
.hg-share-facebook {
  background-color: #1877f2;
}
.hg-share-linkedin {
  background-color: #0a66c2;
}

/* --- Inline Share Buttons --- */

.hg-inline-share {
  text-align: center;
  margin: 3rem 0;
  border-bottom: 1px solid #eef;
  padding-bottom: 2rem;
}

.hg-inline-share-wrapper {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.hg-inline-share-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-radius: 50px; /* Pill shape */
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.hg-inline-share-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--hg-shadow-lg);
  color: #fff;
}

.hg-inline-share-button i {
  font-size: 1.1em;
}

/* ===================================================================
   9. Author Box Responsive Fix
   =================================================================== */

/* --- Mobile-First Default Styles (Stacked Layout) --- */
.hg-author-box {
  display: flex;
  flex-direction: column; /* STACK the items vertically */
  align-items: center; /* Center the avatar horizontally */
  text-align: center; /* Center all the text below the avatar */
  gap: 1.5rem;
  background: var(--neutral-light);
  padding: 2rem;
  border-radius: var(--hg-border-radius);
  margin: 3rem 0;
}

.hg-author-avatar img {
  border-radius: 50%;
  /* No extra styles needed, centering is handled by the parent */
}

.hg-author-name {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.hg-author-bio {
  margin-top: 0.5rem;
  max-width: 65ch; /* Improves readability */
}

/* --- Desktop Styles (Side-by-Side Layout) --- */
/* This media query applies only when the screen is 768px or wider */
@media (min-width: 768px) {
  .hg-author-box {
    flex-direction: row; /* Switch to side-by-side */
    align-items: flex-start; /* Align to the top for a cleaner look */
    text-align: left; /* Align all text to the left */
  }
}

/* ===================================================================
   10. Single Post Featured Image Styling
   =================================================================== */

/* --- The Main Container Div --- */
.hg-single-featured-image {
  /* Positioning & Sizing */
  margin: -3rem auto 0;
  max-width: 1200px;
  position: relative; /* Needed for the overlay */

  /* The CORE FIX: Forcing a widescreen aspect ratio */
  aspect-ratio: 16 / 9;

  /* Visual Polish */
  border-radius: var(--hg-border-radius, 8px);
  box-shadow: var(--hg-shadow-lg);
  background-color: var(
    --neutral-dark
  ); /* Shows a dark block while image loads */
  overflow: hidden; /* CRITICAL: Clips the image to the container's shape and radius */
}

/* --- The Image Tag Itself --- */
.hg-single-featured-image img {
  /* Make the image fill the container */
  width: 100%;
  height: 100%;

  /* The MAGIC PROPERTY: Fills the container without stretching or distorting */
  object-fit: cover;
  object-position: center; /* Ensures the middle of the image is prioritized */

  display: block; /* Removes any tiny space below the image */

  /* Add a smooth transition for the hover effect */
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- Add a subtle zoom effect on hover --- */
.hg-single-featured-image:hover img {
  transform: scale(1.03);
}

/* --- Optional: Add a subtle shadow overlay for depth --- */
.hg-single-featured-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Gradient from a semi-transparent dark at the bottom to fully transparent at the top */
  background: linear-gradient(
    to top,
    rgba(26, 26, 46, 0.3) 0%,
    rgba(26, 26, 46, 0) 50%
  );
  /* This prevents the overlay from interfering with mouse events */
  pointer-events: none;
}

/* --- Responsive Adjustments for Mobile --- */
@media (max-width: 767px) {
  .hg-single-featured-image {
    /* On mobile, an edge-to-edge image looks best */
    border-radius: 0;
    margin-top: -2rem; /* Reduce the overlap slightly */
  }
}

/* ===================================================================
   11. Single Post Meta - Responsive Fix
   =================================================================== */

/* --- Mobile-First Base Styles (Wrapping Horizontal Layout) --- */
.hg-single-meta {
  display: flex;
  flex-wrap: wrap; /* CRITICAL: Allow items to wrap to the next line on mobile */
  justify-content: center; /* Center the items/lines horizontally */
  align-items: center; /* Vertically align all items */
  gap: 0.75rem 1.5rem; /* Flexible gap: 0.75rem vertical, 1.5rem horizontal */
  opacity: 0.9;
  font-size: 0.9rem; /* A slightly smaller font is good for meta info */
  line-height: 1.5;
}

/* --- Style for the author link container --- */
.hg-single-meta .hg-meta-author a {
  display: inline-flex; /* Use inline-flex for better alignment within the line */
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none; /* Explicitly remove underline for a cleaner look */
}

/* --- Style for the avatar image --- */
.hg-single-meta img {
  border-radius: 50%;
}

/* --- Add Separator Between Items (The Professional Touch) --- */
/* This adds a separator before every span EXCEPT the first one */
.hg-single-meta > span + span::before {
  content: "";
  opacity: 0.5; /* Make the separator subtle */
  /* The 'gap' property handles the spacing, so no extra margin is needed */
}

/* --- Desktop Override (for larger screens) --- */
@media (min-width: 768px) {
  .hg-single-meta {
    flex-wrap: nowrap; /* On desktop, force everything onto a single line */
  }
}

/* ===================================================================
   12. YouTube Video Embed Styling
   =================================================================== */

/* --- Wrapper for the responsive iframe --- */
.hg-video-embed-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  background: #000;
  border-radius: var(--hg-border-radius, 8px);
  margin: 2rem 0; /* Add space around the video */
  box-shadow: var(--hg-shadow-md);
}

.hg-video-embed-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- Section for the final video embed at the end of the post --- */
.hg-final-video-section {
  text-align: center;
  /* margin: 3rem 0; */
  /* padding: 2rem 0; */
  /* border-top: 1px solid #eef; */
  border-bottom: 1px solid #eef;
  padding-bottom: 2rem !important;
}

/* --- "Watch on YouTube" Button --- */
.hg-youtube-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background-color: #ff0000; /* YouTube Red */
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-family: var(--font-heading);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  margin-top: 1.5rem; /* Space between video and button */
}

.hg-youtube-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(255, 0, 0, 0.3);
  background-color: #cc0000;
  color: #fff;
}

.hg-youtube-button i {
  font-size: 1.3em;
}

/* ===================================================================
   13. Default Entry Content Styling
   =================================================================== */

/* --- General Typography & Spacing --- */
.entry-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--neutral-dark);
}

.entry-content p,
.entry-content ul,
.entry-content ol {
  margin-bottom: 1.5rem;
  max-width: 70ch; /* Optimal for readability */
}

/* --- Headings within the post --- */
.entry-content h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid;
  border-image: var(--gradient) 1;
}

.entry-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

/* --- Lists --- */
.entry-content ul {
  list-style: none;
  padding-left: 1rem;
}

.entry-content ul li {
  padding-left: 1.5rem;
  position: relative;
  margin-bottom: 0.5rem;
}

.entry-content ul li::before {
  content: "→"; /* A simple, clean marker */
  position: absolute;
  left: 0;
  top: 0;
  color: var(--primary);
  font-weight: bold;
}

.entry-content ol {
  padding-left: 2.5rem;
}

/* --- Links --- */
.entry-content a {
  color: var(--primary);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 2px;
  transition: background-size 0.3s;
}

.entry-content a:hover {
  background-size: 100% 2px;
}

/* --- Blockquotes --- */
.entry-content blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  border-left: 5px solid var(--accent);
  background-color: var(--neutral-light);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--neutral-dark);
}

.entry-content blockquote p {
  margin-bottom: 0;
}

/* ===================================================================
   14. Code Block Styling (for enableCodeBlockCopy function)
   =================================================================== */

/* --- Inline Code (e.g. `venv`) --- */
.entry-content code:not(pre code) {
  background: rgba(0, 102, 255, 0.08);
  color: var(--primary);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: "Fira Code", "JetBrains Mono", monospace;
}

/* --- Code Blocks (`<pre>`) --- */
/* This rule is now a basic container. Prism.js will do the heavy lifting. */
.entry-content pre {
  position: relative;
  margin: 2rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* This targets the <code> tag *inside* the <pre> tag, which Prism styles */
.entry-content pre[class*="language-"] {
  padding: 2rem 1.5rem 1.5rem;
  border-radius: var(--hg-border-radius, 8px);
  border: 1px solid #444;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);

  max-width: 100%; /* Force it to stay within parent */
  overflow-x: auto; /* Add scrollbar if content is too wide */
  white-space: pre-wrap; /* Mandate wrapping (see next section) */
  word-break: break-word; /* Ensure long words break */
}

/* Force Prism to wrap lines */
code[class*="language-"],
pre[class*="language-"] {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
}

/* MOBILE OVERRIDE: Scroll instead of wrap on screens smaller than 768px */
@media (max-width: 768px) {
  .entry-content pre[class*="language-"] {
    max-width: 100%;
    overflow-x: auto;
  }

  code[class*="language-"],
  pre[class*="language-"] {
    white-space: pre !important; /* Disable wrapping on mobile */
    word-break: normal !important;
  }
}

/* --- The Language Tag (Generated by JS) --- */
.entry-content pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  left: 1.5rem;
  background: var(--accent);
  color: var(--neutral-dark);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

/* --- The Copy Button (Generated by JS) --- */
.copy-code-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s ease;
}

.entry-content pre:hover .copy-code-button {
  opacity: 1; /* Show button on hover of the code block */
}

.copy-code-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- The "Copied!" state --- */
.copy-code-button.copied {
  background: var(--success, #10b981);
  color: #fff;
  border-color: transparent;
}

/* ===================================================================
   15. Table of Contents (TOC) Styling
   =================================================================== */

/* --- The Main TOC Container --- */
.hg-toc {
  background-color: var(--neutral-light);
  border-radius: var(--hg-border-radius, 8px);
  border: 1px solid var(--border-color, #eef);
  border-left: 5px solid var(--primary); /* Strong brand accent */
  padding: 1.5rem 2rem;
  margin-bottom: 2.5rem; /* Space between TOC and the first content paragraph */
  box-shadow: var(--hg-shadow-sm);
}

/* --- The TOC Title (e.g., "In This Article") --- */
.hg-toc h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--neutral-dark);
  margin: 0 0 1rem 0; /* Reset margins and add space below */
}

/* --- The List Itself --- */
.hg-toc .toc-list {
  list-style: none; /* Remove default bullets */
  padding: 0;
  margin: 0;
}

/* --- Main List Items (for H2s) --- */
.hg-toc .toc-list > li {
  border-top: 1px solid var(--border-color, #eef); /* Separator line */
}

/* Remove the top border from the very first item */
.hg-toc .toc-list > li:first-child {
  border-top: none;
}

/* --- The Clickable Links (Most Important) --- */
.hg-toc .toc-list a {
  display: block; /* Makes the entire area clickable */
  padding: 0.75rem 0.5rem;
  color: var(--text-secondary, #555);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
}

.hg-toc .toc-list a:hover,
.hg-toc .toc-list a:focus {
  color: var(--primary);
  background-color: rgba(0, 102, 255, 0.05); /* A very subtle primary tint */
  transform: translateX(5px); /* Adds a nice "push" effect */
}

/* --- Nested Lists (for H3s) --- */
.hg-toc .toc-list ul {
  list-style: none;
  padding-left: 1.5rem; /* Indent the nested items */
  margin: 0.5rem 0;
}

/* --- Styling for the nested list items to show hierarchy --- */
.hg-toc .toc-list ul li a {
  font-size: 0.9em; /* Make them slightly smaller */
  padding-left: 2rem; /* Indent the text further */
  position: relative;
  font-weight: 500;
}

/* Add a visual marker for nested items */
.hg-toc .toc-list ul li a::before {
  content: "└"; /* A character that implies hierarchy */
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: monospace;
  color: var(--accent);
  opacity: 0.7;
}

/* ===================================================================
   16. Post Tags Styling
   =================================================================== */

/* --- The main container for the tags section --- */
.hg-post-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap; /* Allows tags to wrap on small screens */
  gap: 1rem;
  margin-top: 3rem; /* Space between content and tags */
  padding-top: 2rem;
  margin-bottom: 2rem;
  border-top: 1px solid var(--border-color, #eef);
}

/* --- The "Tagged In:" label --- */
.hg-post-tags > span {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--neutral-dark);
  font-size: 1rem;
}

/* --- The list that holds the tags --- */
.hg-post-tags .hg-tags-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hg-post-tags .hg-tags-list li {
  margin: 0;
}

/* --- The individual tag links (the most important part) --- */
.hg-post-tags .hg-tags-list li a {
  display: inline-block;
  background: var(--neutral-light);
  border: 1px solid var(--border-color, #eef);
  border-radius: 50px; /* Pill shape */
  padding: 0.5rem 1.25rem;
  color: var(--text-secondary, #555);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
}

.hg-post-tags .hg-tags-list li a:hover,
.hg-post-tags .hg-tags-list li a:focus {
  transform: translateY(-2px);
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--hg-shadow-sm);
  background: #fff;
}

/* Add a hashtag icon for a modern touch */
.hg-post-tags .hg-tags-list li a::before {
  content: "#";
  margin-right: 0.25rem;
  opacity: 0.6;
}

/* ===================================================================
   18. Custom Scrollbar for Code Blocks
   =================================================================== */

/* Target scrollbars within Prism.js code blocks */
.entry-content pre[class*="language-"]::-webkit-scrollbar {
  height: 10px; /* Height of the horizontal scrollbar */
}

/* The track (the bar the scroller sits on) */
.entry-content pre[class*="language-"]::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* The draggable scrolling handle */
.entry-content pre[class*="language-"]::-webkit-scrollbar-thumb {
  background: var(--accent, #00d4ff);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.entry-content pre[class*="language-"]::-webkit-scrollbar-thumb:hover {
  background: var(--primary, #0066ff);
  background-clip: content-box;
}
