html, body {
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

html {
    scroll-padding-top: 90px; /* Offset for sticky nav when jumping to anchors */
}

body {
    font-family: 'Poppins', sans-serif;
    background: #fccd86; 
    color: #333;
    line-height: 1.6;
    scroll-behavior: smooth;
}

main {
    flex: 1;
}

footer {
    background: #2d3e50;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
}

.footer-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: stretch;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    text-align: center;
}

.footer-top-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.footer-contact-links {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
}

.footer-email {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.footer-email:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    color: #ffffff;
}

.footer-bottom {
    display: flex;
    justify-content: center;
}

.footer-weather-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.footer-weather-wrap .weather-info {
    margin: 0;
    text-align: center;
}

.footer-bottom p,
.footer-copyright {
    text-align: center;
}

.footer-container p {
    margin: 0;
}

@media (max-width: 768px) {
    .footer-top-row {
        gap: 0.45rem;
    }

    .footer-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-copyright,
    .footer-weather-wrap .weather-info {
        width: 100%;
    }

    .footer-contact-links {
        width: 100%;
        justify-content: center;
    }

    .footer-email {
        width: 100%;
        justify-content: center;
        max-width: 280px;
        white-space: normal;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .footer-container {
        padding: 0 1rem;
    }

    .footer-email {
        max-width: 100%;
    }
}


h1, h2, h3 {
    font-family: 'Lora', serif;
    font-weight: 700;
    color: #2d3e50; /* Dark blue/gray for headings */
    letter-spacing: 0.01em;
    text-wrap: balance;
}

.header {
    background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.35)), url('images/hero_image.webp') center center no-repeat;
    background-size: cover;
    padding: 3rem 2rem; /* Increased padding to make the background higher */
    width: 100%;
    text-align: center;
    margin-bottom: 2rem;
}

/* Fallback for browsers that don't support WebP */
@supports not (background-image: url('images/hero_image.webp')) {
    .header {
        background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.35)), url('images/hero_image.jpg') center center no-repeat;
        background-size: cover;
    }
}

/* Mobile: use smaller hero image */
@media (max-width: 768px) {
    .header {
        background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.35)), url('images/hero_image_mobile.webp') center center no-repeat;
        background-size: cover;
        max-height: 300px; /* Limit height for mobile */
    }
    @supports not (background-image: url('images/hero_image_mobile.webp')) {
        .header {
            background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.35)), url('images/hero_image_mobile.jpg') center center no-repeat;
            background-size: cover;
        }
    }
}

.header-title {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: #2d3e50;
}

.header-subtitle {
    font-size: 1.5rem;
    color: #2d3e50;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.services, .about-us, .projects, .contact, .certifications {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(195, 152, 60, 0.28);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 16px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.14),
        0 2px 8px  rgba(0, 0, 0, 0.08);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.service-item {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid #e2d9c8;
    border-left: 4px solid #2d3e50;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    transition: box-shadow 0.35s ease, transform 0.35s ease, border-color 0.35s ease;
}

.service-item:hover {
    transform: translateY(-6px);
    border-left-color: #dba555;
    box-shadow:
        0 12px 32px rgba(219, 165, 85, 0.22),
        0 0 0 1px rgba(219, 165, 85, 0.28);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.project-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid #e2d9c8;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 420px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.project-card:hover {
    transform: translateY(-6px);
    border-color: rgba(219, 165, 85, 0.52);
    box-shadow:
        0 18px 42px rgba(219, 165, 85, 0.2),
        0 0 0 1px rgba(219, 165, 85, 0.28);
}

.project-card-body {
    display: flex;
    flex-direction: column;
    justify-content: center; /* vertically center the text/content */
    gap: 0.5rem;
    flex: 1; /* take remaining space so button stays above the CTA */
    padding: 0 0.4rem;
}

.project-card-media {
    height: 220px; /* fixed media area so titles start at same vertical position */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0 0.5rem;
}

.project-card-media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* preserve full image without cropping */
    border-radius: 8px;
    display: block;
}

/* CTA button at bottom of card */
.project-card-cta {
    margin-top: 0.75rem;
    align-self: stretch;
}

/* Portfolio page styles */
.portfolio-container {
    margin-top: 2rem;
}

.portfolio-card-img {
    height: 140px;
    width: 100%;
    object-fit: cover;
    cursor: pointer;
    border: 5px solid white;
    aspect-ratio: 400 / 140;
}

.certification-badge-img {
    height: 150px;
    width: 100%;
    object-fit: contain;
    padding: 1rem;
    background-color: white;
    aspect-ratio: 400 / 150;
}

.certification-text {
    margin-bottom: 0.25rem;
}

