@import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Rajdhani:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #07080d;
    --surface: rgba(22, 24, 36, .55);
    --surface-solid: #10121b;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .16);
    --text: #f3ecef;
    --text-dim: #a59ea6;
    --text-mute: #6f6a74;
    --red: #ff4b2b;
    --amber: #ffb45a;
    --accent: var(--red);
    --grad: linear-gradient(100deg, var(--red), var(--amber));
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --ease-io: cubic-bezier(.65, 0, .35, 1);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Rajdhani', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body.locked {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
}

svg {
    width: 1em;
    height: 1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

strong {
    font-weight: 600;
}

/* ---------- Pozadí ---------- */

.bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.bg-photo {
    position: absolute;
    inset: 0;
    background: url("../images/rednight.jpg") bottom / cover no-repeat;
    opacity: .55;
}

.bg-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(7, 8, 13, .2) 0%, rgba(7, 8, 13, .85) 55%, var(--bg) 100%);
}

.bg-aurora {
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(40% 35% at 20% 30%, rgba(255, 75, 43, .10), transparent 70%),
        radial-gradient(35% 30% at 80% 70%, rgba(255, 180, 90, .07), transparent 70%),
        radial-gradient(45% 40% at 60% 10%, rgba(90, 70, 255, .06), transparent 70%);
    animation: aurora 26s ease-in-out infinite alternate;
    filter: blur(20px);
}

@keyframes aurora {
    to {
        transform: translate3d(4%, -3%, 0) rotate(6deg) scale(1.08);
    }
}

.bg-grain {
    position: absolute;
    inset: 0;
    opacity: .05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Layout ---------- */

.page {
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: 0 90px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ---------- Hlavička ---------- */

.top {
    position: relative;
    display: flex;
    align-items: center;
    padding: clamp(32px, 7vw, 90px) 0 clamp(36px, 6vw, 72px);
}

/* šipky stejně jako na hlavní stránce – vlevo/vpravo uprostřed obrazovky */
.arrow {
    position: fixed;
    top: 50%;
    z-index: 10;
    transform: translateY(-50%);
    font-family: 'Lilita One', cursive;
    font-size: 6em;
    line-height: 1;
    width: fit-content;
    user-select: none;
}

.arrow-left {
    left: 8px;
}

.arrow-right {
    right: 8px;
}

.arrow-active,
.arrow a {
    color: rgb(61, 61, 61);
}

.arrow-hidden {
    color: rgb(0, 0, 0);
}

.arrow a {
    display: block;
    transition: color .3s;
}

.arrow-active a:hover,
.arrow-active a:focus-visible {
    color: #bbb;
    outline: none;
}

.top-titles h1 {
    font-size: clamp(2.4rem, 6vw, 5.2rem);
    font-weight: 300;
    margin: 0 0 .15em;
    line-height: 1;
    letter-spacing: -.01em;
}

.top-titles h1 strong {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.under-h1 {
    font-size: 1.1em;
    font-weight: 400;
    color: var(--text-dim);
}

.dot {
    height: .45em;
    width: .45em;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    margin: 0 .9em;
    vertical-align: middle;
}

/* červená "světelná stopa" jako na fotce z hlavní stránky */
.light-trail {
    position: absolute;
    left: 0;
    right: 0;
    bottom: clamp(14px, 3vw, 30px);
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 75, 43, .9) 20%, var(--amber) 60%, transparent);
    filter: drop-shadow(0 0 6px rgba(255, 75, 43, .8));
    transform-origin: left;
    animation: trail 1.6s var(--ease-out) .2s both;
    opacity: .7;
}

@keyframes trail {
    from {
        transform: scaleX(0);
        opacity: 0;
    }
}

/* ---------- Mřížka aplikací ---------- */

.apps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: clamp(18px, 2.4vw, 30px);
}

.app {
    --mx: 50%;
    --my: 0%;
    --rx: 0deg;
    --ry: 0deg;
    position: relative;
    border-radius: var(--radius);
    opacity: 0;
    transform: translateY(40px) scale(.97);
    animation: card-in .9s var(--ease-out) forwards;
    animation-delay: calc(var(--i) * 90ms + 250ms);
    perspective: 1000px;
}

@keyframes card-in {
    to {
        opacity: 1;
        transform: none;
    }
}

.app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 0;
    text-align: left;
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    transform: rotateX(var(--rx)) rotateY(var(--ry));
    transition: transform .5s var(--ease-out), border-color .4s, box-shadow .5s var(--ease-out);
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
}

/* světlo sledující kurzor */
.app-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    border-radius: inherit;
    background: radial-gradient(420px circle at var(--mx) var(--my), color-mix(in srgb, var(--accent) 22%, transparent), transparent 45%);
    opacity: 0;
    transition: opacity .4s;
}

