.card {
  display: block;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  content-visibility: auto;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.card img,
.card video {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
  background: #eee;
}

.meta {
  padding: 14px 16px;
}

.caption {
  font-size: 17px;
  line-height: 1.5;
  max-height: 4.5em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link {
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.6;
}

.media-type-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  z-index: 2;
  letter-spacing: 0.01em;
}

.empty-state,
.error-state {
  grid-column: 1 / -1;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 14px;
  padding: 14px 16px;
  color: #555;
}

.error-state {
  background: #fff3f3;
  border-color: #ffd2d2;
  color: #8a1f1f;
}

.seo-content {
  margin-top: 34px;
  border-radius: 8px;
  padding: 34px 30px 26px;
}

.seo-title {
  margin: 0;
  max-width: 24ch;
  font-size: clamp(28px, 4.6vw, 58px);
  line-height: 1.07;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: lowercase;
}

.seo-subtitle {
  margin: 0 0 22px;
  color: #4c4c4c;
  font-size: clamp(28px, 3.7vw, 52px);
  line-height: 1;
  font-weight: 400;
  text-transform: lowercase;
}

.seo-body-wrap {
  position: relative;
  max-height: 84px;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.seo-body-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background: linear-gradient(to bottom, rgba(239, 239, 239, 0), #efefef 78%);
}

.seo-content.expanded .seo-body-wrap {
  max-height: 420px;
}

.seo-content.expanded .seo-body-wrap::after {
  display: none;
}

.seo-body {
  margin: 0;
  font-size: clamp(18px, 2.1vw, 40px);
  line-height: 1.25;
  color: #b6b6b6;
}

.seo-toggle {
  display: block;
  margin: 18px auto 0;
  border: none;
  background: transparent;
  color: #111;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-decoration: underline;
  text-underline-offset: 8px;
  cursor: pointer;
  text-transform: lowercase;
}

.seo-toggle:focus-visible {
  outline: 3px solid #2f6fed;
  outline-offset: 3px;
  border-radius: 6px;
}

@media (max-width: 700px) {
  .media-type-badge {
    top: 10px;
    right: 10px;
    font-size: 11px;
    padding: 6px 9px;
  }

  .seo-content {
    padding: 24px 20px 20px;
  }

  .seo-body-wrap {
    max-height: 72px;
  }

  .seo-toggle {
    font-size: 36px;
  }
}

main > .feed-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 28px;
  width: 100%;
  clear: both;
}

main > .feed-actions #loadMoreBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 240px;
  padding: 16px 30px;
  font-size: 18px;
  font-weight: 800;
  border-radius: 16px;
  margin-left: auto;
  margin-right: auto;
  min-height: 56px;
}

.card:focus-visible,
.feed-actions #loadMoreBtn:focus-visible,
.modal-close:focus-visible,
.carousel-arrow:focus-visible {
  outline: 3px solid #2f6fed;
  outline-offset: 3px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
}

.modal.open {
  display: flex;
}

.modal-panel {
  width: min(980px, 100%);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.25);
  display: grid;
  grid-template-columns: 1.3fr 1fr;
}

@media (max-width: 860px) {
  .modal-panel {
    grid-template-columns: 1fr;
  }
}

.modal-media {
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 420px;
}

.modal-media img,
.modal-media video {
  width: 100%;
  height: 100%;
  max-height: 78vh;
  display: block;
}

.modal-media img {
  object-fit: cover;
}

.modal-media video {
  object-fit: cover;
}

.carousel-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: manipulation;
  z-index: 4;
}

.carousel-arrow:hover {
  background: rgba(0, 0, 0, 0.7);
}

.carousel-arrow.prev {
  left: 16px;
}

.carousel-arrow.next {
  right: 16px;
}

.carousel-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  pointer-events: auto;
  z-index: 4;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
}

.carousel-dot.active {
  background: #fff;
}

.modal-content {
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.modal-text {
  margin: 14px 0 0;
  padding: 14px 16px;
  font-size: clamp(15px, 1.15vw, 17px);
  line-height: 1.7;
  color: #222;
  opacity: 1;
  white-space: pre-wrap;
  word-break: break-word;
  text-wrap: pretty;
  background: #f6f6f6;
  border: 1px solid #ececec;
  border-radius: 14px;
  flex: 1;
}

.modal-actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.modal-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 10001;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.5);
}

@media (max-width: 600px) {
  .modal {
    padding: 0;
  }

  .modal-panel {
    width: 100%;
    height: 100%;
    border-radius: 0;
    grid-template-columns: 1fr;
  }

  .modal-media img,
  .modal-media video {
    max-height: 55vh;
  }

  .modal-media {
    min-height: 55vh;
  }

  .modal-content {
    height: auto;
    max-height: 45vh;
    overflow: auto;
  }

  .modal-text {
    margin-top: 12px;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.6;
    border-radius: 12px;
  }

  .carousel-arrow {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .carousel-arrow.prev {
    left: 10px;
  }

  .carousel-arrow.next {
    right: 10px;
  }

  .carousel-dots {
    bottom: 10px;
  }
}
