/* Инструменты созависимости — flip-cards в дизайне Системы */

.tools-page {
  position: relative;
  isolation: isolate;
  padding: 0 0 110px;
  background: #050506;
  overflow: hidden;
}

.tools-page::before {
  content: "";
  position: fixed;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 3, 4, 0.18), #050506 78%),
    var(--tools-page-image) center top / cover no-repeat;
  filter: saturate(0.92) contrast(0.94);
  opacity: 0.3;
  transform: scale(1.04);
}

.tools-page::after {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 12%, rgba(255, 255, 255, 0.11), transparent 42%),
    linear-gradient(180deg, transparent 0, rgba(5, 5, 6, 0.76) 42%, #050506 78%);
}

.tools-hero {
  min-height: min(60vh, 540px);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.14), rgba(5, 5, 6, 0.9) 88%, #050506),
    var(--tools-page-image) center / cover no-repeat !important;
}

.tools-hero .hero-content {
  filter: none;
}

.tools-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 16px 0;
}

.tools-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.tools-back:hover {
  color: #fff;
}

.tools-intro {
  margin-bottom: 22px;
}

.tools-intro .ios-section-kicker {
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.48);
}

.tools-intro h1 {
  margin: 0 0 10px;
  color: #fff;
  font-size: clamp(28px, 5vw, 40px);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.tools-intro p {
  margin: 0;
  max-width: 54ch;
  color: rgba(255, 255, 255, 0.58);
  line-height: 1.55;
  font-size: 15px;
}

.tools-hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.tools-hub-card {
  position: relative;
  min-height: 290px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  background: rgba(12, 12, 14, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    0 24px 70px rgba(0, 0, 0, 0.42);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.tools-hub-card:hover {
  border-color: rgba(255, 255, 255, 0.32);
  transform: translateY(-3px);
}

.tools-hub-card-image {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--hub-image) center / cover no-repeat;
  filter: saturate(0.88) brightness(0.88);
  transform: scale(1.02);
  transition: transform 0.6s ease, filter 0.35s ease;
}

.tools-hub-card:hover .tools-hub-card-image {
  transform: scale(1.06);
  filter: saturate(1) brightness(0.92);
}

.tools-hub-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04) 10%, rgba(0, 0, 0, 0.54) 52%, rgba(5, 5, 7, 0.94) 100%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.13), transparent 24%);
}

.tools-hub-card-illusions { --hub-image: url("/assets/webp/tool-illusions.webp"); }
.tools-hub-card-dictionary { --hub-image: url("/assets/webp/tool-dictionary.webp"); }
.tools-hub-card-i-statements { --hub-image: url("/assets/webp/tool-i-statements.webp"); }
.tools-hub-card-antivirus { --hub-image: url("/assets/webp/tool-antivirus.webp"); }

.tools-hub-card-copy {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 8px;
  padding: 22px;
  backdrop-filter: blur(16px) saturate(0);
  -webkit-backdrop-filter: blur(16px) saturate(0);
}

.tools-hub-card-copy span {
  display: inline-flex;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.19);
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tools-hub-card-copy strong {
  color: #fff;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.tools-hub-card-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 14px;
  line-height: 1.5;
}

.tools-hub-card-copy i {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
}

.tools-hub-card-copy i b {
  font-size: 16px;
  font-weight: 400;
}

.tools-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.tools-chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.tools-chip.is-active {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.tools-search {
  width: 100%;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 15px;
  outline: none;
}

.tools-search::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.tools-search:focus {
  border-color: rgba(255, 255, 255, 0.34);
}

.tools-list {
  display: grid;
  gap: 14px;
}

/* Flip cards */
.sm-flip {
  perspective: 1100px;
  height: 250px;
  position: relative;
  cursor: pointer;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  outline: none;
}

.sm-flip.is-tall {
  height: 320px;
}

.sm-flip-face {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.19),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    0 24px 70px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 20px 18px;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.15), transparent 34%),
    linear-gradient(145deg, rgba(30, 30, 34, 0.68), rgba(8, 8, 10, 0.57)),
    rgba(8, 8, 10, 0.52);
  backdrop-filter: blur(28px) saturate(0);
  -webkit-backdrop-filter: blur(28px) saturate(0);
}

