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

body {
    font-family: 'Courier New', monospace;
    background: #fcfbf8;
    color: #1a1a1a;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(134, 210, 210);
    background-size: 400px;
    background-repeat: repeat;
    z-index: -1;
    pointer-events: none;
}

/* ============================================
   INTRO PAGE STYLES
   ============================================ */
.intro-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #fcfbf8;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.8s ease;
    overflow: hidden;
}

.intro-page.fade-out {
    opacity: 0;
    pointer-events: none;
}

.intro-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
    opacity: 0;
    animation: fadeIn 1.5s ease 0.2s forwards;
}

.intro-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: contrast(1.05) brightness(0.85) grayscale(0);
}

.intro-content {
    text-align: center;
    position: relative;
    z-index: 2;
    padding: 3rem;
    background: rgba(252, 251, 248, 0);
    border: 1px solid rgba(229, 227, 221, 0);
}

.intro-name {
    font-size: 3rem;
    margin-bottom: 1rem;
    letter-spacing: 0.4rem;
    font-weight: 300;
    color: #fcfbf8;
}

.intro-name span {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px) rotate(-5deg);
}

.intro-name span:nth-child(1) { animation: letterDrop 0.6s ease 0.1s forwards; }
.intro-name span:nth-child(2) { animation: letterDrop 0.6s ease 0.2s forwards; }
.intro-name span:nth-child(3) { animation: letterDrop 0.6s ease 0.3s forwards; }
.intro-name span:nth-child(4) { animation: letterDrop 0.6s ease 0.4s forwards; }
.intro-name span:nth-child(5) { animation: letterDrop 0.6s ease 0.5s forwards; }
.intro-name span:nth-child(6) { animation: letterDrop 0.6s ease 0.55s forwards; }
.intro-name span:nth-child(7) { animation: letterDrop 0.6s ease 0.6s forwards; }

.intro-tagline {
    font-size: 0.9rem;
    color: #fcfbf8;
    opacity: 0;
    animation: fadeInUp 0.8s ease 0.8s forwards;
    margin-bottom: 2.5rem;
    letter-spacing: 0.1rem;
}

.intro-enter {
    font-size: 0.75rem;
    color: #fcfbf8;
    cursor: pointer;
    opacity: 0;
    animation: fadeInUp 0.8s ease 1s forwards;
    border: 1px solid #fcfbf8;
    padding: 1rem 3rem;
    background: none;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
    letter-spacing: 0.15rem;
    text-transform: uppercase;
}

