/* ============================================================
   Penzion a restaurace U Maryny — Preloader
   Autor: Rho:Technology
   Navazuje na vizuální styl webu (Barlow, #9E2901, #BFBA6B, #262626)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,300;0,400;0,600;0,900&display=swap');

#maryna-preloader {
    /* --- Barvy webu --- */
    --pl-dark: #262626;
    --pl-dark-deep: #1e1c1d;
    --pl-red: #9E2901;
    --pl-olive: #BFBA6B;
    --pl-light: #EFF3F2;

    /* --- Cesta k logu (relativně k tomuto CSS souboru) --- */
    --pl-logo: url('../themes/logo.fw.png');

    /* --- Časování --- */
    --pl-out-content: 0.45s;
    --pl-out-panels: 0.75s;
    --pl-ease: cubic-bezier(0.76, 0, 0.24, 1);

    /* --- Průběh načítání (0–1), nastavuje JS --- */
    --pl-progress: 0;

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    font-family: 'Barlow', sans-serif;
    text-align: center;
    overflow: hidden;
    pointer-events: auto;
}

/* Zámek scrollování, dokud preloader běží */
html.pl-loading,
html.pl-loading body {
    overflow: hidden !important;
}

/* ------------------------------------------------------------
   Rozjížděcí panely (odhalení webu)
   ------------------------------------------------------------ */
.pl-panel {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50.5%;
    background: var(--pl-dark);
    transition: transform var(--pl-out-panels) var(--pl-ease);
    will-change: transform;
}

.pl-panel--top {
    top: 0;
    background: linear-gradient(180deg, var(--pl-dark-deep) 0%, var(--pl-dark) 100%);
}

.pl-panel--bottom {
    bottom: 0;
    background: linear-gradient(0deg, var(--pl-dark-deep) 0%, var(--pl-dark) 100%);
}

/* Jemná svislá "wall" stopa uprostřed – stejný motiv jako sekce webu */
.pl-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: calc(50% - 300px);
    width: 600px;
    height: 100%;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.022) 50%,
        rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

/* ------------------------------------------------------------
   Obsah preloaderu
   ------------------------------------------------------------ */
.pl-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    max-width: 86vw;
    transition: opacity var(--pl-out-content) ease,
                transform var(--pl-out-content) ease;
    will-change: opacity, transform;
}

/* --- Logo + orámování (motiv .button-corner z webu) --- */
.pl-logo {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 34px auto;
}

.pl-logo__frame {
    position: absolute;
    top: 12px;
    left: 12px;
    width: calc(100% - 24px);
    height: calc(100% - 24px);
    border: 1px solid rgba(191, 186, 107, 0.55);
    opacity: 0;
    transform: scale(1.18);
    animation: pl-frame-in 1s var(--pl-ease) 0.15s forwards;
}

.pl-logo__frame--offset {
    top: -12px;
    left: -12px;
    border-color: rgba(158, 41, 1, 0.55);
    transform: scale(0.82);
    animation-delay: 0.3s;
}

.pl-logo__img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--pl-logo) center / contain no-repeat;
    /* Odhalení zdola nahoru – jako by se kresba dokreslovala */
    clip-path: inset(100% 0 0 0);
    opacity: 0;
    animation: pl-logo-draw 1.5s var(--pl-ease) 0.1s forwards,
               pl-logo-breathe 4s ease-in-out 1.7s infinite;
}

/* Přejezd světla po obrysu loga (maskováno tvarem loga) */
.pl-logo__sheen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(105deg,
        rgba(255, 255, 255, 0) 38%,
        rgba(255, 255, 255, 0.85) 50%,
        rgba(255, 255, 255, 0) 62%);
    background-size: 260% 100%;
    background-position: 160% 0;
    -webkit-mask: var(--pl-logo) center / contain no-repeat;
            mask: var(--pl-logo) center / contain no-repeat;
    mix-blend-mode: screen;
    opacity: 0;
    animation: pl-sheen 3.2s ease-in-out 1.6s infinite;
    pointer-events: none;
}

/* --- Nadpis (styl .nadpis z webu, tmavá varianta) --- */
.pl-title {
    font-size: 22px;
    line-height: 1.25;
    font-weight: 400;
    letter-spacing: 0.16em;
    color: var(--pl-light);
    margin: 0 0 6px 0;
    opacity: 0;
    animation: pl-fade-up 0.8s ease 0.6s forwards;
}

.pl-title span {
    display: block;
    font-weight: 600;
    color: var(--pl-olive);
}

