/* Lankagram — social surfaces (photos, text, explore, profile, messaging).
 * Consumes the shared tokens in theme.css so theming stays consistent. */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

.ig-body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

img,
video {
  display: block;
  max-width: 100%;
}

.ig-shell {
  position: relative;
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  min-height: 100dvh;
  background: var(--bg);
}

/* Top bar -------------------------------------------------------------- */

.ig-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: calc(var(--top-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(21, 15, 32, 0.78);
  backdrop-filter: blur(16px) saturate(120%);
  border-bottom: 1px solid var(--line);
}

.ig-wordmark {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ig-topbar__actions {
  display: flex;
  gap: 6px;
}

.ig-iconbtn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text);
}

.ig-iconbtn svg {
  width: 25px;
  height: 25px;
}

.ig-iconbtn.is-active {
  color: var(--accent);
}

.ig-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--like);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg);
}

.ig-main {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
}

.ig-body--thread .ig-main {
  padding-bottom: 0;
}

/* Bottom tab bar ------------------------------------------------------- */

.ig-tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 50;
  width: 100%;
  max-width: var(--maxw);
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(21, 15, 32, 0.9);
  backdrop-filter: blur(16px) saturate(120%);
  border-top: 1px solid var(--line);
}

.ig-tab {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--muted);
  height: 100%;
}

.ig-tab svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}

.ig-tab.is-active svg {
  fill: currentColor;
  stroke: none;
}

.ig-tab.is-active {
  color: var(--accent);
}

.ig-tab--create {
  flex: 0 0 auto;
}

.ig-tab__plus {
  display: grid;
  place-items: center;
  width: 48px;
  height: 33px;
  border-radius: 12px;
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: var(--grad);
  box-shadow: var(--glow);
}

.ig-tab__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.ig-tab.is-active .ig-tab__avatar {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.ig-tab__avatar--fallback {
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}

/* Stories / creators rail --------------------------------------------- */

.ig-rail {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

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

.ig-rail__item {
  flex: 0 0 auto;
  width: 66px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.ig-rail__ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 3px;
  background: var(--grad);
}

.ig-rail__ring img,
.ig-rail__ring span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--muted);
}

.ig-rail__item small {
  font-size: 12px;
  color: var(--text);
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ig-rail__item--me .ig-rail__ring {
  background: var(--surface-3);
}

.ig-rail__plus {
  position: relative;
}

.ig-rail__plus::after {
  content: "+";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
}

/* Feed ----------------------------------------------------------------- */

.ig-feed {
  padding: 8px 0 0;
}

.ig-card {
  background: var(--surface);
  margin: 0 0 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

@media (min-width: 600px) {
  .ig-card {
    margin: 0 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
}

.ig-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.ig-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--muted);
  flex: 0 0 38px;
  aspect-ratio: 1 / 1;
  overflow: hidden; /* FIX 1: Rigidly clips anything outside the circle */
}

/* FIX 2: Safeguards images used directly inside standard avatars without rings */
.ig-avatar img {
  box-sizing: border-box;
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.ig-avatar--ring {
  padding: 0px;
  background: var(--grad);
}

.ig-avatar--ring img,
.ig-avatar--ring span {
  box-sizing: border-box; /* FIX 3: Prevents border sizes from distorting calculations */
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  max-width: calc(100% - 4px);
  max-height: calc(100% - 4px);
  border-radius: 50%;
  border: 2px solid var(--surface);
  object-fit: cover;
  display: block;
  background: var(--surface-2);
  aspect-ratio: 1 / 1;
}

.ig-avatar--ring span {
  display: grid;
  place-items: center;
}

.ig-card__who {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}

.ig-card__handle {
  font-weight: 700;
  font-size: 14px;
}

.ig-card__loc {
  font-size: 12px;
  color: var(--muted);
}

.ig-card__follow {
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  padding: 4px 8px;
}

.ig-card__follow.is-following {
  color: var(--muted);
}

.ig-card__menu {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 20px;
  padding: 4px 8px;
}

/* Media: carousel + text */

.ig-media {
  position: relative;
  background: #000;
}

.ig-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  aspect-ratio: 4 / 5;
}

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

.ig-carousel__slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
}

