:root {
    --green: #5b8f3b;
    --yellow: #f6d75a;
    --orange: #e5954a;
    --white: #ffffff;
    --dark: #404040;
    --light-bg: #fafafa;
    --shadow: 0 2px 8px rgba(0,0,0,0.05);
    --transition: all 0.25s ease;
}

/* global */
html, body {
    margin: 0;
    padding: 0;
    font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--light-bg);
    color: var(--dark);
    line-height: 1.6;
}

html {
    font-size: clamp(16px, 1.1vw + 0.5rem, 18px);
}

.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0;
}

/* header */
header {
    background: #fff;
    box-shadow: var(--shadow);
    text-align: center;
    padding: 1.2rem 0;
    border-bottom: 1px solid #eee;
}

.logo-wrap {
    margin-top: 0.6rem;
    text-align: center;
    width: 100%; /* full width of container */
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.logo-large {
    width: 80%;
    max-width: 1000px;
    height: auto;
    transition: transform var(--transition);
}

    .logo-large:hover {
        transform: scale(1.02);
    }

/* responsive logo */
@media (max-width: 900px) {
    .logo-large {
        width: 65%;
        max-width: 600px;
    }
}

@media (max-width: 600px) {
    .logo-large {
        width: 60%;
        max-width: 320px; /* smaller cap for SE-sized screens */
    }
}

@media (max-width: 400px) {
    .logo-large {
        width: 70%; /* shrink further for very small screens */
        max-width: 260px;
    }
}

/* nav */
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.main-nav .nav-link {
    color: var(--dark);
    font-weight: 600;
    text-decoration: none;
    padding: 0.4rem 0;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    letter-spacing: 0.02em;
    font-size: 0.98rem;
}

    .main-nav .nav-link:hover {
        color: var(--orange);
        border-bottom-color: var(--orange);
    }

    .main-nav .nav-link.active {
        color: var(--dark);
        border-bottom-color: var(--green);
    }

/* hero */
.hero {
    background: linear-gradient(135deg, #f2f7f3, #fffbe9);
    border-bottom: 3px solid var(--green);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    overflow: hidden;
}

.hero-inner {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-text {
    flex: 1 1 420px;
    min-width: 280px;
}

.hero-image {
    flex: 0 0 420px;
    text-align: center;
}

    .hero-image img {
        max-width: 100%;
        height: auto;
        display: block;
        border-radius: 10px;
        object-fit: contain;
    }

.hero h1 {
    margin: 0 0 0.8rem 0;
    font-size: 1.8rem;
    color: #222;
    line-height: 1.1;
}

.lead {
    color: #555;
    font-size: 1.02rem;
    margin: 0 0 0.8rem 0;
}

/* card grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-top: 1rem;
}

.card {
    background: #fff;
    border-radius: 10px;
    padding: 1.2rem;
    box-shadow: var(--shadow);
    text-align: left;
    transition: transform var(--transition), box-shadow var(--transition), border var(--transition);
    border: 1px solid transparent;
}

    .card:hover {
        /*        transform: translateY(-4px);
*/ box-shadow: 0 6px 16px rgba(0,0,0,0.08);
        border: 1px solid var(--orange);
    }

    .card h3 {
        margin: 0 0 0.5rem 0;
        font-size: 1.05rem;
    }

    .card p {
        margin: 0;
        color: #555;
        font-size: 0.95rem;
    }

.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

/* sections */
.section, .profile {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.8rem;
    margin-bottom: 2rem;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

    .section:hover, .profile:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(0,0,0,0.08);
        background: #fefefe;
        border: 1px solid var(--green);
    }

    .section h2, .profile h2 {
        margin-top: 0;
        margin-bottom: 0.75rem;
        color: var(--green);
    }

    .section p {
        color: #515151;
        font-size: 1.05rem;
        line-height: 1.6;
    }

/* Meet Rob Section */
.profile {
    padding: 2.5rem;
    margin-bottom: 3rem;
}

.section-heading {
    text-align: left;
    font-size: 2rem;
    color: var(--green);
    margin-top: 0;
    margin-bottom: 2rem;
}

/* layout for text + image */
.profile-inner {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2.5rem;
}

.profile-image {
    flex: 1 1 40%;
    max-width: 420px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

    .profile-image img {
        width: 100%;
        height: auto;
        border-radius: 8px;
        box-shadow: var(--shadow);
        margin-bottom: 0.8rem;
        object-fit: contain;
    }

    .profile-image .btn-light {
        margin-top: 0.5rem;
        display: inline-block;
    }

.profile-text {
    flex: 1 1 55%;
    color: var(--dark);
    text-align: left;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

    .profile-text p {
        font-size: 1rem;
        line-height: 1.7;
        margin-bottom: 1rem;
        color: #444;
    }

/* Case Study Section */
.case-study-inner {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2.5rem;
}

.case-text {
    flex: 1 1 55%;
    text-align: left;
    align-self: flex-start;
}

.case-images {
    flex: 1 1 40%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.case-image img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: var(--shadow);
    object-fit: cover;
}

/* responsive adjustments */
@media (max-width: 960px) {
    .profile-inner,
    .case-study-inner {
        flex-direction: column;
        align-items: center;
    }

    .profile-image,
    .case-images,
    .profile-text,
    .case-text {
        flex: 1 1 100%;
        max-width: 700px;
        width: 100%;
    }

    .profile-text,
    .case-text {
        text-align: left !important;
        align-self: flex-start !important;
    }
}

/* Always keep text left-aligned and top-justified */
.hero-text,
.section-text,
.profile-text,
.case-text {
    text-align: left !important;
    align-self: flex-start !important;
}

/* footer */
footer {
    background: var(--green);
    color: #fff;
    padding: 1.25rem 0;
    text-align: center;
    margin-top: 3rem;
}

.footer-link {
    color: #fff;
    text-decoration: underline;
}

/* responsive cards and nav */
@media (max-width: 960px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .hero-inner {
        flex-direction: column-reverse;
        text-align: center;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .main-nav ul {
        gap: 1rem;
    }
}

/* Section layout for text + image */
.section-inner {
    display: flex;
    align-items: stretch; /* ensure text and image columns match height */
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2.5rem;
}

/* text column */
.section-text {
    flex: 1 1 55%;
    text-align: left;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* image wrapper */
.section-image {
    flex: 1 1 45%; /* allow a bit more width than before */
    max-width: 520px; /* slightly larger max for balance */
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center; /* center vertically with text */
}

    .section-image img {
        width: 100%;
        height: 100%;
        min-height: 350px; /* force it to fill more vertical space */
        object-fit: cover; /* fill the height nicely */
        border-radius: 8px;
        box-shadow: var(--shadow);
    }

    .section-image .btn-light {
        margin-top: 0.5rem;
        display: inline-block;
    }

.section-text {
    flex: 1 1 50%;
}

.section-image {
    flex: 1 1 50%;
}

/* stack cleanly on smaller screens */
@media (max-width: 960px) {
    .section-inner {
        flex-direction: column;
        align-items: center;
    }

    .section-text,
    .section-image {
        flex: 1 1 100%;
        max-width: 700px;
        width: 100%;
    }

    .section-text {
        text-align: left !important;
        align-self: flex-start !important;
    }

    .section-image {
        max-width: 100%;
        height: auto;
        margin-top: 1rem;
    }
}

/* Contact page location section */
.location-images {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 1.5rem;
    margin-top: 1.8rem;
    flex-wrap: wrap;
}

    .location-images img {
        flex: 1 1 30%;
        max-width: 300px;
        border-radius: 10px;
        box-shadow: var(--shadow);
        object-fit: cover;
        height: 200px;
        transition: transform var(--transition), box-shadow var(--transition);
    }

        .location-images img:hover {
            transform: scale(1.02);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
        }

/* Stack images vertically on small screens */
@media (max-width: 700px) {
    .location-images {
        flex-direction: column;
        align-items: center;
    }

        .location-images img {
            width: 100%;
            max-width: 600px;
            height: auto;
        }
}

/* Contact Page */
.contact-section .section-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2.5rem;
}

.contact-section h1 {
    color: #515151;
    margin-top: 0;
    margin-bottom: 1rem;
}

.contact-section p {
    color: #515151;
    font-size: 1.05rem;
    line-height: 1.6;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin: 1.5rem 0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

    .contact-item img {
        width: 22px;
        height: 22px;
    }

    .contact-item a {
        color: var(--green);
        font-weight: 600;
        text-decoration: none;
        transition: color var(--transition);
    }

        .contact-item a:hover {
            color: var(--orange);
        }

/* Form */
.contact-form-wrap {
    flex: 1 1 45%;
    max-width: 480px;
    background: #fdfdfd;
    padding: 1.8rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

    .contact-form label {
        font-weight: 600;
        color: #515151;
    }

    .contact-form input,
    .contact-form textarea {
        padding: 0.7rem;
        border-radius: 6px;
        border: 1px solid #ccc;
        font-size: 1rem;
        transition: border-color var(--transition), box-shadow var(--transition);
    }

        .contact-form input:focus,
        .contact-form textarea:focus {
            border-color: var(--green);
            box-shadow: 0 0 4px rgba(91, 143, 59, 0.2);
            outline: none;
        }

.hero-button {
    margin-top: 1.5rem; /* adds space above the button */
}

.btn-primary {
    background-color: var(--green);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.9rem 1.2rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none; /* remove underline */
    display: inline-block;
    transition: background-color 0.3s ease, transform 0.15s ease;
}

    .btn-primary:hover {
        background-color: #4c7a31; /* darker shade */
        text-decoration: underline; /* underline only on hover */
        transform: translateY(-2px); /* small lift effect */
    }


/* Flash messages */
.flash-messages {
    margin-top: 1.2rem;
}

.flash {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    border-left: 5px solid transparent;
}

    .flash.success {
        background: #e8f5e9;
        border-left-color: #70AD47;
    }

    .flash.error {
        background: #fdecea;
        border-left-color: #E57373;
    }

    .flash.warning {
        background: #fff8e1;
        border-left-color: #F4C43D;
    }

/* Responsive layout */
@media (max-width: 900px) {
    .contact-section .section-inner {
        flex-direction: column;
        align-items: center;
    }

    .contact-form-wrap {
        width: 100%;
        max-width: 600px;
    }
}

/* Ensure box sizing accounts for padding in width calculations */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Constrain the section-inner to fit safely inside the section */
.contact-section .section-inner {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem; /* adds a safe side buffer */
    box-sizing: border-box;
}

/* Balance text and form widths */
.contact-section .section-text {
    flex: 1 1 50%;
    max-width: 500px;
}

.contact-section .contact-form-wrap {
    flex: 1 1 45%;
    max-width: 460px;
    width: 100%;
    box-sizing: border-box;
}

/* Prevent form overflow on tighter viewports */
@media (max-width: 1100px) {
    .contact-section .section-inner {
        padding: 0 1.2rem;
    }
}

@media (max-width: 900px) {
    .contact-section .section-inner {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }

    .contact-section .section-text,
    .contact-section .contact-form-wrap {
        flex: 1 1 100%;
        max-width: 600px;
        width: 100%;
    }
}

/* Location Section */
.location-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

    .location-section:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(0,0,0,0.08);
        background: #fefefe;
        border: 1px solid var(--green);
    }

    .location-section h2 {
        color: var(--green);
        font-size: 1.8rem;
        margin-top: 0;
        margin-bottom: 1rem;
    }

    .location-section p {
        color: #515151;
        font-size: 1.05rem;
        line-height: 1.6;
        max-width: 800px;
    }

    /* Reuse your existing .location-images styling */
    .location-section .location-images {
        display: flex;
        justify-content: center;
        align-items: stretch;
        gap: 1.5rem;
        margin-top: 1.8rem;
        flex-wrap: wrap;
    }

        .location-section .location-images img {
            flex: 1 1 30%;
            max-width: 300px;
            border-radius: 10px;
            box-shadow: var(--shadow);
            object-fit: cover;
            height: 200px;
            transition: transform var(--transition), box-shadow var(--transition);
        }

            .location-section .location-images img:hover {
                transform: scale(1.02);
                box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
            }

/* Stack vertically on small screens */
@media (max-width: 700px) {
    .location-section .location-images {
        flex-direction: column;
        align-items: center;
    }

        .location-section .location-images img {
            width: 100%;
            max-width: 600px;
            height: auto;
        }
}

.card-grid-projects {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 3 columns */
    grid-template-rows: repeat(3, auto); /* 2 rows */
    gap: 2rem; /* space between cards */
}

/* Optional: make it responsive */
@media (max-width: 899px) {
    .card-grid-projects {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .card-grid-projects {
        grid-template-columns: 1fr;
    }
}

.card-grid-skills {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    text-align: center;
}

    .card-grid-skills .card {
        padding: 2rem;
        border: 1px solid #ddd;
        border-radius: 10px;
        background-color: #fff;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

        .card-grid-skills .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }

.card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    fill: var(--green);
    opacity: 0.9;
}

/* hero */
.hero {
    background: linear-gradient(135deg, #f2f7f3, #fffbe9);
    border-bottom: 3px solid var(--green);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    margin-bottom: 2.5rem;
    overflow: hidden;
}

.hero-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-text {
    flex: 1 1 480px;
    min-width: 260px;
    text-align: left;
}

.hero-image {
    flex: 1 1 420px;
    text-align: center;
}

    .hero-image img {
        width: 100%;
        max-width: 480px;
        height: auto;
        border-radius: 10px;
        object-fit: contain;
        display: block;
    }

.hero h1 {
    margin: 0 0 0.8rem 0;
    font-size: 2rem;
    color: #222;
    line-height: 1.2;
}

.lead {
    color: #555;
    font-size: 1.05rem;
    margin-bottom: 1.2rem;
}

/* responsive adjustments for hero */
@media (max-width: 960px) {
    .hero {
        padding: 1.8rem 1.2rem;
    }

    .hero-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .hero-text {
        flex: 1 1 auto;
        max-width: 650px;
        text-align: left;
    }

    .hero-image {
        flex: 1 1 auto;
        max-width: 600px;
        margin-top: 1.2rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .lead {
        font-size: 1rem;
    }
}

@media (max-width: 600px) {
    .hero {
        padding: 1.5rem 1rem;
    }

    .hero-inner {
        flex-direction: column-reverse;
    }

    .hero h1 {
        font-size: 1.55rem;
        line-height: 1.3;
    }

    .lead {
        font-size: 0.96rem;
    }

    .hero-button {
        text-align: center;
    }
}

/* ===============================
   IMAGE PROTECTION
================================ */
.img-protect {
    position: relative;
    display: inline-block;
    overflow: hidden;
}

    .img-protect img {
        pointer-events: none;
        user-select: none;
        -webkit-user-drag: none;
    }

.img-overlay {
    position: absolute;
    inset: 0;
    background: transparent;
    cursor: default;
    pointer-events: all;
}

.img-protect.clickable .img-overlay {
    pointer-events: none;
}