.portfolio-title {
    font-family: 'Lora', serif;
    font-weight: 700;
}

.section-spacing {
    margin-bottom: 1rem;
}

/* Index page styles */
.project-card-container {
    display: flex;
    flex-direction: column;
}

.project-card-img-index {
    height: 200px;
    object-fit: cover;
    cursor: pointer;
    aspect-ratio: 300 / 200;
}

.text-center-align {
    text-align: center;
}

.flex-grow {
    flex-grow: 1;
}


.contact form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact .form-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.contact .form-field label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #2d3e50;
}

.contact input, .contact textarea {
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
}

.contact input:focus, .contact textarea:focus {
    outline: none;
    border-color: #2d3e50;
    box-shadow: 0 0 0 2px rgba(45, 62, 80, 0.15);
}

.contact button {
    background-color: #2d3e50;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.contact button:hover {
    background-color: #1e293b;
    transform: translateY(-1px);
}

.contact button:focus-visible {
    outline: 2px solid #8a6a05;
    outline-offset: 2px;
}

.contact button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Contact form inline status messages */
.contact-form-status {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    display: none;
}

.contact-form-status:not(:empty) {
    display: block;
}

.contact-form-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.contact-form-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .project-grid, .service-grid {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 0 1rem;
    }
    .project-card-media {
        height: 160px;
    }
    .project-card-media img {
        max-width: 100%;
        max-height: 100%;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
    }

    .nav-container {
        padding: 0.75rem 0.9rem;
        justify-content: flex-end;
        gap: 0.4rem;
    }

    nav {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: min(calc(100% - 7.5rem), 360px);
    }

    .language-switcher {
        width: auto;
        margin-left: auto;
        flex-wrap: nowrap;
        gap: 0.25rem;
        flex-shrink: 0;
        justify-content: flex-end;
    }

    .lang-btn {
        padding: 0.4rem 0.5rem;
        min-width: 2.2rem;
    }

    .lang-label {
        display: none;
    }

    .lang-flag {
        font-size: 0.95rem;
    }
    
    nav ul li {
        margin: 10px 0;
    }

    .header {
        background-size: cover;
        padding: 4rem 1rem;
    }

    .certification-badge-img {
        height: 100px;
    }

    /* .certifications {
        margin-bottom: 1rem;
    } */
}

.nav-container {
    background-color: rgba(252, 205, 134, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

nav ul {
    list-style-type: none;
    padding: 1rem 0;
    margin: 0;
    display: flex;
    justify-content: center;
}

nav ul li {
    margin: 0 15px;
}

nav ul li a {
    text-decoration: none;
    color: #2d3e50;
    font-weight: 500;
    font-size: 1.1rem;
    transition: color 0.3s ease;
    padding: 1rem 0;
}

nav ul li a:hover {
    color: #8a6a05;
}

nav ul li a.active {
    font-weight: bold;
    color: #8a6a05;
}

.language-switcher {
    display: inline-flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-left: auto;
    position: relative;
    z-index: 1;
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(45, 62, 80, 0.25);
    color: #2d3e50;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.35);
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.lang-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.58);
    border-color: rgba(45, 62, 80, 0.45);
}

.lang-btn.active {
    background: #2d3e50;
    color: #ffffff;
    border-color: #2d3e50;
}

.weather-info {
    color: #ffffff;
    margin-left: auto;
}

/* Footer LinkedIn icon */
.footer-linkedin {
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease;
}

.footer-linkedin:hover {
    opacity: 0.8;
}

.footer-linkedin svg {
    display: block;
}

/* About Me LinkedIn link */
.about-linkedin {
    margin-top: 0.5rem;
}

.about-linkedin a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: #2d3e50;
    font-weight: 500;
    transition: color 0.3s ease;
}

.about-linkedin a:hover {
    color: #8a6a05;
}

.about-linkedin svg {
    transition: fill 0.3s ease;
}

.about-linkedin a:hover svg {
    fill: #8a6a05;
}



#backToTopBtn {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 100px;
    right: 15px;
    z-index: 9997; /* Make sure it does not overlap with chatbot */
    border: none;
    outline: none;
    background-color: #2d3e50;
    color: white;
    cursor: pointer;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

#backToTopBtn:hover {
    background-color: #555; /* Add a dark-grey background on hover */
}



/* ===========================
   ČATBOTA POP-UP LOGS
   =========================== */

/* pārklājums (fonu aptumšošana) */
#chatbot-overlay {
    display: none; /* paslēpts pēc noklusējuma */
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;
}

/* konteiners – centrē čata logu uz ekrāna */
#chatbot-container {
    position: fixed;
    inset: 0;
    display: none; /* paslēpts pēc noklusējuma */
    justify-content: center;
    align-items: center;
    font-family: 'Poppins', sans-serif;
    z-index: 9999;
}

