/* ==========================================================================
   Sekcja "Przymierz te fryzure" (try-on AI)

   Ladowana WYLACZNIE na kartach fryzur (patrz templates/layout.php) — nie ma
   powodu, zeby 200 kB reszty serwisu ciagnelo ten plik za soba.

   Wszystkie zmienne sa scope'owane do .tryon: sekcja nie moze wplynac
   na zaden inny element strony.
   ========================================================================== */

.tryon {
    --t-bg:        #13131e;
    --t-bg-2:      #1e1e30;
    --t-gold:      #c8a96e;
    --t-gold-dim:  rgba(200, 169, 110, 0.35);
    --t-gold-faint:rgba(200, 169, 110, 0.12);
    --t-text:      #f5f2ea;
    --t-muted:     #9c99ad;
    --t-line:      rgba(255, 255, 255, 0.10);
    --t-surface:   rgba(255, 255, 255, 0.045);
    --t-ok:        #4ec38a;

    position: relative;
    isolation: isolate;
    overflow: hidden;
    margin: 2.75rem 0 3.25rem;
    padding: clamp(1.5rem, 3.5vw, 3rem) clamp(1.25rem, 3.5vw, 3rem) clamp(1.75rem, 3.5vw, 2.75rem);
    border-radius: 24px;
    border: 1px solid rgba(200, 169, 110, 0.18);
    background:
        radial-gradient(120% 90% at 88% -10%, rgba(200, 169, 110, 0.16), transparent 55%),
        radial-gradient(90% 70% at 5% 105%, rgba(110, 120, 200, 0.12), transparent 60%),
        linear-gradient(165deg, var(--t-bg-2) 0%, var(--t-bg) 60%);
    color: var(--t-text);
    box-shadow: 0 24px 60px rgba(19, 19, 30, 0.28);
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
}

/* Powolna poswiata w tle — jedyny element czysto dekoracyjny */
.tryon__glow {
    position: absolute;
    top: -30%;
    right: -10%;
    width: 55%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 169, 110, 0.20), transparent 65%);
    filter: blur(30px);
    z-index: -1;
    animation: tryon-drift 18s ease-in-out infinite alternate;
}

@keyframes tryon-drift {
    from { transform: translate3d(0, 0, 0)      scale(1);    opacity: 0.75; }
    to   { transform: translate3d(-6%, 8%, 0)   scale(1.15); opacity: 1;    }
}

/* --------------------------------------------------------------------------
   Pasek zwiniety
   Na karcie fryzury ta sekcja jest dodatkiem, nie trescia glowna. Rozwinieta
   na starcie spycha opis fryzury o caly ekran w dol, wiec domyslnie pokazujemy
   sama zachete — okolo jednej trzeciej wysokosci pelnego kreatora.
   -------------------------------------------------------------------------- */

/* Lewa kolumna: tekst nad akcjami. Prawa: miniatura procesu, przez oba wiersze. */
.tryon__teaser {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem clamp(1.5rem, 4vw, 3rem);
}

.tryon__teaser-text { grid-column: 1; min-width: 0; }
.tryon__teaser-side { grid-column: 1; }
.tviz { grid-column: 2; grid-row: 1 / span 2; }

/* Po rozwinieciu prowadzi juz .tryon__lead — dwa zdania o tym samym
   jedno pod drugim to szum */
.tryon[data-open="1"] .tryon__teaser-sub { display: none; }

.tryon__teaser-sub {
    margin-top: 0.55rem;
    max-width: 46ch;
    color: var(--t-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.tryon__teaser-side {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
    flex: 0 0 auto;
}

.tryon__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.75rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #d8bc82, var(--t-gold) 55%, #b08d4f);
    color: #16161f;
    font-size: 0.92rem;
    font-weight: 700;
    box-shadow: 0 10px 26px rgba(200, 169, 110, 0.26);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.tryon__toggle:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(200, 169, 110, 0.38); }
.tryon__toggle svg {
    width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.tryon[data-open="1"] .tryon__toggle svg { transform: rotate(180deg); }

/* Dwa wyjscia do narzedzi. Jako zwykly tekst gubily sie pod zlotym
   przyciskiem — teraz sa obrysowanymi pigulkami z ikona: czytelnie
   drugorzedne wobec glownego CTA, ale wyraznie klikalne. */
.tryon__links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tryon__link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.95rem;
    border: 1px solid var(--t-gold-dim);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--t-gold);
    font-size: 0.79rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.tryon__link-btn:hover {
    background: var(--t-gold-faint);
    border-color: var(--t-gold);
    transform: translateY(-1px);
}
.tryon__link-btn svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

/* --------------------------------------------------------------------------
   Miniatura procesu w pasku zwinietym (.tviz)
   Trzy kadry w skali, ktora miesci sie w jednej linijce paska. Tlumacza
   mechanizm szybciej niz zdanie tekstu i to one maja zachecic do rozwiniecia.
   -------------------------------------------------------------------------- */

.tviz {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
}

.tviz__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
}

