* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    scroll-behavior: smooth;
    overflow-y: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #ffffff;
    color: #0B1125;
    font-size: 16px;
    line-height: 1.6;
}

main {
    max-width: 620px;
    margin: 0 auto;
    padding: 72px 24px 120px;
}

/* ── Header ── */
.site-header {
    margin-bottom: 40px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    animation: fadeSlideUp 0.45s ease forwards 0.3s;
    flex-shrink: 0;
    padding-top: 4px;
}

.header-icons a {
    display: inline-flex;
    color: #0B1125;
    transition: opacity 0.2s ease;
}

.header-icons a:hover {
    opacity: 0.5;
}

.icon-tooltip,
.copy-toast {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #0B1125;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#aiPromptCopy:hover .icon-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.copy-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.copy-toast.visible ~ .icon-tooltip,
#aiPromptCopy:hover .copy-toast.visible ~ .icon-tooltip {
    opacity: 0;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

h1 {
    font-size: 24px;
    font-weight: 600;
    opacity: 0;
    animation: fadeSlideUp 0.45s ease forwards 0s;
}

.subtitle {
    font-size: 22px;
    font-weight: 400;
    opacity: 0;
    animation: fadeSlideUp 0.45s ease forwards 0.3s;
}

/* ── Chat sequence ── */
.chat-sequence {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.chat-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

/* Typing indicator */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #F0F2F5;
    border-radius: 18px 18px 18px 4px;
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.2s ease, opacity 0.18s ease,
                padding 0.2s ease, margin-bottom 0.2s ease;
    margin-bottom: 0;
}

.typing-indicator.visible {
    max-height: 52px;
    padding: 14px 18px;
    opacity: 1;
    margin-bottom: 8px;
}

.typing-indicator.collapse {
    max-height: 0;
    padding: 0 18px;
    opacity: 0;
    margin-bottom: 0;
}

.typing-indicator span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #90949c;
    animation: dotBounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.30s; }

@keyframes dotBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* Chat bubble */
.chat-bubble {
    display: inline-block;
    background: #F0F2F5;
    border-radius: 18px 18px 18px 4px;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.65;
    color: #0B1125;
    max-width: 100%;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.chat-bubble.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 8px;
}

/* ── Project grid ── */
.project-grid {
    margin-top: 48px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 20px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    /* break out of the narrow main column on desktop */
    width: min(900px, calc(100vw - 48px));
    margin-left: calc(50% - min(450px, calc(50vw - 24px)));
}

.project-grid.visible {
    opacity: 1;
    transform: translateY(0);
}

.project-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
}

.project-item .img-wrap {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: box-shadow 0.3s ease;
}

.project-item:hover .img-wrap {
    box-shadow: 0 12px 32px rgba(0,0,0,0.14);
}

.project-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 0;
    display: block;
    transition: transform 0.4s ease;
}

.project-item:hover img {
    transform: scale(1.04);
}

.project-caption {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    padding: 0 4px;
    transition: color 0.3s ease;
}

.project-item:hover .project-caption {
    color: #0B1125;
}

/* ── Closing bubble ── */
.closing-bubble-wrap {
    margin-top: 48px;
    position: relative;
    z-index: 1;
}

.closing-bubble-wrap .chat-bubble a {
    color: #0B1125;
    text-decoration: none;
    border-bottom: 1.5px solid #0B1125;
    transition: opacity 0.2s ease;
}

.closing-bubble-wrap .chat-bubble a:hover {
    opacity: 0.5;
}

@media (max-width: 640px) {
    main { padding: 40px 18px 80px; }
    .project-grid {
        grid-template-columns: 1fr;
        width: 100%;
        margin-left: 0;
        gap: 16px;
    }
}

/* ── Footer ── */
.site-footer {
    text-align: center;
    padding: 24px;
    font-size: 13px;
    color: #bbb;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.site-footer.visible {
    opacity: 1;
}

/* ── Project Modal ── */
#projectModal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    overflow: hidden;
}

#projectModal.open {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11,17,37,0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
}

.modal-card {
    position: relative;
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 1200px;
    max-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(32px) scale(0.97);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 40px 100px rgba(0,0,0,0.25);
}

#projectModal.open .modal-card {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.92);
    color: #0B1125;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    padding: 0;
    line-height: 1;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.14);
    transition: background 0.2s ease;
}

.modal-close:hover { background: #fff; }

.modal-grabber {
    display: none;
}

.modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ── Modal navigation transitions ── */
@keyframes modalExitLeft {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-40px); }
}
@keyframes modalExitRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}
@keyframes modalEnterRight {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes modalEnterLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
}

