/* Forest Background */
:root {
    --theme-bg-color: rgba(230, 230, 250, 0.95); /* Lavender/Light Purple */
}

body {
    background-color: #232620; /* Dark forest/grey fallback to prevent white flash */
    background-image: url('https://images.unsplash.com/photo-1448375240586-882707db888b?w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
}

/* Semi-transparent overlay for the whole page */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    z-index: -1;
}

/* Header/Navigation styling */
header {
    background: var(--theme-bg-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Mobile Font Size Increase */
@media (max-width: 768px) {
    body, p, .content, .rich-text, article {
        font-size: 18px; /* Increased base font size for better readability on mobile */
    }
}

/* Main content sections */
section {
    position: relative;
}

/* Content containers with transparency */
.container, .container-fluid {
    position: relative;
}

/* Cards and content boxes */
.card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Main content area backgrounds */
.content, .rich-text, article {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Section backgrounds for readability */
.section {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.section .container {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15);
}

/* Light background sections */
.bg-light {
    background: rgba(248, 249, 250, 0.9) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Custom spacing for the contact form section */
.section-contact {
    padding-top: 1.5rem; /* Reduced top padding */
}

/* Footer styling */
footer {
    background: rgba(33, 37, 41, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Style the footer contact form container */
/* Removed specific container styling as it will now use .content class */

footer .btn-primary {
    background-color: #515b3a;
    border-color: #515b3a;
    color: #fff;
    font-weight: 600;
    border-radius: .5rem; /* More rounded buttons */
}

footer .btn-primary:hover {
    background-color: #6a7548;
    border-color: #6a7548;
}

footer p {
    font-weight: 500;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Post/article boxes */
.post {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.post-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
}

/* Form elements */
.form-control {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Ensure text remains readable */
h1, h2, h3, h4, h5, h6, p, li, a {
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

/* Button styling to stand out */
.btn-primary {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Search wrapper */
.search-wrapper {
    background: rgba(255, 255, 255, 0.95);
}

/* Blockquote Styling */
blockquote {
    background: rgba(249, 249, 249, 0.6);
    border-left: 5px solid #515b3a; /* Theme green color */
    margin: 1.5em 10px;
    padding: 1em 20px;
    quotes: "\201C""\201D""\2018""\2019";
    font-style: italic;
    color: #555;
}

blockquote:before {
    color: #515b3a;
    content: open-quote;
    font-size: 3em;
    line-height: 0.1em;
    margin-right: 0.1em;
    vertical-align: -0.4em;
}

blockquote p {
    display: inline;
}

/* Classes Page - Featured Image Styling */
.class-image-wrapper {
    position: relative;
    margin-top: 2rem;
    margin-bottom: 2rem;
    display: flex;             /* Use flexbox to center content */
    justify-content: center;   /* Center horizontally */
    align-items: center;       /* Center vertically if height was fixed (optional here) */
    border-radius: 15px;
    overflow: hidden;          /* Ensure nothing spills out */
}

.class-featured-img {
    width: auto;               /* Allow width to adjust naturally */
    max-width: 100%;           /* Constrain to container width */
    height: auto;              /* Allow height to adjust naturally */
    max-height: 700px;         /* Cap height to prevent super-tall images */
    object-fit: contain;       /* Ensure the whole image is seen */
    border-radius: 15px;       /* Rounded corners */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: block;
}

/* Responsive sizing for smaller screens */
@media (max-width: 768px) {
    .class-featured-img {
        max-height: 500px;     /* Reduce max height on tablets */
    }
}

@media (max-width: 480px) {
    .class-featured-img {
        max-height: 400px;     /* Reduce max height on mobile */
    }
}

/* Content Link Styling */
.content a, .rich-text a, article a {
    color: #515b3a; /* Theme green color */
    text-decoration: underline;
    font-weight: 500;
    transition: all 0.3s ease;
}

.content a:hover, .rich-text a:hover, article a:hover {
    color: #3d4629; /* Darker green on hover */
    text-decoration: underline;
    text-shadow: 0 1px 3px rgba(81, 91, 58, 0.3);
}

/* Heading Links - Maintain larger size and make them stand out */
h2 a, h3 a, h4 a {
    color: #515b3a;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

h2 a:hover, h3 a:hover, h4 a:hover {
    color: #3d4629;
    border-bottom: 2px solid #515b3a;
    text-shadow: 0 2px 4px rgba(81, 91, 58, 0.2);
}

/* Ensure heading links keep their heading size */
h2 a {
    font-size: inherit;
}

h3 a {
    font-size: inherit;
}

h4 a {
    font-size: inherit;
}

/* Back Button Styling */
.btn-back {
    display: inline-flex;
    align-items: center;
    background-color: transparent;
    color: #515b3a;
    border: 2px solid #515b3a;
    padding: 0.5rem 1.2rem;
    border-radius: 30px; /* Pill shape */
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.3s ease;
}

.btn-back i {
    transition: transform 0.3s ease;
}

.btn-back:hover {
    background-color: #515b3a;
    color: white;
    text-shadow: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(81, 91, 58, 0.3);
}

.btn-back:hover i {
    transform: translateX(-3px);
}

/* Classes List - Thumbnail Styling */
.class-list-item {
    padding: 1.5rem;
}

.class-list-thumbnail {
    width: 100%;
    max-width: 180px;
    height: auto;
    max-height: 180px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.class-list-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Mobile: Stack image below text */
@media (max-width: 767px) {
    .class-list-item .col-md-4 {
        margin-top: 1rem;
    }

    .class-list-thumbnail {
        max-width: 150px;
        max-height: 150px;
    }
}

/* ============================================
   SMOOTH ANIMATIONS
   ============================================ */

/* Page Transition Animations */
@keyframes page-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body {
    animation: page-fade-in 0.4s ease-out forwards;
}

body.page-leaving {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Mobile Navigation Slide Animation */
#navigation.collapsing {
    transition: height 0.35s ease;
}

/* Nav items slide in effect */
@media (max-width: 991px) {
    #navigation .nav-item {
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    /* Show items as menu opens (collapsing) and when fully open (show) */
    #navigation.collapsing .nav-item,
    #navigation.collapse.show .nav-item {
        opacity: 1;
        transform: translateY(0);
    }

    /* Stagger the nav items */
    #navigation.collapsing .nav-item:nth-child(1),
    #navigation.collapse.show .nav-item:nth-child(1) { transition-delay: 0s; }
    #navigation.collapsing .nav-item:nth-child(2),
    #navigation.collapse.show .nav-item:nth-child(2) { transition-delay: 0.05s; }
    #navigation.collapsing .nav-item:nth-child(3),
    #navigation.collapse.show .nav-item:nth-child(3) { transition-delay: 0.1s; }
    #navigation.collapsing .nav-item:nth-child(4),
    #navigation.collapse.show .nav-item:nth-child(4) { transition-delay: 0.15s; }
    #navigation.collapsing .nav-item:nth-child(5),
    #navigation.collapse.show .nav-item:nth-child(5) { transition-delay: 0.2s; }
    #navigation.collapsing .nav-item:nth-child(6),
    #navigation.collapse.show .nav-item:nth-child(6) { transition-delay: 0.25s; }
    #navigation.collapsing .nav-item:nth-child(7),
    #navigation.collapse.show .nav-item:nth-child(7) { transition-delay: 0.3s; }
    #navigation.collapsing .nav-item:nth-child(8),
    #navigation.collapse.show .nav-item:nth-child(8) { transition-delay: 0.35s; }
}

/* Content Reveal Animation */
@keyframes content-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content,
.class-list-item {
    animation: content-fade-in 0.5s ease-out forwards;
}

/* Stagger content sections */
.content:nth-of-type(2) { animation-delay: 0.1s; }
.content:nth-of-type(3) { animation-delay: 0.2s; }
.content:nth-of-type(4) { animation-delay: 0.3s; }
.class-list-item:nth-of-type(2) { animation-delay: 0.1s; }
.class-list-item:nth-of-type(3) { animation-delay: 0.15s; }
.class-list-item:nth-of-type(4) { animation-delay: 0.2s; }
.class-list-item:nth-of-type(5) { animation-delay: 0.25s; }
.class-list-item:nth-of-type(6) { animation-delay: 0.3s; }

/* Hamburger Menu Animation */
.navbar-toggler {
    transition: transform 0.3s ease;
}

.navbar-toggler:hover {
    transform: translateY(-50%) scale(1.1);
}

.navbar-toggler[aria-expanded="true"] i {
    display: inline-block;
    animation: rotate-in 0.3s ease forwards;
}

@keyframes rotate-in {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(90deg);
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Link hover animations */
.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: #515b3a;
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
    left: 0;
}

/* Button hover animations */
.btn {
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Align card buttons at bottom */
.card .card-body {
    display: flex;
    flex-direction: column;
}

.card .card-body .btn {
    margin-top: auto;
}