.category-card {
  position: relative;
  cursor: pointer;
  touch-action: manipulation;
}

.category-card::after {
  content: "\203A";
  position: absolute;
  top: 26px;
  right: 26px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 138, 29, 0.38);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  background: rgba(255, 138, 29, 0.12);
  font-size: 1.55rem;
  line-height: 1;
  opacity: 0.82;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.category-card:hover::after,
.category-card:focus-visible::after {
  transform: translateX(3px);
  border-color: rgba(255, 138, 29, 0.72);
  background: rgba(255, 138, 29, 0.22);
  opacity: 1;
}

.category-card:focus-visible {
  outline: 3px solid rgba(255, 178, 92, 0.86);
  outline-offset: 4px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.category-pill::after {
  content: "\203A";
  color: var(--accent-2);
  font-size: 1.2em;
  font-weight: 800;
  line-height: 1;
  transition: transform 0.2s ease;
}

.category-pill:hover,
.category-pill:focus-visible {
  color: var(--text);
  border-color: rgba(255, 138, 29, 0.58);
  background: rgba(255, 138, 29, 0.12);
}

.category-pill:hover::after,
.category-pill:focus-visible::after {
  transform: translateX(2px);
}

.category-pill:focus-visible {
  outline: 3px solid rgba(255, 178, 92, 0.86);
  outline-offset: 3px;
}

#seo-oblasti .category-card h3 {
  padding-right: 52px;
}

.category-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 4, 7, 0.82);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.category-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.category-modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(31, 34, 38, 0.98), rgba(14, 18, 24, 0.99));
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.58);
  transform: translateY(18px) scale(0.98);
  transition: transform 0.2s ease;
}

.category-modal.is-open .category-modal-panel {
  transform: translateY(0) scale(1);
}

.category-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.category-modal-close:hover,
.category-modal-close:focus-visible {
  border-color: rgba(255, 138, 29, 0.62);
  background: rgba(255, 138, 29, 0.16);
}

.category-modal-title {
  max-width: calc(100% - 44px);
  margin: 0 0 18px;
  font-size: clamp(1.45rem, 3.5vw, 2rem);
  line-height: 1.18;
}

.category-modal-text {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.72;
}

.category-modal-image {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 18px auto 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
}

.category-modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.category-modal-actions .btn:hover,
.category-modal-actions .btn:focus-visible {
  transform: none;
}

body.category-modal-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .category-card::after {
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
  }

  .category-modal {
    padding: 16px;
  }

  .category-modal-panel {
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    padding: 34px 22px 24px;
  }

  .category-modal-title {
    padding-right: 36px;
  }

  .category-modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .category-modal-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .category-card::after,
  .category-pill,
  .category-pill::after,
  .category-modal,
  .category-modal-panel {
    transition: none;
  }
}