.tviz__frame {
    position: relative;
    display: block;
    width: 72px;
    aspect-ratio: 4 / 5;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--t-line);
}

/* Wzorzec to kadr 21:9 (przod | tyl) — pokazujemy srodek lewej polowy.
   translateX(-25%) wlasnej szerokosci, tak samo jak w duzej ramce. */
.tviz__frame--ref img {
    position: absolute;
    inset: 0 auto 0 50%;
    width: auto;
    height: 100%;
    max-width: none;
    transform: translateX(-25%);
}

.tviz__frame--you {
    border-style: dashed;
    border-color: var(--t-gold-dim);
    background: rgba(200, 169, 110, 0.05);
}
.tviz__guide {
    position: absolute;
    inset: 8%;
    width: 84%;
    height: 84%;
    fill: none;
    stroke: var(--t-gold);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.6;
}
.tviz__br   { stroke-width: 3; opacity: 0.85; }
.tviz__head { stroke-dasharray: 4 4; }
.tviz__body { stroke-dasharray: 4 4; }

.tviz__frame--out {
    display: grid;
    place-items: center;
    background:
        repeating-linear-gradient(-45deg, rgba(255,255,255,0.03) 0 8px, transparent 8px 16px),
        rgba(255, 255, 255, 0.04);
}
.tviz__spark {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--t-gold);
    stroke-width: 1.3;
    stroke-linejoin: round;
    opacity: 0.9;
}
/* Powolny przeblysk — sygnal, ze tu cos powstanie */
.tviz__sweep {
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(200, 169, 110, 0.28) 50%, transparent 65%);
    background-size: 250% 100%;
    animation: tviz-sweep 3.4s ease-in-out infinite;
}
@keyframes tviz-sweep {
    0%, 100% { background-position: 150% 0; }
    55%      { background-position: -50% 0; }
}

.tviz__lab {
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--t-muted);
    white-space: nowrap;
}

.tviz__op {
    display: grid;
    place-items: center;
    align-self: center;
    margin-top: -0.7rem;   /* wyrownanie do srodka kadru, nie calej kolumny z podpisem */
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 50%;
    border: 1px solid var(--t-gold-dim);
    background: rgba(19, 19, 30, 0.6);
    color: var(--t-gold);
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}
.tviz__op svg { width: 10px; height: 10px; fill: none; stroke: var(--t-gold); stroke-width: 2.4; }

.tviz__op--ai {
    position: relative;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-color: var(--t-gold);
    box-shadow: 0 0 14px rgba(200, 169, 110, 0.25);
}
.tviz__ring {
    position: absolute;
    inset: -1px;
    border: 1px solid var(--t-gold);
    border-radius: 50%;
    opacity: 0;
    animation: tviz-ring 3.4s ease-out infinite;
}
@keyframes tviz-ring {
    0%   { transform: scale(1);   opacity: 0.5; }
    70%  { transform: scale(1.9); opacity: 0;   }
    100% { transform: scale(1.9); opacity: 0;   }
}

/* Po rozwinieciu miniatura jest zbedna — pelny kreator pokazuje to samo, wiekszej */
.tryon[data-open="1"] .tviz { display: none; }

@media (max-width: 880px) {
    .tryon__teaser { grid-template-columns: 1fr; }
    .tviz { grid-column: 1; grid-row: auto; justify-content: center; margin: 0.35rem 0; }
}
@media (max-width: 420px) {
    .tviz__frame { width: 58px; }
    .tviz__lab { font-size: 0.5rem; }
}

