/**
 * Team Module Styles
 * 
 * Vertical portrait cards with full background photo and gradient overlay.
 * Visual pattern matches .news-grid-card--hero from the homepage.
 * Uses CSS variables from parent theme for brand consistency.
 * 
 * @package ANPCDEFP
 * @since 2.3.0
 */

/* ==================== SECTION LAYOUT ==================== */

.team-section {
    padding-bottom: 4rem;
}

/* Pagina echipei folosește toată lățimea coloanei principale
   (gridul de carduri are nevoie de spațiu, nu de coloana de text 800px) */
.team-section .page-main {
    max-width: none;
}

/* Sidebar-ul echipei e sticky (comportamentul standard .page-sidebar):
   meniul de departamente rămâne la îndemână în timpul derulării, ca să
   poți sări rapid de la un departament la altul. Listele mai lungi decât
   ecranul se derulează în interiorul sidebar-ului. */

.team-department {
    margin-bottom: 3rem;
}

.team-department:last-child {
    margin-bottom: 0;
}

/* ==================== DEPARTAMENT COLAPSABIL (<details>) ==================== */

.team-department {
    scroll-margin-top: 96px; /* ancoră sub headerul sticky */
}

@media (max-width: 960px) {
    .team-department {
        /* header fix (62) + banda sticky de chipsuri (~95) + respiro —
           altfel titlul departamentului aterizează ascuns sub bandă */
        scroll-margin-top: 172px;
    }
}

