:root[data-theme="light"] {
    --bg-color: #ffffff;
    --bg-alt: #f8f9fa; /* Very subtle light grey/blue */
    --text-color: #333333;   
    --nav-bg: #ffffff;
    --border-color: #e0e0e0;
    --accent: #2c3e50;
    /* Professional deep blue for light mode */
    --link-color: #0056b3; 
}

:root[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --bg-alt: #222222; /* Slightly lighter than the base black */
    --text-color: #f0f0f0;
    --nav-bg: #1a1a1a;
    --border-color: #444444;
    --accent: #3498db;
    /* High-contrast bright blue or soft gold for dark mode */
    --link-color: #5dade2; 
}

/* Base Styles */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { 
    margin: 0; 
    font-family: 'Helvetica Neue', Arial, sans-serif; 
    background-color: var(--bg-color); 
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease; /* Adds smoothness */
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0; 
    width: 100%;
    display: flex;
    justify-content: space-between; /* Pushes theme selector to the far right */
    align-items: center;
    padding: 10px 30px;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

.nav-left {
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 1.2rem;
    white-space: nowrap;
}

/* The vertical bar */
.divider {
    height: 20px;
    width: 1px;
    background-color: var(--border-color);
    margin: 0 20px;
}

.nav-links { 
    list-style: none; 
    display: flex; 
    margin: 0; 
    padding: 0; 
}

.nav-links li { 
    margin-right: 20px; 
}

.nav-links a { 
    text-decoration: none; 
    color: var(--text-color); 
    font-weight: 500; 
    font-size: 0.95rem;
}

.nav-right {
    display: flex;
    align-items: center;
}

.theme-btn { 
    padding: 5px 10px; 
    border-radius: 4px; 
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
}

/* Modified Two-Column Structure */
.two-column {
    display: flex;
    /* Reduced from 50vh to 0 to let content define height, 
       or use a smaller value like 30vh */
    min-height: auto; 
    /* Reduced top/bottom padding for a slimmer look */
    padding-top: 60px;  /* Space for fixed navbar */
    padding-bottom: 40px; 
    background-color: var(--bg-color);
}

/* All sections get the base background by default */
section.two-column {
    background-color: var(--bg-color);
    transition: background-color 0.3s ease;
}

/* Every second (even) section gets the alternate shade */
section.two-column:nth-of-type(even) {
    background-color: var(--bg-alt);
}

.left-col {
    flex: 1;
    /* Reduced padding from 40px to 20px 40px */
    padding: 20px 40px; 
    text-align: right;
}

.right-col {
    flex: 2;
    /* Reduced padding from 40px 60px to 20px 60px */
    padding: 20px 60px;
}

/* Remove the global border-bottom from sections */
section {
    border-bottom: none;
}

/* Images & Icons */
.side-logo { max-width: 200px; height: auto; }
.icon { width: 24px; height: 24px; vertical-align: middle; margin-right: 10px; }
.contact-line { margin-bottom: 15px; display: flex; align-items: center; }

/* Contact Form */
.stacked-form { display: flex; flex-direction: column; margin-top: 30px; }
.stacked-form textarea { width: 100%; resize: vertical; margin-bottom: 15px; }
.stacked-form input { margin-bottom: 15px; padding: 10px; }
.submit-btn { background: var(--accent); color: white; border: none; padding: 15px; cursor: pointer; }

/* Responsive */
@media (max-width: 768px) {
    .two-column { flex-direction: column; }
    .left-col { text-align: left; border-right: none; border-bottom: 1px solid var(--border-color); }
}

/* Enhanced Icon Styles */
.icon { 
    width: 32px;      /* Increased size from 24px */
    height: 32px;     /* Increased size from 24px */
    margin-right: 15px; 
    flex-shrink: 0;   /* Prevents icon from squishing on mobile */
    color: var(--text-color); /* Forces SVG to match theme text color */
}

.contact-line { 
    margin-bottom: 20px; 
    display: flex; 
    align-items: center; 
    font-size: 1.1rem; /* Slightly larger text to match bigger icons */
}

/* Logo Row in Intro */
.logo-row {
    display: flex;
    /* --- CONTROL GAP HERE --- */
    gap: 80px;            /* Increase this value (e.g., 100px) for more space */
    /* ------------------------ */
    
    margin-top: 40px;     
    width: 100%;          
    align-items: center;  /* Ensures logos stay on the same horizontal level */
}

.logo-container {
    flex: 1;              /* Forces both containers to be identical in width */
    height: 120px;        /* Fixed height to keep them uniform */
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-container img {
    max-width: 100%;      /* Image will not exceed the container width */
    max-height: 100%;     /* Image will not exceed the 120px height */
    object-fit: contain;  /* Maintains logo proportions without distortion */
}

/* Responsive adjustment for mobile */
@media (max-width: 600px) {
    .logo-row {
        flex-direction: column; /* Stack logos on small screens */
        gap: 30px;
    }
}

/* Research Team Grid */
.team-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Two equal columns */
    gap: 40px;
    text-align: center;
}

.team-member {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* If there is an odd number of members, center the last one */
.team-member:last-child:nth-child(odd) {
    grid-column: 1 / span 2;
}

.member-photo {
    width: 180px;         /* Fixed size for all pictures */
    height: 180px;        /* Fixed size for all pictures */
    border-radius: 50%;   /* Makes the frame circular */
    overflow: hidden;     /* Crops anything outside the circle */
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
    background-color: var(--bg-alt); /* Placeholder color if image fails */
}

.member-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;    /* Ensures image fills circle without distortion */
}

.member-name {
    display: block;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text-color);
    text-decoration: none;
    margin-bottom: 5px;
}