/* --------------------------------------------------------------------------
   Czesc rozwijana
   Zwykle display:none/block plus krotkie wejscie opacity. Probowalem dwoch
   animacji wysokosci — grid-template-rows 0fr->1fr (1fr rozwiazywalo sie
   do zera) i mierzonego max-height (inline styl przegrywal z regula CSS).
   Przy tresci tej wysokosci plynne rozwijanie i tak nie wnosi nic poza
   ryzykiem, a to rozwiazanie po prostu dziala.
   -------------------------------------------------------------------------- */

.tryon__body { display: none; }

.tryon[data-open="1"] .tryon__body {
    display: block;
    margin-top: clamp(1.5rem, 3vw, 2.25rem);
    animation: tryon-open 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes tryon-open {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
}

.tryon__lead {
    margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
    max-width: 40rem;
    color: var(--t-muted);
    font-size: clamp(0.94rem, 1.4vw, 1.02rem);
    line-height: 1.65;
}

@media (max-width: 780px) {
    .tryon__teaser-side { width: 100%; align-items: stretch; }
    .tryon__toggle { justify-content: center; width: 100%; }
    .tryon__links { justify-content: center; }
    .tryon__teaser-text { text-align: center; }
    .tryon__teaser-sub { margin-inline: auto; }
}

/* --------------------------------------------------------------------------
   Naglowek
   -------------------------------------------------------------------------- */

.tryon__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.85rem 0.3rem 0.6rem;
    border: 1px solid var(--t-gold-dim);
    border-radius: 999px;
    background: var(--t-gold-faint);
    color: var(--t-gold);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.tryon__spark {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--t-gold);
    box-shadow: 0 0 0 0 rgba(200, 169, 110, 0.6);
    animation: tryon-pulse 2.4s ease-out infinite;
}

@keyframes tryon-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(200, 169, 110, 0.55); }
    70%  { box-shadow: 0 0 0 9px rgba(200, 169, 110, 0); }
    100% { box-shadow: 0 0 0 0 rgba(200, 169, 110, 0); }
}

.tryon__title {
    margin: 0.85rem 0 0.6rem;
    font-family: var(--font-heading, 'Playfair Display', Georgia, serif);
    font-size: clamp(1.6rem, 3.4vw, 2.4rem);
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   Wizualizacja procesu: 3 kroki + 2 zlacza
   -------------------------------------------------------------------------- */

.tryon__flow {
    display: grid;
    grid-template-columns: 1fr 54px 1fr 74px 1fr;
    align-items: start;
    gap: 0;
}

.tryon__step {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tryon__step-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.7rem;
}

.tryon__num {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border: 1px solid var(--t-gold-dim);
    border-radius: 50%;
    background: var(--t-gold-faint);
    color: var(--t-gold);
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tryon__step-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: rgba(245, 242, 234, 0.72);
}

/* Zielony ptaszek — pojawia sie, gdy krok jest skompletowany */
.tryon__badge-ok {
    width: 16px;
    height: 16px;
    margin-left: auto;
    flex: 0 0 16px;
    border-radius: 50%;
    background: var(--t-ok);
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2313131e' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4 10-10'/%3E%3C/svg%3E");
    background-size: 11px;
    background-position: center;
    background-repeat: no-repeat;
}

.tryon__step[data-state="ready"]  .tryon__badge-ok,
.tryon__step[data-state="done"]   .tryon__badge-ok {
    opacity: 1;
    transform: scale(1);
}

/* --- Ramka (wspolna dla wszystkich trzech krokow) --- */

.tryon__frame {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--t-line);
    background: var(--t-surface);
    padding: 0;
}

.tryon__photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Wzorzec to kadr 21:9 (przod | tyl) — pokazujemy LEWA POLOWE, wysrodkowana.
 *
 * object-position w procentach NIE oznacza "wysrodkuj na tym punkcie zdjecia"
 * — przy object-fit: cover procent rozdziela NADMIAR szerokosci, wiec 25%
 * wypadalo na prawo od srodka lewej polowy i twarz uciekala w lewo.
 *
 * Zamiast tego dajemy elementowi naturalne proporcje (height: 100%, width: auto)
 * i przesuwamy go o 25% JEGO WLASNEJ szerokosci — czyli srodek lewej polowy
 * laduje dokladnie na srodku ramki. To nie zalezy od proporcji ramki,
 * wiec dziala identycznie na desktopie (4:5) i na mobile (1:1). */
