.hero-section {
    padding-top: 2.5rem; /* Adjusted padding */
    padding-bottom: 2.5rem; /* Adjusted padding */
    background-color: var(--card-bg); /* Example: Use card background for hero */
    border-bottom: 1px solid var(--border-color); /* Add a separator */
}
.hero-section h2 {
    margin-top: 0; /* Remove top margin, space controlled by element above */
    margin-bottom: 0.75rem; 
    font-size: 2.25rem; /* Optional: slightly reduce font size */
}
.hero-section .animated-title-container {
    font-size: 2.8rem; /* Adjust as needed, consider media queries for smaller screens */
    font-weight: bold;
    color: var(--text-primary); /* Use theme color */
    text-align: center;
    margin-top: 0; /* Remove top margin, space controlled by section padding */
    margin-bottom: 0.75rem; /* Space before the h2 heading */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px; /* Fixed height to prevent layout shifts */
    line-height: 60px; /* Helps with vertical alignment */
}

.hero-section .title-part.static-text {
    padding: 0 8px; /* Small spacing around static parts */
}

.hero-section .animated-word-wrapper {
    position: relative; /* For absolute positioning of animated words */
    display: inline-block; /* Allows it to sit in line with other text */
    text-align: center;
    min-width: 280px; /* Adjust based on the longest word and font size */
    height: 100%; /* Takes full height of its container */
}

.hero-section .animated-word {
    color: var(--accent-blue); /* Use theme accent color */
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0; /* Start hidden */
    animation: changeWord 33s infinite ease-in-out; /* 11 words * 3s each = 33s total */
    white-space: nowrap; /* Prevent words from wrapping */
}

/* Animation delays for each word to appear sequentially */
.hero-section .animated-word-wrapper .animated-word:nth-child(1) { animation-delay: 0s; }
.hero-section .animated-word-wrapper .animated-word:nth-child(2) { animation-delay: 3s; }
.hero-section .animated-word-wrapper .animated-word:nth-child(3) { animation-delay: 6s; }
.hero-section .animated-word-wrapper .animated-word:nth-child(4) { animation-delay: 9s; }
.hero-section .animated-word-wrapper .animated-word:nth-child(5) { animation-delay: 12s; }
.hero-section .animated-word-wrapper .animated-word:nth-child(6) { animation-delay: 15s; }
.hero-section .animated-word-wrapper .animated-word:nth-child(7) { animation-delay: 18s; }
.hero-section .animated-word-wrapper .animated-word:nth-child(8) { animation-delay: 21s; }
.hero-section .animated-word-wrapper .animated-word:nth-child(9) { animation-delay: 24s; }
.hero-section .animated-word-wrapper .animated-word:nth-child(10) { animation-delay: 27s; }
.hero-section .animated-word-wrapper .animated-word:nth-child(11) { animation-delay: 30s; }

@keyframes changeWord {
  /* --- Word Lifecycle (takes up ~9% of the total 33s) --- */

  /* 1. Animate IN */
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.8); /* Start small, transparent */
  }
  1% {
    opacity: 1;
    transform: translateX(-50%) scale(1); /* End at normal size, opaque */
  }

  /* 2. HOLD */
  8% {
    opacity: 1;
    transform: translateX(-50%) scale(1); /* Stay at normal size */
  }

  /* 3. Animate OUT */
  9% {
    opacity: 0;
    transform: translateX(-50%) scale(1.2); /* End large, transparent */
  }

  /* --- Must be hidden for the rest of the cycle --- */
  100% {
    opacity: 0;
  }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .hero-section {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    .hero-section .animated-title-container {
        font-size: 2rem; /* Smaller font on medium devices */
        margin-top: 0;
        margin-bottom: 0.5rem; /* Reduced space for smaller screens */
        height: 50px;
        line-height: 50px;
    }
    .hero-section .animated-word-wrapper { min-width: 200px; }
    .hero-section h2 { font-size: 1.8rem; margin-top: 0; margin-bottom: 0.5rem;}
    .hero-section p.lead { font-size: 1rem; margin-top: 0; }
}
@media (max-width: 480px) {
    .hero-section {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
    .hero-section .animated-title-container { 
        font-size: 1.5rem; 
        margin-top: 0;
        margin-bottom: 0.25rem; /* Further reduced space */
        height: 40px; 
        line-height: 40px; 
    }
    .hero-section .animated-word-wrapper { min-width: 150px; }
    .hero-section .title-part.static-text { padding: 0 4px; }
    .hero-section h2 { font-size: 1.5rem; margin-top: 0; margin-bottom: 0.25rem;}
    .hero-section p.lead { font-size: 0.9rem; margin-top: 0; }
}
.hero-section p.lead {
    margin-top: 0; /* Remove top margin, space controlled by h2's bottom margin */
    font-size: 1.1rem; /* Optional: slightly reduce font size */
    color: var(--text-secondary); /* Use theme secondary text color */

}
.hero-section .love-icon-image {
    height: 0.9em; /* Scales with the parent's font-size (e.g., 0.9 * 2.8rem) */
    width: auto;   /* Maintain aspect ratio */
    /* Space between image and the animated words.
       The space before the image comes from the padding-right of the preceding static-text span "i" */
    margin-right: 8px; 
}

/* Custom styles for 5-column tool cards on large screens */
@media (min-width: 992px) { /* Bootstrap's lg breakpoint */
    .tools-section .row .col-lg-custom-5 {
        flex: 0 0 20%;
        max-width: 20%;
        padding-left: 7.5px;  /* Reduced gutter padding */
        padding-right: 7.5px; /* Reduced gutter padding */
    }
}

/* Tool Card Specific Styles */
.tool-card {
    border-radius: 0.5rem; /* Rounded borders */
    padding: 1rem; /* Add padding inside the card */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); /* Subtle shadow */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.tool-card:hover {
    transform: translateY(-5px); /* Lift effect on hover */
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); /* Enhanced shadow on hover */
}

