/* =========================================================
   4HE / UTILITIES
   Service classes, helpers and small shared effects
   ========================================================= */

/* =========================
   VISIBILITY / DISPLAY
   ========================= */

.hidden,
.is-hidden,
.d_none {
  display: none !important;
}

.d-block {
  display: block !important;
}

.d-inline {
  display: inline !important;
}

.d-inline-block {
  display: inline-block !important;
}

.d-flex {
  display: flex !important;
}

.d-inline-flex {
  display: inline-flex !important;
}

.d-grid {
  display: grid !important;
}

/* =========================
   ACCESSIBILITY
   ========================= */

.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* =========================
   POSITION
   ========================= */

.pos-relative {
  position: relative !important;
}

.pos-absolute {
  position: absolute !important;
}

.pos-static {
  position: static !important;
}

/* =========================
   FLEX HELPERS
   ========================= */

.items-center {
  align-items: center !important;
}

.items-start {
  align-items: flex-start !important;
}

.items-end {
  align-items: flex-end !important;
}

.justify-center {
  justify-content: center !important;
}

.justify-between {
  justify-content: space-between !important;
}

.justify-start {
  justify-content: flex-start !important;
}

.justify-end {
  justify-content: flex-end !important;
}

.flex-wrap {
  flex-wrap: wrap !important;
}

.flex-nowrap {
  flex-wrap: nowrap !important;
}

.flex-1 {
  flex: 1 1 auto !important;
}

.flex-auto {
  flex: 0 0 auto !important;
}

.min-w-0 {
  min-width: 0 !important;
}

/* =========================
   TEXT
   ========================= */

.text-left {
  text-align: left !important;
}

.text-center {
  text-align: center !important;
}

.text-right {
  text-align: right !important;
}

.text-nowrap {
  white-space: nowrap !important;
}

.text-truncate {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* =========================
   OVERFLOW
   ========================= */

.overflow-hidden {
  overflow: hidden !important;
}

.overflow-visible {
  overflow: visible !important;
}

/* =========================
   RADIUS
   ========================= */

.radius-10 {
  border-radius: 10px !important;
}

.radius-12 {
  border-radius: 12px !important;
}

.radius-14 {
  border-radius: 14px !important;
}

.radius-16 {
  border-radius: 16px !important;
}

.radius-18 {
  border-radius: 18px !important;
}

.radius-20 {
  border-radius: 20px !important;
}

.radius-pill {
  border-radius: 999px !important;
}

.radius-circle {
  border-radius: 50% !important;
}

/* =========================
   SHADOW / BORDER / BACKGROUND
   ========================= */

.shadow-none {
  box-shadow: none !important;
}

.border-none {
  border: 0 !important;
}

.bg-none {
  background: transparent !important;
}

/* =========================
   CURSOR / POINTER
   ========================= */

.cursor-pointer {
  cursor: pointer !important;
}

.pointer-none {
  pointer-events: none !important;
}

.pointer-auto {
  pointer-events: auto !important;
}

/* =========================
   IMAGE HELPERS
   ========================= */

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

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

/* =========================
   SCROLL LOCK
   ========================= */

body.ui-lock,
body.no-scroll,
html.no-scroll {
  overflow: hidden !important;
}

/* =========================
   GLOBAL BACKDROP
   Shared backdrop for card menus / bottom sheets
   ========================= */

.card-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1005;
  background: var(--overlay-soft);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.card-menu-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* =========================
   MODAL / OVERLAY STATE GUARDS
   Geometry lives in layout.css / auth.css / static-pages.css
   ========================= */

.auth-modal,
.search-overlay {
  visibility: hidden;
}

.auth-modal.is-open,
.search-overlay.is-open {
  visibility: visible;
}

.auth-modal__panel,
.search-overlay__panel {
  visibility: hidden;
  pointer-events: none;
}

.auth-modal.is-open .auth-modal__panel,
.search-overlay.is-open .search-overlay__panel {
  visibility: visible;
  pointer-events: auto;
}

.auth-modal__stage {
  pointer-events: none;
}

.auth-modal__stage.is-active {
  pointer-events: auto;
}

.auth-modal:not(.is-open),
.search-overlay:not(.is-open) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.auth-modal:not(.is-open) *,
.search-overlay:not(.is-open) * {
  pointer-events: none !important;
}

.menu-close {
  display: none !important;
}

/* =========================
   SLICE / COLLAPSE
   ========================= */

.slice {
  position: relative;
  overflow: hidden;
  transition: height 0.28s ease;
}

.slice-masked::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: 120px;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    var(--surface) 100%
  );
  pointer-events: none;
}

.slice-btn {
  padding: 14px 0 0;
}

.slice-btn span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: var(--accent-main-soft);
  border-radius: 12px;
  color: var(--accent-main);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  font-weight: 600;
}

/* =========================
   DLE TAG HELPERS
   ========================= */

.page_tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0;
}

.page_tags a:not(:last-child):not(:empty) {
  margin-right: 6px;
}

.page_tags a {
  flex: none;
  color: var(--text-soft) !important;
  font-size: 13px;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.page_tags a:hover {
  color: var(--text) !important;
}

.page_tags a:not(:empty)::before {
  content: "#";
  color: var(--text-fade);
  font-size: 10px;
}

.page_tags a.hidden {
  display: none !important;
}

.page_tags-more {
  position: relative;
  padding: 5px;
  border-radius: 22px;
  color: var(--text-fade);
  font-size: 16px;
  line-height: 1;
  transition:
    color 0.2s ease,
    letter-spacing 0.2s ease;
}

.page_tags-more:hover {
  color: var(--text-soft);
  cursor: pointer;
  letter-spacing: 4px;
}

/* =========================
   LOADING / SPIN
   ========================= */

.is-loading {
  pointer-events: none;
}

.spin {
  animation: uiSpin 0.8s linear infinite;
}

@keyframes uiSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* =========================
   MICRO ANIMATIONS
   ========================= */

.fade-in {
  animation: uiFadeIn 0.2s ease;
}

.scale-in {
  animation: uiScaleIn 0.2s ease;
}

@keyframes uiFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes uiScaleIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* =========================
   RESPONSIVE HELPERS
   ========================= */

@media screen and (max-width: 768px) {
  .tablet-hidden {
    display: none !important;
  }
}

@media screen and (max-width: 640px) {
  .mobile-hidden {
    display: none !important;
  }

  .mobile-block {
    display: block !important;
  }

  .mobile-flex {
    display: flex !important;
  }
}

/* =========================
   REDUCED MOTION
   ========================= */

@media (prefers-reduced-motion: reduce) {
  .slice,
  .page_tags a,
  .page_tags-more,
  .card-menu-backdrop {
    transition: none !important;
  }

  .spin,
  .fade-in,
  .scale-in {
    animation: none !important;
  }
}