/* ============================================
   GRID
   ============================================ */

.jobs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

/* ============================================
   JOB CARD — base
   ============================================ */

.job-card {
    position: relative;
    aspect-ratio: 4 / 5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.3s ease;
    cursor: pointer;
}

.job-card.is-visible {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

/* Zoom tła na hover — przez osobny div, nie background na article */
.job-card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    transition: transform 0.4s ease;
    z-index: 0;
}

.job-card.is-visible .job-card-bg {
    transform: scale(1.08);
}

/* ============================================
   TOP BAND — pills ticker
   ============================================ */

.job-card-band-top {
    position: relative;
    z-index: 10;
    height: 42px;
    display: flex;
    align-items: center;
    background-color: var(--color-secondary);
    overflow: hidden;
}

.job-card-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    white-space: nowrap;
    will-change: transform;
    padding-left: 10px;
}

.job-card-pill {
    font-family: var(--font-condensed);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: var(--color-primary);
    border-radius: 3px;
    padding: 2px 7px;
    white-space: nowrap;
    line-height: 1.4;
    flex-shrink: 0;
}

/* ============================================
   SALARY — top-right, ukośna lewa krawędź
   ============================================ */

.job-card-salary-wrap {
    position: absolute;
    top: 42px;
    right: 0;
    z-index: 10;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.job-card-salary {
    position: relative;
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 14px 0 4px;
    background-color: var(--color-primary);
}

.job-card-salary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -44px;
    border-top: 44px solid var(--color-primary);
    border-left: 44px solid transparent;
}

.job-card-salary-text {
    font-family: var(--font-condensed);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   INFO WRAP — lokalizacja + opis, jeden animowany blok
   ============================================ */

/*
 * Stan domyślny: translateY(var(--desc-h)) — opis schowany pod tytułem,
 * lokalizacja widoczna nad tytułem.
 * is-visible: translateY(0) — cały blok jedzie w górę,
 * opis wyjeżdża spod tytułu.
 * --desc-h ustawiane przez JS przy init każdej karty.
 */
.job-card-info-wrap {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 100%;
    z-index: 14;
    transform: translateY(var(--desc-h, 100%));
    transition: transform 0.35s ease;
}

.job-card.is-visible .job-card-info-wrap {
    transform: translateY(0);
}

/* ── Lokalizacja ── */

.job-card-location {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 8px 0 8px 14px;
    max-width: 65%;
    background-color: var(--color-secondary);
}

/* Ukośna prawa krawędź */
.job-card-location::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -56px;
    border-bottom: 56px solid var(--color-secondary);
    border-right: 56px solid transparent;
}

/* Flaga pojedyncza — kółko wystające poza blok po prawej */
.job-card-flag {
    position: absolute;
    right: -38px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--color-secondary);
    overflow: hidden;
    z-index: 15;
    background: var(--color-secondary);
    flex-shrink: 0;
}

.job-card-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* ── Flagi wielokrajowe — rząd flag z podpisami, wystający górą ── */

.job-card-flags-row {
    position: absolute;
    top: 6px;
    left: 14px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    z-index: 15;
}

.job-card-flag-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding-right: 8px;
    border-right: 1px solid #2f2b7f;
}

.job-card-flag-more-item {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 3px;
}

.job-card-flag-item:last-child {
    border-right: none;
}

.job-card-flag-item img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--color-secondary);
    object-fit: cover;
    display: block;
}

.job-card-flag-item-label {
    display: block;
    font-family: var(--font-condensed);
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
    margin-top: 2px;
    opacity: 0.82;
}

.job-card-flag-item-more-label {
    display: block;
    font-family: var(--font-condensed);
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
    margin-top: 2px;
    opacity: 0.82;
}

/* Kółko "+N" — ten sam rozmiar co flaga */
.job-card-flag-more {
    height: 26px;
    width: fit-content;
    border-radius: 6px;
    border: 2px solid var(--color-secondary);
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: start;
    padding: 6px 8px 6px 6px;
    flex-shrink: 0;
}

.job-card-flag-more-label {
    font-family: var(--font-condensed);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

/* ── Tekst lokalizacji ── */

.job-card-location-text {
    font-family: var(--font-condensed);
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.35;
    min-width: 0;
    overflow: hidden;
}

.job-card-location-line1 {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-card-location-line2 {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    opacity: 0.82;
}

/* ── Opis overlay ── */

.job-card-desc-overlay {
    width: 100%;
    background-color: var(--color-secondary);
    border-radius: 0 10px 0 0;
}

.job-card-desc-text {
    margin: 0;
    padding: 10px 16px 12px;
    font-family: var(--font-condensed);
    font-size: 14px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.88);
}

/* ============================================
   TITLE BAND — bottom, ukośna prawa krawędź
   ============================================ */

.job-card-title-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    z-index: 16;
    overflow: visible;
}

.job-card-title-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--color-primary);
    z-index: -1;
    transition: background-color 0.3s ease;
}

.job-card-title-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: -70px;
    border-top: 70px solid var(--color-primary);
    border-right: 70px solid transparent;
    transition: border-top-color 0.3s ease;
}

.job-card.is-visible .job-card-title-wrap::before {
    background-color: var(--color-primary-dark);
}

.job-card.is-visible .job-card-title-wrap::after {
    border-top-color: var(--color-primary-dark);
}

.job-card-title {
    margin: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 14px;
}

.job-card-title-link {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-decoration: none;
    font-family: var(--font-condensed);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
}

.job-card-title-link:hover,
.job-card-title-link:focus {
    text-decoration: none;
    color: #fff;
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton-container {
    display: none;
    margin-bottom: 24px;
}

.skeleton-container.is-loading {
    display: block;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.job-card-skeleton {
    position: relative;
    aspect-ratio: 4 / 5;
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    border-radius: 8px;
    overflow: hidden;
    animation: hirvu-skeleton-pulse 1.5s ease-in-out infinite;
}

.job-card-skeleton::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(227, 10, 108, 0.3);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: hirvu-spinner 0.8s linear infinite;
}

@keyframes hirvu-skeleton-pulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes hirvu-spinner {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1000px) {
    .jobs-grid,
    .skeleton-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 690px) {
    .jobs-grid,
    .skeleton-grid {
        grid-template-columns: 1fr;
    }

    .job-card-salary-text {
        font-size: 15px;
    }
}