.tool-card img {
    max-width: 80px; /* Control icon size */
    height: auto;
    margin: 0 auto 1rem auto; /* Center image and add space below */
    display: block; /* Ensure margin auto works */
}

/* Custom styles for the "Use Tool" button */
/* .tool-card .tool-btn will now use .themed-btn styles */

/* Custom styles for tool name and description */
.tool-card-content h4 { /* Target h4 inside a new wrapper if needed, or style .tool-card h4 directly */
    font-size: 1.25rem; /* Slightly larger tool name */
    margin-bottom: 0.5rem; /* More space below name */
    color: var(--text-primary);
    text-align: center; /* Center tool name */
}
/* .tool-card p will now use .themed-card p styles or var(--text-secondary) */
.tool-card-content p {
    font-size: 0.95rem; /* Slightly larger description */
    margin-bottom: 1rem; /* More space below description */
    color: var(--text-secondary);
    text-align: center; /* Center description */
}

/* Styling for search section to match theme */
.search-tools-section {
    background-color: var(--bg-color); /* Or var(--card-bg) if you want it card-like */
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.search-tools-section .form-control {
    /* Apply themed-input styles here or add class .themed-input to the input */
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.search-tools-section .form-control:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue);
}

/* Blog Post Card Styles */
.blog-post-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.blog-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
.blog-post-card a {
    text-decoration: none;
    color: inherit;
}
.blog-post-image {
    width: 100px; /* Fixed width */
    height: 100px; /* Fixed height */
    object-fit: cover; /* Ensures the image covers the area without distortion */
    margin-right: 1rem;
    border-radius: 0.25rem;
}
.blog-post-content {
    display: flex;
    flex-direction: column;
}
.blog-post-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.blog-post-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* Carousel Styles */
.blog-post-card-carousel {
    position: relative;
}

.blog-post-card-carousel img {
    width: 100%;
    height: 300px; /* Adjust as needed */
    object-fit: cover;
    border-radius: 0.5rem;
}

.carousel-caption {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0.5rem;
}

.carousel-caption h5 a {
    color: #fff;
    text-decoration: none;
}

/* Marquee Styles */
.marquee-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    height: 30px; /* Adjust as needed */
    background-color: var(--card-bg); /* Match a background color */
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.marquee {
    display: flex;
    animation: marquee-rtl 20s linear infinite; /* Adjust speed as needed */
}

.marquee-item {
    padding: 0 15px;
    white-space: nowrap;
    color: var(--text-primary); /* Use theme colors */
    text-decoration: none;
}

.marquee ul, .marquee li {
   display:inline;
    line-height: 30px; /* Match container height */
}

/* Add hover effects if desired */
.marquee-item:hover {
    color: var(--accent-blue);
}

@keyframes marquee-rtl {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Add optional controls for accessibility */
.marquee-control {
    position: absolute;
    top: 0;
    right: 0;
    padding: 5px;
}

.marquee-control button {
    /* Style your button */
}

[data-theme="light"] .marquee-text {
    background-color: yellow;
    color: black;
    font-weight: bold;
}

[data-theme="dark"] .marquee-text {
    background-color: yellow;
    color: black;
    font-weight: bold;
}
