/* --- Brown University Color Palette --- */
:root {
    --brown: #4E3629;
    --red: #ED1C24;
    --warm-gray: #C4BFB6;
    --white: #ffffff;
    --text-dark: #2b2b2b;
}

/* --- General Page Styling --- */
html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
    background: var(--warm-gray);
    color: var(--text-dark);
    overflow-x: hidden;
}

/* --- Header and Navigation --- */
header {
    background: var(--white);
    color: var(--brown);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
}

.branding {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 40px 20px 60px;
    max-width: 1400px;
    margin: 0 auto;
}

@media (min-width: 1200px) {
    .branding {
        padding: 20px 80px 20px 100px;
    }
}

@media (min-width: 1400px) {
    .branding {
        padding: 20px 80px 20px 150px;
    }
}

.logo-mark {
    border-right: 1px solid rgba(0, 0, 0, 0.15);
    padding-right: 20px;
    display: flex;
    align-items: center;
}

.logo-mark img {
    height: 110px;
    width: auto;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-title {
    font-size: 1.35em;
    font-weight: 600;
    font-family: 'CircularStd', 'Inter', sans-serif;
}

/* Hamburger Menu */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background: var(--brown);
    border-radius: 3px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger-menu.active span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

.brand-subtitle {
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(0, 0, 0, 0.6);
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background-color: var(--brown);
}

.navbar .menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0 40px;
    min-height: 58px;
    max-width: 1400px;
    margin: 0 auto;
}

@media (min-width: 1200px) {
    .navbar .menu {
        padding: 0 80px;
    }
}

@media (min-width: 1400px) {
    .navbar .menu {
        padding: 0 80px 0 150px;
    }
}

