/* dodaci preko postojećeg stila — namjerno malo neispeglano */

.photo img,
.wiki-card img,
.cat-stage img,
.project-card img,
.physics-card img {
    cursor: zoom-in;
}

.no-lightbox,
#hiking-secret img,
#ankle-photo img {
    cursor: pointer !important;
}

/* malo uredniji raspored, bez gubitka trashy izgleda */
.homepage-photo-grid,
.homepage-friends-grid,
.hike-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    justify-items: center;
    gap: 30px 24px;
}

.homepage-photo-grid .photo,
.homepage-friends-grid .photo,
.hike-grid .photo {
    width: min(330px, 100%);
}

.homepage-photo-grid .photo:nth-child(2),
.homepage-friends-grid .photo:nth-child(2),
.hike-grid .photo:nth-child(2n) {
    margin-top: 28px;
}

.homepage-photo-grid .photo:nth-child(3),
.hike-grid .photo:nth-child(3) {
    margin-top: -6px;
}

.homepage-friends-grid .photo:nth-child(3) {
    grid-column: 1 / -1;
    margin-top: -8px;
}

.photo-help {
    text-align: center;
    margin-top: 22px;
}

/* game shortcut */
.game-shortcut {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 8800;
    padding: 8px 11px;
    color: #111;
    background: #ffe66c;
    border: 2px solid #111;
    box-shadow: 4px 4px 0 #111;
    text-decoration: none;
    font-weight: bold;
    font-size: 12px;
    transform: rotate(1.5deg);
}

.game-shortcut:hover {
    transform: translate(2px, 2px) rotate(-1deg);
    box-shadow: 2px 2px 0 #111;
}

/* lightbox — samo X zatvara */
.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 120000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, .86);
}

.image-lightbox.hidden {
    display: none;
}

.image-lightbox-card {
    position: relative;
    width: min(900px, 96vw);
    max-height: 92vh;
    padding: 10px 10px 14px;
    overflow: auto;
    background: #fffdf0;
    border: 4px solid #111;
    box-shadow: 12px 12px 0 rgba(255, 230, 80, .7);
    transform: rotate(-.45deg);
    text-align: center;
}

.image-lightbox img {
    display: block;
    width: 100%;
    max-height: 76vh;
    object-fit: contain;
    cursor: default;
}

.image-lightbox img[data-action="chypsi"],
.image-lightbox img[data-action="projects"] {
    cursor: pointer;
}

.image-lightbox-caption {
    margin: 10px 6px 0;
    font-weight: bold;
}

.image-lightbox-hint {
    margin: 5px 6px 0;
    font-size: 11px;
    opacity: .65;
}

.image-lightbox-close {
    position: sticky;
    z-index: 5;
    float: right;
    top: 0;
    width: 42px;
    height: 42px;
    margin: -4px -4px -38px 0;
    border: 3px solid #111;
    background: #e62f2f;
    color: white;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
}

.chypsi-angry {
    animation: chypsiAngry .18s linear infinite alternate;
    filter: contrast(1.15) saturate(1.25);
}

@keyframes chypsiAngry {
    from { transform: translate(-3px, 1px) rotate(-1deg); }
    to { transform: translate(3px, -1px) rotate(1deg); }
}

/* title popup cipher link */
.meme-code-link {
    display: inline-block;
    margin: 2px 0 7px;
    padding: 5px 9px;
    border: 2px solid #111;
    background: #fff176;
    color: #111;
    font: bold 12px monospace;
    text-decoration: none;
    box-shadow: 3px 3px 0 #111;
}

/* shiny događaj je namjerno kratak */
.shiny-event::before {
    content: "SHINY PAGE ✦ 1/64";
    position: fixed;
    z-index: 119000;
    inset: 7px;
    pointer-events: none;
    border: 7px ridge gold;
    color: #111;
    font: bold 12px Arial, sans-serif;
    padding: 8px;
    text-shadow: 1px 1px #fff;
    animation: shinyPulse .55s steps(2, end) infinite;
}