.modal-card.exit-left  { animation: modalExitLeft  200ms ease forwards; }
.modal-card.exit-right { animation: modalExitRight 200ms ease forwards; }
.modal-card.enter-right { animation: modalEnterRight 320ms cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.modal-card.enter-left  { animation: modalEnterLeft  320ms cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* Slideshow (left panel) */
.modal-media {
    position: relative;
    background: #F0F2F5;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
    transition: height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.slideshow {
    height: 100%;
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
    cursor: grab;
}

.slideshow.is-dragging { cursor: grabbing; }

.slideshow-track {
    display: flex;
    height: 100%;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide {
    flex: 0 0 100%;
    height: 100%;
    overflow: hidden;
}

.slide img, .slide video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.slideshow-prev, .slideshow-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.92);
    color: #0B1125;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.14);
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    pointer-events: auto;
}

.slideshow:hover .slideshow-prev,
.slideshow:hover .slideshow-next { opacity: 1; }
.slideshow-prev:hover, .slideshow-next:hover { background: #fff; }
.slideshow-prev { left: 12px; }
.slideshow-next { right: 12px; }

/* Auto-advance progress bar */
.slideshow-timer {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 6;
    --timer-progress: 0%;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.14);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.slideshow-timer.visible { opacity: 1; }
.slideshow-timer-fill {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from -90deg, #0B1125 var(--timer-progress), rgba(11,17,37,0.12) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
}

.slideshow-timer.paused .slideshow-timer-fill {
    transition: none;
}

.slideshow-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
    pointer-events: none;
}

.slideshow-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(11,17,37,0.2);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
}

.slideshow-dot.active {
    background: #0B1125;
    transform: scale(1.35);
}

/* Content (right panel) */
.modal-content {
    padding: 44px 40px 40px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.modal-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 10px;
}

#modalTitle {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 6px;
}

.modal-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 28px;
    line-height: 1.55;
}

.modal-description { font-size: 15px; line-height: 1.75; color: #333; }
.modal-description p { margin-bottom: 14px; }
.modal-description p:last-child { margin-bottom: 0; }
.modal-description h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #0B1125; margin: 22px 0 8px; }
.modal-description ul { padding-left: 18px; margin-bottom: 14px; }
.modal-description li { margin-bottom: 6px; }

.modal-cta {
    margin-top: 28px;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #0B1125;
    text-decoration: none;
    border-bottom: 1.5px solid #0B1125;
    padding-bottom: 2px;
    transition: opacity 0.2s ease;
    align-self: flex-start;
}

.modal-cta:hover { opacity: 0.45; }

/* Prev / Next project navigation */
.modal-project-nav {
    margin-top: 40px;
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.modal-nav-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #0B1125;
    background: transparent;
    border: 2px solid #0B1125;
    border-radius: 9999px;
    cursor: pointer;
    padding: 10px 18px;
    overflow: hidden;
    z-index: 0;
    transition: color 0.35s ease, border-color 0.35s ease, opacity 0.3s ease;
}

.modal-nav-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #0B1125;
    transform: scaleY(0);
    transform-origin: bottom center;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: -1;
}

.modal-nav-btn:hover { color: #fff; border-color: #0B1125; }
.modal-nav-btn:hover::before { transform: scaleY(1); }

.modal-nav-btn.nav-hidden {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    #projectModal {
        padding: 0;
        align-items: stretch;
    }
    .modal-card {
        width: 100%;
        max-width: none;
        max-height: none;
        height: 100dvh;
        border-radius: 0;
        transform: translateY(100%);
        transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    }
    #projectModal.open .modal-card { transform: translateY(0); }
    .modal-grabber {
        display: none;
    }
    .modal-close {
        top: max(12px, env(safe-area-inset-top));
    }
    .modal-media {
        /* aspect-ratio: 16/9 already set; no height override needed */
        flex-shrink: 0;
    }
    .modal-content { padding: 28px 20px calc(20px + env(safe-area-inset-bottom)); }
    .modal-project-nav {
        position: sticky;
        bottom: 0;
        padding: 20px 0 calc(12px + env(safe-area-inset-bottom));
        padding-top:44px;
        background: linear-gradient(to top, #fff 50%, rgba(255,255,255,0.92) 80%, rgba(255,255,255,0));
    }
    .modal-nav-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
        min-height: 40px;
    }
    .modal-nav-btn.nav-hidden {
        display: none;
    }
}