/* Mobile Navigation Styles */
@media (max-width: 768px) {
    /* Header - Smaller logo and text */
    header {
        padding-right: 60px;
    }
    
    .branding {
        padding: 15px 20px;
        gap: 15px;
    }
    
    .logo-mark {
        padding-right: 15px;
    }
    
    .logo-mark img {
        height: 60px;
    }
    
    .brand-title {
        font-size: 0.9em;
    }
    
    /* Hamburger Menu */
    .hamburger-menu {
        display: flex;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    /* Hide regular menu by default on mobile */
    .navbar .menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--brown);
        flex-direction: column;
        padding: 0;
        min-height: auto;
        max-width: 100%;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    /* Show menu when active */
    .navbar .menu.active {
        display: flex;
    }
    
    .navbar .menu li {
        border-left: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        width: 100%;
        display: block;
        position: relative;
    }
    
    .navbar .menu li:last-child {
        border-bottom: none;
    }
    
    .navbar a {
        padding: 18px 20px;
        width: 100%;
        justify-content: flex-start;
        align-items: center;
        display: flex;
        min-height: 50px;
        white-space: nowrap;
        border-left: none !important;
    }
    
    .home-link a {
        font-size: 1.2em;
        padding: 18px 20px;
        transform: none;
        min-height: 50px;
    }
    
    /* Dropdown link - prevent wrapping */
    .dropdown > a {
        white-space: nowrap;
        flex-wrap: nowrap;
    }
    
    /* Dropdown container - remove border-bottom from li to avoid double border with dropdown > a */
    .navbar .menu .dropdown {
        display: block;
        flex-direction: column;
        border-bottom: none; /* Remove border from li, let the link handle it */
    }
    
    /* Dropdown container - no border when active */
    .dropdown.active {
        border-bottom: none;
    }
    
    /* Dropdown submenu on mobile - display below parent */
    .navbar .menu .submenu {
        position: static !important;
        display: none;
        background: var(--white) !important;
        box-shadow: none;
        border-radius: 0;
        margin: 0 !important;
        width: 100% !important;
        padding: 0;
        list-style: none;
        border-top: none; /* Remove border-top to avoid double border with dropdown > a */
        top: auto !important;
        left: auto !important;
        min-width: 100% !important;
    }
    
    .dropdown.active .submenu {
        display: block !important;
    }
    
    .navbar .menu .dropdown > a {
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .navbar .menu .submenu li {
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        border-left: none !important; /* Remove left border on mobile */
        width: 100%;
        display: flex;
        align-items: center;
        min-height: 32px;
    }
    
    .navbar .menu .submenu li:last-child {
        border-bottom: none;
    }
    
    .navbar .menu .submenu a {
        padding: 8px 20px 8px 40px;
        color: var(--text-dark);
        text-transform: none;
        letter-spacing: normal;
        width: 100%;
        display: flex;
        align-items: center;
        min-height: 32px;
        font-weight: 600;
        transition: background 0.2s ease;
    }
    
    .navbar .menu .submenu a:hover {
        background: rgba(0, 0, 0, 0.04);
        color: var(--brown);
    }
}

.navbar .menu li {
    position: relative;
    display: flex;
    align-items: center;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.navbar .menu li:first-child {
    border-left: none;
}

.navbar a {
    color: var(--white);
    text-decoration: none;
    font-size: 0.95em;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 100%;
    transition: color .3s ease;
}

.home-link a {
    font-size: 1.4em;
    padding: 0 24px;
    transform: translateY(-2px);
}

.navbar a:hover {
    color: var(--warm-gray);
}

/* --- Dropdown Submenu --- */
.submenu {
    display: none;
    position: absolute;
    background: var(--white);
    list-style: none;
    padding: 10px 0;
    margin: 0;
    top: 58px;
    left: 0;
    min-width: 220px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    overflow: hidden;
    z-index: 10;
}

.submenu li {
    width: 100%;
}

.submenu a {
    padding: 12px 20px;
    display: block;
    width: 100%;
    color: var(--text-dark);
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

.submenu a:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--brown);
}

.dropdown:hover .submenu {
    display: block;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    min-height: 600px;
    background-image: url('providence.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    color: var(--white);
    max-width: 1200px;
    padding: 40px 20px;
}

.hero h1 {
    font-size: 3.5em;
    font-weight: 700;
    margin-bottom: 40px;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.cta-button {
    display: inline-block;
    background: var(--red);
    color: var(--white);
    text-decoration: none;
    padding: 18px 40px;
    font-size: 1.1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-family: 'CircularStd', 'Inter', sans-serif;
}

.cta-button:hover {
    background: var(--brown);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
    .hero {
        min-height: 500px;
    }
    
    .hero h1 {
        font-size: 2.2em;
    }
    
    .cta-button {
        padding: 15px 30px;
        font-size: 1em;
    }
}

/* --- NEST Section --- */
.nest-section {
    display: flex;
    min-height: 600px;
    background: #FDFDFD;
}

.nest-content {
    flex: 1;
    padding: 80px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    max-width: 50%;
}

.nest-logo-container {
    margin-bottom: 30px;
}

.nest-logo {
    max-width: 300px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.nest-title {
    font-size: 4em;
    font-weight: 700;
    margin: 0 0 30px 0;
    line-height: 1;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

.nest-green {
    color: #4CAF50;
}

.nest-black {
    color: var(--text-dark);
}

.nest-description {
    font-size: 0.95em;
    line-height: 1.8;
    color: var(--text-dark);
    margin: 0 0 40px 0;
    max-width: 600px;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

.nest-contact-button {
    display: inline-block;
    background: var(--red);
    color: var(--white);
    text-decoration: none;
    padding: 18px 40px;
    font-size: 1.1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-family: 'CircularStd', 'Inter', sans-serif;
}

.nest-contact-button:hover {
    background: var(--brown);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.nest-image {
    flex: 1;
    max-width: 50%;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nest-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}

@media (max-width: 1024px) {
    .nest-section {
        flex-direction: column;
    }
    
    .nest-content {
        max-width: 100%;
        padding: 60px 40px;
    }
    
    .nest-image {
        max-width: 100%;
        min-height: 400px;
        padding: 30px;
    }
    
    .nest-title {
        font-size: 3em;
    }
}

@media (max-width: 768px) {
    .nest-content {
        padding: 40px 20px;
    }
    
    .nest-image {
        padding: 20px;
    }
    
    .nest-title {
        font-size: 2.5em;
    }
    
    .nest-description {
        font-size: 1em;
    }
    
    .nest-contact-button {
        padding: 15px 30px;
        font-size: 1em;
    }
}

/* --- Sensor Types Section --- */
.sensor-types {
    background: #E8F0F8;
    padding: 80px 40px;
}

.sensor-types-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.sensor-types-heading {
    font-size: 3.5em;
    font-weight: 700;
    color: var(--brown);
    margin: 0 0 20px 0;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

.sensor-types-intro {
    font-size: 0.95em;
    color: #333333;
    margin: 0 auto 60px;
    line-height: 1.8;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
    max-width: 800px;
}

.sensor-types-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 60px;
    margin-top: 40px;
}

.sensor-type-item {
    text-align: center;
}

.sensor-number {
    font-size: 5em;
    font-weight: 700;
    color: var(--brown);
    line-height: 1;
    margin: 0 0 15px 0;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

.sensor-title {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--brown);
    margin: 0 0 15px 0;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

.sensor-description {
    font-size: 0.95em;
    color: #333333;
    line-height: 1.8;
    margin: 0;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

@media (max-width: 1024px) {
    .sensor-types-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .sensor-types {
        padding: 60px 20px;
    }
    
    .sensor-types-heading {
        font-size: 2.5em;
    }
    
    .sensor-types-intro {
        font-size: 1em;
        margin-bottom: 40px;
    }
    
    .sensor-types-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .sensor-number {
        font-size: 4em;
    }
    
    .sensor-title {
        font-size: 1.3em;
    }
}

/* --- Gallery Section --- */
.gallery-section {
    background: var(--white);
    padding: 80px 40px;
}

.gallery-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.gallery-heading {
    font-size: 3.5em;
    font-weight: 700;
    color: var(--brown);
    margin: 0 0 60px 0;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.gallery-item {
    overflow: hidden;
    border-radius: 4px;
    aspect-ratio: 4 / 3;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .gallery-section {
        padding: 60px 20px;
    }
    
    .gallery-heading {
        font-size: 2.5em;
        margin-bottom: 40px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* --- Team Section --- */
.team-section {
    background: #F5F5F5;
    padding: 80px 40px;
}

.team-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.team-heading {
    font-size: 3.5em;
    font-weight: 700;
    color: var(--brown);
    margin: 0 0 60px 0;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

.team-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 60px;
    margin-top: 40px;
}

.team-member {
    flex: 0 0 calc(50% - 30px);
    max-width: 400px;
    text-align: center;
}

.team-member-center {
    flex: 0 0 100%;
    max-width: 400px;
    margin: 0 auto;
}

.team-photo {
    width: 100%;
    max-width: 300px;
    margin: 0 auto 20px;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 4px;
}

.team-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.team-info {
    text-align: center;
}

.team-name {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 10px 0;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

.team-title {
    font-size: 0.95em;
    color: var(--text-dark);
    line-height: 1.6;
    margin: 0 0 10px 0;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

.team-email {
    font-size: 0.95em;
    color: var(--text-dark);
    margin: 0;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
}

.team-email a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.team-email a:hover {
    color: var(--brown);
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .team-member {
        flex: 0 0 100%;
        max-width: 400px;
    }
    
    .team-member-center {
        flex: 0 0 100%;
    }
}

@media (max-width: 768px) {
    .team-section {
        padding: 60px 20px;
    }
    
    .team-heading {
        font-size: 2.5em;
        margin-bottom: 40px;
    }
    
    .team-grid {
        gap: 40px;
    }
    
    .team-photo {
        max-width: 250px;
    }
}

/* --- Footer --- */
footer {
    background: var(--brown);
    padding: 60px 40px 30px;
    margin-top: 0px;
    color: #E8DCC0;
    font-family: 'CircularStd', 'Inter', sans-serif;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-top {
    text-align: center;
    margin-bottom: 30px;
}

.footer-university {
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 20px 0;
    color: var(--white);
    font-family: 'CircularStd', 'Inter', sans-serif;
}

.footer-contact {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    font-size: 0.95em;
    font-family: 'CircularStd', 'Inter', sans-serif;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--white);
}

.footer-contact-details {
    text-align: center;
    margin: 20px 0 30px;
    font-size: 0.9em;
    line-height: 1.6;
    font-family: 'CircularStd', 'Inter', sans-serif;
}

.footer-contact-details p {
    margin: 8px 0;
    color: #E8DCC0;
}

.footer-contact-details a {
    color: #E8DCC0;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-contact-details a:hover {
    color: var(--white);
    text-decoration: underline;
}

.footer-divider {
    border: none;
    border-top: 1px solid rgba(232, 220, 192, 0.3);
    margin: 25px 0;
}

.footer-links {
    text-align: center;
    margin: 30px 0;
}

.footer-links-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    margin: 20px 0;
}

.footer-links-row a {
    color: #FFD700;
    text-decoration: none;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    transition: color 0.3s ease;
    font-family: 'CircularStd', 'Inter', sans-serif;
}

.footer-links-row a:hover {
    color: #FFED4E;
}

.footer-cta {
    text-align: center;
    margin: 40px 0;
}

.footer-button {
    display: inline-block;
    color: #E8DCC0;
    text-decoration: none;
    padding: 12px 30px;
    font-size: 1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid #FFD700;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-family: 'CircularStd', 'Inter', sans-serif;
}

.footer-button:hover {
    background: rgba(255, 215, 0, 0.1);
    color: var(--white);
    border-color: #FFED4E;
}

.footer-bottom {
    margin-top: 40px;
    padding: 20px 40px;
    background: #3A2A1F;
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-bottom: -30px;
}

.footer-copyright {
    margin: 0;
    font-size: 0.9em;
    color: #E8DCC0;
    text-align: left;
    font-family: 'CircularStd', 'Inter', sans-serif;
}

@media (max-width: 768px) {
    footer {
        padding: 40px 20px 20px;
    }
    
    .footer-contact {
        flex-direction: column;
        gap: 15px;
    }
    
    .footer-links-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .footer-bottom {
        padding: 20px;
    }
    
    .footer-copyright {
        text-align: center;
    }
}

/* Back to Top Button - Mobile Only */
.back-to-top {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--red);
    color: var(--white);
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0);
    align-items: center;
    justify-content: center;
    font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
    font-weight: bold;
}

.back-to-top.visible {
    opacity: 1;
    transform: scale(1);
}

.back-to-top:hover {
    background: #c4161c;
    transform: scale(1.1);
}

.back-to-top:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .back-to-top {
        display: flex;
        opacity: 1;
        transform: scale(1);
    }
}
