@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;600&display=swap');

/* ===========================
   TEAM SECTION — Polaroid Wall
   =========================== */

.team-section {
    background: #f5f0e8;
    padding: 20px 0;
}

.team-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 32px;
}

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

.team-card {
    position: relative;
    width: 200px;
    flex-shrink: 0;
    background: #ffffff;
    padding: 12px 12px 48px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition:
        transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.4s ease,
        z-index 0s;
    opacity: 0;
}

/* Static rotation per card */
.team-card:nth-child(1) { transform: rotate(-4deg); }
.team-card:nth-child(2) { transform: rotate(2deg);  }
.team-card:nth-child(3) { transform: rotate(-3deg); }
.team-card:nth-child(4) { transform: rotate(5deg);  }
.team-card:nth-child(5) { transform: rotate(-2deg); }
.team-card:nth-child(6) { transform: rotate(4deg);  }
.team-card:nth-child(7) { transform: rotate(-5deg); }
.team-card:nth-child(8) { transform: rotate(3deg);  }

/* Hover — straighten, scale, lift */
.team-card:hover {
    transform: rotate(0deg) scale(1.12) translateY(-20px);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
    z-index: 100;
    position: relative;
}

/* ===========================
   TAPE STRIP (::before)
   =========================== */

.team-card::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 20px;
    background: rgba(255, 220, 150, 0.75);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

/* ===========================
   PHOTO AREA
   =========================== */

.team-card__photo-wrap {
    width: 176px;
    height: 176px;
    overflow: hidden;
    margin-bottom: 0;
    flex-shrink: 0;
    background: #c8d8e8;
}

.team-card__photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

