/* ============================================================
   style.css — tampilan halaman publik Instagram (/ig/)
   ============================================================ */

:root {
    --ig-grad: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    --bg: #f5f5f7;
    --card: #ffffff;
    --text: #1a1a1e;
    --muted: #6b6b76;
    --line: #e7e7ec;
    --shadow: 0 6px 24px rgba(20, 20, 30, 0.08);
    --shadow-lg: 0 18px 60px rgba(20, 20, 30, 0.22);
    --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: #cc2366; text-decoration: none; }

/* ---------- Header ---------- */
.ig-header {
    background: var(--ig-grad);
    color: #fff;
    padding: 28px 20px;
}
.ig-header__inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.ig-brand { display: flex; align-items: center; gap: 14px; }
.ig-brand__logo {
    width: 54px; height: 54px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.18);
    display: grid; place-items: center;
    flex: 0 0 auto;
    backdrop-filter: blur(4px);
}
.ig-brand__text h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.ig-brand__text p { font-size: 0.85rem; opacity: 0.92; max-width: 560px; }

.ig-follow {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 600; font-size: 0.9rem;
    transition: background 0.2s ease;
}
.ig-follow:hover { background: rgba(255, 255, 255, 0.28); }

/* ---------- Main ---------- */
.ig-main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 20px 48px; }

.ig-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 20px; flex-wrap: wrap;
}
.ig-toolbar__count { font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.ig-search {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 0.9rem;
    min-width: 240px;
    outline: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.ig-search:focus { border-color: #cc2366; box-shadow: 0 0 0 3px rgba(204, 35, 102, 0.12); }

/* ---------- Grid ---------- */
.ig-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}
.ig-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.ig-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.ig-card__media { position: relative; aspect-ratio: 1 / 1; background: #e8e8ec; }
.ig-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ig-card__media.is-broken {
    display: grid; place-items: center;
    background: repeating-linear-gradient(45deg, #ececf0, #ececf0 10px, #e3e3e8 10px, #e3e3e8 20px);
}
.ig-card__media.is-broken::after {
    content: "Gambar tidak tersedia";
    color: var(--muted); font-size: 0.8rem;
}

.ig-card__play {
    position: absolute; inset: 0;
    display: none; place-items: center;
    color: #fff; font-size: 2rem;
    text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.ig-card__badge {
    position: absolute; top: 10px;
    font-size: 0.68rem; font-weight: 700;
    padding: 4px 9px; border-radius: 999px;
    color: #fff; letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.ig-card__badge--type { left: 10px; background: rgba(0, 0, 0, 0.55); }
.ig-card__badge--author { right: 10px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-card__badge--author.is-official { background: var(--ig-grad); }
.ig-card__badge--author.is-mention { background: rgba(64, 93, 230, 0.92); }

.ig-card__caption {
    padding: 12px 14px;
    font-size: 0.85rem;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Empty state ---------- */
.ig-empty, .ig-empty-search {
    text-align: center; color: var(--muted);
    padding: 60px 20px;
}
.ig-empty__icon { color: #c7c7d1; margin-bottom: 12px; }
.ig-empty h2 { color: var(--text); margin-bottom: 6px; font-size: 1.15rem; }
.ig-empty-search { padding: 30px; }

/* ---------- Footer ---------- */
.ig-footer {
    text-align: center;
    padding: 20px;
    font-size: 0.82rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    background: #fff;
}
.ig-footer a { color: var(--muted); }
.ig-footer a:hover { color: #cc2366; }

/* ---------- Modal ---------- */
.ig-modal { position: fixed; inset: 0; z-index: 60; display: none; }
.ig-modal.is-open { display: block; }
.ig-modal__backdrop { position: absolute; inset: 0; background: rgba(15, 15, 20, 0.66); backdrop-filter: blur(3px); }
.ig-modal__panel {
    position: relative; z-index: 1;
    max-width: 560px; width: calc(100% - 32px);
    margin: 5vh auto 0;
    background: #fff; border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    display: flex; flex-direction: column;
}
.ig-modal__head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--line);
    font-weight: 600; font-size: 0.9rem;
}
.ig-modal__head > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-modal__actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.ig-modal__btn { font-size: 0.82rem; font-weight: 600; color: #cc2366; }
.ig-modal__close {
    border: none; background: #f0f0f3; color: #444;
    width: 30px; height: 30px; border-radius: 50%;
    cursor: pointer; font-size: 0.9rem; line-height: 1;
}
.ig-modal__body { background: #fafafa; }
.ig-modal__body iframe { width: 100%; height: 70vh; max-height: 640px; border: 0; display: block; }

@media (max-width: 600px) {
    .ig-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .ig-header__inner { flex-direction: column; align-items: flex-start; }
}
