:root {
    --testimony-orange: var(--brand-orange, #ffa700);
    --testimony-orange-dark: var(--brand-orange-dark, #ff8100);
    --testimony-orange-soft: rgba(255, 167, 0, 0.13);

    --testimony-text: var(--text-color, #333333);
    --testimony-muted: var(--text-muted, #777777);
    --testimony-bg: #fcfcfc;

    --testimony-card: var(--card-bg, #ffffff);
    --testimony-border: var(--border-soft, #e8e4dd);
    --testimony-shadow: var(--shadow-sm, 0 8px 28px rgba(46, 36, 20, 0.09));
    --testimony-radius: var(--radius-lg, 16px);
}

/* Wszystkie style są ograniczone do komponentu świadectwa.
   Arkusz może być bezpiecznie dołączony do głównej aplikacji SPA. */
.testimony-page {
    width: min(100%, 820px);
    margin: 0 auto;
    padding: 8px 0 18px;
    color: var(--testimony-text);
    font-family: "Roboto", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.testimony-page,
.testimony-page *,
.testimony-page *::before,
.testimony-page *::after {
    box-sizing: border-box;
}

/* Powrót do strony głównej */
.testimony-back {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    margin: 0 0 18px 2px;
    padding: 7px 13px;
    border: 1px solid rgba(255, 129, 0, 0.20);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: #a95a00;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.035);
    transition: background-color 160ms ease, border-color 160ms ease,
                color 160ms ease, transform 160ms ease;
}

.testimony-back span {
    display: inline-block;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    transition: transform 160ms ease;
}

.testimony-back:hover {
    border-color: rgba(255, 129, 0, 0.48);
    background: #fff7e9;
    color: #8b4900;
    transform: translateY(-1px);
}

.testimony-back:hover span {
    transform: translateX(-2px);
}

.testimony-back:focus-visible,
.testimony-home-link:focus-visible,
.testimony-source a:focus-visible {
    outline: 3px solid rgba(255, 129, 0, 0.45);
    outline-offset: 3px;
}

/* Karta treści */
.testimony-card {
    position: relative;
    overflow: hidden;
    padding: clamp(26px, 5vw, 54px) clamp(22px, 6vw, 62px);
    border: 1px solid var(--testimony-border);
    border-radius: var(--testimony-radius);
    background: var(--testimony-card);
    box-shadow: var(--testimony-shadow);
}

.testimony-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--testimony-orange), var(--testimony-orange-dark));
    content: "";
}

.testimony-eyebrow {
    margin: 0 0 13px;
    color: var(--testimony-orange-dark);
    font-family: "Roboto Condensed", "Roboto", sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3px;
    line-height: 1.5;
    text-transform: uppercase;
}

.testimony-title {
    margin: 0;
    color: #292722;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(30px, 5vw, 43px);
    font-weight: 700;
    letter-spacing: -0.45px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.testimony-meta {
    display: inline-flex;
    align-items: center;
    margin-top: 18px;
    padding: 6px 11px;
    border: 1px solid rgba(255, 167, 0, 0.22);
    border-radius: 999px;
    background: var(--testimony-orange-soft);
    color: #8c5b12;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.testimony-text {
    margin-top: 28px;
    color: #3d3b37;
    font-size: 17px;
    line-height: 1.8;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

.testimony-text br + br {
    content: "";
    display: block;
    margin-top: 0.7em;
}

/* Opcjonalne źródło świadectwa */
.testimony-source {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 12px;
    margin-top: 34px;
    padding-top: 19px;
    border-top: 1px solid var(--testimony-border);
    color: var(--testimony-muted);
    font-size: 13px;
    line-height: 1.5;
}

.testimony-source span {
    font-weight: 500;
}

.testimony-source a,
.testimony-home-link {
    color: #a95a00;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgba(255, 129, 0, 0.45);
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
    transition: color 150ms ease, text-decoration-color 150ms ease;
}

.testimony-source a:hover,
.testimony-home-link:hover {
    color: var(--testimony-orange-dark);
    text-decoration-color: currentColor;
}

/* Strona błędu generowana przez page_error() */
.testimony-error {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 0;
}

.testimony-error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    border: 1px solid rgba(190, 45, 45, 0.18);
    border-radius: 50%;
    background: rgba(190, 45, 45, 0.08);
    color: #b3261e;
    font-family: "Roboto", Arial, sans-serif;
    font-size: 25px;
    font-weight: 700;
    line-height: 1;
}

.testimony-error h1 {
    margin: 0 0 10px;
    color: #292722;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(25px, 4vw, 34px);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.testimony-error p {
    margin: 0;
    color: var(--testimony-muted);
    font-size: 15px;
    line-height: 1.7;
    text-align: left;
    overflow-wrap: anywhere;
}

.testimony-home-link {
    display: inline-block;
    margin-top: 22px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 129, 0, 0.25);
    border-radius: var(--radius-md);
    background: #fff8ed;
    text-decoration: none;
}

.testimony-home-link:hover {
    border-color: rgba(255, 129, 0, 0.5);
    background: #fff1d9;
}

@media (max-width: 600px) {
    .testimony-page {
        width: 100%;
        padding: 4px 0 14px;
        font-size: 15px;
    }

    .testimony-back {
        margin-bottom: 13px;
    }

    .testimony-card {
        padding: 29px 21px 27px;
        border-radius: var(--radius-lg);
    }

    .testimony-eyebrow {
        margin-bottom: 12px;
        font-size: 10px;
        letter-spacing: 1.5px;
    }

    .testimony-title {
        font-size: clamp(28px, 8vw, 36px);
        letter-spacing: -0.25px;
        line-height: 1.22;
    }

    .testimony-meta {
        margin-top: 15px;
    }

    .testimony-text {
        margin-top: 22px;
        font-size: 16px;
        line-height: 1.8;
    }

    .testimony-source {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        margin-top: 27px;
        padding-top: 16px;
    }
}

@media (max-width: 360px) {
    .testimony-page {
        padding-right: 0;
        padding-left: 0;
    }

    .testimony-card {
        padding-right: 17px;
        padding-left: 17px;
    }

    .testimony-text {
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .testimony-page,
    .testimony-page *,
    .testimony-page *::before,
    .testimony-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
