html {
  scroll-behavior: smooth;
}

/* Ensure sufficient color contrast */
body {
    background-color: #f8f9fa;
    color: #212529;
    font-family: 'Cinzel', serif;
    transition: background-color 0.3s, color 0.3s;
    /* Add padding to account for fixed navbar */
    padding-top: 70px; /* Mobile navbar height */
}

/* Responsive navbar padding */
@media (min-width: 768px) {
    body {
        padding-top: 80px; /* Tablet navbar height */
    }
}

@media (min-width: 1024px) {
    body {
        padding-top: 90px; /* Desktop navbar height */
    }
}

/* Special handling for index page with full viewport hero */
body.index-page {
    padding-top: 0;
}

/* Special handling for about-me page with full viewport hero */
body.about-me-page {
    padding-top: 0;
}

.pi-body a:hover,
.pi-body button:hover {
  transition: 0.3s;
}

.pi-body a:focus,
.pi-body button:focus,
.pi-body input:focus,
.pi-body textarea:focus {
    outline: 2px solid #dd3649;
    outline-offset: 2px;
}

/* Add comments for section headings */
.header {
    text-align: center;
    padding: 20px;
}

.header-img {
    width: 100%; /* Full width */
    margin: 0 auto; /* Center the image */
}

.header-text {
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 10px;
    display: inline-block;
    margin-top: -50px;
    animation: fadeInDown 1s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Additional styles for improved accessibility and performance */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.container {
    padding: 15px;
}

.btn {
    transition: background-color 0.3s, color 0.3s;
    font-family: 'Cinzel', serif;
}

.btn:hover {
    background-color: #c12e42;
    color: #ffffff;
}

.pi-btn-custom {
    background: linear-gradient(45deg, #2196f3, #1e88e5);
    color: #ffffff;
    border: none;
    border-radius: 30px;
    padding: 10px 20px;
    margin: 5px;
    transition: transform 0.3s, background 0.3s;
    font-family: 'Cinzel', serif;
}

.pi-btn-custom:hover {
    background: linear-gradient(45deg, #1e88e5, #2196f3);
    transform: translateY(-2px);
}

/* Set header text to Cinzel */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Cinzel', serif;
}

/* Set body text to Lato only */
body {
    font-family: 'Lucida Sans', sans-serif;
}

/* Ensure text changes color in dark theme */
.night-theme .header-text,
.night-theme .nav-link,
.night-theme .card,
.night-theme .card-body,
.night-theme .card-title,
.night-theme .card-text {
    color: #ffffff;
}

.night-theme .card {
    background-color: #343a40;
}

.night-theme .header-text {
    background: rgba(0, 0, 0, 0.8);
}

/* Theme-specific styles */

/* Global theme variables */
:root {
    --primary-color: #dd3649;
    --primary-color-hover: #c12e42;
    --bg-color: #ffffff;
    --text-color: #333333;
    --card-bg: #f8f9fa;
    --card-text: #333333;
    --navbar-bg-color: #f8f9fa;
    --navbar-text-color: #333333;
    --footer-bg-color: #ffffff;
    --footer-text-color: #333333;
    --border-color: #dee2e6;
    --button-bg: #dd3649;
    --button-text: #ffffff;
    --filter-button-bg: #343a40;
    --filter-button-text: #ffffff;

    /* Day theme colors */
    --day-bg-color: #ffffff;
    --day-text-color: #333333;
    --day-card-bg: #f8f9fa;
    --day-card-text: #333333;
    --day-navbar-bg: #f8f9fa;
    --day-navbar-text: #333333;
    --day-footer-bg: #ffffff;
    --day-footer-text: #333333;
    --day-border-color: #dee2e6;

    /* Night theme colors */
    --night-bg-color: #121212;
    --night-text-color: #f8f9fa;
    --night-card-bg: #2c2f33;
    --night-card-text: #f8f9fa;
    --night-navbar-bg: #1e2124;
    --night-navbar-text: #f8f9fa;
    --night-footer-bg: #000000;
    --night-footer-text: #f8f9fa;
    --night-border-color: #495057;
}

/* Basic theme styles */
.day-theme {
    background-color: var(--day-bg-color);
    color: var(--day-text-color);
}

.night-theme {
    background-color: var(--night-bg-color);
    color: var(--night-text-color);
}

/* Theme transitions for smooth switching */
body, .navbar, .card, .footer, .nav-link, .btn, .header, section, .description {
    transition: background-color 0.3s, color 0.3s;
}

/* Day-Night theme-specific styles for navbar */
.day-theme .navbar {
    background-color: var(--day-navbar-bg) !important;
}

.night-theme .navbar {
    background-color: var(--night-navbar-bg) !important;
}

.day-theme .navbar .nav-link {
    color: var(--day-navbar-text) !important;
}

.night-theme .navbar .nav-link {
    color: var(--night-navbar-text) !important;
}

/* General card styling for themes */
.day-theme .card {
    background-color: var(--day-card-bg);
    color: var(--day-card-text);
    border-color: var(--day-border-color);
}

.night-theme .card {
    background-color: var(--night-card-bg);
    color: var(--night-card-text);
    border-color: var(--night-border-color);
}

/* Description sections */
.day-theme .description {
    background-color: #343a40 !important;
    color: white !important;
}

.night-theme .description {
    background-color: #212529 !important;
    color: #f8f9fa !important;
}

/* Header styles */
.day-theme .header {
    background-color: var(--day-bg-color);
}

.night-theme .header {
    background-color: var(--night-bg-color);
}

.day-theme .header .title,
.day-theme .header .subtitle {
    color: var(--day-text-color);
}

.night-theme .header .title,
.night-theme .header .subtitle {
    color: var(--night-text-color);
}

.night-theme .card-body {
    background-color: var(--night-card-bg);
    color: var(--night-card-text);
}

.night-theme .card-footer {
    background-color: #212529 !important;
    color: var(--night-card-text);
}

/* Text colors for night theme */
.night-theme h1,
.night-theme h2,
.night-theme h3,
.night-theme h4,
.night-theme h5,
.night-theme h6,
.night-theme p,
.night-theme .text-dark {
    color: var(--night-text-color) !important;
}

/* Text muted color for night theme */
.night-theme .text-muted {
    color: #adb5bd !important;
}

.night-theme .card-subtitle {
    color: #adb5bd !important;
}

/* Remove redundant jump to top button styles */
/* Jump to top button styles are now in the component CSS file */

/* Remove red hover from brand-toggle */
#brand-toggle:hover {
    color: inherit;
}

/* Ensure all card footers have appropriate theme colors */
.night-theme .card-footer {
    background-color: #212529 !important;
}

.day-theme .card-footer {
    background-color: #f8f9fa !important;
}

/* Theme-specific styles */

/* Global theme variables */
:root {
    --primary-color: #dd3649;
    --primary-color-hover: #c12e42;
}

/* Day theme colors */
.day-theme {
    --bg-color: #ffffff;
    --text-color: #333333;
    --card-bg: #f8f9fa;
    --card-text: #333333;
    --navbar-bg-color: #f8f9fa;
    --navbar-text-color: #333333;
    --footer-bg-color: #ffffff;
    --footer-text-color: #333333;
    --border-color: #dee2e6;
    --button-bg: #dd3649;
    --button-text: #ffffff;
    --filter-button-bg: #343a40;
    --filter-button-text: #ffffff;
}

/* Night theme colors */
.night-theme {
    --bg-color: #121212;
    --text-color: #f8f9fa;
    --card-bg: #2c2f33;
    --card-text: #f8f9fa;
    --navbar-bg-color: #1e2124;
    --navbar-text-color: #f8f9fa;
    --footer-bg-color: #000000;
    --footer-text-color: #f8f9fa;
    --border-color: #495057;
    --button-bg: #dd3649;
    --button-text: #ffffff;
    --filter-button-bg: #212529;
    --filter-button-text: #ffffff;
}

/* Apply theme colors to elements */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.night-theme .navbar {
    background-color: var(--navbar-bg-color) !important;
}

.night-theme .navbar .nav-link {
    color: var(--navbar-text-color) !important;
}

.night-theme .card-body {
    background-color: var(--card-bg);
    color: var (--card-text);
}

.night-theme .card-footer {
    background-color: rgba(44, 47, 51, 0.8);
    color: var(--card-text);
}

.night-theme .card-subtitle {
    color: #adb5bd !important;
}

/* Theme transition effects */
.navbar, .card, .btn, .footer, body {
    transition: background-color 0.3s, color 0.3s;
}

/* Ensure text colors change appropriately with theme */
.night-theme h1,
.night-theme h2,
.night-theme h3,
.night-theme h4,
.night-theme h5,
.night-theme h6,
.night-theme p,
.night-theme .text-dark {
    color: var(--text-color) !important;
}

/* Text muted color for night theme */
.night-theme .text-muted {
    color: #adb5bd !important;
}

.header-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    margin-bottom: 1.2rem;
    font-size: 3rem;
    letter-spacing: 0;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
    position: relative;
    padding-bottom: 0.5rem;
    color: white; /* Ensure hero title is always white */
}

