/* Global Base & Typography */
:root {
    --epfl-red: #E3000F;
    --epfl-red-dark: #b3000b;
    --dark-slate: #1a1a1c;
    --white: #ffffff;
    --bg-light: #f9f9f9;
    --text-primary: #333333;
    --text-light: #666666;
    --border-color: #eaeaea;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--white);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

.section {
    padding: 6rem 0;
}

.bg-light {
    background-color: var(--bg-light);
}

.bg-white {
    background-color: var(--white);
}

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

h1,
h2,
h3,
h4,
h5 {
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2.5rem;
    color: var(--dark-slate);
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--dark-slate);
}

.divider {
    width: 60px;
    height: 4px;
    background-color: var(--epfl-red);
    margin: 1.5rem 0 2rem;
}

.section-header p {
    font-size: 1.125rem;
    color: var(--text-light);
    max-width: 700px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

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

.align-center {
    align-items: center;
}

/* Buttons */
.btn-primary {
    display: inline-block;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--white);
    background-color: var(--epfl-red);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(227, 0, 15, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-secondary {
    display: inline-block;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-slate);
    background-color: transparent;
    border: 2px solid var(--dark-slate);
    border-radius: 30px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover,
.btn-secondary.active {
    background-color: var(--dark-slate);
    color: var(--white);
    transform: scale(1.05);
}

/* Light sweep effect / glare across the button */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg,
            transparent,
            rgba(255, 255, 255, 0.4),
            transparent);
    transition: all 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    background-color: var(--epfl-red-dark);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 25px rgba(227, 0, 15, 0.5);
}

.btn-secondary {
    display: inline-block;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-slate);
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--dark-slate);
}

/* Hero Section */
.hero {
    position: relative;
    height: 100vh;
    min-height: 800px;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: #000;
    /* Dark mode for hero contrast */
}