.member-name:hover {
    color: var(--accent); /* Changes color on hover */
    text-decoration: underline;
}

.member-role {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-color);
    opacity: 0.8;
}

/* Responsive adjustment for team grid */
@media (max-width: 600px) {
    .team-grid {
        grid-template-columns: 1fr; /* Single column on small mobile */
    }
    .team-member:last-child:nth-child(odd) {
        grid-column: auto;
    }
}

/* --- RESPONSIVE BREAKPOINTS --- */

/* Tablets and small desktops (Large screens) */
@media (max-width: 1024px) {
    .navbar {
        padding: 10px 20px;
    }
    .left-col {
        padding: 20px;
    }
    .right-col {
        padding: 20px 30px;
    }
}

/* Mobile Devices (Phones) */
@media (max-width: 768px) {
    /* Stack the two columns vertically */
    .two-column {
        flex-direction: column;
        min-height: auto;
        padding-top: 70px; /* Adjust for mobile navbar height */
    }

    .left-col {
        text-align: center; /* Center headers/logos on mobile */
        border-right: none;
        padding: 30px 20px 10px 20px;
    }

    .right-col {
        padding: 10px 20px 40px 20px;
    }

    /* Adjust the Navigation Bar */
    .nav-left {
        flex-direction: column;
        align-items: flex-start;
    }

    .divider {
        display: none; /* Remove the vertical bar on small screens */
    }

    .nav-links {
        margin-top: 10px;
        flex-wrap: wrap; /* Allow links to wrap to a new line if needed */
    }

    .nav-links li {
        margin-right: 15px;
        margin-bottom: 5px;
    }

    /* Adjust the Research Team to 1 column */
    .team-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .team-member:last-child:nth-child(odd) {
        grid-column: auto; /* Reset the centering logic for single column */
    }

    /* Adjust the Sponsor Logos (Imperial/NIHR) */
    .logo-row {
        flex-direction: column;
        gap: 40px;
    }
}

/* Theme Dropdown Container */
.theme-dropdown {
    position: relative;
    display: inline-block;
}

.theme-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--text-color);
    display: flex;
    align-items: center;
}

.moon-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.theme-icon-btn:hover .moon-icon {
    transform: rotate(-15deg);
}

/* Hidden Menu */
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--bg-color);
    min-width: 100px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    z-index: 1001;
}

/* Show on Hover */
.theme-dropdown:hover .dropdown-content {
    display: block;
}

/* Dropdown Buttons */
.theme-opt {
    color: var(--text-color);
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
}

.theme-opt:hover {
    background-color: var(--bg-alt);
}

.clickable-email {
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s;
}

.clickable-email:hover {
    opacity: 0.7;
}

