/* Instagram feed — home page. Tokens follow the site palette (style.css: --linen, --tan, --dim-grey, --black-2). */
.ig-feed {
    --ig-bg: #f9f1e4;
    --ig-ink: #201a16;
    --ig-muted: #7d6a5d;
    --ig-line: #ecdfc9;
    --ig-card: #ffffff;
    --ig-media-bg: #f3ece0;
    --ig-gold: #caa547;
    --ig-gold-deep: #9c7a2a;
    --ig-link: #7f6120;
    --ig-dot: #dccfb6;
    --ig-overlay: rgba(32, 26, 22, .72);

    background: var(--ig-bg);
    color: var(--ig-ink);
    padding: clamp(56px, 8vw, 104px) 0;
    font-family: IRANSansX, serif, sans-serif;
}

.ig-feed *,
.ig-feed *::before,
.ig-feed *::after { box-sizing: border-box; }

.ig-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ig-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.ig-feed__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

.ig-feed a:focus-visible,
.ig-feed button:focus-visible {
    outline: 2px solid var(--ig-gold-deep);
    outline-offset: 2px;
}

/* ---------- Profile header (mirrors an Instagram profile: avatar | handle + actions, stats, bio) ---------- */
.ig-profile {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "body ring";
    align-items: center;
    gap: 0 clamp(24px, 4vw, 48px);
    margin: 0 0 clamp(28px, 4vw, 40px);
}

.ig-ring {
    grid-area: ring;
    position: relative;
    display: block;
    width: 160px;
    height: 160px;
    border-radius: 50%;
}

.ig-ring__svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    overflow: visible;
}

.ig-ring__track,
.ig-ring__arc {
    fill: none;
    stroke-width: 3;
}

.ig-ring__track { stroke: var(--ig-line); }

.ig-ring__arc {
    stroke: url(#ig-gold);
    stroke-linecap: round;
    stroke-dasharray: 384;
    stroke-dashoffset: 0;
}

/* The one orchestrated moment: the gold story ring draws itself when the section arrives. */
.ig-feed.is-armed .ig-ring__arc { stroke-dashoffset: 384; }
.ig-feed.is-armed.is-visible .ig-ring__arc {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1.6s cubic-bezier(.65, 0, .35, 1) .15s;
}

.ig-ring__img {
    position: absolute;
    inset: 7%;
    width: 86%;
    height: 86%;
    border-radius: 50%;
    object-fit: cover;
    background: var(--ig-media-bg);
    transition: transform .4s cubic-bezier(.2, .7, .2, 1);
}

.ig-ring:hover .ig-ring__img { transform: scale(1.03); }

.ig-profile__body { grid-area: body; }

.ig-profile__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
}

.ig-profile__handle {
    color: var(--ig-ink);
    font-size: 24px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: .005em;
    text-decoration: none;
}

.ig-profile__handle:hover { color: var(--ig-gold-deep); }

.ig-profile__cta {
    display: flex;
    gap: 8px;
}

.ig-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 20px;
    border-radius: 9px;
    background: var(--ig-line);
    color: var(--ig-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s ease, color .2s ease;
}

.ig-btn:hover { background: #e2d2b5; color: var(--ig-ink); }

.ig-btn--primary {
    background: var(--ig-ink);
    color: var(--ig-bg);
}

.ig-btn--primary:hover { background: var(--ig-gold-deep); color: #fff; }

.ig-profile__stats {
    display: flex;
    gap: 36px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ig-ink);
}

.ig-profile__stats b { font-weight: 700; }

.ig-profile__about { margin-top: 16px; }

.ig-profile__name {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.7;
}

.ig-profile__bio {
    margin: 2px 0 0;
    font-size: 14px;
    line-height: 1.9;
    color: var(--ig-ink);
}

.ig-profile__line {
    display: block;
    min-height: 1em;
    text-align: right;
}

.ig-profile__bio a {
    color: var(--ig-link);
    font-weight: 600;
    text-decoration: none;
}

.ig-profile__bio a:hover { text-decoration: underline; }

/* Instagram's posts tab: a hairline across the feed with the active tab marked on it. */
.ig-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: clamp(24px, 3vw, 32px);
    border-top: 1px solid var(--ig-line);
}

.ig-tabs__tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: -1px;
    padding: 14px 2px 0;
    border-top: 1px solid var(--ig-ink);
    color: var(--ig-ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
}

/* Phones: Instagram's mobile profile — small avatar beside handle and stats, bio and buttons below. */
@media (max-width: 639px) {
    .ig-profile {
        grid-template-columns: minmax(0, 1fr) 92px;
        grid-template-areas:
            "handle ring"
            "stats ring"
            "about about"
            "cta cta";
        gap: 0 20px;
        align-items: end;
    }

    .ig-profile__body,
    .ig-profile__top { display: contents; }

    .ig-ring { grid-area: ring; width: 92px; height: 92px; align-self: center; }
    .ig-profile__handle { grid-area: handle; justify-self: start; font-size: 19px; }
    .ig-profile__stats { grid-area: stats; justify-self: start; gap: 24px; margin-top: 6px; font-size: 14px; align-self: start; }
    .ig-profile__about { grid-area: about; margin-top: 14px; }
    .ig-profile__cta { grid-area: cta; margin-top: 14px; }
    .ig-profile__cta .ig-btn { flex: 1; }
}