.header-subtitle {
    font-family: 'Cinzel', serif;
    font-weight: 400;
    margin-bottom: 0.8rem;
    letter-spacing: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    color: white; /* Ensure hero subtitle is always white */
}

/* Style the premium experience section */
.premium-experience {
    background: linear-gradient(135deg, #004d7a 0%, #002d47 100%); /* Gradient background */
    color: #ffffff; /* White text */
    padding: 3rem 2rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15); /* Subtle shadow */
    border-radius: 15px; /* Rounded corners */
    margin-bottom: 2rem; /* Add some space below */
}

.premium-experience h2,
.premium-experience p {
    color: #ffffff; /* Ensure text is white */
}

.premium-metrics {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
}

.premium-metrics .metric {
    text-align: center;
    margin-bottom: 1rem;
}

.premium-metrics .metric-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #f8d948; /* Accent color */
    margin-bottom: 0.5rem;
}

.premium-metrics .metric-label {
    font-size: 1.1rem;
    color: #ffffff;
    opacity: 0.8;
}

/* Normalized Hero Card Styling for all pages */
.page-header {
    position: relative;
    padding: 4.5rem 0;
    margin-bottom: 0;
    width: 100%;
    overflow: visible;
    color: white;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.6) 50%, rgba(0,0,0,0.7) 100%);
    z-index: 1;
}