.team-department__summary {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    list-style: none;
    padding: 0.6rem 0;
    min-height: 44px;
    border-bottom: 1px solid var(--gray-200, #E8EAED);
    user-select: none;
}

.team-department__summary::-webkit-details-marker { display: none; }

.team-department__chevron {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--brand-primary-100, #F3EEFA);
    color: var(--brand-primary, #5C2D91);
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.team-department:not([open]) .team-department__chevron {
    transform: rotate(-90deg);
}

@media (prefers-reduced-motion: reduce) {
    .team-department__chevron { transition: none; }
}

/* Aliniat cu .cariera-section-title (stil unificat pe site) */
.team-department__title {
    font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary, #1A1A2E);
    line-height: 1.25;
}

.team-department__summary:hover .team-department__title {
    color: var(--brand-primary, #5C2D91);
}

.team-department__count {
    flex: none;
    margin-left: auto;
    padding: 0.2rem 0.75rem;
    border-radius: var(--radius-full, 999px);
    background: var(--brand-primary-100, #F3EEFA);
    color: var(--brand-primary, #5C2D91);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.team-department__body {
    padding-top: 1.5rem;
}

/* ==================== MENIU LATERAL DEPARTAMENTE ==================== */

/* Sub meniul contextual al secțiunii, blocul de departamente respira */
.page-sidebar .section-nav + .team-deptnav {
    margin-top: 2rem;
}

.team-deptnav__link {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.team-deptnav__name {
    min-width: 0;
}

.team-deptnav__count {
    flex: none;
    min-width: 26px;
    text-align: center;
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-full, 999px);
    background: var(--gray-100, #F1F3F4);
    color: var(--text-secondary, #4A4A68);
    font-size: 0.72rem;
    font-weight: 700;
}

.team-deptnav__link:hover .team-deptnav__count {
    background: var(--brand-primary-100, #F3EEFA);
    color: var(--brand-primary, #5C2D91);
}

/* „Arată mai mult” — doar pe mobil, când lista e limitată la 6 */
.team-deptnav__more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.9rem;
    min-height: 44px;
    border: 1px solid var(--gray-300, #DADCE0);
    border-radius: var(--radius-md, 8px);
    background: #fff;
    color: var(--text-secondary, #4A4A68);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.team-deptnav__more i {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.team-deptnav__more.is-open i {
    transform: rotate(180deg);
}

@media (max-width: 1024px) {
    .team-deptnav.is-clamped .team-deptnav__list > li:nth-child(n+7) {
        display: none;
    }
}

/* Pe desktop lista e mereu completă — butonul nu are ce căuta acolo */
@media (min-width: 1025px) {
    .team-deptnav__more {
        display: none !important;
    }
}

.team-role-group {
    margin-bottom: 2rem;
}

.team-role-group:last-child {
    margin-bottom: 0;
}

.team-role-group__title {
    font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
    font-size: 1.15rem;
    font-weight: 500;
    font-style: italic;
    color: var(--text-secondary, #4A4A68);
    margin: 0 0 1rem 0;
}

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

/* 3 pe rând, cu separare clară (px, ca să nu depindă de font-size-ul
   rădăcinii). Important: cardul NU are min-height/min-width — cu
   aspect-ratio, un minim pe o axă se transferă pe cealaltă și cardul
   ar ieși din coloana lui, peste gap. */
.team-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 28px;
    row-gap: 32px;
}

/* Pe desktop cardurile sunt mai mici (4 pe rând): fără datele de contact
   mereu la vedere, nu mai au nevoie de lățimea veche */
@media (min-width: 1025px) {
    .team-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        column-gap: 24px;
        row-gap: 28px;
    }
}

@media (max-width: 1024px) {
    .team-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 20px;
        row-gap: 24px;
    }
}

@media (max-width: 560px) {
    .team-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== CARD ==================== */

/* Poza pe tot fundalul + gradient negru jos — același limbaj vizual ca
   hero-cardurile de știri (Eurodesk / secțiunea Știri) */
.team-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    aspect-ratio: 3 / 4;
    min-height: 0; /* vezi nota de la .team-grid: minimul se transferă prin aspect-ratio */
    border-radius: var(--radius-2xl, 1rem);
    overflow: hidden;
    background-color: var(--gray-100, #F1F3F4);
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    /* Inel subtil: marginile cardului se citesc și când poza e la fel
       de deschisă ca fundalul paginii */
    box-shadow: 0 0 0 1px rgba(26, 26, 46, 0.07);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.team-card:hover {
    box-shadow: 0 0 0 1px rgba(26, 26, 46, 0.07), var(--shadow-lg, 0 10px 25px -5px rgba(0,0,0,0.15));
    transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
    .team-card,
    .team-card:hover { transition: none; transform: none; }
}

/* ==================== PLACEHOLDER (no photo) ==================== */

.team-card--no-photo {
    background-color: var(--gray-100, #F1F3F4);
    background-image: none !important;
}

.team-card__placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-300, #DADCE0);
    font-size: 4rem;
    z-index: 0;
}

/* ==================== OVERLAY ==================== */

.team-card__overlay {
    position: relative;
    z-index: 1;
    padding: 3.25rem 1.1rem 1.1rem;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.92) 0%,
        rgba(0, 0, 0, 0.72) 45%,
        rgba(0, 0, 0, 0.25) 75%,
        transparent 100%
    );
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.team-card--no-photo .team-card__overlay {
    background: linear-gradient(
        to top,
        rgba(92, 45, 145, 0.95) 0%,
        rgba(92, 45, 145, 0.8) 45%,
        rgba(92, 45, 145, 0.3) 70%,
        transparent 100%
    );
}

/* ==================== IDENTITY ==================== */

.team-card__identity {
    display: flex;
    flex-direction: column;
}

.team-card__name {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.team-card__first-name {
    font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
}

.team-card__last-name {
    font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.01em;
}

.team-card__first-name,
.team-card__last-name {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.team-card__position {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.35;
    margin-top: 0.2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* ==================== CONTACT ==================== */

.team-card__contact {
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.team-card__contact-inner {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

/* ---------- Desktop: contactul apare la hover ----------
   Implicit cardul arată doar identitatea (gradient mai scund, card mai
   aerisit); la hover/focus contactul se desface, iar un gradient mai
   înalt (pseudo-element, doar opacitate) ține textul lizibil pe poză.
   Pe touch și pe mobil, totul rămâne mereu vizibil, ca până acum. */
@media (min-width: 1025px) and (hover: hover) {
    .team-card__overlay {
        padding-top: 2.4rem;
    }

    .team-card__contact {
        display: grid;
        grid-template-rows: 0fr;
        opacity: 0;
        padding-top: 0;
        border-top-color: transparent;
        transition:
            grid-template-rows 0.25s cubic-bezier(0.22, 1, 0.36, 1),
            opacity 0.2s ease,
            padding-top 0.25s cubic-bezier(0.22, 1, 0.36, 1),
            border-top-color 0.2s ease;
    }

    .team-card__contact-inner {
        min-height: 0;
        overflow: hidden;
    }

    .team-card:hover .team-card__contact,
    .team-card:focus-within .team-card__contact {
        grid-template-rows: 1fr;
        opacity: 1;
        padding-top: 0.4rem;
        border-top-color: rgba(255, 255, 255, 0.18);
    }

    /* Gradientul mai înalt de la hover — strat propriu, animat pe opacitate */
    .team-card::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: 0;
        border-radius: inherit;
        background: linear-gradient(
            to top,
            rgba(0, 0, 0, 0.94) 0%,
            rgba(0, 0, 0, 0.72) 38%,
            rgba(0, 0, 0, 0.32) 62%,
            transparent 85%
        );
        opacity: 0;
        transition: opacity 0.25s ease;
        pointer-events: none;
    }

    .team-card:hover::before,
    .team-card:focus-within::before {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .team-card__contact,
    .team-card::before { transition: none; }
}

.team-card__contact-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.team-card__phone,
.team-card__email {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.15s ease;
    flex: 1;
    min-width: 0;
}

.team-card__phone i,
.team-card__email i {
    flex-shrink: 0;
    font-size: 0.65rem;
    width: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
}

.team-card__phone span,
.team-card__email span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-card__phone:hover,
.team-card__email:hover {
    color: #fff;
}

/* Copy button */
.team-card__copy {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.68rem;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

/* Tooltip „Telefon/Email copiat” după apăsare */
.team-card__copy.is-copied::after {
    content: attr(data-done);
    position: absolute;
    bottom: calc(100% + 7px);
    right: 0;
    background: #fff;
    color: var(--gray-900, #1A1A2E);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    animation: team-tooltip-in 0.15s ease;
    z-index: 5;
}

.team-card__copy.is-copied::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    right: 8px;
    border: 5px solid transparent;
    border-top-color: #fff;
    border-bottom: none;
    pointer-events: none;
    z-index: 5;
}

@keyframes team-tooltip-in {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .team-card__copy.is-copied::after { animation: none; }
}

.team-card__contact-row:hover .team-card__copy {
    opacity: 1;
}

.team-card__copy:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.team-card__copy.is-copied {
    opacity: 1;
    color: #4ade80;
}

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

@media (max-width: 480px) {
    /* Copy button always visible on touch */
    .team-card__copy {
        opacity: 0.6;
    }
}

/* ==================== PRINT ==================== */

@media print {
    .team-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        min-height: auto;
        background-image: none !important;
    }

    .team-card__overlay {
        background: none;
        position: static;
        padding: 1rem;
    }
    
    .team-card__first-name,
    .team-card__last-name,
    .team-card__position {
        color: #000;
    }
    
    .team-card__phone,
    .team-card__email {
        color: #333;
    }
    
    .team-card:hover {
        transform: none;
        box-shadow: none;
    }
}
