/* Final integration layer: profile settings, media consistency and navigation. */

/* Profile settings ------------------------------------------------------- */
.profile-settings-modal .profile-settings__card {
  align-content: start;
}

.profile-settings-modal .profile-form-group {
  min-width: 0;
}

.profile-settings-modal .profile-form-option {
  min-width: 0;
  min-height: 50px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 15px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  transition: background-color .18s ease, border-color .18s ease;
}

.profile-settings-modal .profile-form-option:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.profile-settings-modal .profile-form-option label {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  color: inherit !important;
  cursor: pointer;
  font: inherit;
}

.profile-settings-modal .profile-form-option input[type="checkbox"],
.profile-settings-modal .profile-form-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 24px;
  margin: 0;
  padding: 2px;
  flex: 0 0 42px;
  background: #aeb5bf;
  border: 1px solid transparent;
  border-radius: 999px;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, .16);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.profile-settings-modal .profile-form-option input[type="checkbox"]::after,
.profile-settings-modal .profile-form-option input[type="radio"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(15, 23, 42, .28);
  opacity: 1;
  transform: none;
  transition: transform .2s var(--ease-main);
}

.profile-settings-modal .profile-form-option input[type="checkbox"]:checked,
.profile-settings-modal .profile-form-option input[type="radio"]:checked {
  background: var(--accent-main);
  border-color: var(--accent-main);
}

.profile-settings-modal .profile-form-option input[type="checkbox"]:checked::after,
.profile-settings-modal .profile-form-option input[type="radio"]:checked::after {
  transform: translateX(18px);
}

.profile-settings-modal .profile-form-option input[type="checkbox"]:focus-visible,
.profile-settings-modal .profile-form-option input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-main-soft), inset 0 1px 3px rgba(15, 23, 42, .12);
}

.profile-settings-modal .profile-form-option--security:has(input:not(:checked)) {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, .16);
}

.profile-settings-modal .profile-form-option--security input:not(:checked) {
  background: var(--danger);
}

.profile-settings-modal .profile-form-file {
  min-height: 52px;
  padding: 6px 8px;
  overflow: hidden;
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
}

.profile-settings-modal .profile-form-file::file-selector-button {
  min-height: 38px;
  margin-right: 11px;
  padding: 0 14px;
  border: 0;
  border-radius: 11px;
  background: var(--accent-main-soft);
  color: var(--accent-main);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.profile-settings-modal .profile-form-file::-webkit-file-upload-button {
  min-height: 38px;
  margin-right: 11px;
  padding: 0 14px;
  border: 0;
  border-radius: 11px;
  background: var(--accent-main-soft);
  color: var(--accent-main);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

/* Full story gallery: identical fixed canvas to the feed card. ----------- */
.full_story > .story-primary-media .pk-gallery {
  width: 100% !important;
  aspect-ratio: 4 / 3 !important;
  height: auto !important;
  max-height: min(72dvh, 620px) !important;
  overflow: hidden !important;
}

.full_story > .story-primary-media .pk-gallery .pk-gallery__grid {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  display: grid !important;
  overflow: hidden !important;
  aspect-ratio: auto !important;
}

.full_story > .story-primary-media .pk-gallery--2 .pk-gallery__grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: minmax(0, 1fr) !important;
}

.full_story > .story-primary-media .pk-gallery .pk-gallery__link {
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.full_story > .story-primary-media .pk-gallery .pk-gallery__link img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
}

/* Related cards: 4:3 canvas, complete image and blurred empty margins. --- */
.related-card__media {
  position: relative;
  aspect-ratio: 4 / 3 !important;
  overflow: hidden;
  isolation: isolate;
  background: #161b21;
}

.related-card__media-bg {
  position: absolute !important;
  inset: -18px !important;
  z-index: 0 !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  filter: blur(20px) brightness(.62) saturate(1.05) !important;
  opacity: .9 !important;
  transform: scale(1.12) !important;
}

.related-card__media-inner {
  position: absolute !important;
  inset: 0 !important;
  z-index: 1 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
}

.related-card__image {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block !important;
  object-fit: contain !important;
  object-position: center !important;
}

.related-card__type {
  z-index: 2;
}

/* Sidebar --------------------------------------------------------------- */
.side_menu_marker,
.side_menu_marker[class*="side_menu_marker--"] {
  --side-menu-marker: #7e8792 !important;
  --side-menu-marker-ring: rgba(126, 135, 146, .13) !important;
}

.theme-dark .side_menu_marker,
.theme-dark .side_menu_marker[class*="side_menu_marker--"] {
  --side-menu-marker: #9ba3ae !important;
  --side-menu-marker-ring: rgba(155, 163, 174, .14) !important;
}

.side_menu_more.is-open .js-side-menu-toggle {
  display: none !important;
}

/* Last comments and profile activity ----------------------------------- */
.comment-card--stream {
  display: block;
  margin: 0 0 14px !important;
}

.comment-card--stream:last-of-type {
  margin-bottom: 0 !important;
}

.comment-card--activity .comment-card__context-label,
.profile-comment__context-label {
  font-size: 10px !important;
  line-height: 1.2 !important;
  font-weight: 650 !important;
  letter-spacing: .035em !important;
}

.comment-card--activity .comment-card__news-title,
.comment-card--activity .comment-card__news-title a,
.profile-comment__news-title,
.profile-comment__news-title a {
  font-size: 13px !important;
  line-height: 1.35 !important;
  font-weight: 650 !important;
  letter-spacing: -.01em !important;
}

@media screen and (max-width: 640px) {
  .profile-settings-modal .auth-modal__panel {
    padding-right: 12px;
    padding-left: 12px;
  }

  .profile-settings-modal .profile-settings__card {
    padding: 15px;
    border-radius: 18px;
  }

  .comment-card.comment-card--activity > .comment-card__inner {
    padding: 14px !important;
    border-radius: 18px !important;
  }

  .content > .comment-card--stream {
    margin-right: max(12px, env(safe-area-inset-right)) !important;
    margin-bottom: 12px !important;
    margin-left: max(12px, env(safe-area-inset-left)) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-settings-modal .profile-form-option,
  .profile-settings-modal .profile-form-option input,
  .profile-settings-modal .profile-form-option input::after {
    transition: none !important;
  }
}