.ig-carousel__slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Carousel prev/next controls */
.ig-carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(20, 16, 30, 0.55);
  color: #fff;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}

.ig-carousel__nav svg {
  width: 16px;
  height: 16px;
}

.ig-carousel__nav--prev {
  left: 10px;
}

.ig-carousel__nav--next {
  right: 10px;
}

.ig-carousel__nav[hidden] {
  display: none;
}

.ig-carousel__nav:active {
  transform: translateY(-50%) scale(0.88);
}

.ig-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.ig-dots button {
  width: 6px;
  height: 6px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.ig-dots button.is-active {
  background: #fff;
  transform: scale(1.25);
}

/* On desktop the arrows reveal on hover; dots remain the always-on affordance. */
@media (hover: hover) {
  .ig-media .ig-carousel__nav {
    opacity: 0;
  }

  .ig-media:hover .ig-carousel__nav {
    opacity: 0.92;
  }

  .ig-carousel__nav:hover {
    background: rgba(20, 16, 30, 0.78);
  }
}

.ig-count-pill {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.ig-textpost {
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
}

.ig-textpost p {
  margin: 0;
  color: #fff;
  font-weight: 700;
  font-size: clamp(20px, 6vw, 30px);
  line-height: 1.3;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.25);
  overflow-wrap: anywhere;
}

.ig-burst {
  position: absolute;
  z-index: 5;
  width: 96px;
  height: 96px;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  fill: #fff;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
  animation: ig-burst 0.7s ease forwards;
}

@keyframes ig-burst {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(-12deg);
    opacity: 0;
  }

  35% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
  }
}

/* Actions row */

.ig-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 2px;
}

.ig-actions__btn {
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--text);
  width: 42px;
  height: 42px;
}

.ig-actions__btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}

.ig-actions__btn[data-role="like"][aria-pressed="true"] svg {
  fill: var(--like);
  stroke: var(--like);
}

.ig-actions__btn[data-role="save"][aria-pressed="true"] svg {
  fill: var(--accent-2);
  stroke: var(--accent-2);
}

.ig-actions__btn.is-bump svg {
  animation: ig-pop 0.35s ease;
}

.ig-actions__spacer {
  flex: 1;
}

@keyframes ig-pop {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1);
  }
}

.ig-card__body {
  padding: 0 14px 14px;
}

.ig-likes {
  font-weight: 700;
  font-size: 14px;
  margin: 2px 0 6px;
}

.ig-caption {
  font-size: 14px;
  line-height: 1.4;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.ig-caption a {
  font-weight: 700;
}

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

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

.ig-viewcomments {
  color: var(--muted);
  font-size: 14px;
  background: none;
  border: none;
  padding: 2px 0;
  display: block;
}

.ig-time {
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-top: 6px;
}

/* Buttons & forms ------------------------------------------------------ */

.ig-btn {
  display: inline-grid;
  place-items: center;
  border: none;
  border-radius: 12px;
  padding: 11px 18px;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  min-height: 44px;
  box-shadow: var(--glow);
}

.ig-btn--block {
  width: 100%;
}

.ig-btn--soft {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: none;
}

.ig-btn--outline {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text);
  box-shadow: none;
}

.ig-btn:disabled {
  opacity: 0.6;
}

.ig-page {
  padding: 14px;
}

.ig-page__title {
  font-size: 20px;
  font-weight: 800;
  margin: 6px 4px 14px;
}

/* Shared message alerts ------------------------------------------------ */
.ig-messages {
  margin-bottom: 12px;
}

/* Auth (login / signup / password) ------------------------------------- */

.ig-auth {
  min-height: calc(100dvh - var(--top-h) - var(--nav-h) - var(--safe-top) - var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 16px;
}

.ig-auth__card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px;
}

.ig-auth__brand {
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ig-auth__tagline {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 20px;
}

.ig-auth__content h1,
.ig-auth__content .ig-auth__title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 16px;
}

.ig-auth__content p {
  color: var(--muted);
  font-size: 14px;
}

.ig-auth__content a {
  color: var(--accent);
  font-weight: 600;
}

