/* ---------- Page & sections ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.boot__cycle {
  position: relative;
  width: 64px;
  height: 64px;
  font-size: 42px;
  line-height: 1;
}
.boot__cycle span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  animation: boot-emoji 4.8s linear infinite;
}
.boot__cycle span:nth-child(2) { animation-delay: 0.8s; }
.boot__cycle span:nth-child(3) { animation-delay: 1.6s; }
.boot__cycle span:nth-child(4) { animation-delay: 2.4s; }
.boot__cycle span:nth-child(5) { animation-delay: 3.2s; }
.boot__cycle span:nth-child(6) { animation-delay: 4s; }
@keyframes boot-emoji {
  0% { opacity: 0; }
  5% { opacity: 1; }
  14% { opacity: 1; }
  19% { opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .boot__cycle span { animation: none; opacity: 0; }
  .boot__cycle span:first-child { opacity: 1; }
}

.page {
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: page-in 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.topbar {
  display: flex;
  align-items: center;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #ffffff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.back:active {
  transform: scale(0.96);
}

.section {
  display: flex;
  flex-direction: column;
}

.section__title {
  font-size: 16px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #000000;
  text-align: left;
  margin: 0 0 10px 0;
  padding: 0;
  text-wrap: balance;
}

.grid {
  container: cards / inline-size;
  display: grid;
  align-items: stretch;
}
.grid--hero {
  grid-template-columns: 1fr;
}
.grid--tile {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}
.grid--half {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}

/* ---------- Card Styles: Flat, solid colors, 16px radius, no border, no outline ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  background: var(--card-gray);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.card:active,
.card.is-pressed {
  transform: scale(0.96);
}

.card[data-accent="hero-gray"] { background: var(--card-hero-gray); }
.card[data-accent="gray"] { background: var(--card-gray); }
.card[data-accent="purple"] { background: var(--card-purple); }
.card[data-accent="yellow"] { background: var(--card-yellow); }
.card[data-accent="peach"] { background: var(--card-peach); }
.card[data-accent="pink"] { background: var(--card-pink); }

.card__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* One title / description style shared by every card */
.card__title {
  position: relative;
  z-index: 1;
  font-size: var(--card-title-size);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--card-title-color);
  overflow-wrap: normal;
  white-space: pre-line;
}
.card__desc {
  font-size: var(--card-desc-size);
  line-height: 1.35;
  font-weight: 400;
  letter-spacing: -0.003em;
  color: var(--card-desc-color);
  white-space: pre-line;
}

/* ---------- Hero Card Layouts ---------- */
.card--hero {
  min-height: 120px;
}

/* Ex24.pro Card */
.card[data-id="exchange"] {
  min-height: 160px;
  padding: 16px 16px 14px 16px;
  justify-content: space-between;
}
.card[data-id="exchange"] .card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.card[data-id="exchange"] .card__text {
  flex: 1 1 auto;
}
.card[data-id="exchange"] .logo {
  flex: none;
  width: clamp(126px, 48%, 174px);
  height: 78px;
  object-fit: contain;
  object-position: right center;
}

/* Legalization Banner Card */
.card[data-id="legalization_banner"] {
  min-height: 120px;
  padding: 16px 0 0 16px;
}
.card[data-id="legalization_banner"] .card__body {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  height: 100%;
}
.card[data-id="legalization_banner"] .card__text {
  /* Stop short of the bottom-right icon on narrow cards */
  max-width: min(190px, calc(100% - var(--icon-banner) - var(--icon-inset) - 4px));
  padding-bottom: 12px;
}

/* ---------- Icons: fixed square boxes, uniform inset ---------- */
.card-picture {
  display: block;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  line-height: 0;
  overflow: visible;
}
.card[data-id="exchange"] .card__head .card-picture {
  display: flex;
  flex: none;
  width: auto;
  height: auto;
  line-height: 1;
  margin-right: -8px;
}
.card__tile-img,
.card__half-img,
.card__hero-img {
  position: absolute;
  right: var(--icon-inset);
  bottom: var(--icon-inset);
  object-fit: contain;
  object-position: center;
}
.card__tile-img {
  width: var(--icon-tile);
  height: var(--icon-tile);
}
.card[data-id="vpn"] .card__tile-img,
.card[data-id="esim"] .card__tile-img {
  top: 10%;
  bottom: auto;
  width: 40%;
  height: 80%;
}
.card__half-img {
  width: var(--icon-half);
  height: var(--icon-half);
}
.card__hero-img {
  width: var(--icon-banner);
  height: var(--icon-banner);
}

/* ---------- Tile Card Layout (3 columns) ---------- */
.card--tile {
  container-type: inline-size;
  min-height: 96px;
  padding: var(--icon-inset) 10px;
}
/* "Виртуальная" must fit on one line in the narrowest tile (360px screens) */
.card--tile .card__title {
  font-size: min(var(--card-title-size), calc(100cqw / 6.4));
}

/* ---------- Half Card Layout (2 columns) ---------- */
.card--half {
  min-height: 110px;
  padding: 14px var(--icon-inset) var(--icon-inset) 14px;
}
.card--half .card__title {
  max-width: 125px;
}

/* Primary CTA Button: Golden-yellow background, black text, 14px radius */
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 14px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: #000000;
  background: var(--accent-cta);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.1s ease, background 0.1s ease;
}
.cta:active {
  background: var(--accent-cta-active);
  transform: scale(0.98);
}

/* ---------- Hover (mouse/trackpad only, so taps don't leave cards stuck) ---------- */
@media (hover: hover) and (pointer: fine) {
  .card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }
  .card:hover {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  }
  .card:hover .cta,
  .cta:hover {
    background: var(--accent-cta-active);
  }
  .back:hover {
    background: #f8fafc;
  }
  .card__tile-img,
  .card__half-img,
  .card__hero-img,
  .card .logo {
    transition: transform 0.25s ease;
  }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .card:hover {
    transform: translateY(-2px);
  }
  .card:hover :is(.card__tile-img, .card__half-img, .card__hero-img, .logo) {
    transform: scale(1.06);
  }
  .card:active,
  .card.is-pressed {
    transform: translateY(-2px) scale(0.98);
  }
}

.link {
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent-ink);
}

/* Skeleton */
.skeleton {
  border-radius: var(--radius-lg);
  background: #f1f1f6;
  animation: pulse 1.5s ease-in-out infinite;
}
.skeleton--title {
  width: 50%;
  height: 20px;
  margin-bottom: 10px;
  border-radius: 8px;
}
.skeleton--hero { height: 160px; }
.skeleton--tile { height: 96px; }
.skeleton--half { height: 110px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Message screens */
.message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18vh;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--card-gray);
}
.message h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.022em;
}
.message p {
  color: var(--ink-soft);
  line-height: 1.45;
}
.message .cta {
  width: auto;
  margin-top: 6px;
  padding: 12px 20px;
}

/* ---------- Narrow phones (under ~410px) ---------- */
@container cards (max-width: 380px) {
  /* The hand-placed line breaks no longer fit; let the text flow instead */
  .card[data-id="exchange"] .card__desc {
    white-space: normal;
    text-wrap: pretty;
  }
  .card--tile {
    --icon-tile: 44px;
  }
  .card--half {
    --icon-half: 60px;
    --card-title-size: 13px;
    min-height: 118px;
  }
}