.tryon__frame--ref .tryon__photo {
    inset: 0 auto 0 50%;
    width: auto;
    height: 100%;
    max-width: none;              /* globalne img { max-width: 100% } ze style.css */
    transform: translateX(-25%);
}

/* --- Krok 1: dropzone --- */

.tryon__frame--drop {
    cursor: pointer;
    border-style: dashed;
    border-color: var(--t-gold-dim);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.tryon__frame--drop:hover,
.tryon__frame--drop:focus-visible {
    border-color: var(--t-gold);
    background: rgba(200, 169, 110, 0.07);
    transform: translateY(-2px);
    outline: none;
}

.tryon__frame--drop.is-dragover {
    border-style: solid;
    border-color: var(--t-gold);
    background: rgba(200, 169, 110, 0.13);
}

/* Prowadnica kadru — rysowana jako SVG, zeby byla ostra w kazdej skali */
.tryon__guide {
    position: absolute;
    inset: 12% 16%;
    width: 68%;
    height: 76%;
    fill: none;
    stroke: var(--t-gold);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.55;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tryon__guide-brackets { stroke-width: 2.4; opacity: 0.9; }
.tryon__guide-body     { stroke-dasharray: 5 5; }
.tryon__guide-axis     { stroke-dasharray: 2 6; opacity: 0.55; }
.tryon__guide-axis circle { fill: var(--t-gold); stroke: none; opacity: 0.8; }

/* Po wgraniu zdjecia prowadnica zostaje, ale schodzi do roli nakladki */
.tryon__step[data-state="ready"] .tryon__guide { opacity: 0.22; }

.tryon__hint {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: max-content;
    max-width: 90%;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(19, 19, 30, 0.72);
    backdrop-filter: blur(6px);
    color: rgba(245, 242, 234, 0.9);
    font-size: 0.76rem;
    line-height: 1.3;
    text-align: left;
    transition: opacity 0.25s ease;
}

.tryon__hint b { color: var(--t-gold); font-weight: 600; }

.tryon__hint-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    fill: none;
    stroke: var(--t-gold);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tryon__step[data-state="ready"] .tryon__hint { opacity: 0; pointer-events: none; }

/* Przesuwajaca sie linia skanu — sygnal, ze cos sie dzieje */
.tryon__scan {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 34%;
    opacity: 0;
    background: linear-gradient(to bottom, transparent, rgba(200, 169, 110, 0.22), transparent);
    pointer-events: none;
}

.tryon.is-working .tryon__scan {
    opacity: 1;
    animation: tryon-scan 2.1s ease-in-out infinite;
}

@keyframes tryon-scan {
    0%   { transform: translateY(-40%); }
    100% { transform: translateY(300%); }
}

.tryon__step-note {
    margin: 0.7rem 0 0;
    color: var(--t-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.tryon__change {
    margin-top: 0.5rem;
    padding: 0;
    align-self: flex-start;
    border-bottom: 1px solid var(--t-gold-dim);
    color: var(--t-gold);
    font-size: 0.78rem;
    background: none;
    transition: border-color 0.2s ease;
}

.tryon__change:hover { border-color: var(--t-gold); }

/* --- Krok 2: wzorzec --- */

.tryon__ref-tag {
    position: absolute;
    left: 0.7rem;
    top: 0.7rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(19, 19, 30, 0.78);
    backdrop-filter: blur(6px);
    color: var(--t-ok);
    font-size: 0.7rem;
    font-weight: 600;
}

/* Miniatura pelnego kadru 21:9 — w srodku ramki, zeby wszystkie trzy
   kolumny mialy identyczna wysokosc (inaczej wezly + i AI schodza z osi) */
.tryon__strip {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    width: 62%;
    display: block;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.tryon__strip img {
    display: block;
    width: 100%;
    height: auto;
}

/* --- Krok 3: wynik --- */

.tryon__frame--result {
    border-style: solid;
    background:
        repeating-linear-gradient(-45deg, rgba(255,255,255,0.018) 0 12px, transparent 12px 24px),
        var(--t-surface);
}

.tryon__locked {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1rem;
    color: var(--t-muted);
    font-size: 0.8rem;
    text-align: center;
    transition: opacity 0.3s ease;
}

.tryon__locked svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: var(--t-gold);
    stroke-width: 1.4;
    stroke-linejoin: round;
    opacity: 0.85;
}

.tryon__step[data-state="working"] .tryon__locked,
.tryon__step[data-state="done"]    .tryon__locked { opacity: 0; }

/* Poswiata "renderowania" */
.tryon__skeleton {
    position: absolute;
    inset: 0;
    opacity: 0;
    background: linear-gradient(100deg,
        rgba(255, 255, 255, 0.02) 20%,
        rgba(200, 169, 110, 0.16) 45%,
        rgba(255, 255, 255, 0.02) 70%);
    background-size: 250% 100%;
    transition: opacity 0.3s ease;
}

.tryon__step[data-state="working"] .tryon__skeleton {
    opacity: 1;
    animation: tryon-shimmer 1.7s linear infinite;
}

@keyframes tryon-shimmer {
    from { background-position: 160% 0; }
    to   { background-position: -60% 0; }
}

/* Licznik postepu w kadrze wyniku — bez niego stan pracy to pusta ramka */
.tryon__working {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tryon__step[data-state="working"] .tryon__working { opacity: 1; }

.tryon__working-ring {
    width: 44px;
    height: 44px;
    border: 2px solid rgba(200, 169, 110, 0.22);
    border-top-color: var(--t-gold);
    border-radius: 50%;
    animation: tryon-spin 0.9s linear infinite;
}

.tryon__working-pct {
    font-size: 1.35rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: var(--t-text);
}

/* Odsloniecie wyniku */
.tryon__compare {
    position: absolute;
    inset: 0;
    --tryon-pos: 50%;
}

.tryon__step[data-state="done"] .tryon__compare {
    animation: tryon-reveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes tryon-reveal {
    from { clip-path: inset(0 0 100% 0); opacity: 0.4; }
    to   { clip-path: inset(0 0 0 0);    opacity: 1;   }
}

/* "Przed" przycinamy maska — obrazek nie jest skalowany, wiec nic nie plywa */
.tryon__before {
    position: absolute;
    inset: 0;
    clip-path: inset(0 calc(100% - var(--tryon-pos)) 0 0);
}

.tryon__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--tryon-pos);
    width: 2px;
    margin-left: -1px;
    background: var(--t-gold);
    box-shadow: 0 0 12px rgba(200, 169, 110, 0.7);
    pointer-events: none;
}

.tryon__handle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    transform: translate(-50%, -50%);
    border: 2px solid var(--t-gold);
    border-radius: 50%;
    background: rgba(19, 19, 30, 0.8) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8a96e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 7-5 5 5 5M15 7l5 5-5 5'/%3E%3C/svg%3E") center / 17px no-repeat;
    backdrop-filter: blur(4px);
}

.tryon__slider {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
    -webkit-appearance: none;
    appearance: none;
    background: none;
}

.tryon__slider::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 100%; }
.tryon__slider::-moz-range-thumb     { width: 44px; height: 100%; border: 0; background: transparent; }

/* Lupa na kadrze wyniku — suwak porownania przykrywa cala ramke,
   wiec przycisk musi lezec nad nim */
.tryon__zoom-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(19, 19, 30, 0.78);
    backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.16s ease, transform 0.16s ease;
}
.tryon__compare:hover .tryon__zoom-btn,
.tryon__zoom-btn:focus-visible { opacity: 1; transform: none; }
.tryon__zoom-btn svg { width: 17px; height: 17px; stroke: var(--t-gold); fill: none; stroke-width: 1.9; }
/* Na dotyku nie ma hoveru — lupa musi byc widoczna od razu */
@media (hover: none) { .tryon__zoom-btn { opacity: 1; transform: none; } }

/* [hidden] przegrywa z display:flex — bez tego przyciski wyniku widac
   zanim cokolwiek zostanie wygenerowane */
.tryon [hidden] { display: none !important; }

/* ==========================================================================
   OCENA NARZEDZIA
   Delikatna ramka na tle sekcji zamiast wyroznienia kolorem: ma byc
   zauwazalna, ale nie konkurowac z wynikiem, na ktory patrzy uzytkownik.
   ========================================================================== */
.tryon__rate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--t-line);
    border-radius: 12px;
    background: var(--t-surface);
    /* Wchodzi z opoznieniem — najpierw wynik, dopiero potem pytanie o niego */
    animation: tryonRateIn 0.45s 0.55s cubic-bezier(.22, 1, .36, 1) both;
}
.tryon__rate[hidden] { display: none !important; }