.copy-badge {
    visibility: hidden;
    background-color: var(--accent);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.copy-badge.show {
    visibility: visible;
    opacity: 1;
}

/* Global Link Styling */
a {
    color: var(--link-color);
    text-decoration: underline; /* Keeps it accessible for color-blind users */
    transition: color 0.3s ease;
}

a:hover {
    filter: brightness(1.2); /* Makes the link slightly glow/brighten on hover */
}

/* Ensure navbar links remain the theme text color (if you prefer them not to be blue) */
.nav-links a {
    color: var(--text-color);
    text-decoration: none;
}

.cta-box {
    background-color: var(--bg-alt);
    padding: 20px;
    border-radius: 8px;
    border-left: 5px solid var(--accent);
    margin: 25px 0;
}

.cta-button {
    display: inline-block;
    background-color: var(--accent);
    color: white !important; /* Forces white text in both themes */
    padding: 12px 24px;
    text-decoration: none !important;
    border-radius: 5px;
    font-weight: bold;
    margin-top: 10px;
    transition: transform 0.2s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Eligibility Card */
.eligibility-card {
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    background-color: var(--bg-color); /* Contrast against alt-section */
}

/* Journey Timeline */
.section-subheading {
    margin: 40px 0 20px 0;
    font-size: 1.3rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.journey-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.journey-step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.step-number {
    background: var(--accent);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: bold;
}

.highlight-step .step-number {
    background: #27ae60; /* A green "success" color for the payment step */
}

.step-content strong {
    display: block;
    margin-bottom: 5px;
}

.step-content p {
    margin: 0;
    font-size: 0.95rem;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.info-item {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.info-item h4 {
    margin-top: 0;
    font-size: 1rem;
}

.contact-hint {
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 30px;
}

/* Responsive fix for the Info Grid */
@media (max-width: 600px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* This ensures the box doesn't sit directly under the fixed navbar when jumping */
#screening-box {
    scroll-margin-top: 50px; 
}

/* Information Notice Box */
.info-notice {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent);
    padding: 20px;
    border-radius: 4px;
    margin: 25px 0;
    text-align: center;
}

.info-notice p {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.info-notice p:last-child {
    margin-bottom: 0;
}

.overview-lead {
    font-style: italic;
    color: var(--text-color);
    opacity: 0.9;
    margin-bottom: 20px;
    display: block;
}

/* Global styling for all content in the right columns */
.right-col p {
    line-height: 1.7;    /* Adds breathability between lines */
    margin-bottom: 1.2rem; /* Creates consistent spacing between paragraphs */
}

/* Ensure lists in the right column also follow this spacing */
.right-col ul li {
    line-height: 1.7;
    margin-bottom: 0.8rem;
}

.focus-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns */
    gap: 20px;
    margin-top: 20px;
}

.focus-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
    border-top: 4px solid var(--accent);
}

.focus-header {
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

@media (max-width: 600px) { .focus-grid { grid-template-columns: 1fr; } }

/* Container for the rows (Wristband, App, Agent) */
.tech-row {
    display: flex;
    /* Changed from center to flex-start to align with the top line */
    align-items: flex-start; 
    gap: 40px; 
    margin-bottom: 40px;
}

/* Left subcolumn: Fixed and narrower */
.tech-row .tech-img {
    flex: 0 0 160px;
    /* Removed fixed height to allow it to sit tight at the top */
    display: flex;
    justify-content: center;
    /* Optional: add a tiny bit of top padding to match the text line-height perfectly */
    padding-top: 5px; 
}

/* Forces all input figures to the same size */
.tech-row .tech-img img {
    width: 80px;      
    height: 80px;     
    object-fit: contain; 
}

/* Right subcolumn: Takes up the remaining space */
.tech-row .tech-text {
    flex: 1;
}

/* Ensure the first paragraph in the text block has no top margin 
   so it aligns perfectly with the image */
.tech-row .tech-text p:first-child {
    margin-top: 0;
}

/* Figure Styling */
.img-container {
    text-align: center;
    margin: 40px 0;
}

.img-container img {
    width: 100%;
    max-width: 800px;
    height: auto;
}

.center-caption {
    display: block;
    margin-top: 15px;
    font-style: italic;
    font-size: 0.95rem;
}

/* Responsive: stack columns on mobile */
@media (max-width: 600px) {
    .tech-row {
        flex-direction: column;
        text-align: center;
    }
}



/* 1. Ensure the whole page scrolls smoothly */
html {
    scroll-behavior: smooth;
    /* 2. OFFSET FOR FIXED NAVBAR: Adjust this value (60px) to match your navbar height */
    scroll-padding-top: 60px; 
}

/* 3. Specifically target the tech rows to ensure they align perfectly */
.tech-row {
    scroll-margin-top: 5px; /* Backup for older browsers */
    display: flex;
    margin-bottom: 40px;
}

/* Clean up the titles */
.tech-title {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
}

.recruiting-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;      
    /* Centers the banner itself, but stays on its own row */
    margin: 0 auto 10px auto; 
    
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid #c8e6c9;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}


.recruiting-banner:hover {
    transform: scale(1.05);
    background-color: #c8e6c9; /* Slightly darker green on hover */
}

/* Remove the top margin only for the first subheading to bring it closer to the banner */
.right-col .section-subheading:first-of-type {
    margin-top: 0;
    text-align: left; /* Ensures this stays left-aligned */
    display: inline-block; /* Keeps your underline styling intact */
}

/* QR Code Side-by-Side Container */
.qr-wrapper {
    display: flex;
    /* --- INCREASED DISTANCE HERE --- */
    gap: 100px;              /* Changed from 40px to 100px */
    /* ------------------------------- */
    margin: 30px 0;
    justify-content: center; 
    align-items: flex-start;
}

.qr-item {
    display: flex;
    flex-direction: column;
    align-items: center; 
    /* Changed to auto or a larger value to allow for more breathing room */
    width: auto; 
}

.qr-item img {
    width: 150px;           /* Set the width specifically on the image instead */
    height: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px; 
    background: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.qr-item span {
    margin-top: 12px;
    font-weight: bold;
    font-size: 1rem;
    color: var(--text-color);
    letter-spacing: 1px;
}

.caption-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;           /* Space between icon and text */
    margin-top: 12px;
    font-weight: bold;
    font-size: 1rem;
    color: var(--text-color);
}

.brand-icon {
    width: 1.1em;   /* Using 'em' makes it scale perfectly with font-size */
    height: 1.1em;
    fill: var(--text-color);
    flex-shrink: 0;
}

/* The 'Active' state when a QR code is clicked */
.qr-item.active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95); /* Dims the background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: zoom-out;
}

/* Make the image larger when active */
.qr-item.active img {
    width: 350px; /* Adjust size for the popup */
    transition: transform 0.3s ease;
}

/* Ensure the original items look clickable */
.qr-item {
    cursor: zoom-in;
    transition: all 0.3s ease;
}

/* Specific color for Android green if you want it to pop (Optional) */
/* .qr-item:last-child .brand-icon { fill: #3DDC84; } */

/* Gallery Container */
.image-gallery-wrapper {
    display: flex;
    gap: 20px;            /* Space between images */
    justify-content: center; 
    margin: 40px 0;       /* Increased vertical margin for the larger images */
    flex-wrap: wrap;      
}

/* Individual Image Container */
.gallery-item {
    /* Increased from 220px to 320px to take more horizontal space */
    flex: 0 1 320px;      
    text-align: center;
    max-width: 100%;      /* Safety for small screens */
}

.gallery-item img {
    width: 100%;          
    height: 240px;        /* Increased height to match the wider look */
    object-fit: cover;    
    border: 1px solid var(--border-color);
    border-radius: 12px;  /* Slightly rounder corners for larger images */
    background-color: var(--bg-alt);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); /* Adds depth to larger images */
}

.gallery-caption {
    margin-top: 15px;
    font-size: 1rem;      /* Slightly larger text for larger images */
    font-style: italic;
    color: var(--text-color);
}

/* Video Container Styling */
.video-container {
    margin: 30px 0;
    text-align: center;
    width: 100%;
}

.demo-video {
    width: 100%;
    max-width: 600px;
    height: auto;
    /* Added aspect-ratio to prevent layout shift while loading */
    aspect-ratio: 4 / 3; 
    background-color: var(--bg-alt); /* Shows a grey box while downloading */
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: block;
    margin: 0 auto;
}

/* Ensure captions are consistent */
.center-caption {
    margin-top: 12px;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

/* Professional Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
}

.data-table thead tr {
    background-color: var(--bg-alt);
    text-align: left;
}

.data-table th, 
.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.5;
}

.data-table th {
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: var(--accent);
}

/* Zebra striping for readability */
.data-table tbody tr:nth-of-type(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Dark mode adjustment for zebra striping */
:root[data-theme="dark"] .data-table tbody tr:nth-of-type(even) {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Container for the three side-by-side survey images */
.survey-gallery {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin: 30px 0;
}

.survey-item {
    flex: 1; /* Makes all three take up equal width */
    text-align: center;
    margin: 0;
}

.survey-item img {
    width: 100%;
    height: 350px;       /* Forces all images to the same height */
    object-fit: contain; /* Prevents distortion/stretching */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--bg-alt); /* Helps if image has transparency */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.survey-item figcaption {
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-color);
}

/* Responsive: Stack them on mobile devices */
@media (max-width: 768px) {
    .survey-gallery {
        flex-direction: column;
        align-items: center;
    }
    
    .survey-item {
        width: 100%;
        max-width: 300px; /* Prevents them from being too huge on mobile */
    }
}

/* 1. Reset Tech Image container to match your original look */
.tech-row .tech-img {
    flex: 0 0 160px;
    display: flex;
    justify-content: center;
}

/* Base style for the clickable images */
.zoomable {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

/* The Background Dimmer */
.zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85); /* Dark cinematic overlay */
    z-index: 9998; /* Just below the image */
    display: none; /* Hidden by default */
    cursor: zoom-out;
}

.zoom-overlay.active {
    display: block;
}

/* The "Pop Out" State for the Image */
.zoomable.zoomed {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Perfectly centered */
    width: auto !important; /* Overrides the inline 150px */
    height: auto !important;
    max-width: 90vw; 
    max-height: 80vh;
    z-index: 9999;
    cursor: zoom-out;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: none !important;
}