.ig-auth__content .btn {
  width: 100%;
  margin-top: 10px;
}

.ig-auth__content .row {
  margin: 0;
}

.ig-auth__content .col-sm-10,
.ig-auth__content [class^="col-"] {
  width: 100%;
  max-width: 100%;
  flex: 0 0 100%;
  padding: 0;
  margin-bottom: 12px;
}

.ig-auth__content label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.ig-auth__content .form-text {
  color: var(--faint);
  font-size: 12px;
}

/* About ---------------------------------------------------------------- */

.ig-about {
  padding: 8px 4px 24px;
}

.ig-about__hero {
  text-align: center;
  padding: 24px 12px 18px;
}

.ig-about__logo {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ig-about__hero p {
  color: var(--muted);
  font-size: 15px;
  max-width: 360px;
  margin: 8px auto 0;
}

.ig-about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}

.ig-about__feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.ig-about__feature span {
  font-size: 26px;
}

.ig-about__feature h3 {
  margin: 8px 0 4px;
  font-size: 15px;
}

.ig-about__feature p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.ig-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}

.ig-field textarea,
.ig-field input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  resize: vertical;
}

.ig-field textarea::placeholder,
.ig-field input::placeholder {
  color: var(--faint);
}

.ig-field textarea:focus,
.ig-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.ig-formerror {
  color: var(--like);
  font-size: 13px;
  margin-bottom: 10px;
}

.ig-formerror ul {
  margin: 0;
  padding-left: 18px;
}

/* Create --------------------------------------------------------------- */

.ig-segment {
  display: flex;
  gap: 6px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 4px;
  margin: 0 0 16px;
}

.ig-segment a {
  flex: 1;
  text-align: center;
  padding: 9px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}

.ig-segment a.is-active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.ig-dropzone {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 14px;
  overflow: hidden;
}

.ig-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ig-dropzone__hint {
  color: var(--muted);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ig-dropzone__hint .ig-dropzone__icon {
  font-size: 36px;
}

.ig-previews {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.ig-previews img {
  width: 84px;
  height: 105px;
  object-fit: cover;
  border-radius: 12px;
  flex: 0 0 auto;
}

.ig-textcompose {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  padding: 22px;
  margin-bottom: 14px;
}

.ig-textcompose textarea {
  width: 100%;
  background: transparent;
  border: none;
  resize: none;
  text-align: center;
  color: #fff;
  font-weight: 700;
  font-size: clamp(20px, 6vw, 28px);
  line-height: 1.3;
  outline: none;
}

.ig-textcompose textarea::placeholder {
  color: rgba(255, 255, 255, 0.78);
}

.ig-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.ig-swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.ig-swatch.is-active {
  border-color: var(--text);
}

/* Explore -------------------------------------------------------------- */

.ig-search {
  position: relative;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.ig-search input {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  padding: 11px 14px;
  font-size: 15px;
}

.ig-search input::placeholder {
  color: var(--faint);
}

.ig-search input:focus {
  outline: 1px solid var(--line-strong);
}

.ig-userresults {
  background: var(--surface);
}

.ig-userrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.ig-userrow__name {
  font-weight: 700;
  font-size: 14px;
}

.ig-userrow__handle {
  font-size: 13px;
  color: var(--muted);
}

.ig-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.ig-grid__item {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  overflow: hidden;
}

.ig-grid__item img,
.ig-grid__item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ig-grid__item .ig-textmini {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
}

.ig-textmini p {
  margin: 0;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ig-grid__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  color: #fff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.ig-grid__badge svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Profile -------------------------------------------------------------- */

.ig-profile__head {
  padding: 16px 16px 8px;
}

.ig-profile__top {
  display: flex;
  align-items: center;
  gap: 18px;
}

.ig-profile__avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  padding: 2px;
  background: var(--grad);
  flex: 0 0 auto;
  cursor: pointer;
  display: block;
  border: none;
  appearance: none;
  overflow: hidden;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.24s ease;
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.1);
}

.ig-profile__avatar:hover {
  transform: scale(1.04);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.ig-profile__avatar:active {
  transform: scale(0.98);
}

.ig-profile__avatar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.ig-profile__avatar img,
.ig-profile__avatar span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid var(--surface);
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
}

.ig-imageviewer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease 0.01s, visibility 0.22s ease 0.01s;
  background: rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(0px);
}

.ig-imageviewer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  backdrop-filter: blur(4px);
}

