/* ============================================================
   PM-UI.CSS: wspólna warstwa wyglądu dla wszystkich stron
   (nagłówek, przycisk logowania, stopka, przyciski, pola, okna).
   Ładowane po styles.css (i po landing.css na stronie głównej).
   ============================================================ */

:root {
    --ink: #0B1220;
    --ink-2: #1E293B;
    --muted: #64748B;
    --line: #E2E8F0;
    --paper: #FFFFFF;
    --bg: #F6F8FC;
    --blue: #2563EB;
    --blue-d: #1D4ED8;
    --violet: #7C3AED;
    --cyan: #06B6D4;
    --amber: #F59E0B;
    --green: #16A34A;
    --grad: linear-gradient(100deg, #2563EB 0%, #7C3AED 55%, #06B6D4 100%);
    --ease: cubic-bezier(.22, 1, .36, 1);
    --r-lg: 28px;
    --r-md: 18px;
    --shadow-1: 0 1px 2px rgba(11, 18, 32, .04), 0 8px 24px rgba(11, 18, 32, .06);
    --shadow-2: 0 2px 6px rgba(11, 18, 32, .05), 0 24px 60px rgba(11, 18, 32, .10);
    --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-head: 'Sora', 'Manrope', -apple-system, sans-serif;
}

/* scroll-behavior: smooth ze styles.css psuł przeliczanie pozycji ScrollTriggera
   (jego wewnętrzne skoki scrolla stawały się animacjami). Płynność daje Lenis. */
html:has(body.pm) { overflow-x: clip; scroll-behavior: auto !important; }

body.pm {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--bg);
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
}

body.pm h1, body.pm h2, body.pm h3 {
    font-family: var(--font-head);
    letter-spacing: -0.025em;
}

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* Stara nawigacja z styles.css nie występuje już w HTML, ale na wszelki wypadek */
body.pm .navbar { display: none !important; }

/* ============================================================
   TŁO-KAMERA (pm-journey.js)
   ============================================================ */
.pm-stage {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.pm-stage canvas { display: block; width: 100%; height: 100%; }

.pmh { position: fixed; z-index: 1000; }

/* ============================================================
   NAGŁÓWEK
   ============================================================ */
.pmh {
    top: 0;
    left: 0;
    right: 0;
    padding: 14px 16px 0;
    pointer-events: none;
    transition: transform .55s var(--ease);
}

.pmh.is-hidden { transform: translateY(-130%); }

.pmh-bar {
    pointer-events: auto;
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    height: 64px;
    padding: 0 10px 0 22px;
    display: flex;
    align-items: center;
    gap: 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background .4s ease, border-color .4s ease, box-shadow .4s ease, max-width .6s var(--ease);
}

.pmh.is-scrolled .pmh-bar,
.pmh.is-solid .pmh-bar {
    background: rgba(255, 255, 255, .78);
    border-color: rgba(255, 255, 255, .9);
    box-shadow: 0 10px 40px rgba(11, 18, 32, .10), inset 0 0 0 1px rgba(11, 18, 32, .04);
    -webkit-backdrop-filter: saturate(1.6) blur(18px);
    backdrop-filter: saturate(1.6) blur(18px);
}

.pmh.is-scrolled .pmh-bar { max-width: 1040px; }

.pmh-logo { display: flex; align-items: center; flex-shrink: 0; }
.pmh-logo { height: 100%; overflow: hidden; }
.pmh-logo img { height: 92px; width: auto; display: block; margin: -14px 0 -14px -6px; }

.pmh-nav {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0 auto;
    padding: 4px;
    border-radius: 999px;
}

.pmh-pill {
    position: absolute;
    top: 4px;
    left: 0;
    height: calc(100% - 8px);
    width: 0;
    border-radius: 999px;
    background: var(--ink);
    opacity: 0;
    transition: transform .45s var(--ease), width .45s var(--ease), opacity .3s ease;
    z-index: 0;
}

.pmh-link {
    position: relative;
    z-index: 1;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 15px;
    color: var(--ink-2);
    text-decoration: none;
    transition: color .3s ease;
    white-space: nowrap;
}

.pmh-link.is-lit { color: #fff; }

.pmh-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pmh-actions .nav-auth { display: flex; opacity: 1 !important; visibility: visible !important; }

/* Przycisk "Zaloguj się" */
.pmh-login,
.pmh-user {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 46px;
    padding: 0 20px 0 6px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    overflow: hidden;
    isolation: isolate;
    transition: transform .3s var(--ease), box-shadow .3s ease;
}

.pmh-login::before,
.pmh-user::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--grad);
    transform: translateX(-101%);
    transition: transform .55s var(--ease);
    z-index: -1;
}