/* poga stūrī, kas atver pop-up */
#chatbot-toggle-btn {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    background: #2d3e50;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
    display: block !important;
    z-index: 2147483647 !important;
    transition: transform 0.3s ease;
    pointer-events: auto !important;
}

#chatbot-toggle-btn:hover {
    background: #1e293b;
    transform: scale(1.05);
}

body.chat-open #chatbot-toggle-btn {
    display: none !important;
}

/* pats čata logs */
#chatbot-window {
    width: min(460px, 90%);
    max-height: 90vh;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* galvene */
#chatbot-header {
    background: #dba555;
    color: #ffffff;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-title {
    font-weight: 600;
    font-size: 14px;
}

#chatbot-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
}

/* ziņu zona */
#chatbot-messages {
    padding: 10px;
    background: #f5f5f7;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ziņu burbuļi */
.message {
    max-width: 80%;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
}

/* bot ziņa (pa kreisi) */
.message.bot {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

.message.bot p {
    margin: 0 0 8px 0;
}

.message.bot p:last-child {
    margin-bottom: 0;
}

.message.bot ul.chat-list {
    margin: 6px 0 8px 18px;
    padding: 0;
    list-style-type: disc;
}

.message.bot ul.chat-list li {
    margin-bottom: 4px;
}

.message.bot ul.chat-list li:last-child {
    margin-bottom: 0;
}

.message.bot a.chat-link {
    color: #dba555;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

.message.bot a.chat-link:hover {
    color: #b8863b;
}

.message.bot strong {
    color: #1f2937;
    font-weight: 600;
}

/* lietotāja ziņa (pa labi) */
.message.user {
    align-self: flex-end;
    background: #2d3e50;
    color: #ffffff;
}

/* ievades zona */
#chatbot-input-area {
    display: flex;
    border-top: 1px solid #e5e7eb;
    padding: 8px;
    gap: 6px;
    background: #ffffff;
    flex-shrink: 0;
}

#chatbot-input {
    flex: 1;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    font-size: 13px;
}

#chatbot-input:focus {
    outline: none;
    border-color: #2d3e50;
}

#chatbot-send-btn {
    background: #2d3e50;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}

#chatbot-send-btn:hover {
    background: #1e293b;
}

/* "Raksta…" indikators */
.typing-indicator {
    font-size: 11px;
    color: #6b7280;
    padding-left: 4px;

}

/* Mobile responsive for chatbot */
@media (max-width: 768px) {
    #chatbot-container {
        align-items: flex-end;
        padding: 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    #chatbot-window {
        width: 100%;
        height: min(62dvh, 520px);
        max-height: calc(100dvh - 140px);
        min-height: 340px;
        border-radius: 14px;
    }

    #chatbot-header {
        flex-shrink: 0;
    }
    
    #chatbot-input-area {
        padding: 8px;
        gap: 6px;
    }
    
    #chatbot-input {
        font-size: 14px;
        padding: 8px 10px;
        min-width: 0; /* Allow input to shrink */
    }
    
    #chatbot-send-btn {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
        min-width: 60px; /* Ensure button has minimum width */
    }
    
    .message {
        font-size: 14px;
        padding: 10px 12px;
    }

    #chatbot-toggle-btn {
        right: 12px !important;
        bottom: calc(12px + env(safe-area-inset-bottom)) !important;
        padding: 9px 12px;
        font-size: 12px;
        max-width: 62vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #backToTopBtn {
        bottom: calc(72px + env(safe-area-inset-bottom));
        right: 12px;
        padding: 16px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        justify-content: normal;
        padding: 0.75rem 0.9rem;
        gap: 0.5rem;
    }

    nav {
        position: static;
        left: auto;
        transform: none;
        width: 100%;
        min-width: 0;
    }

    nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem 0.55rem;
        padding: 0;
        overflow: visible;
    }

    nav ul li {
        margin: 0;
    }

    nav ul li a {
        padding: 0.2rem 0;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .language-switcher {
        width: auto;
        margin-left: 0;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 0.25rem;
        flex-shrink: 0;
        position: relative;
        z-index: 1;
    }

    .lang-btn {
        padding: 0.45rem 0.6rem;
        min-width: 2.4rem;
        justify-content: center;
    }

    .lang-label {
        display: none;
    }

    .lang-flag {
        font-size: 1rem;
    }
}

/* ===========================
   Scroll-Triggered Reveal
   Progressive enhancement — only active when JS adds .js-reveal-ready
   =========================== */
.js-reveal-ready .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.js-reveal-ready .reveal.visible {
    opacity: 1;
    transform: translateY(0);
}