/* Font Face Declarations */
@font-face {
    font-family: 'Roboto';
    src: url('assets/fonts/roboto/Roboto-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto';
    src: url('assets/fonts/roboto/Roboto-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    color: #333;
    background-color: #ffffff;
    line-height: 1.6;
    padding-bottom: 0; /* used to be 64 for nav height safeguard */
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.site-header {
    background-color: #29292A;
    padding: 20px 0;
}

.site-header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img { 
  height: 40px; 
  filter: brightness(0) invert(1); /* Make logo white */ 
}

.logo {
    color: #ffffff;
    font-weight: 900;
    font-size: 18px;
    text-decoration: none;
    letter-spacing: 2px;
    opacity: 0.9;
}

.logo:hover {
    opacity: 1;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
    margin: 0 auto;
}

.nav-links a {
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    letter-spacing: 0.5px;
    transition: opacity 0.3s ease;
}

.nav-links a:hover {
    opacity: 0.8;
}

.social-links {
    display: flex;
    gap: 20px;
}

.social-links a {
    color: #ffffff;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.social-links a:hover {
    opacity: 0.7;
}

.social-links svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 160px);
    padding: 60px 0;
}

.demo-section {
    width: 100%;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start; /* Changed from center to start */
    min-height: 500px; /* Ensure minimum height */
}

/* Text Content */
.text-content {
    max-width: 600px;
    align-self: center; /* Center text content vertically */
}

.main-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 900;
    font-size: 48px;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.2;
}

.section-divider {
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
    width: 100%;
}

.description {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 30px;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.action-button {
    background-color: #555;
    color: #ffffff;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-button:hover {
    background-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-button:active {
    transform: translateY(0);
}

/* Visual Content */
.visual-content {
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 100px; /* Keep visual in place when scrolling */
    align-self: center;
    cursor: pointer;
    z-index: 900; /* Add z-index that's lower than nav bar */
}

.media-container {
    position: relative;
    width: 45vh;
    height: 45vh;
    max-width: 100%;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.state-visual,
.state-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.state-visual {
    z-index: 1;
    opacity: 1;
}

.state-animation {
    z-index: 2;
    opacity: 0;
    pointer-events: none;
}

.state-animation.playing {
    opacity: 1;
}

/* Optional: Add a subtle indicator on hover */
.visual-content::after {
    content: "";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="rgba(255,255,255,0.7)" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M10 8l6 4-6 4V8z"/></svg>');
    background-size: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.visual-content:hover::after {
    opacity: 1;
}

/* Prevent selection on visual content for mobile */
.visual-content,
.media-container,
.state-visual,
.state-animation {
    -webkit-user-select: none;  /* Safari */
    -ms-user-select: none;      /* IE/Edge */
    user-select: none;          /* Standard syntax */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
    outline: none; /* Remove focus outline */
}

/* Ensure clickable cursor is still shown */
.visual-content {
    cursor: pointer;
}

/* Footer */
.site-footer {
    background-color: #29292A;
    color: #ffffff;
    padding: 30px 0;
    text-align: center;
}

.site-footer p {
    font-size: 14px;
    opacity: 0.8;
}

/* Content Transitions */
.text-content {
    transition: opacity 0.3s ease;
}

.text-content.fade-out {
    opacity: 0;
}

/* State Navigation - Updated for bottom positioning */
.state-nav {
    --accent: #29292A;
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,.06);
    background: #fff;
    position: sticky;
    bottom: 0;
    top: auto;
    z-index: 1100;
    box-shadow: 0 -1px 3px rgba(0,0,0,.04);
}

.state-link {
    background: none;
    border: none;
    font: 600 13px/1 Roboto, sans-serif;
    color: var(--accent);
    opacity: .55;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: opacity .25s, transform .25s;
}

.state-link i, 
.state-link .nav-icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: block;
    color: var(--accent);
    transition: opacity .25s;
}

.nav-icon {
    filter: invert(15%) sepia(5%) saturate(108%) hue-rotate(314deg) brightness(93%) contrast(92%);
    opacity: 1;
}

.state-link:hover {
    opacity: .8;
    transform: translateY(-2px);
}

.state-link.active {
    cursor: default;
    opacity: 1;
    position: relative;
}

.state-link.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

/* Thin divider */
.thin-divider {
    border: 0;
    height: 1px;
    margin: 12px 0 6px;
    background: rgba(0,0,0,.08);
}

/* Citation footer */
.paper-cite {
    font: 400 12px/1.4 "Roboto", sans-serif;
    color: #555;
    display: flex;
    gap: 6px;
    align-items: center;
}

.paper-cite i {
    font-size: 12px;
    opacity: .75;
    transition: opacity .2s;
}

.paper-cite a:hover i {
    opacity: 1;
}

/* Switch Button for State 3 */
.switch-btn {
    background-color: #29292A;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    font-size: 15px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    margin-bottom: 20px;
    transition: all 0.25s ease;
    display: inline-block;
}

.switch-btn:hover {
    background-color: #444;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.switch-btn:active {
    transform: translateY(0);
}

/* Updated Context Image Styles */
.context-image-container {
    margin-top: 20px;
    width: fit-content; /* Only take up needed space */
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    opacity: 1;
    transition: opacity 300ms ease-in-out;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Move shadow to container */
    position: relative;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
    transition: all 300ms ease-in-out;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.context-image-container.fade-out {
    opacity: 0;
}

.context-image-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16);
}

.context-image {
    display: block; /* Remove any extra space below image */
    width: 100%;
    max-height: 150px;
    object-fit: contain;
    border-radius: 8px; /* This won't actually be visible due to overflow:hidden */
}

/* For larger screens, constrain width */
@media (min-width: 768px) {
    .context-image {
        max-width: 400px;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .media-container {
        width: 50vw;
        height: 50vw;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 40px;
        min-height: auto;
    }
    
    .main-title {
        font-size: 36px;
    }
    
    .button-group {
        flex-direction: row;
        gap: 15px;
    }
    
    .action-button {
        flex: 1;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .nav-links {
        display: none;
    }
    
    .media-container {
        width: 75vw;
        height: 75vw;
        max-width: 400px;
        max-height: 400px;
    }
    
    .visual-content {
        position: relative;
        top: auto;
        margin-bottom: 30px;
    }
    
    .text-content {
        order: 2;
    }
    
    .visual-content {
        order: 1;
    }
    
    .state-link i,
    .state-link .nav-icon {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
}