/* ========================================
   Projects — cards, modal, demos
   ======================================== */

.projects-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* Project card */
.project-card {
    background-color: var(--color-card);
    border-radius: 10px;
    padding: 22px 24px;
    border: 1px solid var(--border-card);
    transition: border-color 0.25s ease, transform 0.25s ease;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.project-card:hover {
    transform: translateY(-2px);
}

.project-card h3 {
    margin: 0;
    color: var(--color-text);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Project link */
.project-link {
    display: inline-block;
    color: rgba(var(--color-text-rgb), 0.45);
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.project-card:hover .project-link {
    color: rgba(var(--color-text-rgb), 0.8);
}

/* Modal README section */
.project-modal-readme {
    padding: 32px 40px 12px 40px;
    background: var(--color-surface);
}

.readme-content h1 {
    color: var(--color-text);
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

.readme-content p {
    color: rgba(var(--color-text-rgb), 0.65);
    line-height: 1.65;
    margin-bottom: 12px;
    font-size: 15px;
}

.readme-content p:last-child {
    margin-bottom: 0;
}

.readme-content hr {
    border: none;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 20px 0 0 0;
}

.project-links {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.project-links a {
    display: inline-block;
    color: rgba(var(--color-text-rgb), 0.7);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.2s ease;
}

.project-links a:hover {
    color: var(--color-text);
}

.github-link {
    display: inline-block;
    transition: transform 0.2s ease;
}

.github-link:hover { transform: scale(1.1); }

.github-logo {
    width: 28px;
    height: 28px;
    filter: invert(1) brightness(0.7);
    transition: filter 0.2s ease;
}

.github-logo:hover {
    filter: invert(1) brightness(1);
}

/* Modal demo section */
.project-modal-demo {
    padding: 0 40px 32px 40px;
    background: var(--color-surface);
    min-height: 200px;
}

.project-modal-demo h3 {
    color: var(--color-text);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 14px;
}

/* Game container */
.game-container {
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
    max-width: 740px;
    margin-left: auto;
    margin-right: auto;
}

.game-container iframe {
    display: block;
    border: none;
    width: 100%;
    border-radius: 10px;
    height: 540px;
}

/* Fractal iframes — fill available screen height */
#fractal-demo iframe {
    display: block;
    width: 100%;
    height: 70dvh;
    border: none;
    border-radius: 0;
}

.game-instructions {
    color: rgba(var(--color-text-rgb), 0.5);
    font-size: 13px;
    text-align: center;
    margin: 0;
    font-style: italic;
}

/* Branch selector */
.branch-selector { margin: 16px 0; }

.branch-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    justify-content: center;
}

.branch-btn {
    padding: 9px 18px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(var(--color-text-rgb), 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.branch-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--color-text);
}

.branch-btn.active {
    background: rgba(255, 255, 255, 0.18);
    color: var(--color-text);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Fractal content */
#fractal-content { line-height: 1.6; max-width: none; }
#fractal-content h2 { color: var(--color-text); border-bottom: 1px solid rgba(255,255,255,0.12); padding-bottom: 8px; margin-top: 0; }
#fractal-content h3 { color: var(--color-text); margin-top: 28px; margin-bottom: 12px; }
#fractal-content h4 { color: var(--color-text); margin-top: 20px; margin-bottom: 8px; }
#fractal-content p  { color: rgba(232,232,232,0.7); margin-bottom: 14px; }
#fractal-content ol, #fractal-content ul { color: rgba(232,232,232,0.7); margin-bottom: 16px; padding-left: 22px; }
#fractal-content li { margin-bottom: 6px; }
#fractal-content em { font-style: italic; color: rgba(232,232,232,0.6); }
#fractal-content code { background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }

/* Olympic nav */
.olympic-nav { margin: 8px 0 6px 0; }
.olympic-nav .branch-buttons { margin-top: 6px; }

/* TestFlight notice */
.testflight-notice { margin-top: 14px; color: rgba(232,232,232,0.7); font-size: 14px; }
.testflight-notice a { color: var(--color-text); text-decoration: underline; text-underline-offset: 2px; }
.testflight-notice a:hover { opacity: 0.6; }

/* QuizBowl screenshots */
.quizbowl-screenshots {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.quizbowl-screenshots img {
    height: 500px;
    width: auto;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ── Screenshot lightbox ── */

.img-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    align-items: center;
    justify-content: center;
}

.img-lightbox.show {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}

.img-lb-img {
    max-width: 90vw;
    max-height: 88dvh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}

.img-lb-close {
    position: fixed;
    top: 20px;
    right: 24px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--color-text);
    z-index: 1;
    transition: background 0.2s ease;
}

.img-lb-close:hover { background: rgba(255,255,255,0.2); }

.img-lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 22px;
    color: var(--color-text);
    transition: background 0.2s ease;
}

.img-lb-nav:hover { background: rgba(255,255,255,0.2); }
.img-lb-prev { left: 20px; }
.img-lb-next { right: 20px; }
.img-lb-nav.disabled { opacity: 0.2; pointer-events: none; }

/* ----------------------------------------
   Projects responsive
   ---------------------------------------- */

@media screen and (max-width: 767px) {
    .project-modal-readme { padding: 24px 24px 12px 24px; }
    .project-modal-demo   { padding: 0 24px 24px 24px; }
    .readme-content h1    { font-size: 22px; }
    .quizbowl-screenshots img { height: auto; max-height: 55dvh; }
}

@media screen and (max-width: 479px) {
    .project-modal-readme { padding: 20px 20px 12px 20px; }
    .project-modal-demo   { padding: 0 20px 20px 20px; }
    .readme-content h1    { font-size: 20px; }
    .quizbowl-screenshots { gap: 10px; }
    .quizbowl-screenshots img { height: auto; max-height: 50dvh; }
}