@keyframes tryonRateIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.tryon__rate-q {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--t-text);
}

.tryon__stars { display: inline-flex; gap: 2px; }

.tryon__star {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    transition: transform 0.12s, background 0.12s;
}
.tryon__star:hover { background: var(--t-gold-faint); transform: scale(1.12); }
.tryon__star:focus-visible { outline: 2px solid var(--t-gold); outline-offset: 1px; }

.tryon__star svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: var(--t-gold);
    stroke-width: 1.5;
    stroke-linejoin: round;
    transition: fill 0.12s;
}
/* Klasa, nie :hover — przy najechaniu trzeba zapalic takze wszystkie
   gwiazdki PRZED wskazana, a CSS nie ma selektora poprzedniego rodzenstwa */
.tryon__star.on svg { fill: var(--t-gold); }

.tryon__rate-hint {
    font-size: 0.75rem;
    color: var(--t-muted);
    min-width: 5.5rem;
}

.tryon__rate.is-done {
    border-color: rgba(78, 195, 138, 0.4);
    background: rgba(78, 195, 138, 0.08);
}
.tryon__rate.is-done .tryon__rate-q { color: var(--t-ok); }
.tryon__rate.is-sending { opacity: 0.6; pointer-events: none; }

.tryon__result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.7rem;
    flex-wrap: wrap;
}

