.ihp-featured-work {
    clear: both;
    width: 100%;
    margin: 22px 0 38px;
    box-sizing: border-box;
}
.ihp-featured-work *,
.ihp-featured-work *::before,
.ihp-featured-work *::after { box-sizing: border-box; }
.ihp-featured-grid { display: grid; gap: 30px; min-width: 0; }
.ihp-content-panel { min-width: 0; }
.ihp-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 13px; }
.ihp-section-title { margin: 0; font-size: clamp(1.25rem, 1.5vw, 1.65rem); line-height: 1.2; letter-spacing: -.02em; }

/* Full-width rows on desktop: projects first, gallery second, four cards visible. */
@media (min-width: 981px) {
    .ihp-featured-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "projects" "gallery";
    }
    .ihp-projects-panel { grid-area: projects; }
    .ihp-work-panel { grid-area: gallery; }
}

.ihp-carousel { --ihp-gap: 16px; --ihp-visible: 4; position: relative; min-width: 0; }
.ihp-carousel.ihp-count-1 { --ihp-visible: 1; }
.ihp-carousel.ihp-count-2 { --ihp-visible: 2; }
.ihp-carousel.ihp-count-3 { --ihp-visible: 3; }
.ihp-carousel-viewport {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}
.ihp-carousel-viewport::-webkit-scrollbar { display: none; }
.ihp-carousel-track { display: flex; gap: var(--ihp-gap); min-width: 100%; align-items: stretch; }
.ihp-carousel-track > * {
    flex: 0 0 calc((100% - (var(--ihp-gap) * (var(--ihp-visible) - 1))) / var(--ihp-visible));
    min-width: 0;
    scroll-snap-align: start;
}
.ihp-carousel-controls { display: inline-flex; gap: 8px; flex: 0 0 auto; }
.ihp-carousel-controls[hidden] { display: none !important; }
.ihp-carousel-arrow {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0 0 3px;
    border: 1px solid rgba(0,0,0,.16);
    border-radius: 50%;
    background: #fff;
    color: inherit;
    font: inherit;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.06);
    transition: opacity .2s ease, transform .2s ease, box-shadow .2s ease;
}
.ihp-carousel-arrow:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(0,0,0,.1); }
.ihp-carousel-arrow:disabled { opacity: .28; cursor: default; }