.intro-enter:hover {
    background: rgba(26, 26, 26, 0); 
    color: #fcfbf8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px); 
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes letterDrop {
    from {
        opacity: 0;
        transform: translateY(30px) rotate(-5deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
}

/* ============================================
   MAIN PORTFOLIO STYLES
   ============================================ */
.main-content {
    opacity: 0;
    transition: opacity 0.6s ease;
    padding: 3rem 2rem;
    position: relative;
}

.main-content.visible {
    opacity: 1;
}

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

.header {
    display: flex;
    border: 2px solid #1a1a1a;
    overflow: hidden;
}

.header-text {
    padding: 2.5rem;
    background: #fcfbf8;
    flex: 0 0 auto;
    border-right: 2px solid #1a1a1a;
}

.header-gif {
    flex: 1;
    min-height: 120px;
    background-image: var(--header-gif);
    background-size: cover;
    background-position: center;
}

.name {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 
        -1px -1px 0 #fcfbf8,
        1px -1px 0 #fcfbf8,
        -1px 1px 0 #fcfbf8,
        1px 1px 0 #fcfbf8,
        -2px -2px 0 #fcfbf8,
        2px -2px 0 #fcfbf8,
        -2px 2px 0 #fcfbf8,
        2px 2px 0 #fcfbf8;
}

.tagline {
    font-size: 0.95rem;
    color: #000000;
    font-weight: 600;
    text-shadow: 
        -1px -1px 0 #fcfbf8,
        1px -1px 0 #fcfbf8,
        -1px 1px 0 #fcfbf8,
        1px 1px 0 #fcfbf8,
        -1.5px -1.5px 0 #fcfbf8,
        1.5px -1.5px 0 #fcfbf8,
        -1.5px 1.5px 0 #fcfbf8,
        1.5px 1.5px 0 #fcfbf8;
}

.index {
    margin-top: 25px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}

.index-item {
    cursor: pointer;
    padding: 2.5rem;
    padding-left: 3rem;
    border-bottom: 2px solid #1a1a1a;
    border-right: 2px solid #1a1a1a;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.index-item:nth-child(3n) {
    border-right: none;
}

.index-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--album-gif);
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* A thin animated gif frame revealed on hover (see the hover media query).
   The mask paints the gif only in the outer sliver: the inner content-box
   is subtracted, leaving just the border ring. */
.index-item::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    padding: 8px;
    background-image: url('../gifs/back3.gif');
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
}

.index-info {
    min-width: 0;
    position: relative;
    z-index: 1;
}

.index-number {
    font-size: 0.85rem;
    color: #000000;
    margin-bottom: 0.7rem;
    font-weight: 700;
    text-shadow: 
        -1px -1px 0 #fcfbf8,
        1px -1px 0 #fcfbf8,
        -1px 1px 0 #fcfbf8,
        1px 1px 0 #fcfbf8,
        -1.5px -1.5px 0 #fcfbf8,
        1.5px -1.5px 0 #fcfbf8,
        -1.5px 1.5px 0 #fcfbf8,
        1.5px 1.5px 0 #fcfbf8;
}

.index-title {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 
        -1px -1px 0 #fcfbf8,
        1px -1px 0 #fcfbf8,
        -1px 1px 0 #fcfbf8,
        1px 1px 0 #fcfbf8,
        -2px -2px 0 #fcfbf8,
        2px -2px 0 #fcfbf8,
        -2px 2px 0 #fcfbf8,
        2px 2px 0 #fcfbf8;
}

.index-count {
    font-size: 0.9rem;
    color: #000000;
    font-weight: 600;
    text-shadow: 
        -1px -1px 0 #fcfbf8,
        1px -1px 0 #fcfbf8,
        -1px 1px 0 #fcfbf8,
        1px 1px 0 #fcfbf8,
        -1.5px -1.5px 0 #fcfbf8,
        1.5px -1.5px 0 #fcfbf8,
        -1.5px 1.5px 0 #fcfbf8,
        1.5px 1.5px 0 #fcfbf8;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view-header {
    margin-bottom: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid #000000;
    padding-bottom: 1rem;
    padding-top: 1rem;
}

.view-title {
    font-size: 1.4rem;
    font-weight: 700;
    text-shadow: 
        -1px -1px 0 #fcfbf8,
        1px -1px 0 #fcfbf8,
        -1px 1px 0 #fcfbf8,
        1px 1px 0 #fcfbf8;
}

.view-actions {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.view-info {
    font-size: 0.85rem;
    color: #000000;
    font-weight: 600;
}

.back-btn {
    font-size: 0.85rem;
    color: #000000;
    cursor: pointer;
    background: none;
    border: none;
    font-family: 'Courier New', monospace;
    transition: color 0.2s;
    font-weight: 600;
}

.back-btn:hover {
    color: #1a1a1a;
}

.works {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem 1.5rem;
}

.work {
    cursor: pointer;
    overflow: hidden;
}

.work img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    margin-bottom: 0.7rem;
    transition: transform 0.5s ease, filter 0.4s ease;
    filter: contrast(1.05) brightness(0.98);
}

.work-title {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    font-weight: 700;
    text-shadow: 
        -0.5px -0.5px 0 #fcfbf8,
        0.5px -0.5px 0 #fcfbf8,
        -0.5px 0.5px 0 #fcfbf8,
        0.5px 0.5px 0 #fcfbf8;
}

.work-meta {
    font-size: 0.75rem;
    color: #999;
    font-weight: 600;
}

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

.writing {
    cursor: pointer;
    border-bottom: 1px solid #000000;
    padding-bottom: 2rem;
}

.writing-number {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 0.6rem;
    font-weight: 600;
}

.writing-title {
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
    font-weight: 700;
    text-shadow: 
        -0.5px -0.5px 0 #fcfbf8,
        0.5px -0.5px 0 #fcfbf8,
        -0.5px 0.5px 0 #fcfbf8,
        0.5px 0.5px 0 #fcfbf8;
}

.writing-meta {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 1rem;
    font-weight: 600;
}

.writing-excerpt {
    font-size: 0.85rem;
    line-height: 1.7;
    color: #666;
}

/* Hover effects only on real pointers — touch devices skip them so nothing
   gets stuck in a washed-out hover state after a tap (are.na-style). */
@media (hover: hover) {
    /* A sliver of the gif frames the hovered tile. */
    .index-item:hover::after {
        opacity: 1;
    }

    /* A subtle zoom on the artwork rather than dimming it. */
    .work:hover img {
        transform: scale(1.04);
        filter: contrast(1.05) brightness(1.02);
    }

    .writing:hover .writing-excerpt {
        color: #1a1a1a;
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fcfbf8;
    z-index: 1000;
    padding: 3rem;
    overflow-y: auto;
}

.modal.active {
    display: block;
}

.modal-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fcfbf8;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 2.5rem;
}

.modal-close {
    font-size: 0.95rem;
    cursor: pointer;
    background: none;
    border: none;
    color: #1a1a1a;
    font-family: 'Courier New', monospace;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #999;
}

.modal-nav-right {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.modal-zoom-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.zoom-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    transition: color 0.2s;
    padding: 0.3rem 0.5rem;
}

.zoom-btn:hover:not(:disabled) {
    color: #1a1a1a;
}

.zoom-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.zoom-level {
    font-size: 0.7rem;
    color: #999;
    min-width: 3rem;
    text-align: center;
}

.modal-arrows {
    display: flex;
    gap: 2rem;
}

.modal-arrow {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    transition: color 0.2s;
}

.modal-arrow:hover:not(:disabled) {
    color: #1a1a1a;
}

.modal-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.modal-content {
    max-width: 900px;
    margin: 5rem auto 0;
}

.modal-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 2rem;
    filter: contrast(1.05) brightness(0.98);
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.modal-content img.zoomed {
    cursor: grab;
    transform: translate(var(--pan-x, 0), var(--pan-y, 0)) scale(var(--zoom-level, 1));
    transform-origin: center center;
}

.modal-content img.zoomed:active {
    cursor: grabbing;
}

.modal-text {
    max-width: 650px;
    margin: 0 auto;
}

.modal-text h1 {
    font-size: 1.3rem;
    font-weight: normal;
    margin-bottom: 0.5rem;
}

.modal-text .meta {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 3rem;
}

.modal-text p {
    font-size: 0.9rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.about-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    cursor: pointer;
    z-index: 3000;
    display: inline-block;

    background: none;
    border: none;
    padding: 0;
    font-size: 3rem;
    line-height: 1;
    color: #1a1a1a;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hide about button when modal is open */
.about-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Only change frog color on hover */
.about-btn .frog {
    transition: color 0.2s ease;
}

.about-btn:hover .frog {
    color: #3cff00;
}

.frog {
    position: relative;
    color: #ffffff;
    text-shadow:
        1px 0 0 #1a1a1a,
        -1px 0 0 #1a1a1a,
        0 1px 0 #1a1a1a,
        0 -1px 0 #1a1a1a,
        1px 1px 0 #1a1a1a,
        -1px -1px 0 #1a1a1a,
        1px -1px 0 #1a1a1a,
        -1px 1px 0 #1a1a1a;
    font-size: 1.5rem;
}

.about-btn:hover {
    transform: translateY(-3px);
}

/* Popup only shows on click with .show class */
.about-popup {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #fcfbf8;
    border: 1px solid #1a1a1a;
    padding: 1rem 1.5rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-size: 0.85rem;
    color: #1a1a1a;
}

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

.about-popup a {
    color: #1a1a1a;
    text-decoration: none;
    border-bottom: 1px solid #1a1a1a;
}

.about-popup a:hover {
    opacity: 0.7;
    color: blueviolet;
}

/* ============================================
   TOUCH DEVICES — are.na-style image viewing
   ============================================ */
@media (pointer: coarse) {
    /* Pinch-zoom is native here; the +/- controls only get in the way. */
    .modal-zoom-controls {
        display: none !important;
    }

    .modal-content img {
        cursor: default;
    }
}

@media (max-width: 1024px) {
    .index {
        grid-template-columns: 1fr;
    }

    .index-item {
        border-right: none;
    }

    .header-gif {
        min-height: 30px;
    }

    .about-popup {
        position: absolute;
        bottom: 70px;
        right: 0;
        background: #fcfbf8;
        border: 1px solid #1a1a1a;
        padding: 1rem 1.5rem;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        font-size: 0.85rem;
    }

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

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

    .writings {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
    }

    .header-text {
        border-right: none;
        border-bottom: 2px solid #1a1a1a;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 2rem 1.5rem;
    }

    .works {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal {
        padding: 1.5rem;
    }

    .modal-nav {
        padding: 1rem 1.5rem;
    }

    .modal-content {
        margin-top: 4rem;
    }

    /* Center a single artwork in the viewport, like opening an image on are.na.
       Writings keep their normal top-aligned, scrollable layout. */
    .modal.image-mode .modal-content {
        margin-top: 0;
        min-height: calc(100vh - 3rem);
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .modal.image-mode .modal-content img {
        max-height: 82vh;
        width: auto;
        max-width: 100%;
        margin: 0 auto;
        object-fit: contain;
    }

    .intro-name {
        font-size: 2rem;
        letter-spacing: 0.2rem;
    }

    .intro-content {
        padding: 2rem;
    }

    .index-title {
        font-size: 1.1rem;
    }

    .name {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .works {
        grid-template-columns: 1fr;
    }

    .intro-name {
        font-size: 1.5rem;
        letter-spacing: 0.15rem;
    }

    .intro-content {
        padding: 1.5rem;
    }

    .index-title {
        font-size: 1rem;
    }
    .modal-nav {
        flex-wrap: wrap;
        gap: 0.75rem 1rem;
        padding: 1rem 1.25rem;
    }

    .modal-nav-right {
        gap: 1.25rem;
    }
}