.tryon__download {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--t-gold-dim);
    border-radius: 999px;
    color: var(--t-gold);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.tryon__download:hover { background: var(--t-gold-faint); border-color: var(--t-gold); }

.tryon__download svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tryon__compare-hint { color: var(--t-muted); font-size: 0.74rem; }

/* --------------------------------------------------------------------------
   Powiekszenie wyniku (.tzoom)
   Wynik z API ma 1024x1280, a kadr w sekcji ~280 px. Dopiero w powiekszeniu
   widac fakture wlosow i linie ciecia — czyli to, po co uzytkownik tu przyszedl.
   -------------------------------------------------------------------------- */

.tzoom {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(12, 12, 20, 0.94);
    backdrop-filter: blur(6px);
    animation: tzoom-in 0.22s ease;
}
.tzoom[hidden] { display: none; }
@keyframes tzoom-in { from { opacity: 0; } to { opacity: 1; } }

.tzoom__x {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: grid;
    place-items: center;
    transition: background 0.15s ease;
}
.tzoom__x:hover { background: rgba(255, 255, 255, 0.12); }
.tzoom__x svg { width: 17px; height: 17px; stroke: #fff; stroke-width: 2; fill: none; }

.tzoom__compare {
    position: relative;
    --pos: 50%;
    height: min(78vh, 760px);
    aspect-ratio: 4 / 5;
    max-width: 92vw;
    border-radius: 14px;
    overflow: hidden;
    background: #1a1a24;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.tzoom__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tzoom__before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.tzoom__handle {
    position: absolute;
    top: 0; bottom: 0;
    left: var(--pos);
    width: 2px;
    margin-left: -1px;
    background: var(--t-gold);
    box-shadow: 0 0 14px rgba(200, 169, 110, 0.9);
    pointer-events: none;
}
.tzoom__handle::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 38px; height: 38px;
    transform: translate(-50%, -50%);
    border: 2px solid var(--t-gold);
    border-radius: 50%;
    background: rgba(12, 12, 20, 0.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8a96e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m9 7-5 5 5 5M15 7l5 5-5 5'/%3E%3C/svg%3E") center / 19px no-repeat;
}
.tzoom__slider {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
    -webkit-appearance: none;
    appearance: none;
    background: none;
}
.tzoom__slider::-webkit-slider-thumb { -webkit-appearance: none; width: 52px; height: 100%; }
.tzoom__slider::-moz-range-thumb { width: 52px; height: 100%; border: 0; background: transparent; }

/* Brak zdjecia wyjsciowego — sam wynik, bez suwaka */
.tzoom__compare.is-solo .tzoom__before,
.tzoom__compare.is-solo .tzoom__handle,
.tzoom__compare.is-solo .tzoom__slider { display: none; }

.tzoom__bar {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 92vw;
}
.tzoom__name { font-size: 0.82rem; color: rgba(245, 242, 234, 0.75); text-align: center; }
.tzoom__dl {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.25rem;
    border-radius: 999px;
    border: 1px solid rgba(200, 169, 110, 0.5);
    color: var(--t-gold);
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.tzoom__dl:hover { background: rgba(200, 169, 110, 0.14); border-color: var(--t-gold); }
.tzoom__dl svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; }

@media (max-width: 760px) {
    .tzoom { padding: 0.9rem; gap: 0.75rem; }
    .tzoom__compare { height: auto; width: 100%; max-height: 74vh; }
    .tzoom__x { top: 0.6rem; right: 0.6rem; width: 36px; height: 36px; }
}

/* --------------------------------------------------------------------------
   Zlacza miedzy krokami
   -------------------------------------------------------------------------- */

.tryon__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    align-self: center;
    /* Kolumny krokow maja identyczna wysokosc (miniatura 21:9 siedzi wewnatrz
       ramki), wiec zwykle wysrodkowanie trafia w os ramek. */
    min-height: 140px;
}