.pmh-login:hover::before,
.pmh-user:hover::before { transform: translateX(0); }

.pmh-login:hover,
.pmh-user:hover { box-shadow: 0 12px 30px rgba(79, 70, 229, .35); }

.pmh-login-ic,
.pmh-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--grad);
    color: #fff;
    flex-shrink: 0;
    transition: transform .55s var(--ease), background .3s ease;
}

.pmh-avatar { font-size: 13px; font-weight: 800; letter-spacing: .02em; }

.pmh-login:hover .pmh-login-ic { transform: rotate(-12deg) scale(1.05); background: rgba(255, 255, 255, .22); }
.pmh-user:hover .pmh-avatar { background: rgba(255, 255, 255, .22); }

.pmh-login-arrow {
    width: 14px;
    margin-left: -2px;
    transition: transform .4s var(--ease);
}

.pmh-login:hover .pmh-login-arrow { transform: translateX(4px); }

/* Burger */
.pmh-burger {
    display: none;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-1);
    cursor: pointer;
    position: relative;
}

.pmh-burger span {
    position: absolute;
    left: 14px;
    right: 14px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform .45s var(--ease), top .45s var(--ease);
}

.pmh-burger span:nth-child(1) { top: 18px; }
.pmh-burger span:nth-child(2) { top: 26px; }

.pmh.menu-open .pmh-burger span:nth-child(1) { top: 22px; transform: rotate(45deg); }
.pmh.menu-open .pmh-burger span:nth-child(2) { top: 22px; transform: rotate(-45deg); }

/* Menu mobilne */
.pmh-menu {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: -1;
    padding: 110px 28px 40px;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(600px 400px at 100% 0%, rgba(124, 58, 237, .22), transparent 60%),
        radial-gradient(500px 400px at 0% 100%, rgba(6, 182, 212, .2), transparent 60%),
        #F8FAFF;
    clip-path: circle(0% at calc(100% - 40px) 40px);
    transition: clip-path .7s var(--ease);
}

.pmh.menu-open .pmh-menu {
    pointer-events: auto;
    clip-path: circle(150% at calc(100% - 40px) 40px);
}

.pmh-menu-list { list-style: none; margin: 0; padding: 0; }

.pmh-menu-list li {
    overflow: hidden;
    border-bottom: 1px solid rgba(11, 18, 32, .08);
}

.pmh-menu-list a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 16px 0;
    font-family: var(--font-head);
    font-size: clamp(30px, 9vw, 44px);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ink);
    text-decoration: none;
    transform: translateY(110%);
    transition: transform .7s var(--ease);
    transition-delay: calc(.08s + var(--i, 0) * .06s);
}

.pmh-menu-list a small {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0;
}

.pmh.menu-open .pmh-menu-list a { transform: translateY(0); }

.pmh-menu-list li#navAuthMobile { display: block !important; }
.pmh-menu-list a.auth-link-mobile,
.pmh-menu-list #authLinkMobile,
.pmh-menu-list .logout-link-mobile {
    background: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 16px 0 !important;
    color: var(--blue) !important;
}

.pmh-menu-foot {
    margin-top: auto;
    font-size: 14px;
    color: var(--muted);
    opacity: 0;
    transition: opacity .5s ease .4s;
}

.pmh.menu-open .pmh-menu-foot { opacity: 1; }

/* Pasek postępu czytania */
.pmh-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--grad);
    transform-origin: 0 50%;
    transform: scaleX(0);
    pointer-events: none;
}

