:root {
  --bg: #fafafa;
  --white: #ffffff;
  --border: #dbdbdb;
  --text: #262626;
  --text-muted: #8e8e8e;
  --link: #0095f6;
  --like: #ed4956;
  --story-gradient: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: 975px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-family: "Grand Hotel", cursive;
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  flex-shrink: 0;
}

.search {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  min-width: 215px;
  color: var(--text-muted);
}

.search__input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 14px;
  text-align: center;
}

.search__input::placeholder {
  color: var(--text-muted);
}

.search__input:focus {
  text-align: left;
}

.nav-icons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  color: var(--text);
}

.icon-btn:hover {
  opacity: 0.65;
}

.nav-icons__avatar {
  padding: 4px;
}

.nav-icons__avatar .avatar {
  width: 28px;
  height: 28px;
}

.layout {
  max-width: 975px;
  margin: 0 auto;
  padding: 30px 20px 60px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 1000px) {
  .search {
    display: flex;
  }

  .layout {
    grid-template-columns: minmax(0, 470px) 293px;
    justify-content: center;
    align-items: start;
  }
}

.feed {
  width: 100%;
  max-width: 470px;
  margin: 0 auto;
}

@media (min-width: 1000px) {
  .feed {
    margin: 0;
  }
}

.stories {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 0 12px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.stories__track {
  display: flex;
  gap: 16px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.stories__track::-webkit-scrollbar {
  display: none;
}

.story {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 66px;
  cursor: pointer;
}

.story__ring {
  padding: 2px;
  border-radius: 50%;
  background: var(--story-gradient);
}

.story__ring--seen {
  background: var(--border);
}

.story__name {
  font-size: 12px;
  color: var(--text);
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: inline-block;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 2px solid var(--white);
  width: 56px;
  height: 56px;
}

.avatar--sm {
  width: 32px;
  height: 32px;
}

.avatar--story {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.avatar--1 {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.avatar--2 {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.avatar--3 {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.avatar--4 {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.post {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.post__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.post__user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post__user .avatar {
  width: 32px;
  height: 32px;
}

.post__username {
  font-weight: 600;
  display: block;
  font-size: 14px;
}

.post__location {
  font-size: 12px;
  color: var(--text-muted);
}

.post__media {
  position: relative;
  aspect-ratio: 1;
  background: #eee;
  cursor: pointer;
  user-select: none;
}

.post__image {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.post__image--1 {
  background-image: linear-gradient(160deg, #1a1a2e 0%, #16213e 40%, #e94560 100%);
}

.post__image--2 {
  background-image: linear-gradient(120deg, #ffecd2 0%, #fcb69f 50%, #ff9a9e 100%);
}

.post__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px;
}

.post__actions-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.like-btn .heart-filled.hidden {
  display: none;
}

.like-btn.liked .heart-outline {
  display: none;
}

.like-btn.liked .heart-filled {
  display: block !important;
}

.post__likes,
.post__caption {
  padding: 0 12px;
  margin: 0 0 6px;
}

.post__time {
  padding: 0 12px 12px;
  margin: 0;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.heart-pop {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.heart-pop.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.sidebar {
  display: none;
}

@media (min-width: 1000px) {
  .sidebar {
    display: block;
    position: sticky;
    top: 100px;
  }
}

.sidebar__me {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.sidebar__me .avatar {
  width: 56px;
  height: 56px;
}

.sidebar__username {
  font-weight: 600;
  font-size: 14px;
}

.sidebar__fullname {
  font-size: 14px;
  color: var(--text-muted);
}

.sidebar__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.suggestions {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.suggestions li {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.suggestions li .avatar {
  width: 32px;
  height: 32px;
}

.suggestions__user {
  display: block;
  font-weight: 600;
  font-size: 14px;
}

.suggestions__hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.link-btn {
  margin-left: auto;
  color: var(--link);
  font-weight: 600;
  font-size: 12px;
}

.link-btn--muted {
  color: var(--text);
  font-size: 12px;
}

.sidebar__footer {
  font-size: 11px;
  color: #c7c7c7;
  line-height: 1.6;
}

.sidebar__footer p {
  margin: 0 0 8px;
}

.sidebar__copy {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gallery-block {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.gallery-block__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--text);
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.gallery__item {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  margin: 0;
  border: none;
  cursor: pointer;
  display: block;
  overflow: hidden;
}

.gallery__item:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.gallery__thumb {
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.gallery__item:hover .gallery__thumb {
  opacity: 0.92;
  transform: scale(1.02);
}

.gallery__thumb--1,
.gallery-modal__image.gallery__thumb--1 {
  background-image: linear-gradient(145deg, #2d3436 0%, #636e72 40%, #dfe6e9 100%);
}

.gallery__thumb--2,
.gallery-modal__image.gallery__thumb--2 {
  background-image: linear-gradient(160deg, #0984e3 0%, #74b9ff 50%, #a29bfe 100%);
}

.gallery__thumb--3,
.gallery-modal__image.gallery__thumb--3 {
  background-image: linear-gradient(135deg, #d63031 0%, #fdcb6e 100%);
}

.gallery__thumb--4,
.gallery-modal__image.gallery__thumb--4 {
  background-image: linear-gradient(180deg, #b2bec3 0%, #2d3436 100%);
}

.gallery__thumb--5,
.gallery-modal__image.gallery__thumb--5 {
  background-image: linear-gradient(120deg, #00b894 0%, #55efc4 100%);
}

.gallery__thumb--6,
.gallery-modal__image.gallery__thumb--6 {
  background-image: linear-gradient(200deg, #6c5ce7 0%, #a29bfe 50%, #fd79a8 100%);
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gallery-modal[hidden] {
  display: none !important;
}

.gallery-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  cursor: pointer;
}

.gallery-modal__panel {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 560px);
  width: 100%;
}

.gallery-modal__close {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 2;
  color: #fff;
  padding: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
}

.gallery-modal__close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.5);
}

.gallery-modal__frame {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.gallery-modal__image {
  width: 100%;
  aspect-ratio: 1;
  background-size: cover;
  background-position: center;
}

.gallery-modal__caption {
  margin: 12px 0 0;
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