.top-nav {
    position: absolute;
    top: 2rem;
    left: 0;
    width: 100%;
    padding: 0 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.team-logo-text {
    font-size: 3.2rem;
    font-weight: 600;
    color: var(--white);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.team-logo-text span {
    color: var(--epfl-red);
}

.university-logos {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.logo-box img {
    height: 80px;
    object-fit: contain;
}

.metu-logo img {
    height: 120px;
    /* 1.5x bigger than previous 80px */
}

.bilkent-logo img {
    height: 50px;
    /* Slightly smaller than the METU logo */
}

.metu-logo,
.bilkent-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 0 5%;
    max-width: 1400px;
    margin: 140px auto 0;
    width: 100%;
}

.subtitle {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--epfl-red);
    margin-bottom: 1rem;
}

.main-title {
    font-size: clamp(3rem, 6vw, 5.5rem);
    color: var(--white);
    margin-bottom: 1rem;
}

.sub-title {
    font-size: clamp(1.2rem, 2vw, 2rem);
    color: #aaaaaa;
    font-weight: 300;
    margin-bottom: 3rem;
    max-width: 800px;
}

.team-container {
    margin-bottom: 3rem;
}

.team-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.team-members span,
.team-members a {
    display: inline-block;
    color: var(--white);
    font-weight: 600;
    margin-right: 1.5rem;
    font-size: 1.1rem;
    border-bottom: 2px solid rgba(227, 0, 15, 0.5);
    padding-bottom: 2px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.team-members a:hover {
    color: var(--epfl-red);
    border-bottom-color: var(--epfl-red);
}

/* Cards */
.card {
    padding: 2.5rem;
    border-radius: 16px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.card p {
    color: var(--text-light);
}

.card-red {
    background-color: var(--epfl-red);
    color: var(--white);
    border: none;
    box-shadow: 0 10px 30px rgba(227, 0, 15, 0.2);
}

.card-red h3 {
    color: var(--white);
}

.card-red p {
    color: rgba(255, 255, 255, 0.9);
}

.card-dark {
    background-color: var(--dark-slate);
    color: var(--white);
    border: none;
}

.card-dark h3 {
    color: var(--white);
}

.card-dark p {
    color: rgba(255, 255, 255, 0.7);
}

/* Interactive Sandbox Container */
.sandbox-container {
    margin-top: 3rem;
    background-color: var(--dark-slate);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

#draw-canvas {
    width: 100%;
    height: 400px;
    background-color: #111;
    border-radius: 8px;
    border: 1px solid #333;
    cursor: crosshair;
}

.sandbox-controls {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
}

/* Architecture Features */
.feature-list {
    list-style: none;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 2.5rem;
}

.feature-list .icon {
    font-size: 2.5rem;
    font-weight: 800;
    color: rgba(227, 0, 15, 0.1);
    margin-right: 1.5rem;
    line-height: 1;
}

.feature-list h4 {
    font-size: 1.25rem;
    color: var(--dark-slate);
    margin-bottom: 0.5rem;
}

.feature-list p {
    color: var(--text-light);
    font-size: 1rem;
}

/* PT-QRC Pipeline Animation */
.pipeline-container {
    background: #0f172a;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.5rem;
    color: white;
    width: 100%;
    margin-bottom: 4rem;
    overflow-x: auto;
}

.pipeline-container:hover {
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.25);
}

.pipeline-container.window-expanded {
    transform: scale(1.2);
    z-index: 50;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    cursor: zoom-out !important;
}

.pipe-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: auto;
    text-align: center;
    border-radius: 8px;
    position: relative;
    padding: 0.5rem;
}

.pipe-step.process {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    font-weight: 600;
}

.pipe-step.output {
    background: rgba(46, 204, 113, 0.15);
    border-color: #2ecc71;
    color: #2ecc71;
}

.pipe-step.qrc-block {
    background: linear-gradient(135deg, rgba(227, 0, 15, 0.15), rgba(128, 0, 0, 0.4));
    border: 1px solid var(--epfl-red);
    padding: 1rem;
    box-shadow: 0 0 15px rgba(227, 0, 15, 0.1) inset;
}

.qrc-internals {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.qrc-modes,
.qrc-layers {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
}

.input-modes,
.memory-modes,
.layer {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 1;
}

.layer.mix {
    color: #3498db;
}

.layer.virt {
    color: #9b59b6;
}

.memory-modes {
    color: #f1c40f;
}

.input-modes {
    color: #1abc9c;
}

.qrc-ensemble {
    margin-top: 0.2rem;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.pipe-step.split {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.sub-process {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.sub-process.alg-accent {
    border-color: rgba(155, 89, 182, 0.5);
    background: rgba(155, 89, 182, 0.1);
    color: #dfa6f5;
}

.pipe-step .plus {
    font-size: 1.2rem;
    font-weight: 800;
    color: #666;
}

.pipe-anim-arrow {
    color: var(--epfl-red);
    font-size: 1.2rem;
    margin: 0 0.2rem;
    align-self: center;
    display: flex;
    align-items: center;
    animation: flow-right 1.2s infinite;
}

@keyframes flow-right {
    0% {
        transform: translateX(-3px);
        opacity: 0.3;
    }

    50% {
        transform: translateX(3px);
        opacity: 1;
    }

    100% {
        transform: translateX(-3px);
        opacity: 0.3;
    }
}

.pipe-step.regress {
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.5);
    padding: 0.8rem;
    color: #85c1e9;
    font-weight: 600;
}

/* Results */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 1.5rem;
    margin-top: 3rem;
    align-items: stretch;
}

.metric-card {
    padding: 2.5rem 0.5rem 1.5rem;
    background: #fafafa;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.metric-card.highlight {
    background: #e3000f;
    color: var(--white);
    border: none;
    transform: scale(1.08);
    box-shadow: 0 10px 40px rgba(227, 0, 15, 0.35);
    padding-bottom: 2rem;
    margin-top: -10px;
}

.metric-card.highlight h5,
.metric-card.highlight p {
    color: rgba(255, 255, 255, 0.9);
}

.metric-card h5 {
    margin-bottom: auto;
    font-size: 1rem;
    font-weight: 800;
    color: #666;
    line-height: 1.3;
}

.metric-card.highlight h5 {
    color: white;
}

.metric-card .score {
    font-size: 2.4rem;
    font-weight: 800;
    color: #222;
    margin: 1.5rem 0;
}

.metric-card.highlight .score {
    color: white;
    font-size: 2.6rem;
}

.metric-card .label {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 0;
}

.metric-card.highlight .label {
    color: rgba(255, 255, 255, 0.9);
}

.metric-card .badge {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: #ad0000;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    margin-top: 1.5rem;
    line-height: 1.3;
}

.plot-box {
    text-align: center;
}

.plot-box img {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.plot-box .caption {
    margin-top: 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Auto-Regressive Cascading Error Visualization */
.cascade-breakdown {
    margin-top: 5rem;
    padding: 3rem;
    background-color: var(--dark-slate);
    border-radius: 16px;
    color: var(--white);
}

.cascade-breakdown h3 {
    color: var(--white);
}

.cascade-breakdown p {
    color: #888;
    margin-bottom: 2rem;
}

.day-tracker {
    position: relative;
    height: 300px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding-bottom: 30px;
    border-bottom: 2px solid #333;
}

.day-bar {
    width: 50px;
    background-color: var(--epfl-red);
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: height 1s ease;
}

.day-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    color: #ccc;
    white-space: nowrap;
}

.day-bar .val {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--white);
}

.threshold-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.4);
    transform: translateY(-80%);
    /* Simulate 10% line visually */
    z-index: 0;
    pointer-events: none;
}

.threshold-line::after {
    content: "10% Error Threshold Limit";
    position: absolute;
    right: 0;
    bottom: 5px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Footer */
footer {
    background-color: #111;
    color: var(--white);
    padding: 4rem 0;
    text-align: center;
}

footer h2 {
    color: var(--white);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

footer p {
    color: #666;
    margin-bottom: 2rem;
}

.footer-names {
    color: #444;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Lightbox Modal */
.zoomable {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.zoomable:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

/* Lightbox functionality */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.show {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.lightbox.show .lightbox-content {
    transform: scale(1);
}

.lightbox-caption {
    color: white;
    margin-top: 15px;
    font-size: 1.1rem;
    max-width: 80%;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: var(--epfl-red);
    text-decoration: none;
    cursor: pointer;
}

/* --- Challenge Visualizations --- */
.challenge-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 4px;
    aspect-ratio: 1;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    position: relative;
    border: 1px solid #e2e8f0;
}

.challenge-cell {
    background: var(--epfl-red);
    border-radius: 3px;
    transition: all 0.5s ease;
}

.challenge-cell.missing {
    background: #e2e8f0;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
}

.challenge-cell.reconstructed {
    background: var(--epfl-red);
    opacity: 0.8 !important;
    animation: pulseReconstruct 2s infinite;
}

.challenge-cell.future {
    background: #2ecc71;
    opacity: 0 !important;
}

.challenge-cell.future.predicting {
    opacity: 0.8 !important;
    animation: fadeTarget 1.5s forwards;
}

@keyframes pulseReconstruct {
    0% {
        transform: scale(0.95);
        opacity: 0.4 !important;
    }

    50% {
        transform: scale(1);
        opacity: 0.9 !important;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.4 !important;
    }
}

@keyframes fadeTarget {
    from {
        opacity: 0 !important;
        transform: translateX(-5px);
    }

    to {
        opacity: 0.8 !important;
        transform: translateX(0);
    }
}

/* Base class for feature grid to replace inline styling */
.feature-list-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-top: 0;
}

.feature-list-grid .feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 0;
}

/* Responsive Tablet */
@media screen and (max-width: 900px) {
    .feature-list-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive Mobile */
@media screen and (max-width: 768px) {
    .section {
        padding: 4rem 0;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .feature-list-grid {
        grid-template-columns: 1fr;
    }

    .top-nav {
        flex-direction: column;
        gap: 1rem;
        top: 1rem;
    }

    .team-logo-text {
        font-size: 2.2rem;
    }

    .university-logos {
        justify-content: center;
        gap: 1.2rem;
    }

    .logo-box img {
        height: 70px;
    }

    .hero-content {
        text-align: center;
        margin-top: 6rem;
    }

    .main-title {
        font-size: 2.5rem;
    }

    .sub-title {
        font-size: 1.2rem;
        margin-bottom: 2rem;
    }

    .team-members {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }

    .team-members a {
        margin: 0;
        font-size: 1rem;
    }

    .pipeline-container {
        flex-direction: column;
        align-items: center;
    }

    .pipe-step {
        width: 100%;
        margin-bottom: 0px;
    }

    .pipe-anim-arrow {
        transform: rotate(90deg);
        margin: 1rem 0;
    }

    .qrc-modes,
    .qrc-layers {
        flex-direction: column;
    }

    .sandbox-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .sandbox-controls button,
    #toggle-imputer-btn {
        width: 100%;
    }

    h2 {
        font-size: 2rem;
    }
}