.header-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    z-index: 0;
}

.header-content {
    position: relative;
    z-index: 2;
    padding: 0 1rem;
}

.header-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    margin-bottom: 1.2rem;
    font-size: 3rem;
    letter-spacing: 0;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
    position: relative;
    padding-bottom: 0.5rem;
    color: white !important;
}

.title-decorator {
    width: 80px;
    height: 4px;
    background-color: #dd3649;
    margin: 0.5rem auto 1.5rem;
    border-radius: 2px;
}

.header-subtitle {
    font-family: 'Cinzel', serif;
    font-weight: 400;
    margin-bottom: 0.8rem;
    letter-spacing: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    color: white !important;
}

/* Media queries to ensure responsive behavior */
@media (max-width: 1200px) {
    .header-title {
        font-size: 2.8rem;
    }
}

@media (max-width: 992px) {
    .header-title {
        font-size: 2.5rem;
    }
    .header-subtitle {
        font-size: 1.4rem;
    }
}

@media (max-width: 768px) {
    .page-header {
        padding: 3.5rem 0;
    }
    .header-title {
        font-size: 2.2rem;
    }
    .header-subtitle {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .page-header {
        padding: 3rem 0;
    }
    .header-title {
        font-size: 1.8rem;
    }
    .title-decorator {
        width: 60px;
        height: 3px;
    }
}

/* Enhanced Hero Card Styling */
.page-header {
    position: relative;
    padding: 0;
    margin-bottom: 0;
    width: 100%;
    overflow: hidden;  /* This is critical - keep overflow hidden */
    color: white;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.65) 40%,
        rgba(0, 0, 0, 0.55) 60%,
        rgba(0, 0, 0, 0.75) 100%);
    z-index: 1;
}