.ihp-preview-item,
.ihp-project-cover { position: relative; border: 0; padding: 0; overflow: hidden; background: #ececec; cursor: pointer; }
.ihp-preview-item { display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: 14px; }
.ihp-preview-item img,
.ihp-project-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 1;
    transition: opacity .2s ease, transform .28s ease;
}
.ihp-preview-item img.ihp-lazy-media:not([src]),
.ihp-project-cover img.ihp-lazy-media:not([src]) { opacity: 0; }
.ihp-preview-item:hover img,
.ihp-project-cover:hover img { transform: scale(1.025); }
.ihp-media-label { position: absolute; left: 10px; bottom: 10px; z-index: 2; padding: 6px 10px; border-radius: 999px; background: rgba(17,24,39,.82); color: #fff; font-size: 12px; font-weight: 700; line-height: 1; letter-spacing: .01em; backdrop-filter: blur(5px); }
.ihp-video-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; font-size: 20px; padding-left: 3px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.ihp-preview-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: #777; font-size: 34px; }
.ihp-preview-item img[src] + .ihp-preview-fallback,
.ihp-project-cover img[src] + .ihp-preview-fallback { display: none; }

.ihp-project { overflow: hidden; border: 1px solid rgba(0,0,0,.09); border-radius: 16px; background: #fff; box-shadow: 0 7px 22px rgba(0,0,0,.055); }
.ihp-project-cover { display: block; width: 100%; aspect-ratio: 16 / 10; }
.ihp-project-count { position: absolute; right: 12px; bottom: 12px; border-radius: 999px; background: rgba(0,0,0,.72); color: #fff; padding: 6px 10px; font-size: 12px; line-height: 1; backdrop-filter: blur(5px); }
.ihp-project-body { padding: 16px 17px 17px; }
.ihp-project-title { margin: 0 0 7px; font-size: 1.15em; line-height: 1.3; }
.ihp-project-description { display: -webkit-box; overflow: hidden; margin: 0; color: #555; line-height: 1.55; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* Fullscreen viewer is attached to body and constrained to the visual viewport. */
html.ihp-modal-open,
body.ihp-modal-open { overflow: hidden; overscroll-behavior: none; }
.ihp-modal[hidden] { display: none !important; }
.ihp-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transform: none !important;
}
.ihp-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.95); }
.ihp-modal-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    min-width: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr) 68px;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
}
.ihp-modal-stage { grid-column: 2; grid-row: 1; width: 100%; max-width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; display: grid; place-items: center; padding: 48px 8px 16px; }
.ihp-modal-stage > img { display: block; max-width: 100%; max-height: 88vh; max-height: 88dvh; width: auto; height: auto; object-fit: contain; }
.ihp-video-frame { width: 100%; max-width: 1600px; max-height: 88vh; max-height: 88dvh; aspect-ratio: 16 / 9; }
.ihp-video-frame iframe { width: 100%; height: 100%; border: 0; }
.ihp-modal-close { position: absolute; z-index: 3; top: max(14px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right)); width: 46px; height: 46px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 32px; line-height: 1; cursor: pointer; }
.ihp-modal-nav { z-index: 2; width: 48px; height: 64px; justify-self: center; border: 0; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-size: 42px; cursor: pointer; }
.ihp-modal-prev { grid-column: 1; grid-row: 1; }
.ihp-modal-next { grid-column: 3; grid-row: 1; }
.ihp-modal-counter { grid-column: 1 / 4; grid-row: 2; justify-self: center; color: #fff; padding: 8px 16px max(14px, env(safe-area-inset-bottom)); }

@media (max-width: 1180px) and (min-width: 981px) {
    .ihp-carousel { --ihp-visible: 3; }
    .ihp-carousel.ihp-count-1 { --ihp-visible: 1; }
    .ihp-carousel.ihp-count-2 { --ihp-visible: 2; }
    .ihp-carousel.ihp-count-3 { --ihp-visible: 3; }
}

@media (max-width: 980px) {
    .ihp-featured-grid { grid-template-columns: 1fr; grid-template-areas: "gallery" "projects"; gap: 26px; }
    .ihp-work-panel { grid-area: gallery; }
    .ihp-projects-panel { grid-area: projects; }
}

@media (max-width: 980px) and (min-width: 768px) {
    .ihp-carousel { --ihp-visible: 2; }
    .ihp-carousel.ihp-count-1 { --ihp-visible: 1; }
    .ihp-carousel.ihp-count-2 { --ihp-visible: 2; }
}

@media (max-width: 767px) {
    .ihp-featured-work { margin: 20px 0 30px; }
    .ihp-featured-grid { gap: 25px; }
    .ihp-panel-heading { margin-bottom: 11px; }
    .ihp-section-title { font-size: 1.3rem; }
    .ihp-carousel { --ihp-gap: 12px; --ihp-visible: 1.13 !important; }
    .ihp-carousel-track > * { flex-basis: calc((100% - (var(--ihp-gap) * (var(--ihp-visible) - 1))) / var(--ihp-visible)); }
    .ihp-carousel-controls { display: none !important; }
    .ihp-preview-item,
    .ihp-project-cover { aspect-ratio: 4 / 3; }
    .ihp-project-body { padding: 15px 16px 16px; }

    .ihp-modal-dialog {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
    }
    .ihp-modal-stage {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        max-width: 100%;
        padding: calc(54px + env(safe-area-inset-top)) 12px 12px;
    }
    .ihp-modal-stage > img { max-width: 100%; max-height: 84vh; max-height: 84dvh; }
    .ihp-video-frame { width: 100%; max-width: 100%; max-height: 84vh; max-height: 84dvh; }
    .ihp-modal-nav {
        position: absolute;
        top: 50%;
        width: 38px;
        height: 52px;
        font-size: 32px;
        background: rgba(255,255,255,.1);
        transform: translateY(-50%);
    }
    .ihp-modal-prev { left: max(6px, env(safe-area-inset-left)); grid-column: auto; grid-row: auto; }
    .ihp-modal-next { right: max(6px, env(safe-area-inset-right)); grid-column: auto; grid-row: auto; }
    .ihp-modal-counter { grid-column: 1; grid-row: 2; }
    .ihp-modal-close { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
}
.ihp-live-root { clear: both; width: 100%; min-width: 0; }