.tryon__wire {
    flex: 1 1 auto;
    width: 1px;
    min-height: 14px;
    background-image: linear-gradient(to bottom, var(--t-gold-dim) 55%, transparent 0);
    background-size: 1px 9px;
    background-repeat: repeat-y;
    opacity: 0.8;
}

.tryon.is-working .tryon__wire {
    animation: tryon-wire 0.85s linear infinite;
}

@keyframes tryon-wire {
    from { background-position-y: 0; }
    to   { background-position-y: 9px; }
}

.tryon__node {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1px solid var(--t-gold-dim);
    background: rgba(19, 19, 30, 0.75);
    color: var(--t-gold);
}

.tryon__node--plus { width: 30px; height: 30px; }

.tryon__node--plus svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: var(--t-gold);
    stroke-width: 2;
    stroke-linecap: round;
}

.tryon__node--ai {
    position: relative;
    width: 52px;
    height: 52px;
    border-color: var(--t-gold);
    background:
        radial-gradient(circle at 35% 30%, rgba(200, 169, 110, 0.32), transparent 60%),
        rgba(19, 19, 30, 0.9);
    box-shadow: 0 0 22px rgba(200, 169, 110, 0.22);
}

.tryon__node-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--t-gold);
}

/* Rozchodzace sie pierscienie — spokojne w spoczynku, szybsze przy pracy */
.tryon__ring {
    position: absolute;
    inset: -1px;
    border: 1px solid var(--t-gold);
    border-radius: 50%;
    opacity: 0;
    animation: tryon-ring 3.4s ease-out infinite;
}

.tryon__ring:nth-child(2) { animation-delay: 1.7s; }

.tryon.is-working .tryon__ring { animation-duration: 1.5s; }
.tryon.is-working .tryon__ring:nth-child(2) { animation-delay: 0.75s; }

@keyframes tryon-ring {
    0%   { transform: scale(1);   opacity: 0.55; }
    100% { transform: scale(2.1); opacity: 0;    }
}

.tryon.is-working .tryon__node--ai {
    animation: tryon-node-breathe 1.5s ease-in-out infinite;
}

@keyframes tryon-node-breathe {
    0%, 100% { box-shadow: 0 0 22px rgba(200, 169, 110, 0.22); }
    50%      { box-shadow: 0 0 34px rgba(200, 169, 110, 0.5); }
}

/* --------------------------------------------------------------------------
   Akcja, postep, komunikaty
   -------------------------------------------------------------------------- */

.tryon__action {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: clamp(1.4rem, 3vw, 2rem);
}

.tryon__cta {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-width: 15rem;
    padding: 0.95rem 2rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #d8bc82, var(--t-gold) 55%, #b08d4f);
    color: #16161f;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 26px rgba(200, 169, 110, 0.26);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.tryon__cta:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(200, 169, 110, 0.36);
}

.tryon__cta:active:not(:disabled) { transform: translateY(0); }

.tryon__cta:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    box-shadow: none;
}

.tryon__cta-spin {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(22, 22, 31, 0.28);
    border-top-color: #16161f;
    border-radius: 50%;
    animation: tryon-spin 0.75s linear infinite;
}

.tryon.is-working .tryon__cta-spin { display: block; }

@keyframes tryon-spin { to { transform: rotate(360deg); } }

.tryon__cta-meta { color: var(--t-muted); font-size: 0.8rem; }