/* New wrapper to contain the background image overflow */
.header-bg-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.header-bg {
    position: absolute;
    width: 100%;
    height: 100%; /* Dynamic height will be set by JS */
    object-fit: cover;
    z-index: 0;
    transform-origin: center center;
    transition: transform 0.05s ease-out; /* Smoother transitions */
}

/* Fixed parallax effect for header backgrounds */
.parallax-bg {
    will-change: transform;
    object-position: center center; /* Ensure image is centered */
    transform: translateY(0);
}

.header-content {
    position: relative;
    z-index: 2;
    padding: 2rem;
    max-width: 1200px;
    display: flex;          /* Add flexbox */
    flex-direction: column; /* Stack items vertically */
    justify-content: center; /* Center vertically */
    align-items: center;    /* Center horizontally */
    text-align: center;     /* Center text content */
    width: 100%;            /* Ensure full width */
    height: 100%;           /* Take full height of parent */
    margin: 0 auto;         /* Ensure it's centered in the container */
}

.header-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 3.5rem;
    margin-bottom: 1.2rem;
    letter-spacing: 0;
    position: relative;
    padding-bottom: 0.5rem;
    color: white !important;
    opacity: 0;
    transform: translateY(20px);
}

.animate-title {
    animation: fadeInUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.title-decorator {
    width: 80px;
    height: 4px;
    background-color: #dd3649;
    margin: 0.5rem auto 1.5rem; /* Default center alignment */
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: scaleX(0.3);
    animation: expandWidth 1.2s 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.text-left .header-content {
    align-items: flex-start;
    text-align: left;
}

.text-right .header-content {
    align-items: flex-end;
    text-align: right;
}

.text-left .title-decorator {
    margin-left: 0;
    margin-right: auto;
}

.text-right .title-decorator {
    margin-right: 0;
    margin-left: auto;
}

.title-decorator::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 255, 255, 0) 100%);
    animation: shimmer 2s 1.5s infinite;
}

.header-subtitle {
    font-family: 'Cinzel', serif;
    font-weight: 400;
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
    letter-spacing: 0;
    color: white !important;
    opacity: 0;
    transform: translateY(20px);
}

.animate-subtitle {
    animation: fadeInUp 1s 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-button {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1s 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Hero animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes expandWidth {
    from {
        opacity: 0;
        transform: scaleX(0.3);
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

@keyframes shimmer {
    from {
        left: -100%;
    }
    to {
        left: 100%;
    }
}

/* Media queries to ensure responsive behavior */
@media (max-width: 1200px) {
    .header-title {
        font-size: 3rem;
    }

    .header-subtitle {
        font-size: 1.6rem;
    }

    .page-header {
        min-height: 60vh;
    }
}

@media (max-width: 992px) {
    .header-title {
        font-size: 2.5rem;
    }

    .header-subtitle {
        font-size: 1.4rem;
    }

    .page-header {
        min-height: 50vh;
    }
}

@media (max-width: 768px) {
    .page-header {
        min-height: 40vh;
    }

    .header-content {
        padding: 1.5rem;    /* Reduce padding on smaller screens */
    }

    /* Ensure text remains centered on mobile regardless of alignment setting */
    .text-left .header-content,
    .text-right .header-content {
        align-items: center;
        text-align: center;
    }

    .text-left .title-decorator,
    .text-right .title-decorator {
        margin-left: auto;
        margin-right: auto;
    }

    .header-title {
        font-size: 2.2rem;
    }

    .header-subtitle {
        font-size: 1.2rem;
    }

    .title-decorator {
        width: 60px;
        height: 3px;
    }
}

@media (max-width: 576px) {
    .page-header {
        min-height: 30vh;
    }

    .header-title {
        font-size: 1.8rem;
    }

    .header-subtitle {
        font-size: 1rem;
    }

    .title-decorator {
        width: 50px;
        height: 3px;
    }
}
