.beneficiary-profile {
    --profile-green: #4f8508;
    --profile-green-dark: #315d32;
    --profile-green-soft: #edf6e4;
    --profile-ink: #203029;
    --profile-muted: #66736c;
    --profile-line: #dfe8df;
    padding: 30px 0 68px;
    color: var(--profile-ink);
    background:
        radial-gradient(circle at 8% 5%, rgba(143, 190, 72, .14), transparent 28rem),
        linear-gradient(180deg, #fbfdf9 0, #fff 38rem);
}

.beneficiary-profile *,
.beneficiary-profile *::before,
.beneficiary-profile *::after { box-sizing: border-box; }
.beneficiary-profile .tz-gallery { padding: 0; }

.profile-wrap { width: min(1160px, calc(100% - 32px)); margin: 0 auto; }
.profile-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--profile-green-dark); font-weight: 700; text-decoration: none; }
.profile-back:hover { color: var(--profile-green); text-decoration: none; }

.profile-hero,
.profile-section {
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--profile-line);
    border-radius: 26px;
    box-shadow: 0 18px 55px rgba(45, 78, 55, .09);
}

.profile-hero { display: grid; grid-template-columns: minmax(220px, .65fr) minmax(0, 1.35fr); gap: 38px; padding: 34px; overflow: hidden; }
.profile-photo-wrap { min-width: 0; }
.profile-photo-media { position: relative; }
.profile-photo-link { display: block; border-radius: 22px; overflow: hidden; background: var(--profile-green-soft); box-shadow: 0 16px 38px rgba(39, 67, 46, .16); }
.beneficiary-profile .profile-photo-link img.profile-photo { display: block; width: 100%; max-width: none; aspect-ratio: 1 / 1; margin: 0; border: 0; border-radius: 0; object-fit: cover; }
.profile-photo-hint { position: absolute; right: 14px; bottom: 14px; padding: 8px 11px; border-radius: 999px; background: rgba(24, 39, 31, .78); color: #fff; font-size: 13px; backdrop-filter: blur(6px); }
.profile-gallery-jump { display: flex; width: 100%; margin-top: 13px; padding: 12px 16px; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--profile-green-dark); border-radius: 13px; background: var(--profile-green-dark); color: #fff !important; font-weight: 800; text-decoration: none !important; transition: background .2s ease, transform .2s ease; }
.profile-gallery-jump span { padding: 3px 7px; border-radius: 999px; background: rgba(255, 255, 255, .16); font-size: 11px; }
.profile-gallery-jump:hover { background: var(--profile-green); transform: translateY(-1px); }

.profile-summary { align-self: center; min-width: 0; }
.profile-kicker { margin: 0 0 8px; color: var(--profile-green); font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.profile-title { margin: 0 0 22px; color: var(--profile-ink); font-size: clamp(32px, 5vw, 54px); line-height: 1.05; font-weight: 800; overflow-wrap: anywhere; }


.profile-facts { display: grid; gap: 10px; margin: 0 0 20px; }
.profile-fact { display: grid; grid-template-columns: minmax(110px, 145px) minmax(0, 1fr); gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--profile-line); }
.profile-fact dt { color: var(--profile-muted); font-size: 14px; font-weight: 700; }
.profile-fact dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.profile-fact dd > :last-child { margin-bottom: 0; }

.profile-goal { margin-top: 20px; padding: 20px 22px; border-left: 5px solid var(--profile-green); border-radius: 0 18px 18px 0; background: linear-gradient(135deg, var(--profile-green-soft), #f8fbf4); }
.profile-goal-label { display: block; margin-bottom: 7px; color: var(--profile-green-dark); font-size: 13px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.profile-goal-content { line-height: 1.65; overflow-wrap: anywhere; }
.profile-goal-content > :last-child { margin-bottom: 0; }

.profile-section { margin-top: 24px; padding: 34px; }
#profile-gallery { scroll-margin-top: 18px; }
.profile-section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.profile-section-icon { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 13px; background: var(--profile-green-soft); color: var(--profile-green-dark); font-size: 20px; }
.profile-section h2 { margin: 0; color: var(--profile-ink); font-size: clamp(23px, 3vw, 30px); font-weight: 800; }
.profile-description { font-size: 17px; line-height: 1.82; overflow-wrap: anywhere; }
.profile-description p { margin-bottom: 1.15em; }
.profile-description img,
.profile-description video,
.profile-description iframe { max-width: 100%; height: auto; }
.profile-description a { overflow-wrap: anywhere; }
.profile-description table { display: block; max-width: 100%; overflow-x: auto; }
.profile-description > :last-child { margin-bottom: 0; }

.profile-history { display: grid; gap: 16px; }
.profile-year { display: block; }
.profile-year-label { width: 100%; padding: 15px 17px; border: 1px solid var(--profile-green-dark); border-radius: 14px; background: var(--profile-green-dark); color: #fff; text-align: left; font-size: 17px; font-weight: 800; box-shadow: 0 7px 18px rgba(49, 93, 50, .14); }
.profile-year-toggle { display: grid; width: 100%; grid-template-columns: auto 1fr auto; gap: 13px; padding: 15px 17px; align-items: center; border: 1px solid var(--profile-line); border-radius: 14px; background: #f7faf5; color: var(--profile-green-dark); text-align: left; cursor: pointer; transition: border-color .2s ease, background .2s ease; }
.profile-year-toggle strong { font-size: 17px; }
.profile-year-toggle small { color: var(--profile-muted); }
.profile-year-toggle > span { font-size: 24px; line-height: 1; transition: transform .2s ease; }
.profile-year-toggle[aria-expanded="true"] { border-color: #b9cfae; background: var(--profile-green-soft); }
.profile-year-toggle[aria-expanded="true"] > span { transform: rotate(180deg); }
.profile-year .profile-events { margin: 14px 0 4px; }
.profile-events { position: relative; display: grid; gap: 12px; padding-left: 23px; }
.profile-events[hidden] { display: none !important; }.profile-events::before { content: ''; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--profile-line); }
.profile-event { position: relative; padding: 15px 17px; border: 1px solid var(--profile-line); border-radius: 15px; background: #fbfcfa; line-height: 1.6; }
.profile-event::before { content: ''; position: absolute; left: -23px; top: 21px; width: 12px; height: 12px; border: 3px solid #fff; border-radius: 50%; background: var(--profile-green); box-shadow: 0 0 0 1px var(--profile-green); }
.profile-event-month { display: inline-block; margin-bottom: 5px; color: var(--profile-green-dark); font-size: 12px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.profile-event p { margin: 0; }

.profile-gallery { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.profile-gallery-item { position: relative; display: block; flex: 0 0 calc((100% - 48px) / 4); aspect-ratio: 1 / 1; overflow: hidden; border-radius: 18px; background: var(--profile-green-soft); box-shadow: 0 8px 24px rgba(42, 69, 49, .11); }
.beneficiary-profile .profile-gallery .profile-gallery-item img { display: block; width: 100%; max-width: none; height: 100%; margin: 0; border: 0; border-radius: 0; object-fit: cover; transition: transform .35s ease; }
.profile-gallery-item::after { content: 'Powiększ'; position: absolute; right: 10px; bottom: 10px; padding: 6px 9px; border-radius: 999px; background: rgba(24, 39, 31, .74); color: #fff; font-size: 12px; opacity: 0; transform: translateY(5px); transition: .25s; }
.profile-gallery-item:hover img { transform: scale(1.045); }
.profile-gallery-item:hover::after { opacity: 1; transform: translateY(0); }

.profile-back-top { position: fixed; z-index: 1035; right: max(14px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); display: grid; width: 100px; height: 100px; padding: 0; place-items: center; overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .2s ease, visibility .2s ease, transform .2s ease; }
.profile-back-top img { display: block; width: 100%; max-width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.profile-back-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.profile-back-top:hover { transform: translateY(-2px); }
@media (max-width: 900px) {
    .beneficiary-profile { padding-top: 20px; }
    .profile-hero { grid-template-columns: minmax(210px, .65fr) minmax(0, 1.35fr); gap: 25px; padding: 24px; }
    .profile-gallery-item { flex-basis: calc((100% - 32px) / 3); }
}

@media (max-width: 700px) {
    .profile-wrap { width: min(100% - 22px, 580px); }
    .profile-hero { grid-template-columns: 1fr; gap: 25px; padding: 16px; border-radius: 20px; }
    .profile-photo-wrap { width: 70%; max-width: 364px; margin: 0 auto; }
    .profile-gallery-item { flex-basis: calc((100% - 16px) / 2); }
    .profile-summary { padding: 2px 5px 10px; }
    .profile-title { margin-bottom: 17px; }
    .profile-section { margin-top: 16px; padding: 22px 17px; border-radius: 20px; }
    .profile-fact { grid-template-columns: 1fr; gap: 4px; }
    .profile-goal { padding: 17px; }
    .profile-events { padding-left: 19px; }
    .profile-event::before { left: -19px; }
    .profile-description { font-size: 16px; line-height: 1.72; }
}

@media (max-width: 440px) {
    .beneficiary-profile { padding-bottom: 42px; }
    .profile-wrap { width: min(100% - 16px, 420px); }
    .profile-back-top { right: 8px; bottom: 10px; width: 84px; height: 84px; }
    .profile-gallery { gap: 12px; }
    .profile-gallery-item { flex-basis: calc((100% - 12px) / 2); }
    .profile-section-heading { align-items: flex-start; }
    .profile-photo-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .profile-gallery-item img,
    .profile-gallery-item::after,
    .profile-gallery-jump,
    .profile-year-toggle,
    .profile-year-toggle > span,
    .profile-back-top { transition: none; }
}