/* --- Dělicí linka (motiv lineas.fw.png) --- */
.pl-divider {
    width: 180px;
    height: 1px;
    margin: 20px auto 22px auto;
    background: linear-gradient(90deg,
        rgba(158, 41, 1, 0) 0%,
        var(--pl-red) 50%,
        rgba(158, 41, 1, 0) 100%);
    transform: scaleX(0);
    opacity: 0;
    animation: pl-divider-in 0.9s var(--pl-ease) 0.8s forwards;
}

/* --- Ukazatel průběhu --- */
.pl-progress {
    opacity: 0;
    animation: pl-fade-up 0.8s ease 1s forwards;
}

.pl-progress__track {
    position: relative;
    width: 220px;
    height: 2px;
    margin: 0 auto;
    background: rgba(239, 243, 242, 0.14);
}

.pl-progress__bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--pl-red) 0%, var(--pl-olive) 100%);
    transform: scaleX(var(--pl-progress));
    transform-origin: left center;
    transition: transform 0.4s ease-out;
}

/* Světelný bod na čele ukazatele */
.pl-progress__track::after {
    content: '';
    position: absolute;
    top: -2px;
    left: calc(var(--pl-progress) * 100%);
    width: 6px;
    height: 6px;
    margin-left: -3px;
    border-radius: 50%;
    background: var(--pl-olive);
    box-shadow: 0 0 10px 2px rgba(191, 186, 107, 0.6);
    transition: left 0.4s ease-out;
}

.pl-progress__meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 220px;
    margin: 14px auto 0 auto;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: rgba(239, 243, 242, 0.5);
}

.pl-progress__value {
    color: var(--pl-light);
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   Odchod preloaderu
   ------------------------------------------------------------ */
#maryna-preloader.is-done {
    pointer-events: none;
}

#maryna-preloader.is-done .pl-content {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 16px));
}

#maryna-preloader.is-done .pl-panel--top {
    transform: translateY(-101%);
    transition-delay: 0.28s;
}

#maryna-preloader.is-done .pl-panel--bottom {
    transform: translateY(101%);
    transition-delay: 0.28s;
}

#maryna-preloader.is-hidden {
    display: none;
}

/* ------------------------------------------------------------
   Klíčové snímky
   ------------------------------------------------------------ */
@keyframes pl-logo-draw {
    0%   { clip-path: inset(100% 0 0 0); opacity: 0; }
    15%  { opacity: 1; }
    100% { clip-path: inset(0 0 0 0); opacity: 1; }
}

@keyframes pl-logo-breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.035); }
}

@keyframes pl-sheen {
    0%        { background-position: 160% 0; opacity: 0; }
    12%       { opacity: 0.55; }
    55%, 100% { background-position: -60% 0; opacity: 0; }
}

@keyframes pl-frame-in {
    0%   { opacity: 0; }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes pl-fade-up {
    0%   { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes pl-divider-in {
    0%   { opacity: 0; transform: scaleX(0); }
    100% { opacity: 1; transform: scaleX(1); }
}

/* ------------------------------------------------------------
   Tablet
   ------------------------------------------------------------ */
@media screen and (max-width: 1099px) {
    .pl-logo { width: 170px; height: 170px; margin-bottom: 30px; }
    .pl-title { font-size: 20px; }
}

/* ------------------------------------------------------------
   Mobil
   ------------------------------------------------------------ */
@media screen and (max-width: 767px) {
    .pl-content { width: 260px; }
    .pl-logo { width: 140px; height: 140px; margin-bottom: 26px; }
    .pl-logo__frame { top: 9px; left: 9px; width: calc(100% - 18px); height: calc(100% - 18px); }
    .pl-logo__frame--offset { top: -9px; left: -9px; }
    .pl-title { font-size: 17px; letter-spacing: 0.12em; }
    .pl-divider { width: 140px; margin: 16px auto 18px auto; }
    .pl-progress__track,
    .pl-progress__meta { width: 180px; }
    .pl-progress__meta { font-size: 11px; }
    .pl-panel::after { left: 0; width: 100%; }
}

/* ------------------------------------------------------------
   Omezený pohyb – bez animací, jen prolnutí
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    #maryna-preloader {
        --pl-out-content: 0.2s;
        --pl-out-panels: 0.2s;
    }

    .pl-logo__img,
    .pl-logo__frame,
    .pl-title,
    .pl-divider,
    .pl-progress {
        animation: none !important;
        opacity: 1;
        clip-path: none;
        transform: none;
    }

    .pl-logo__sheen { display: none; }

    #maryna-preloader.is-done .pl-panel--top,
    #maryna-preloader.is-done .pl-panel--bottom {
        transform: none;
        opacity: 0;
        transition: opacity 0.2s linear;
        transition-delay: 0s;
    }
}