/* barevný okraj */
.app-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    border-radius: inherit;
    padding: 1px;
    background: radial-gradient(300px circle at var(--mx) var(--my), var(--accent), transparent 60%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity .4s;
}

.app-card:hover,
.app-card:focus-visible {
    border-color: var(--line-strong);
    box-shadow: 0 30px 60px -20px color-mix(in srgb, var(--accent) 35%, transparent), 0 18px 40px -18px rgba(0, 0, 0, .8);
    outline: none;
}

.app-card:hover::before,
.app-card:hover::after,
.app-card:focus-visible::after {
    opacity: 1;
}

.app-media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #0c0e16;
}

.app-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 1s var(--ease-out), filter .6s;
    filter: saturate(.9) brightness(.92);
}

.app-card:hover .app-media img {
    transform: scale(1.06);
    filter: saturate(1.05) brightness(1);
}

.app-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(16, 18, 27, .9));
}

.app-count {
    position: absolute;
    z-index: 1;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: .85rem;
    font-weight: 600;
    border-radius: 99px;
    background: rgba(7, 8, 13, .6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--line);
    color: var(--text-dim);
}

.app-info {
    position: relative;
    padding: 6px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.prefix {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .74rem;
    letter-spacing: .02em;
    padding: 5px 11px;
    border-radius: 99px;
    color: color-mix(in srgb, var(--accent) 70%, white);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.prefix::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.app-info h2 {
    margin: 4px 0 0;
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.1;
}

.app-info p {
    margin: 0;
    color: var(--text-dim);
    font-size: 1.08rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-more {
    margin-top: auto;
    padding-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: .95rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-mute);
    transition: color .3s, gap .4s var(--ease-out);
}

.app-card:hover .app-more {
    color: var(--text);
    gap: 14px;
}

.app.is-source .app-card {
    visibility: hidden;
}

.empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-mute);
    padding: 80px 0;
    font-size: 1.3rem;
}

/* ---------- Detail ---------- */

.detail {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: clamp(0px, 3vw, 40px);
}

.detail[hidden],
.lightbox[hidden] {
    display: none;
}

.detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 5, 9, .72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity .5s var(--ease-out);
}

.detail.open .detail-backdrop {
    opacity: 1;
}

.detail-panel {
    position: relative;
    width: min(1100px, 100%);
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 40px 120px -30px color-mix(in srgb, var(--accent) 35%, transparent), 0 30px 80px rgba(0, 0, 0, .7);
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.detail-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    z-index: 2;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.detail-hero {
    position: relative;
    aspect-ratio: 16 / 9;
    max-height: 62vh;
    width: 100%;
    background: #0c0e16;
    cursor: zoom-in;
    overflow: hidden;
}

.detail-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 1.2s var(--ease-out);
}

.detail-hero:hover img {
    transform: scale(1.025);
}

.detail-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 60%, var(--surface-solid));
}

.zoom-hint {
    position: absolute;
    z-index: 1;
    right: 18px;
    bottom: 18px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    font-size: 18px;
    border-radius: 50%;
    background: rgba(7, 8, 13, .6);
    border: 1px solid var(--line-strong);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform .4s var(--ease-out), background .3s;
}

.detail-hero:hover .zoom-hint {
    transform: scale(1.1);
    background: var(--accent);
}

.detail-body {
    padding: 8px clamp(22px, 4vw, 52px) clamp(28px, 4vw, 48px);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.detail-body h2 {
    margin: 0;
    font-size: clamp(2rem, 4.5vw, 3.4rem);
    font-weight: 600;
    line-height: 1.05;
}

.detail-text {
    color: #cfc7cf;
    font-size: 1.18rem;
    line-height: 1.55;
    max-width: 70ch;
}

.detail-text p {
    margin: 0 0 .8em;
}

.detail-text p:last-child {
    margin: 0;
}

.thumbs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.thumbs:empty {
    display: none;
}

.thumb {
    position: relative;
    width: 132px;
    aspect-ratio: 16 / 10;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    cursor: zoom-in;
    background: #0c0e16;
    border: 1px solid var(--line);
    transition: transform .4s var(--ease-out), border-color .3s, box-shadow .4s;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb:hover,
.thumb:focus-visible {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 12px 24px -10px color-mix(in srgb, var(--accent) 60%, transparent);
    outline: none;
}

.open-app {
    align-self: flex-start;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 26px;
    border-radius: 99px;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: .04em;
    color: #140806;
    background: var(--grad);
    box-shadow: 0 10px 30px -10px rgba(255, 75, 43, .7);
    transition: transform .4s var(--ease-out), box-shadow .4s;
}

.open-app:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px -10px rgba(255, 75, 43, .9);
}

.open-app svg {
    font-size: 1.1em;
    transition: transform .4s var(--ease-out);
}

.open-app:hover svg {
    transform: translate(2px, -2px);
}

.open-app[hidden] {
    display: none;
}

/* postupné objevení obsahu detailu */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s var(--ease-out), transform .7s var(--ease-out);
}