/* ---------- Grid ---------- */
.ig-feed__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    align-items: start;
}

@media (max-width: 1023px) {
    .ig-feed__grid {
        grid-template-columns: minmax(0, 470px);
        justify-content: center;
        gap: 24px;
    }
}

/* ---------- Post card ---------- */
.ig-post {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--ig-card);
    border: 1px solid var(--ig-line);
    border-radius: 16px;
    overflow: hidden;
}

.ig-post__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 10px 10px 6px;
    padding-inline-start: 14px;
}

.ig-post__author {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--ig-ink);
    text-decoration: none;
}

.ig-avatar {
    flex: none;
    display: block;
    width: 36px;
    height: 36px;
    padding: 2px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ecd4a0, #caa547 50%, #9c7a2a);
}

.ig-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--ig-card);
    object-fit: cover;
}

.ig-post__handle {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ig-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--ig-ink);
    cursor: pointer;
    text-decoration: none;
    transition: color .15s ease;
}

.ig-icon-btn:hover { color: var(--ig-gold-deep); }

/* ---------- Media ---------- */
.ig-post__media {
    position: relative;
    aspect-ratio: 4 / 5;
    background: var(--ig-media-bg);
    overflow: hidden;
}

.ig-post__track {
    display: flex;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.ig-post__track::-webkit-scrollbar { display: none; }

.ig-slide {
    position: relative;
    flex: 0 0 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.ig-slide img,
.ig-slide video {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Images wider than 4:5 (square, landscape) are shown whole over a soft blur of themselves,
   so text baked into clinic graphics is never cropped. */
.ig-slide.is-wide img { object-fit: contain; }
.ig-slide.is-wide::before {
    content: "";
    position: absolute;
    inset: -24px;
    background: var(--ig-bg-img) center / cover no-repeat;
    filter: blur(22px) saturate(1.1);
    opacity: .75;
}

.ig-post__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--ig-overlay);
    color: #fff;
    font-size: 12px;
    line-height: 1.6;
    pointer-events: none;
}

.ig-post__badge--icon {
    padding: 0;
    background: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45));
}

.ig-post__badge--icon svg { display: block; }

.ig-nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--ig-ink);
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s ease;
}

.ig-nav--prev { right: 10px; }
.ig-nav--next { left: 10px; }
.ig-nav--next svg { transform: scaleX(-1); }

.ig-post__media:hover .ig-nav,
.ig-nav:focus-visible { opacity: 1; }

.ig-nav[disabled] { opacity: 0 !important; pointer-events: none; }

@media (hover: none) {
    .ig-nav { display: none; }
}

/* ---------- Video ---------- */
.ig-video-hit {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.ig-video-hit__glyph {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--ig-overlay);
    color: #fff;
    opacity: 0;
    transform: scale(.9);
    transition: opacity .2s ease, transform .2s ease;
}

.ig-video-hit__glyph svg { margin-left: -3px; } /* optical centring of the play triangle */

.ig-slide.is-paused .ig-video-hit__glyph {
    opacity: 1;
    transform: scale(1);
}

.ig-sound {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--ig-overlay);
    color: #fff;
    cursor: pointer;
}

.ig-sound__on { display: none; }
.ig-sound[aria-pressed="true"] .ig-sound__on { display: block; }
.ig-sound[aria-pressed="true"] .ig-sound__off { display: none; }

/* ---------- Action bar ---------- */
.ig-post__bar {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 6px 6px 2px;
}

.ig-post__actions {
    display: flex;
    align-items: center;
}

.ig-dots {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    gap: 4px;
    transform: translate(-50%, -50%);
    direction: rtl;
}

.ig-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ig-dot);
    transition: background-color .2s ease, transform .2s ease;
}

.ig-dot.is-active {
    background: var(--ig-gold-deep);
    transform: scale(1.15);
}

.ig-post__toast {
    position: absolute;
    top: 50%;
    left: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--ig-ink);
    color: #fff;
    font-size: 12px;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity .2s ease;
    pointer-events: none;
}

.ig-post__toast.is-shown { opacity: 1; }

/* ---------- Text ---------- */
.ig-post__likes {
    margin: 0;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.8;
}

.ig-post__caption { padding: 2px 14px 0; }

.ig-post__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.ig-post__text.is-clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.ig-post__text a {
    color: var(--ig-link);
    text-decoration: none;
}

.ig-post__text a:hover { text-decoration: underline; }

.ig-post__text .ig-post__text-handle {
    margin-inline-end: 4px;
    color: var(--ig-ink);
    font-weight: 600;
}

.ig-post__more {
    padding: 0;
    border: 0;
    background: none;
    color: var(--ig-muted);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.ig-post__more:hover { color: var(--ig-ink); }

.ig-post__time {
    display: block;
    padding: 6px 14px 16px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--ig-muted);
}

@media (prefers-reduced-motion: reduce) {
    .ig-feed *,
    .ig-feed *::before { transition: none !important; }
    .ig-ring:hover .ig-ring__img { transform: none; }
    .ig-post__track { scroll-behavior: auto; }
}