.tryon__progress { margin-top: 1.35rem; }

.tryon__bar {
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.tryon__bar-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--t-gold-dim), var(--t-gold));
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.tryon__phases {
    display: flex;
    gap: 1.6rem;
    flex-wrap: wrap;
    margin: 0.85rem 0 0;
    padding: 0;
    list-style: none;
}

.tryon__phases li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--t-muted);
    font-size: 0.8rem;
    transition: color 0.3s ease;
}

.tryon__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.tryon__phases li.is-active { color: var(--t-text); }
.tryon__phases li.is-active .tryon__dot {
    background: var(--t-gold);
    box-shadow: 0 0 0 4px rgba(200, 169, 110, 0.16);
}

.tryon__phases li.is-done { color: rgba(245, 242, 234, 0.6); }
.tryon__phases li.is-done .tryon__dot { background: var(--t-ok); }

.tryon__error {
    margin: 1rem 0 0;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(214, 48, 49, 0.35);
    border-radius: 10px;
    background: rgba(214, 48, 49, 0.10);
    color: #ffb4b4;
    font-size: 0.85rem;
}

/* Turnstile — renderowany tylko, gdy klucz jest ustawiony w panelu */
.tryon__captcha {
    margin-top: 1.25rem;
    max-width: 22rem;
}

/* --- Wskazowki do zdjecia --- */

.tryon__tips {
    margin-top: 1.5rem;
    border-top: 1px solid var(--t-line);
    padding-top: 1rem;
}

.tryon__tips summary {
    cursor: pointer;
    color: var(--t-gold);
    font-size: 0.82rem;
    font-weight: 600;
    list-style: none;
}

.tryon__tips summary::-webkit-details-marker { display: none; }

.tryon__tips summary::before {
    content: "+";
    display: inline-block;
    width: 1.1em;
    font-weight: 700;
}

.tryon__tips[open] summary::before { content: "–"; }

.tryon__tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem 2rem;
    margin-top: 1rem;
}

.tryon__tips-col h3 {
    margin: 0 0 0.5rem;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tryon__tips-col--do h3   { color: var(--t-ok); }
.tryon__tips-col--dont h3 { color: #e08b8b; }

.tryon__tips-col ul { margin: 0; padding: 0; list-style: none; }

.tryon__tips-col li {
    position: relative;
    padding-left: 1.3rem;
    margin-bottom: 0.4rem;
    color: var(--t-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.tryon__tips-col li::before {
    position: absolute;
    left: 0;
    top: -1px;
    font-weight: 700;
}

.tryon__tips-col--do li::before   { content: "✓"; color: var(--t-ok); }
.tryon__tips-col--dont li::before { content: "✕"; color: #e08b8b; }

/* --------------------------------------------------------------------------
   Responsywnosc
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .tryon__flow { grid-template-columns: 1fr 40px 1fr 56px 1fr; }
    .tryon__node--ai { width: 44px; height: 44px; }
}

/* Ponizej 780 px uklad poziomy przestaje sie miescic — kroki ida w kolumne,
   a zlacza obracaja sie o 90 stopni. Ta sama historia, inny kierunek. */
@media (max-width: 780px) {
    .tryon {
        margin-inline: -0.75rem;
        border-radius: 18px;
    }

    .tryon__flow {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .tryon__step { max-width: 22rem; width: 100%; margin-inline: auto; }

    .tryon__frame { aspect-ratio: 1 / 1; }

    .tryon__link {
        flex-direction: row;
        min-height: 0;
        padding: 0.9rem 0;
        width: 100%;
        max-width: 22rem;
        margin-inline: auto;
    }

    .tryon__wire {
        width: auto;
        height: 1px;
        min-height: 0;
        min-width: 20px;
        background-image: linear-gradient(to right, var(--t-gold-dim) 55%, transparent 0);
        background-size: 9px 1px;
        background-repeat: repeat-x;
    }

    .tryon.is-working .tryon__wire { animation-name: tryon-wire-h; }

    @keyframes tryon-wire-h {
        from { background-position-x: 0; }
        to   { background-position-x: 9px; }
    }

    .tryon__cta { width: 100%; }
    .tryon__cta-meta { width: 100%; text-align: center; }
    .tryon__phases { gap: 0.9rem 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
    .tryon *,
    .tryon *::before,
    .tryon *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .tryon__glow { animation: none; }
}