.detail.content-in .reveal {
    opacity: 1;
    transform: none;
}

.detail.content-in .reveal:nth-child(2) { transition-delay: 60ms; }
.detail.content-in .reveal:nth-child(3) { transition-delay: 120ms; }
.detail.content-in .reveal:nth-child(4) { transition-delay: 180ms; }
.detail.content-in .reveal:nth-child(5) { transition-delay: 240ms; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    font-size: 20px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: rgba(7, 8, 13, .55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    transition: transform .4s var(--ease-out), background .3s, border-color .3s;
}

.icon-btn:hover,
.icon-btn:focus-visible {
    transform: rotate(90deg);
    background: var(--accent);
    border-color: transparent;
    outline: none;
}

.detail-close {
    position: sticky;
    top: 16px;
    margin: 16px 16px -62px auto;
    z-index: 5;
    opacity: 0;
    transition: opacity .4s, transform .4s var(--ease-out), background .3s;
}

.detail.content-in .detail-close {
    opacity: 1;
}

/* obrázek "letící" z karty do detailu */
.ghost {
    position: fixed;
    z-index: 60;
    object-fit: cover;
    pointer-events: none;
    will-change: transform, border-radius;
}

/* ---------- Lightbox ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(3, 3, 6, .94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .35s var(--ease-out);
    touch-action: pan-y;
}

.lightbox.open {
    opacity: 1;
}

.lb-stage {
    position: absolute;
    inset: 70px 90px 120px;
    display: grid;
    place-items: center;
}

.lb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .8);
    user-select: none;
    -webkit-user-drag: none;
}

.lb-counter {
    position: absolute;
    top: 24px;
    left: 28px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .85rem;
    color: var(--text-dim);
    letter-spacing: .1em;
}

.lb-close {
    position: absolute;
    top: 16px;
    right: 18px;
}

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Lilita One', cursive;
    font-size: 4em;
    line-height: 1;
    padding: 10px 18px;
    background: none;
    border: 0;
    color: rgb(80, 80, 80);
    cursor: pointer;
    transition: color .3s, transform .4s var(--ease-out);
}

.lb-prev { left: 10px; }
.lb-next { right: 10px; }

.lb-prev:hover { color: #ddd; transform: translate(-4px, -50%); }
.lb-next:hover { color: #ddd; transform: translate(4px, -50%); }

.lb-nav[hidden] {
    display: none;
}

.lb-thumbs {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 22px;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 0 16px;
    overflow-x: auto;
}

.lb-thumbs button {
    flex: 0 0 auto;
    width: 88px;
    aspect-ratio: 16 / 10;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    background: #0c0e16;
    opacity: .45;
    cursor: pointer;
    transition: opacity .3s, border-color .3s, transform .4s var(--ease-out);
}

.lb-thumbs button:hover {
    opacity: .8;
}

.lb-thumbs button.active {
    opacity: 1;
    border-color: var(--accent);
    transform: translateY(-3px);
}

.lb-thumbs img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---------- Patička ---------- */

footer {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: clamp(48px, 8vw, 100px);
    padding: 20px 0;
    color: rgb(122, 122, 122);
    cursor: default;
}

footer a {
    color: rgb(219, 219, 219);
}

footer a:hover {
    color: #fff;
}

/* ---------- Responzivita ---------- */

@media (max-width: 800px) {
    footer {
        flex-direction: column-reverse;
        text-align: center;
    }

    .detail {
        padding: 0;
    }

    .detail-panel {
        height: 100%;
        border-radius: 0;
        border: 0;
    }

    .detail-hero {
        aspect-ratio: 4 / 3;
    }

    .lb-stage {
        inset: 64px 12px 110px;
    }

    .lb-nav {
        display: none;
    }
}

@media (max-width: 700px) {
    .page {
        padding: 0 44px;
    }

    .arrow {
        font-size: 3.2em;
    }

    .arrow-left {
        left: 4px;
    }

    .arrow-right {
        right: 4px;
    }
}

@media (max-width: 520px) {
    .under-h1 .dot {
        margin: 0 .5em;
    }

    .app-info {
        padding: 4px 18px 20px;
    }

    .thumb {
        width: calc(33.333% - 8px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-delay: 0ms !important;
        transition-duration: .01ms !important;
    }
}