.ig-imageviewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.ig-imageviewer.is-open .ig-imageviewer__backdrop {
  opacity: 1;
}

.ig-imageviewer__frame {
  position: relative;
  width: min(92vw, 460px);
  height: min(92vw, 92vh, 460px);
  opacity: 0;
  transform: scale(0.92) translateY(20px);
  transition: opacity 0.26s cubic-bezier(0.16, 1, 0.3, 1), transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.ig-imageviewer.is-open .ig-imageviewer__frame {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.ig-imageviewer__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.3s ease, filter 0.3s ease;
}

.ig-imageviewer__frame:hover img {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.48);
}

.ig-imageviewer__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.85;
  transition: transform 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
  font-weight: 300;
  line-height: 1;
}

.ig-imageviewer__close:hover {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.8);
  opacity: 1;
}

.ig-imageviewer__close:active {
  transform: scale(0.94);
}

.ig-imageviewer__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {

  .ig-profile__avatar,
  .ig-imageviewer,
  .ig-imageviewer__backdrop,
  .ig-imageviewer__frame,
  .ig-imageviewer__close {
    transition: none;
  }
}

.ig-profile__stats {
  flex: 1;
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.ig-profile__stats b {
  display: block;
  font-size: 18px;
}

.ig-profile__stats span {
  font-size: 12px;
  color: var(--muted);
}

.ig-profile__name {
  font-weight: 800;
  font-size: 15px;
  margin: 12px 0 2px;
}

.ig-profile__bio {
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
  white-space: pre-wrap;
  color: var(--text);
}

.ig-profile__actions {
  display: flex;
  gap: 8px;
  margin: 14px 0 4px;
}

.ig-profile__actions .ig-btn {
  flex: 1;
}

.ig-tabs {
  display: flex;
  border-top: 1px solid var(--line);
  position: sticky;
  top: calc(var(--top-h) + var(--safe-top));
  background: var(--surface);
  z-index: 20;
}

.ig-tabs a {
  flex: 1;
  display: grid;
  place-items: center;
  height: 46px;
  color: var(--faint);
}

.ig-tabs a svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.ig-tabs a.is-active {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.ig-empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 24px;
}

.ig-empty__art {
  font-size: 46px;
  margin-bottom: 8px;
}

.ig-empty h2 {
  font-size: 18px;
  margin: 0 0 6px;
  color: var(--text);
}

/* Activity ------------------------------------------------------------- */

.ig-activity__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.ig-activity__row p {
  margin: 0;
  font-size: 14px;
}

.ig-activity__row .ig-time {
  margin: 2px 0 0;
}

.ig-activity__thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--surface-2);
}

/* Comments sheet ------------------------------------------------------- */

.ig-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.ig-sheet.is-open {
  display: block;
}

.ig-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.ig-sheet__panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--maxw);
  height: 72vh;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  animation: ig-slide-up 0.25s ease;
}

@keyframes ig-slide-up {
  from {
    transform: translate(-50%, 100%);
  }

  to {
    transform: translate(-50%, 0);
  }
}

.ig-sheet__grip {
  width: 38px;
  height: 4px;
  border-radius: 4px;
  background: var(--line-strong);
  margin: 8px auto 4px;
}