@media (max-width: 900px) {
    .pmh-nav { display: none; }
    .pmh-burger { display: block; }
    .pmh-bar { padding: 0 8px 0 18px; height: 60px; justify-content: space-between; }
    .pmh-logo img { height: 78px; margin: -9px 0 -9px -4px; }
    .pmh-actions .nav-auth { display: none; }
}

body.menu-open { overflow: hidden; }

/* ============================================================
   PRZYCISKI I ELEMENTY WSPÓLNE
   ============================================================ */
.pm-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 56px;
    padding: 0 30px;
    border: none;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    transition: transform .3s var(--ease), box-shadow .3s ease, opacity .2s ease;
}

.pm-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--grad);
    z-index: -1;
    transform: translateY(101%);
    transition: transform .5s var(--ease);
}

.pm-btn:hover::before { transform: translateY(0); }
.pm-btn:hover { box-shadow: 0 16px 40px rgba(79, 70, 229, .32); }
.pm-btn:disabled { opacity: .6; cursor: wait; }
.pm-btn svg { transition: transform .4s var(--ease); }
.pm-btn:hover svg { transform: translateX(4px); }

.pm-btn.is-grad { background: var(--grad); background-size: 200% 100%; }
.pm-btn.is-grad::before { background: var(--ink); }

.pm-btn.is-ghost {
    background: rgba(255, 255, 255, .7);
    color: var(--ink);
    box-shadow: inset 0 0 0 1.5px rgba(11, 18, 32, .12);
}

.pm-btn.is-ghost:hover { color: #fff; }

.pm-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .8);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .18);
    color: var(--blue-d);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pm-kicker::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--grad);
}

.pm-grad-text {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.pm-shell { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

.pm-page-hero {
    padding: 170px 0 70px;
    text-align: center;
}

.pm-page-hero h1 {
    margin: 22px auto 0;
    max-width: 900px;
    font-size: clamp(42px, 7vw, 92px);
    line-height: .98;
    font-weight: 800;
    letter-spacing: -0.045em;
}

.pm-page-hero p {
    margin: 24px auto 0;
    max-width: 620px;
    font-size: clamp(17px, 2vw, 20px);
    line-height: 1.6;
    color: var(--muted);
}

/* słowa w nagłówkach dzielone przez pm-ui.js */
.pm-w { display: inline-block; overflow: hidden; vertical-align: top; padding: .04em .02em .2em; margin: -.04em -.02em -.2em; }
.pm-wi { display: inline-block; will-change: transform; }

/* Karta "szkło" */
.pm-card {
    background: rgba(255, 255, 255, .86);
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
}

/* ============================================================
   POLA FORMULARZY
   ============================================================ */
body.pm .pm-field { position: relative; display: block; margin-bottom: 14px; }

body.pm .pm-field input,
body.pm .pm-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 26px 18px 10px;
    border: 1.5px solid var(--line);
    border-radius: 16px;
    background: #fff;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    transition: border-color .25s ease, box-shadow .25s ease;
    resize: vertical;
}

body.pm .pm-field textarea { min-height: 150px; }

body.pm .pm-field label {
    position: absolute;
    left: 19px;
    top: 18px;
    font-size: 16px;
    font-weight: 600;
    color: var(--muted);
    pointer-events: none;
    transform-origin: 0 0;
    transition: transform .3s var(--ease), color .3s ease;
}

body.pm .pm-field input:focus,
body.pm .pm-field textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

body.pm .pm-field input:focus + label,
body.pm .pm-field input:not(:placeholder-shown) + label,
body.pm .pm-field textarea:focus + label,
body.pm .pm-field textarea:not(:placeholder-shown) + label {
    transform: translateY(-11px) scale(.76);
    color: var(--blue);
}

/* autouzupełnianie przeglądarki: etykieta też idzie do góry */
body.pm .pm-field input:-webkit-autofill + label { transform: translateY(-11px) scale(.76); color: var(--blue); }
body.pm .pm-field input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #fff inset; }
body.pm .pm-field input { margin: 0; height: auto; min-height: 58px; line-height: 1.3; }
body.pm .pm-field textarea { margin: 0; line-height: 1.5; }

.pm-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 6px 0 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
    cursor: pointer;
}

