@import url('https://fonts.googleapis.com/css2?family=Unbounded&display=swap');

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

body {
  font-family: "Unbounded", sans-serif;
  font-optical-sizing: auto;
  font-size: 1.1rem;
  margin: 4%;
  background-color: #ff69b4;
  color: rgb(255, 255, 255);
  overflow-x: hidden;
  line-height: 1.5;
}

h1 {
    text-align: center;
    font-weight: bold;
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin: 1.5rem 0;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.grid {
    column-count: 4;
    column-gap: 1.5em;
    padding: 1.5em;
    margin: 0 auto;
}

.panel {
    break-inside: avoid; 
    margin-bottom: 1.5em;
    background-color: rgba(160, 0, 147, 0.133);
    padding: 0.6em;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1em;
    animation: fadeIn 0.5s ease-out forwards;
}

.panel:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    background-color: rgba(160, 0, 147, 0.2);
}

.image-container {
    display: flex;
    flex-direction: column;
    gap: 1em;
    border-radius: 18px;
    padding: 0.6em;
    background: rgb(220, 53, 150);
}

.panel img {
    width: 100%;
    max-height: none;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    transition: transform 0.3s ease;
    cursor: pointer;
}

a {
    color: rgb(255, 255, 255);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
    display: inline-block;
    margin: 2px 0;
}

a:hover {
    color: #ffd1dc;
    text-decoration: underline;
}

.info-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    word-wrap: break-word;
}

.author {
    background: rgba(160, 0, 147, 0.8);
    padding: 0.8em 1em;
    border-radius: 12px;
    margin: 0.5em 0;
    width: 100%;
    font-size: 0.95em;
}

.source {
    background: rgba(140, 0, 127, 0.7);
    padding: 0.7em 1em;
    border-radius: 12px;
    margin: 0.5em 0;
    width: 100%;
    font-size: 0.9em;
}

.author a, .source a {
    color: #ffd1dc;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.92);
    
    justify-content: center; 
    align-items: center;
    
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}


.modal-content {
    display: block;
    max-width: 95%;
    max-height: 90%;
    object-fit: contain;
    animation: zoomIn 0.3s ease-out;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.close {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #fff;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    background: rgba(100, 100, 100, 0.4);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close:hover {
    background: rgba(0, 0, 0, 0.6);
}

.modal-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    color: #fff;
    padding: 15px;
    background: rgba(0, 0, 0, 0.8);
    font-size: 0.9rem;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 1.2rem;
}

.controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.prev, .next {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(100, 100, 100, 0.2);
    color: white;
    font-size: 30px;
    cursor: pointer;
    width: 50px;
    height: 80px;
    border-radius: 4px;
    transition: background 0.2s;
    margin: auto 10px;
    user-select: none;
}

.prev:hover, .next:hover {
    background: rgba(100, 100, 100, 0.5);
}

.img-wrapper {
    position: relative;
    width: 100%;
    line-height: 0;
    container-type: inline-size;
}

.ai-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60cqw; 
    font-weight: 1000;
    color: white;
    opacity: 0.32;
    background: none;
    pointer-events: none; 
    user-select: none;
    white-space: nowrap;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.filters-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8em;
    padding: 0 1.5em 1.5em 1.5em;
    margin-bottom: 1em;
}

.filter-btn {
    background-color: rgba(160, 0, 147, 0.133);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6em 1.2em;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: rgba(160, 0, 147, 0.3);
}

.filter-btn.active {
    background-color: rgba(160, 0, 147, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

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

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@media (max-width: 600px) {
    body {
        margin: 2%;
        font-size: 0.85rem;
    }

    h1 {
        font-size: 1.5rem;
        margin: 0.8rem 0;
    }

    .grid {
        column-count: 2;
        column-gap: 0.5em;
        padding: 0.5em;
    }

    .panel {
        padding: 2px;
        margin-bottom: 0.5em;
        background-color: transparent;
        border: none;
        border-radius: 8px;
        box-shadow: none; 
    }

    .image-container {
        background: none;
        padding: 0;
        border-radius: 8px;
        gap: 0.5em;
    }
    
    .panel img {
        border-radius: 8px;
    }

    .panel img:hover {
        transform: none;
    }

    .filters-container {
        padding: 0 0.5em 1em 0.5em;
        gap: 0.5em;
    }

    .filter-btn {
        padding: 0.4em 0.8em;
        font-size: 0.8rem;
    }

    .ai-badge {
        font-size: 50cqw;
    }

    .modal-content {
        max-width: 100%;
        max-height: 85%;
        border-radius: 0;
    }

    .prev, .next {
        width: 25%; 
        height: 100%;
        margin: 0;
        border-radius: 0;

        background: transparent !important;
        border: none;
        box-shadow: none !important;
        opacity: 0;

        -webkit-tap-highlight-color: transparent;
        outline: none;
        cursor: default;

        font-size: 0; 
        color: transparent;
    }

    .prev:hover, .next:hover,
    .prev:active, .next:active {
        background: transparent !important;
        box-shadow: none !important;
    }

    .close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.3);
    }

    .modal-caption {
        padding: 10px;
        font-size: 0.85rem;
        background: rgba(0, 0, 0, 0.6);
    }
}

@media (min-width: 768px) {
    body { margin: 2%; font-size: 0.95rem; }
    h1 { font-size: 2.2rem; }
    .grid { column-count: 2; padding: 1em; column-gap: 1em; }
    .panel { padding: 1.2em; margin-bottom: 1em; }
}

@media (min-width: 1024px) {
    body { margin: 3%; font-size: 1rem; }
    .grid { column-count: 3; padding: 1.2em; column-gap: 1.2em; }
    .panel { padding: 1.2em; }
    .image-container { padding: 1em; }
}

@media (min-width: 1200px) {
    .grid { column-count: 4; column-gap: 1.5em; }
    .panel { margin-bottom: 1.5em; }
}

@media (min-width: 1600px) {
    .grid { column-count: 4; max-width: 1600px; margin: 0 auto; }
}

@media (min-width: 2560px) {
    .grid { column-count: 5; max-width: 2000px; column-gap: 2em; }
    h1 { font-size: 5rem; }
    .author, .source { font-size: 1.1rem; padding: 1em 1.2em; }
}

@media (max-height: 600px) and (orientation: landscape) {
    .modal-content { max-height: 80%; }
}