.ig-sheet__head {
  text-align: center;
  font-weight: 700;
  padding: 6px 0 10px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.ig-sheet__close {
  position: absolute;
  right: 12px;
  top: 2px;
  border: none;
  background: none;
  font-size: 24px;
  color: var(--text);
}

.ig-sheet__list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

.ig-sheet__form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.ig-sheet__form input {
  flex: 1;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 15px;
}

.ig-sheet__form input::placeholder {
  color: var(--faint);
}

.ig-sheet__form button {
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 700;
}

.ig-sheet__form button:disabled {
  color: var(--faint);
}

.ig-sheet__login {
  display: block;
  text-align: center;
  padding: 14px;
  color: var(--accent);
  font-weight: 600;
  border-top: 1px solid var(--line);
}

.ig-sheet__empty,
.ig-sheet__loading {
  text-align: center;
  color: var(--muted);
  padding: 30px 0;
}

.ig-comment {
  display: flex;
  gap: 10px;
  padding: 9px 0;
}

.ig-comment__body {
  font-size: 14px;
  line-height: 1.4;
}

.ig-comment__handle {
  font-weight: 700;
  margin-right: 6px;
}

.ig-comment__time {
  font-size: 12px;
  color: var(--faint);
  margin-top: 2px;
}

/* Messaging ------------------------------------------------------------ */

.ig-inbox__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.ig-inbox__main {
  flex: 1;
  min-width: 0;
}

.ig-inbox__name {
  font-weight: 700;
  font-size: 14px;
}

.ig-inbox__preview {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ig-inbox__preview.is-unread {
  color: var(--text);
  font-weight: 600;
}

.ig-inbox__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-2);
  flex: 0 0 auto;
}

.ig-thread {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--top-h) - var(--safe-top));
}

.ig-thread__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.ig-thread__head a.ig-back {
  font-size: 24px;
  line-height: 1;
}

.ig-thread__list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ig-bubble {
  max-width: 76%;
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ig-bubble--them {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text);
  border-bottom-left-radius: 5px;
}

.ig-bubble--me {
  align-self: flex-end;
  background: var(--grad);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.ig-thread__compose {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.ig-thread__compose input {
  flex: 1;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 15px;
}

.ig-thread__compose input::placeholder {
  color: var(--faint);
}

.ig-thread__compose button {
  border: none;
  background: var(--grad);
  color: #fff;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 700;
}

/* Toast ---------------------------------------------------------------- */

.ig-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  transform: translateX(-50%) translateY(12px);
  z-index: 90;
  background: var(--surface-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: 90%;
}

.ig-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Privacy: locks, menus, settings, requests --------------------------- */

.ig-lock-mini {
  font-size: 0.82em;
}

.ig-locked {
  text-align: center;
  color: var(--muted);
  padding: 52px 28px 64px;
  border-top: 1px solid var(--line);
}

.ig-locked__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 28px;
}

.ig-locked h2 {
  font-size: 17px;
  color: var(--text);
  margin: 0 0 6px;
}

.ig-locked p {
  font-size: 14px;
  margin: 0 auto;
  max-width: 300px;
  line-height: 1.45;
}

/* Bottom-sheet options menu (block / unblock) */
.ig-menu {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.ig-menu[hidden] {
  display: none;
}

.ig-menu__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.ig-menu__panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--maxw);
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  padding-bottom: var(--safe-bottom);
  animation: ig-slide-up 0.25s ease;
}

.ig-menu__item {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  padding: 16px;
}

.ig-menu__item:first-child {
  border-top: none;
}

.ig-menu__item--danger {
  color: var(--like);
  font-weight: 700;
}

/* Settings (privacy) page */
.ig-settings {
  padding: 4px 0 28px;
}

.ig-settings__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  font-weight: 600;
}

.ig-settings__right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.ig-pill {
  background: var(--like);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
}

.ig-settings__form {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ig-settings__subtitle {
  padding: 24px 16px 4px;
  font-size: 15px;
}

.ig-settings__hint {
  padding: 4px 16px;
  color: var(--faint);
  font-size: 14px;
}

.ig-settings__blocked {
  display: flex;
  flex-direction: column;
}

.ig-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.ig-toggle__text {
  flex: 1;
}

.ig-toggle__text b {
  display: block;
  font-size: 15px;
}

.ig-toggle__text small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.ig-toggle__input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.ig-toggle__track {
  flex: 0 0 auto;
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background 0.2s ease;
}

.ig-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ig-toggle__input:checked~.ig-toggle__track {
  background: var(--accent);
}

.ig-toggle__input:checked~.ig-toggle__track .ig-toggle__thumb {
  transform: translateX(20px);
}

.ig-toggle__input:focus-visible~.ig-toggle__track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ig-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  appearance: none;
}

.ig-field select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Follow-request banner + rows */
.ig-reqbanner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ig-reqbanner__icon {
  font-size: 22px;
}

