/* IIT Companion - Programme Cards widget (Direction D) */

.ipc-wrap {
    --ipc-per: 4;
    --ipc-gap: 26px;
    position: relative;
}

@media (max-width: 1024px) {
    .ipc-wrap { --ipc-per: 2; }
}

@media (max-width: 767px) {
    .ipc-wrap { --ipc-per: 1; }
}

.ipc-grid {
    display: grid;
    grid-template-columns: repeat(var(--ipc-per, 3), 1fr);
    gap: var(--ipc-gap, 26px);
    align-items: stretch;
}

/* ---------- carousel mode ---------- */

.ipc-scroller {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Room for the flip shadow on every side so it never clips. */
    padding: 8px 10px 16px;
    scroll-padding-left: 10px;
}

.ipc-scroller::-webkit-scrollbar {
    display: none;
}

.ipc-track {
    display: flex;
    gap: var(--ipc-gap, 26px);
    align-items: stretch;
    width: max-content;
}

.ipc-track .ipc-flip {
    flex: 0 0 auto;
    width: calc((100cqw - (var(--ipc-gap, 26px) * (var(--ipc-per, 3) - 1))) / var(--ipc-per, 3));
    scroll-snap-align: start;
}

.ipc-scroller {
    container-type: inline-size;
}

@supports not (width: 1cqw) {
    .ipc-track .ipc-flip {
        width: calc((92vw - (var(--ipc-gap, 26px) * (var(--ipc-per, 3) - 1))) / var(--ipc-per, 3));
        max-width: 420px;
    }
}

.ipc-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: #002D74;
    color: #ffffff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.25);
    transition: background 0.15s ease, opacity 0.15s ease;
    padding: 0;
}

.ipc-arrow:hover {
    background: #0448B3;
}

.ipc-prev { left: -14px; }
.ipc-next { right: -14px; }

.ipc-dots {
    display: flex;
    justify-content: center;
    gap: 9px;
    padding-top: 6px;
}

.ipc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: #C7D3E8;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.ipc-dot.is-active {
    background: #002D74;
    transform: scale(1.25);
}

@media (max-width: 767px) {
    .ipc-prev { left: 4px; }
    .ipc-next { right: 4px; }
}

.ipc-flip {
    --ipc-accent: #FFB000;
    --ipc-back: #002D74;
    perspective: 1200px;
    outline: none;
}

.ipc-inner {
    position: relative;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.ipc-flip:hover .ipc-inner,
.ipc-flip:focus-visible .ipc-inner,
.ipc-flip.is-flipped .ipc-inner {
    transform: rotateY(180deg);
}

.ipc-face {
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(16, 24, 40, 0.12);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* The front sits in normal flow, so the tallest card's content sets the
   row height and the grid stretches every other card to match it - equal
   heights, no arbitrary fixed number. */
.ipc-front {
    position: relative;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ipc-body {
    flex: 1 1 auto;
}

.ipc-photo {
    position: relative;
    height: 185px;
    flex: 0 0 auto;
}

.ipc-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ipc-badge {
    position: absolute;
    top: 13px;
    left: 13px;
    background: var(--ipc-accent);
    color: #002D74;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    padding: 5px 12px;
    border-radius: 999px;
}

.ipc-body {
    padding: 15px 20px 14px;
}

.ipc-name {
    margin: 0 0 4px 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    color: #14213A;
    position: relative;
    padding-bottom: 10px;
}

.ipc-name::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 34px;
    background: var(--ipc-accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.ipc-flip:hover .ipc-name::after,
.ipc-flip.is-flipped .ipc-name::after {
    width: 86px;
}

.ipc-specs {
    margin: 6px 0 0 0;
}

.ipc-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px dotted #D9E2EF;
    font-size: 13.5px;
    line-height: 1.5;
}

.ipc-row:last-child {
    border-bottom: 0;
    padding-bottom: 2px;
}

.ipc-row dt {
    color: #5A6880;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    flex: 0 0 84px;
}

.ipc-row dd {
    margin: 0;
    color: #14213A;
    font-weight: 500;
}

.ipc-back {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
    background: linear-gradient(160deg, var(--ipc-back), var(--ipc-back-2, #001230));
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 13px;
    padding: 26px;
}

.ipc-back h3 {
    margin: 0;
    font-size: 21px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

.ipc-back p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.88);
}

.ipc-focus {
    color: var(--ipc-accent);
    font-weight: 600;
    font-size: 13px;
}

.ipc-btn {
    background: var(--ipc-accent);
    color: #002D74;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.4;
    padding: 11px 26px;
    border-radius: 7px;
    text-decoration: none;
    display: inline-block;
}

.ipc-btn:hover {
    filter: brightness(1.08);
    color: #002D74;
}

@media (prefers-reduced-motion: reduce) {
    .ipc-inner,
    .ipc-name::after {
        transition: none;
    }
}

/* Old homepage programme section: kept in the editor, never rendered. */
.iitc-hide-all {
    display: none !important;
}