.pm-check input {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    accent-color: var(--blue);
}

.pm-check a { color: var(--blue); font-weight: 700; }

.pm-msg {
    margin: 14px 0 0;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
}

.pm-msg.is-error { background: #FEF2F2; color: #B91C1C; }

body.pm .error-message {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #FEF2F2;
    color: #B91C1C;
    font-size: 14px;
    font-weight: 700;
    border: none;
}

body.pm .loading-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pmSpin .8s linear infinite;
}

@keyframes pmSpin { to { transform: rotate(360deg); } }

/* ============================================================
   OKNA (modal) – reset hasła, edycja profilu
   ============================================================ */
body.pm .modal {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(11, 18, 32, .5);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility 0s linear .3s;
}

body.pm .modal.active {
    opacity: 1;
    visibility: visible;
    transition: opacity .3s ease;
}

body.pm .modal-content {
    width: 100%;
    max-width: 460px;
    padding: 36px 32px 30px;
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 40px 100px rgba(11, 18, 32, .3);
    transform: translateY(24px) scale(.97);
    transition: transform .45s var(--ease);
}

body.pm .modal.active .modal-content { transform: none; }
body.pm .modal-content h2 { margin: 0 0 8px; font-size: 26px; }
body.pm .modal-content > p { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
body.pm .modal-buttons { display: flex; gap: 10px; margin-top: 8px; }
body.pm .modal-buttons .pm-btn { flex: 1; height: 52px; padding: 0 18px; }

/* ============================================================
   STOPKA
   ============================================================ */
body.pm .footer {
    position: relative;
    z-index: 1;
    margin-top: 40px;
    padding: 90px 0 40px;
    background: var(--ink);
    color: #CBD5E1;
    border-radius: 40px 40px 0 0;
    overflow: hidden;
}

body.pm .footer::before {
    content: 'Pomocnik Maturalny';
    position: absolute;
    left: 50%;
    bottom: -0.18em;
    transform: translateX(-50%);
    font-family: var(--font-head);
    font-weight: 800;
    font-size: clamp(60px, 12vw, 190px);
    letter-spacing: -0.05em;
    white-space: nowrap;
    color: transparent;
    -webkit-text-stroke: 1px rgba(148, 163, 184, .18);
    pointer-events: none;
}

body.pm .footer .container { max-width: 1180px; margin: 0 auto; padding: 0 24px 90px; position: relative; }
body.pm .footer-content { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; }
body.pm .footer-section h3 { color: #fff; font-size: 24px; margin: 0 0 12px; }
body.pm .footer-section h4 { color: #fff; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 16px; font-family: var(--font-body); }
body.pm .footer-section p { color: #94A3B8; line-height: 1.6; margin: 0; overflow-wrap: anywhere; }
body.pm .footer-section ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
body.pm .footer-section a { color: #CBD5E1; text-decoration: none; transition: color .2s ease; }
body.pm .footer-section a:hover { color: #fff; }

@media (max-width: 800px) {
    body.pm .footer { padding-top: 64px; border-radius: 28px 28px 0 0; }
    body.pm .footer-content { grid-template-columns: 1fr 1fr; gap: 32px 20px; }
    body.pm .footer-section:first-child { grid-column: 1 / -1; }
}

/* ============================================================
   DOSTĘPNOŚĆ
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .pmh-menu, .pmh-menu-list a, .pmh, .pmh-bar { transition: none !important; }
}

/* nagłówek jest fixed: pierwsza sekcja starszych podstron dostaje miejsce pod nim */
body.pm > .pmh + section:not(.hero-x):not(.pm-own-top) { padding-top: 120px; }

/* animacje GSAP zastępują przejścia CSS dla [data-reveal] */
.pm-motion [data-reveal] { transition: none !important; }

/* miękka poświata pod tekstem nagłówków stron, żeby tło-kamera nie zagłuszało treści */
.pm-page-hero .pm-shell {
    background: radial-gradient(closest-side, rgba(246, 248, 252, .82), rgba(246, 248, 252, 0));
}