.ig-reqbanner__text {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
}

.ig-reqbanner__chev {
  color: var(--muted);
  font-size: 20px;
}

.ig-reqs {
  padding-bottom: 28px;
}

.ig-reqrow__actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.ig-reqrow__actions .ig-btn {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 13px;
  box-shadow: none;
}

/* Settings dashboard (grouped list) */
.ig-settings__group {
  margin-bottom: 22px;
}

.ig-settings__label {
  padding: 6px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
}

.ig-settings__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.ig-settings__item:last-child {
  border-bottom: 1px solid var(--line);
}

.ig-settings__ico {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: var(--surface-2);
  border-radius: 11px;
}

.ig-settings__body {
  flex: 1;
  min-width: 0;
}

.ig-settings__body b {
  display: block;
  font-size: 15px;
}

.ig-settings__body small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.ig-settings__chev {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 18px;
}

.ig-settings__item--danger .ig-settings__body b {
  color: var(--like);
}

.ig-settings__row {
  display: flex;
  padding: 14px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* Danger zone (deactivate) */
.ig-dangerzone {
  margin: 18px 16px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.ig-dangerzone h2 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--like);
}

.ig-dangerzone p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ig-btn--danger {
  background: var(--like);
  box-shadow: none;
}

/* Edit profile */
.ig-editprofile {
  padding-bottom: 28px;
}

.ig-editprofile__avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 6px 0 18px;
}

.ig-editprofile__avatar .ig-profile__avatar {
  width: 92px;
  height: 92px;
}

.ig-editprofile__change {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* Form error lists (Django default markup) */
.errorlist {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  color: var(--like);
  font-size: 13px;
}

/* Thread extras: title, blocked composer */
.ig-thread__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ig-thread__blocked {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-bottom: calc(14px + var(--safe-bottom));
}

.ig-bubble[data-mine="true"] {
  cursor: pointer;
  -webkit-touch-callout: none;
}

/* Post options menu / archive / edit */
.ig-card__menu {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 50%;
}

.ig-card__menu svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.ig-card__menu:active {
  transform: scale(0.9);
}

.ig-archived-banner {
  margin: 0 0 8px;
  padding: 10px 16px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.ig-archived-hint {
  padding: 0 16px 12px;
  color: var(--muted);
  font-size: 13px;
}

.ig-editpost {
  padding-bottom: 28px;
}

.ig-editpost__preview {
  width: 160px;
  aspect-ratio: 1;
  margin: 4px auto 16px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
}

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

.ig-editpost__actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.ig-editpost__actions .ig-btn {
  flex: 1;
}

/* Onboarding wizard */
.ig-onboard {
  max-width: 460px;
  margin: 0 auto;
  padding: 24px 20px calc(28px + var(--safe-bottom));
}

.ig-onboard__progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 6px 0 26px;
}

.ig-onboard__progress span {
  width: 30px;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  transition: background-color 0.25s ease;
}

.ig-onboard__progress span.is-active {
  background: var(--grad);
}

.ig-onboard__step {
  animation: ig-onboard-in 0.25s ease both;
}

@keyframes ig-onboard-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.ig-onboard__art {
  font-size: 42px;
  text-align: center;
}

.ig-onboard h1 {
  font-size: 22px;
  margin: 10px 0 4px;
  text-align: center;
}

.ig-onboard__sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.ig-handle {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 0 12px;
}

.ig-handle__at {
  color: var(--muted);
  font-weight: 700;
}

.ig-handle input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 12px 8px;
  font-size: 15px;
}

.ig-handle input:focus {
  outline: none;
}

.ig-handle__status {
  width: 20px;
  text-align: center;
  font-weight: 800;
}

.ig-handle__status.is-ok {
  color: #3ad29f;
}

.ig-handle__status.is-bad {
  color: var(--like);
}

.ig-handle__status.is-checking {
  color: var(--muted);
}