@keyframes shinyPulse {
    0% { box-shadow: inset 0 0 0 5px #ff4, 0 0 25px gold; }
    50% { box-shadow: inset 0 0 0 11px #fff, 0 0 55px #fff24a; }
    100% { box-shadow: inset 0 0 0 5px #ff4, 0 0 25px gold; }
}

/* Chypsi čips */
.chip-layer,
.leg-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9990;
    overflow: hidden;
}

.falling-leg {
    position: absolute;
    top: -90px;
    font-size: clamp(34px, 6vw, 72px);
    filter: drop-shadow(4px 5px 0 rgba(0,0,0,.25));
    animation: legRain 1.6s cubic-bezier(.16,.76,.36,1) forwards;
}

@keyframes legRain {
    from { transform: translateY(-100px) rotate(0deg); opacity: 0; }
    12% { opacity: 1; }
    to { transform: translateY(115vh) rotate(530deg); opacity: .3; }
}

/* ankle easter egg — prvo noge, onda cijela fotka nestane dolje */
#ankle-photo {
    cursor: pointer;
    transform-origin: 50% 95%;
}

#ankle-photo.ankle-wobble {
    animation: ankleWobble .35s linear infinite alternate;
}

@keyframes ankleWobble {
    from { transform: rotate(-8deg) translateX(-3px); }
    to { transform: rotate(7deg) translateX(4px); }
}

#ankle-photo.ankle-fall-off {
    position: relative;
    z-index: 50;
    animation: ankleFallOff 2.2s cubic-bezier(.44,.04,.79,.36) forwards;
}

@keyframes ankleFallOff {
    0% { transform: rotate(-4deg) translate(0, 0); opacity: 1; }
    18% { transform: rotate(10deg) translate(8px, 5px); opacity: 1; }
    45% { transform: rotate(58deg) translate(55px, 110px); opacity: 1; }
    100% { transform: rotate(130deg) translate(230px, 125vh); opacity: .15; }
}

.single-hike {
    min-height: 420px;
    overflow: visible;
}

.ankle-intro {
    margin-top: 65px;
}

/* Konami */
.konami-mode {
    animation: konamiHue 1.1s linear infinite;
}

.konami-banner {
    position: fixed;
    left: 50%;
    top: 18px;
    z-index: 130000;
    transform: translateX(-50%) rotate(-2deg);
    padding: 10px 16px;
    background: #111;
    color: #5dff72;
    border: 3px solid #5dff72;
    font: bold 16px monospace;
    box-shadow: 6px 6px 0 #5dff72;
}

@keyframes konamiHue {
    to { filter: hue-rotate(360deg); }
}

/* DVD easter egg */
.dvd-bouncer {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 125000;
    width: 92px;
    height: 48px;
    display: grid;
    place-items: center;
    pointer-events: none;
    background: #111;
    color: #fff24a;
    border: 3px solid #fff24a;
    border-radius: 50%;
    font: 900 22px Arial, sans-serif;
    box-shadow: 0 0 15px #fff24a;
    will-change: transform;
}

/* wikipedia / Schrödinger */
.wiki-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
    align-items: start;
}

.wiki-card {
    margin: 0;
    padding: 11px;
    background: #f4f1df;
    border: 2px solid #111;
    box-shadow: 6px 6px 0 #111;
}

.wiki-card:nth-child(2) {
    transform: rotate(1deg);
}

.wiki-card img {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: white;
}

.wiki-card figcaption {
    padding: 9px 4px 2px;
    font-size: 13px;
}

.wiki-source {
    font-size: 11px;
    opacity: .68;
}

.schrodinger-secret {
    cursor: pointer !important;
}

.schrodinger-hint {
    display: table;
    margin: 12px auto 0;
    padding: 5px 8px;
    background: #fff088;
    border: 1px dashed #111;
    font: 12px monospace;
    transform: rotate(-1deg);
}

.schrodinger-target {
    position: absolute;
    right: 7%;
    bottom: 25px;
    width: 170px;
    padding: 7px;
    background: #f8f1d9;
    border: 4px solid #111;
    transform: rotate(3deg);
    box-shadow: 5px 6px 0 rgba(0,0,0,.25);
}

.schrodinger-target img {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: cover;
}

.schrodinger-label {
    padding-top: 5px;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
}

/* youtube */
.video-grid-real {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 24px;
    margin-top: 22px;
}

.channel-video-card {
    padding: 12px;
    color: #111;
    background: #faf6e6;
    border: 3px solid #111;
    box-shadow: 7px 7px 0 #111;
}

