/* Instagram showcase page — follows the site's palette:
   brown accent #a05a1c (headings/icons), Bootstrap primary for actions. */
.ig-page {
    --ig-accent: #a05a1c;
    --ig-accent-soft: rgba(160, 90, 28, 0.08);
    max-width: 1100px;
}

.ig-title {
    font-weight: 700;
    color: var(--ig-accent);
}

/* Profile strip */
.ig-avatar {
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    background: #e9ecef;
}
.ig-follow {
    min-width: 0;
}

/* Filter tabs */
.ig-filter {
    border: 1px solid #dee2e6;
    background: #fff;
    color: var(--text-color, #212529);
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.ig-filter:hover:not(:disabled) {
    border-color: var(--ig-accent);
    color: var(--ig-accent);
}
.ig-filter.active {
    background: var(--ig-accent);
    border-color: var(--ig-accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(160, 90, 28, 0.3);
}
.ig-filter:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.ig-filter:focus-visible,
.ig-tile:focus-visible {
    outline: 3px solid rgba(13, 110, 253, 0.5);
    outline-offset: 2px;
}
.ig-count {
    display: inline-block;
    min-width: 1.6em;
    margin-inline-start: 0.25rem;
    padding: 0 0.4em;
    border-radius: 999px;
    font-size: 0.8em;
    background: var(--ig-accent-soft);
    color: var(--ig-accent);
}
.ig-filter.active .ig-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Grid */
.ig-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
@media (max-width: 767.98px) {
    .ig-grid { gap: 0.5rem; }
}
@media (max-width: 479.98px) {
    .ig-grid { grid-template-columns: repeat(2, 1fr); }
}

.ig-tile {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    padding: 0;
    border: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #e9ecef;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: ig-fade-in 0.3s ease both;
}
.ig-tile[hidden] { display: none; }
.ig-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}
.ig-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}
.ig-tile:hover img { transform: scale(1.04); }

.ig-badge {
    position: absolute;
    top: 0.6rem;
    inset-inline-end: 0.6rem;
    color: #fff;
    font-size: 1.1rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.ig-badge:empty { display: none; }

.ig-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.35rem;
    padding: 1rem;
    text-align: start;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.15) 55%, transparent 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.ig-tile:hover .ig-overlay,
.ig-tile:focus-visible .ig-overlay { opacity: 1; }
.ig-overlay-caption {
    font-size: 0.9rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ig-overlay-date {
    font-size: 0.75rem;
    opacity: 0.85;
}
@media (hover: none) {
    .ig-overlay { display: none; }
}

@keyframes ig-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* Empty state */
.ig-empty { max-width: 560px; }
.ig-empty-icon {
    font-size: 3rem;
    color: var(--ig-accent);
}

/* Lightbox */
.ig-modal .modal-content {
    border-radius: 10px;
    overflow: hidden;
}
.ig-close {
    position: absolute;
    top: 0.75rem;
    inset-inline-end: 0.75rem;
    z-index: 5;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    padding: 0.6rem;
    opacity: 1;
}
.ig-media-col {
    position: relative;
    background: #111;
    min-height: 320px;
}
.ig-media {
    height: 100%;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ig-media img,
.ig-media video {
    display: block;
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    margin: 0 auto;
}
.ig-media.is-reel video,
.ig-media.is-reel img { max-height: 80vh; }

.ig-external {
    position: relative;
    display: block;
    color: #fff;
    text-decoration: none;
}
.ig-external img { opacity: 0.85; }
.ig-external-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: background-color 0.2s;
}
.ig-external:hover .ig-external-play { background: rgba(160, 90, 28, 0.9); }
.ig-external-label {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    text-align: center;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.ig-slide-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.ig-slide-btn[hidden] { display: none; }
.ig-slide-prev { left: 0.75rem; }
.ig-slide-next { right: 0.75rem; }
[dir="rtl"] .ig-slide-prev { left: auto; right: 0.75rem; }
[dir="rtl"] .ig-slide-next { right: auto; left: 0.75rem; }
[dir="rtl"] .ig-slide-btn i { transform: scaleX(-1); }

.ig-dots {
    position: absolute;
    bottom: 0.75rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
}
.ig-dots button {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
}
.ig-dots button.active { background: #fff; }

.ig-details {
    padding: 1.5rem;
    max-height: 85vh;
}
.ig-details-head {
    padding-inline-end: 2.5rem; /* room for the close button */
    margin-bottom: 1rem;
}
.ig-kind-pill {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--ig-accent-soft, rgba(160, 90, 28, 0.08));
    color: #a05a1c;
}
.ig-caption {
    overflow-y: auto;
    white-space: pre-line;
    line-height: 1.6;
    margin-bottom: 1rem;
    min-height: 3rem;
}
.ig-caption a {
    color: #a05a1c;
    text-decoration: none;
}
.ig-caption a:hover { text-decoration: underline; }
.ig-details-foot {
    border-top: 1px solid #eee;
    padding-top: 1rem;
}
.ig-details-foot .btn {
    min-width: 0;
    white-space: nowrap;
    font-size: 1rem;
}
.ig-nav { width: 44px; }

@media (max-width: 991.98px) {
    .ig-media-col { min-height: 0; }
    .ig-media, .ig-media img, .ig-media video { max-height: 60vh; }
    .ig-details { max-height: none; }
    .ig-caption { max-height: 30vh; }
}

@media (prefers-reduced-motion: reduce) {
    .ig-tile, .ig-tile img, .ig-overlay { transition: none; animation: none; }
}