.sm-flip-front {
  transform: rotateY(0deg);
}

.sm-flip-back {
  transform: rotateY(180deg);
}

.sm-flip.is-flipped .sm-flip-front {
  transform: rotateY(180deg);
}

.sm-flip.is-flipped .sm-flip-back {
  transform: rotateY(0deg);
}

.sm-flip-face::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.13), transparent 25%),
    radial-gradient(circle at 85% 110%, rgba(255, 255, 255, 0.06), transparent 36%);
}

.sm-flip-meta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.sm-flip-pill {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 700;
}

.sm-flip-pill.is-soft {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.62);
}

.sm-flip-text {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 4px 8px;
}

.sm-flip-text p {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.4;
}

.sm-flip-text .sm-flip-sub {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
}

.sm-flip-hint {
  position: relative;
  text-align: center;
  color: rgba(255, 255, 255, 0.42);
  font-size: 12.5px;
  font-weight: 550;
}

.sm-flip-section-label {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
}

.sm-dict-card {
  position: relative;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.11), transparent 34%),
    rgba(14, 14, 16, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    0 18px 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(24px) saturate(0);
  -webkit-backdrop-filter: blur(24px) saturate(0);
  padding: 20px;
}

.sm-dict-card h3 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.sm-dict-card .sm-dict-body {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-line;
}

.tools-empty {
  padding: 28px 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 14px;
}

/* Today block */
.today-soza-tools-panel.hidden {
  display: none;
}

.today-soza-tools-grid {
  display: flex;
  gap: 14px;
  width: 100%;
  padding: 8px 2px 16px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}

.today-soza-tools-grid::-webkit-scrollbar {
  display: none;
}

.today-soza-tools-grid.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  user-select: none;
  -webkit-user-select: none;
}

.today-soza-tool-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 0 0 min(72vw, 270px);
  height: 300px;
  min-height: 0;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  background: rgba(10, 10, 12, 0.46);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 20px 54px rgba(0, 0, 0, 0.32);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  scroll-snap-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.today-soza-tool-card::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background: var(--tool-image) center / cover no-repeat;
  filter: saturate(0.92) contrast(0.94);
  transform: scale(1.02);
  transition: transform 0.55s ease, filter 0.3s ease;
}

.today-soza-tool-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.12) 30%, rgba(3, 3, 4, 0.94) 100%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.12), transparent 24%);
}

.today-soza-tool-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
}

.today-soza-tool-card:hover::before {
  transform: scale(1.07);
  filter: saturate(1) contrast(0.96);
}

.today-soza-tool-number {
  width: fit-content;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.today-soza-tool-copy {
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding-top: 56px;
}

.today-soza-tool-copy strong {
  color: #fff;
  font-size: 16px;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.today-soza-tool-copy small {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  line-height: 1.4;
}

.today-soza-tool-card > i {
  position: absolute;
  right: 15px;
  top: 15px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
  font-style: normal;
}

.today-soza-tools-all {
  margin: 14px 0 0;
}

.today-soza-tools-all a {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13.5px;
  font-weight: 650;
  text-decoration: none;
}

.today-soza-tools-all a:hover {
  color: #fff;
}

@media (max-width: 640px) {
  .sm-flip {
    height: 230px;
  }

  .tools-hub-grid {
    grid-template-columns: 1fr;
  }

  .tools-hub-card {
    min-height: 280px;
  }

  .today-soza-tool-card {
    flex-basis: min(72vw, 250px);
    height: 286px;
  }

  .today-soza-tools-grid {
    width: 100vw;
    max-width: none;
    margin-left: calc(50% - 50vw);
    padding: 8px 16px 14px;
    scroll-padding-left: 16px;
  }
}

@media (min-width: 769px) {
  .today-soza-tool-card {
    flex-basis: min(28vw, 300px);
  }

  /* Чтобы последняя карточка в горизонтальной ленте не обрезалась у правого края */
  .today-soza-tools-grid {
    padding-right: 32px;
    scroll-padding-right: 32px;
  }
}

@media (max-width: 768px) {
  .tools-back {
    display: none;
  }
}