/* Placeholder — different colour per nth-child */
.team-card__photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 800;
    color: #ffffff;
    font-family: 'Caveat', serif;
    background: #8aaabf;
}
.team-card:nth-child(2) .team-card__photo-placeholder { background: #7aaa8a; }
.team-card:nth-child(3) .team-card__photo-placeholder { background: #9a80b8; }
.team-card:nth-child(4) .team-card__photo-placeholder { background: #bf8a7a; }
.team-card:nth-child(5) .team-card__photo-placeholder { background: #7aaabf; }
.team-card:nth-child(6) .team-card__photo-placeholder { background: #aa8a7a; }
.team-card:nth-child(7) .team-card__photo-placeholder { background: #8abf8a; }
.team-card:nth-child(8) .team-card__photo-placeholder { background: #aa7a9a; }

/* ===========================
   CARD BODY — handwritten text below photo
   =========================== */

.team-card__body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px 10px;
    text-align: center;
}

.team-card__name {
    font-family: 'Caveat', cursive;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 2px 0;
    line-height: 1.2;
    display: block;
}

.team-card__title {
    font-family: 'Caveat', cursive;
    font-size: 13px;
    color: #666666;
    margin: 0;
    display: block;
}

/* Type badge hidden in polaroid view */
.team-card__type { display: none; }

/* ===========================
   SOCIAL ICONS — hidden, appear on hover
   =========================== */

.team-card__social {
    position: absolute;
    bottom: -44px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease 0.1s;
    pointer-events: none;
}

.team-card:hover .team-card__social {
    opacity: 1;
    pointer-events: auto;
}

.team-card__social-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3C78B4;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.team-card__social-btn:hover {
    background: #3C78B4;
    color: #ffffff;
    transform: scale(1.1);
}

.team-card__social-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.team-card__social-btn svg[fill="currentColor"] {
    fill: currentColor;
    stroke: none;
}

/* ===========================
   SCROLL REVEAL — polaroidDrop
   Uses CSS custom property --rot so each card drops at its own angle
   =========================== */

@keyframes polaroidDrop {
    from { opacity: 0; transform: rotate(var(--rot)) translateY(-40px); }
    to   { opacity: 1; transform: rotate(var(--rot)) translateY(0);     }
}

.team-section.is-visible .team-card:nth-child(1) { --rot: -4deg; animation: polaroidDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s forwards; }
.team-section.is-visible .team-card:nth-child(2) { --rot:  2deg; animation: polaroidDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s forwards; }
.team-section.is-visible .team-card:nth-child(3) { --rot: -3deg; animation: polaroidDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s forwards; }
.team-section.is-visible .team-card:nth-child(4) { --rot:  5deg; animation: polaroidDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s forwards; }
.team-section.is-visible .team-card:nth-child(5) { --rot: -2deg; animation: polaroidDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.45s forwards; }
.team-section.is-visible .team-card:nth-child(6) { --rot:  4deg; animation: polaroidDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.55s forwards; }
.team-section.is-visible .team-card:nth-child(7) { --rot: -5deg; animation: polaroidDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.65s forwards; }
.team-section.is-visible .team-card:nth-child(8) { --rot:  3deg; animation: polaroidDrop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.75s forwards; }

/* Hover override after animation settles */
.team-section.is-visible .team-card:nth-child(1):hover,
.team-section.is-visible .team-card:nth-child(2):hover,
.team-section.is-visible .team-card:nth-child(3):hover,
.team-section.is-visible .team-card:nth-child(4):hover,
.team-section.is-visible .team-card:nth-child(5):hover,
.team-section.is-visible .team-card:nth-child(6):hover,
.team-section.is-visible .team-card:nth-child(7):hover,
.team-section.is-visible .team-card:nth-child(8):hover {
    transform: rotate(0deg) scale(1.12) translateY(-20px) !important;
}

/* ===========================
   RTL
   =========================== */

[dir="rtl"] .team-card__name,
[dir="rtl"] .team-card__title {
    font-family: 'Caveat', 'Cairo', cursive;
}

/* ===========================
   RESPONSIVE — PORTRAIT
   Grid replaces flex; cards flat (no rotation); social always visible
   =========================== */

@media (max-width: 1024px) and (orientation: portrait) {
    .team-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 0 16px;
    }

    .team-card {
        transform: rotate(0deg) !important;
        width: 100%;
        padding: 12px 12px 48px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
    }

    .team-card::before { display: none; }

    .team-card:hover {
        transform: scale(1.02) translateY(-4px) !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }

    .team-card__photo-wrap {
        width: 140px;
        height: 140px;
    }

    /* Social icons always shown on mobile — no hover needed */
    .team-card__social {
        position: static;
        transform: none;
        opacity: 1;
        pointer-events: auto;
        margin-top: 8px;
        justify-content: center;
    }

    /* Override all nth-child rotations */
    .team-card:nth-child(1), .team-card:nth-child(2),
    .team-card:nth-child(3), .team-card:nth-child(4),
    .team-card:nth-child(5), .team-card:nth-child(6),
    .team-card:nth-child(7), .team-card:nth-child(8) {
        transform: rotate(0deg) !important;
    }

    /* Hover overrides inside .is-visible for portrait */
    .team-section.is-visible .team-card:nth-child(1):hover,
    .team-section.is-visible .team-card:nth-child(2):hover,
    .team-section.is-visible .team-card:nth-child(3):hover,
    .team-section.is-visible .team-card:nth-child(4):hover,
    .team-section.is-visible .team-card:nth-child(5):hover,
    .team-section.is-visible .team-card:nth-child(6):hover,
    .team-section.is-visible .team-card:nth-child(7):hover,
    .team-section.is-visible .team-card:nth-child(8):hover {
        transform: scale(1.02) translateY(-4px) !important;
    }
}

/* ===========================
   RESPONSIVE — LANDSCAPE
   =========================== */

@media (max-width: 1024px) and (orientation: landscape) {
    .team-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 28px;
        padding: 0 20px;
    }

    .team-card {
        width: 160px;
    }

    .team-card__photo-wrap {
        width: 136px;
        height: 136px;
    }
}