.ig-onboard__nav {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.ig-onboard__nav .ig-btn {
  flex: 1;
}

.ig-onboard__skip {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.ig-onboard__avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 120px;
  height: 120px;
  margin: 6px auto 14px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px dashed var(--line-strong);
  cursor: pointer;
  overflow: hidden;
}

.ig-onboard__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ig-onboard__avatar-fallback {
  font-size: 36px;
  color: var(--muted);
}

.ig-onboard__pick {
  display: block;
  text-align: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* Full-screen progress overlay (uploads / saves) */
.ig-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 8, 20, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.ig-overlay.is-show {
  opacity: 1;
  visibility: visible;
}

.ig-overlay__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 180px;
  padding: 26px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.ig-overlay__spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: ig-spin 0.8s linear infinite;
}

.ig-overlay__msg {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

@keyframes ig-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Submit buttons in a loading state */
.ig-btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.ig-btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  animation: ig-spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {

  .ig-overlay__spinner,
  .ig-btn.is-loading::after {
    animation-duration: 1.6s;
  }
}

/* Micro-interactions & polish ----------------------------------------- */

.ig-body {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.ig-tab:focus:not(:focus-visible),
.ig-iconbtn:focus:not(:focus-visible),
.ig-actions__btn:focus:not(:focus-visible) {
  outline: none;
}

/* Press feedback for tappable controls (springy, fast) */
.ig-tab,
.ig-iconbtn,
.ig-actions__btn,
.ig-btn,
.ig-card__follow,
.ig-segment a,
.ig-swatch,
.ig-tabs a,
.ig-rail__item,
.ig-tab__plus {
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.18s ease,
    opacity 0.18s ease, box-shadow 0.2s ease, background-color 0.18s ease, filter 0.18s ease;
  -webkit-user-select: none;
  user-select: none;
}

.ig-tab:active,
.ig-iconbtn:active,
.ig-actions__btn:active,
.ig-card__follow:active,
.ig-segment a:active,
.ig-rail__item:active {
  transform: scale(0.9);
}

.ig-btn:active {
  transform: scale(0.97);
}

.ig-tab--create:active .ig-tab__plus {
  transform: scale(0.88);
  box-shadow: 0 4px 14px rgba(255, 122, 77, 0.5);
}

/* Active tab indicator: soft gradient pill above the icon */
.ig-tab {
  position: relative;
}

.ig-tab.is-active:not(.ig-tab--create)::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: var(--grad);
  transform: translateX(-50%);
}

/* Feed entrance reveal (progressive enhancement; only when JS opts in) */
.ig-reveal-on .ig-card {
  opacity: 0;
  transform: translateY(14px);
}

.ig-reveal-on .ig-card.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Loading skeleton shimmer */
.ig-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
}

.ig-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: ig-shimmer 1.2s infinite;
}

.ig-feed__more {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 0 16px;
}

.ig-feed__more .ig-skeleton {
  height: 64px;
  border-radius: var(--radius-sm);
  margin: 0 12px;
}

@keyframes ig-shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* Momentum scrolling for horizontal/scroll regions */
.ig-rail,
.ig-carousel,
.ig-previews,
.ig-sheet__list,
.ig-thread__list {
  -webkit-overflow-scrolling: touch;
}

/* Desktop hover affordances */
@media (hover: hover) {
  .ig-tab:hover {
    color: var(--text);
  }

  .ig-iconbtn:hover {
    background: var(--surface-2);
  }

  .ig-btn:hover {
    filter: brightness(1.06);
  }

  .ig-actions__btn:hover {
    color: var(--accent);
  }

  .ig-card__menu:hover {
    color: var(--accent);
  }

  .ig-grid__item img,
  .ig-grid__item video,
  .ig-grid__item .ig-textmini {
    transition: transform 0.3s ease;
  }

  .ig-grid__item:hover img,
  .ig-grid__item:hover video,
  .ig-grid__item:hover .ig-textmini {
    transform: scale(1.05);
  }
}

@media (min-width: 600px) {
  .ig-shell {
    border-inline: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  .ig-reveal-on .ig-card {
    opacity: 1;
    transform: none;
  }
}

/* Image overlay */

/* This sits on top and intercepts clicks */
.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  /* Makes it completely invisible */

  /* Ensures mobile devices don't show the 'Save Image' popup on long-press */
  -webkit-touch-callout: none;
}