.channel-video-card:nth-child(2) {
    transform: rotate(-1deg);
}

.channel-video-card h3 {
    margin: 12px 0 6px;
}

.video-player-shell {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #111;
    border: 2px solid #111;
}

.video-player-shell img,
.video-player-shell iframe {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
}

.play-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-2deg);
    min-width: 76px;
    min-height: 52px;
    border: 3px solid #111;
    background: #e93434;
    color: white;
    box-shadow: 4px 4px 0 #111;
    font: bold 19px Arial, sans-serif;
    cursor: pointer;
}

.video-description {
    min-height: 48px;
    font-size: 14px;
    line-height: 1.45;
}

/* game */
.game-wrapper {
    max-width: 860px;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 560px) minmax(150px, 1fr);
    gap: 18px;
    align-items: start;
    justify-content: center;
}

.game-board-column {
    min-width: 0;
}

#snake {
    width: min(560px, 100%);
    touch-action: none;
}

.game-info {
    flex-wrap: wrap;
}

.game-reward-rail {
    min-height: 220px;
    padding: 12px;
    background: #fff7b6;
    border: 3px dashed #111;
    transform: rotate(1deg);
}

.game-reward-rail h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

.side-reward {
    display: none;
    margin-top: 12px;
    padding: 7px;
    background: white;
    border: 3px solid #111;
    box-shadow: 5px 5px 0 #111;
    transform: rotate(-2deg);
}

.side-reward.show {
    display: block;
    animation: rewardPop .5s ease both;
}

.side-reward img {
    display: block;
    width: 100%;
    max-height: 190px;
    object-fit: contain;
}

.side-reward p {
    margin: 6px 2px 0;
    font-size: 11px;
    font-weight: bold;
}

@keyframes rewardPop {
    0% { transform: rotate(-5deg) scale(.82); opacity: 0; }
    20% { transform: rotate(3deg) scale(1.05); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: rotate(-2deg) scale(1); opacity: 0; }
}

#snake.dino-caught {
    filter: brightness(1.12) contrast(1.05);
}

/* projects + physics */
.project-grid,
.physics-grid,
.timeline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.project-card,
.physics-card,
.timeline-card {
    background: #fbf6df;
    border: 3px solid #111;
    box-shadow: 7px 7px 0 #111;
    padding: 14px;
}

.project-card:nth-child(even),
.physics-card:nth-child(even),
.timeline-card:nth-child(even) {
    transform: rotate(1deg);
}

.project-card:nth-child(odd),
.physics-card:nth-child(odd),
.timeline-card:nth-child(odd) {
    transform: rotate(-.6deg);
}

.project-card img,
.physics-card img,
.timeline-card img {
    display: block;
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    background: #eee;
}

.project-card h3,
.physics-card h3,
.timeline-card h3 {
    margin: 12px 0 7px;
}

.source-row {
    margin-top: 12px;
    font-size: 12px;
}

.physics-formula {
    display: table;
    margin: 12px auto;
    padding: 8px 12px;
    background: #111;
    color: #69ff7c;
    font: bold 18px monospace;
    transform: rotate(-1deg);
}

.physics-callout {
    border-left: 7px solid #d53b3b;
}

/* mobile */
@media (max-width: 760px) {
    .homepage-photo-grid,
    .homepage-friends-grid,
    .hike-grid {
        grid-template-columns: 1fr;
    }

    .homepage-photo-grid .photo,
    .homepage-friends-grid .photo,
    .hike-grid .photo,
    .homepage-photo-grid .photo:nth-child(n),
    .homepage-friends-grid .photo:nth-child(n),
    .hike-grid .photo:nth-child(n) {
        margin-top: 0;
        grid-column: auto;
    }

    .game-layout {
        grid-template-columns: 1fr;
    }

    .game-reward-rail {
        min-height: 105px;
    }

    .side-reward {
        max-width: 210px;
        margin: 8px auto 0;
    }

    .side-reward img {
        max-height: 115px;
    }

    .schrodinger-target {
        position: relative;
        right: auto;
        bottom: auto;
        width: min(210px, 80%);
        margin: 20px auto 0;
    }

    .image-lightbox {
        padding: 10px;
    }

    .game-shortcut {
        right: 9px;
        bottom: 9px;
    }
}
