/* Content cards grow with the supplied copy and keep item icons together.
   Text stays in the left column. Circuit stripes stay on every big card. */
.mining-icons { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }
.mining-icons .card-image-big { width: 6rem; height: 6rem; }

/* Широкие GUI — база; десктопный буст в gregtech-cards.css. */
.card-image-wrapper-big.media-gui {
  flex: 1 1 40rem;
  width: min(60%, 46rem);
  min-width: 24rem;
  min-height: 18rem;
  place-items: center;
}
.card-image-wrapper-big.media-gui > .card-image-big {
  width: min(100%, 44rem);
  height: auto;
  max-height: 28rem;
  image-rendering: auto;
}
@media (min-width: 981px) {
  .card-image-wrapper-big.media-gui {
    flex: 1 1 48rem;
    width: min(60%, 50rem);
    min-width: 28rem;
    min-height: 20rem;
  }
  .card-image-wrapper-big.media-gui > .card-image-big {
    width: min(100%, 48rem);
    max-height: 30rem;
  }
}
@media (max-width: 980px) {
  .card-image-wrapper-big.media-gui {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
  }
  .card-image-wrapper-big.media-gui > .card-image-big {
    width: min(100%, 34rem);
    max-height: 20rem;
  }
}
.ae2-cards .card-big + .card-big { margin-top: 4rem; }
.ae2-cards > .card-container + .card-big,
.ae2-cards > .card-container + .theme-wrapper { margin-top: 4rem; }
.ranking-group { width: 100%; }
.ranking-group-title { text-align: center; margin: 1.5rem 0; }

/* Long introductions align with the text inset of the next big card. */
.theme-wrapper.theme-wrapper--wide {
  width: min(100%, 72rem);
  max-width: 72rem;
  padding-inline: 7rem;
  align-items: flex-start;
  text-align: left;
}
.theme-wrapper--wide .theme-title.large {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: baseline;
  column-gap: .22em;
  row-gap: 0.06em;
  width: 100%;
  max-width: none;
  text-align: left;
}
.theme-wrapper--wide .theme-title.large > span {
  display: inline;
  width: auto;
  max-width: none;
  text-align: left;
}
.theme-wrapper--wide > .theme-text {
  max-width: none;
  text-align: left;
}
@media (min-width: 981px) {
  .theme-section:has(> .theme-wrapper--wide) { padding-inline: 4rem; }
  .theme-wrapper.theme-wrapper--wide {
    width: min(100%, 79rem);
    max-width: 79rem;
    padding-inline: 4rem;
  }
}
@media (max-width: 980px) {
  /* Крупный H2 (Переход…) + боковые стопы; абзац чуть мельче. */
  main > .theme-section {
    padding-top: 1.75rem;
    padding-bottom: 2.75rem;
  }
  main > .theme-section:has(> .theme-wrapper):not(:has(.card-big)) {
    padding-bottom: 3.5rem;
  }

  .theme-wrapper .theme-title.large {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.1em;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    font-size: clamp(1.55rem, 7.2vw, 2.05rem) !important;
    letter-spacing: -0.015em;
    text-align: center;
  }
  .theme-wrapper .theme-title.large > span {
    display: block;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
    text-align: center;
  }
  /* Wide на мобилке тоже центрируем — узкий экран. */
  .theme-wrapper--wide .theme-title.large {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.1em;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    font-size: clamp(1.55rem, 7.2vw, 2.05rem) !important;
    letter-spacing: -0.015em;
    text-align: center;
  }
  .theme-wrapper--wide .theme-title.large > span {
    display: block;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
    text-align: center;
  }
  .theme-wrapper .theme-text,
  .theme-wrapper--wide > .theme-text {
    max-width: 24rem;
    margin-inline: auto;
    font-size: 0.8rem;
    line-height: 1.45;
    text-align: center;
  }

  .theme-wrapper.theme-wrapper--wide {
    padding-inline: calc(1.75rem - 5px);
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 680px) {
  .theme-wrapper.theme-wrapper--wide { padding-inline: calc(1.4rem - 5px); }
  .theme-wrapper .theme-title.large,
  .theme-wrapper--wide .theme-title.large {
    max-width: 100%;
    font-size: clamp(1.45rem, 7.4vw, 1.9rem) !important;
  }
  .theme-wrapper .theme-text,
  .theme-wrapper--wide > .theme-text {
    font-size: 0.78rem;
  }
  main > .theme-section:has(> .theme-wrapper):not(:has(.card-big)) {
    padding-bottom: 3.85rem;
  }
}

/* Thematic headings use a neutral lead and one section-coloured accent. */
.theme-wrapper .theme-title.large > .theme-heading-lead {
  color: #f4f8ff;
  -webkit-text-fill-color: currentColor;
  hyphens: manual;
  -webkit-hyphens: manual;
}
.theme-wrapper .theme-title.large > .theme-heading-accent {
  color: var(--section-accent, #aa91ff);
  background-image: linear-gradient(105deg, var(--section-accent, #aa91ff), color-mix(in srgb, var(--section-accent, #aa91ff) 55%, white));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* text-shadow вместо filter: drop-shadow не сдвигает glyph box влево при clip */
  filter: none;
  text-shadow: 0 0 .45rem color-mix(in srgb, var(--section-accent, #aa91ff) 42%, transparent);
}

/* Individual AE2 cards keep their own accent for text, border and circuit. */
.ae2-cards > .card-big[data-card-accent="gold"] { --card-color: #f0c96b; }
.ae2-cards > .card-big[data-card-accent="cyan"] { --card-color: #64cfe7; }
.ae2-cards > .card-big[data-card-accent="rose"] { --card-color: #e78bd1; }
.ae2-cards > .card-big[data-card-accent="green"] { --card-color: #9bcf77; }
.ae2-cards > .card-big[data-card-accent="orange"] { --card-color: #f29a5b; }
.ae2-cards > .card-big[data-card-accent="blue"] { --card-color: #76aaf5; }
.ae2-cards > .card-big[data-card-accent="violet"] { --card-color: #aa91ff; }
.ae2-cards > .card-big[data-card-accent="teal"] { --card-color: #5dcab5; }
.theme-section.feature-section.ae2-cards[data-accent] > .card-big[data-card-accent] {
  --card-accent: var(--card-color);
  border-color: color-mix(in srgb, var(--card-accent) 48%, transparent);
  background: radial-gradient(ellipse at 8% 5%, color-mix(in srgb, var(--card-accent) 8%, transparent), transparent 48%), rgba(4, 8, 16, .72);
}
.theme-section.feature-section.ae2-cards[data-accent] > .card-big .theme-title,
.card-big .theme-title .title-lead { color: #f4f8ff; -webkit-text-fill-color: currentColor; }

.card-big .theme-title .title-accent,
.card-big .theme-title .tag {
  --title-color: var(--card-accent);
  color: var(--title-color);
  background-image: linear-gradient(105deg, var(--title-color), color-mix(in srgb, var(--title-color) 55%, white), var(--title-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 .35rem color-mix(in srgb, var(--title-color) 32%, transparent));
}
.card-big .theme-title .title-eco { --title-color: #ed8ad5; }
.card-big .theme-title .tag {
  background-image: linear-gradient(105deg, var(--title-color) 0%, var(--title-color) 38%, #fff 50%, var(--title-color) 62%, var(--title-color) 100%);
  background-size: 270% 100%;
  animation: wipe-date-chrome 5s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .card-big .theme-title .tag { animation: none; }
}

/* Screens supplied for quests and client are shown without cropping. */
.launch-gallery img { height: auto; object-fit: contain; }
.launch-gallery img:last-child:nth-child(odd):not(:only-child) {
  grid-column: 1 / -1;
  width: calc((100% - 1.5rem) / 2);
  justify-self: center;
}
.launch-gallery:has(img:only-child) { max-width: 58rem; grid-template-columns: 1fr; }
@media (max-width: 680px) {
  .launch-gallery img:last-child:nth-child(odd):not(:only-child) { width: 100%; }
}

/* Client screens: a scroll story on desktop, a readable gallery otherwise. */
#client { overflow: visible; }
.client-story {
  position: relative;
  width: min(100%, 79rem);
  margin: 1.5rem auto 0;
}
.client-story__sticky { position: relative; width: 100%; }
.client-story__sticky::before {
  content: "";
  position: absolute;
  inset: 0 -8% 2rem;
  background: radial-gradient(ellipse at 50% 55%, rgba(34, 115, 221, .22), transparent 68%);
  filter: blur(2rem);
  pointer-events: none;
}
.client-device { position: relative; width: 100%; margin-inline: auto; }
.client-screen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.client-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(100, 207, 231, .28);
  border-radius: 1.25rem;
  background: #03070d;
}
.client-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* Загрузка: заполнить высоту монитора, лишняя ширина обрежется */
.client-frame--cover img {
  object-fit: cover;
  object-position: center center;
}
.client-frame--escape {
  background: #03070d;
}
.client-frame--escape .client-frame__under,
.client-frame--escape > img:not(.client-frame__under) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.client-frame--escape .client-frame__under {
  z-index: 0;
  pointer-events: none;
  /* не светить предыдущий слайд сквозь прозрачности оверлея */
  background: #03070d;
}
.client-frame--escape > img:not(.client-frame__under) { z-index: 1; }
.client-frame--escape figcaption { z-index: 2; }
.client-frame figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 2rem 1.2rem .85rem;
  color: #e9f6ff;
  background: linear-gradient(transparent, rgba(2, 8, 17, .88));
  font-size: .75rem;
}
.client-device__base, .client-story__steps { display: none; }
@media (min-width: 981px) { #client { padding-inline: 4rem; } }
@media (max-width: 980px) { .client-story { width: calc(100% - 2rem); } }
@media (max-width: 680px) {
  .client-screen { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 769px) {
  .client-story.is-animated .client-device {
    width: min(100%, 78rem, 125vh);
    padding: .7rem .7rem .9rem;
    border: 1px solid #506176;
    border-radius: 1.4rem 1.4rem .55rem .55rem;
    background: linear-gradient(135deg, #344455, #111b28 38%, #263547);
    box-shadow: 0 2rem 5rem rgba(0, 0, 0, .55), 0 0 4rem rgba(29, 119, 227, .15);
  }
  .client-story.is-animated .client-screen {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    isolation: isolate;
    border-radius: .75rem;
    background: #03070d;
  }
  .client-story.is-animated .client-frame {
    position: absolute;
    inset: 0;
    border: 0;
    border-radius: 0;
    opacity: 0;
    will-change: opacity;
  }
  .client-story.is-animated .client-frame:first-child { opacity: 1; }
  .client-story.is-animated .client-frame figcaption { display: none; }
  .client-story.is-animated .client-device__base {
    display: block;
    position: absolute;
    top: 100%;
    left: -2%;
    width: calc(100% + 4%);
    height: .8rem;
    margin-top: -.05rem;
    border-radius: 0 0 1.5rem 1.5rem;
    background: linear-gradient(#697887, #273746 48%, #111b27);
    box-shadow: 0 .8rem 1.5rem rgba(0, 0, 0, .45);
  }
  .client-story.is-animated .client-story__steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    width: min(100%, 78rem, 125vh);
    margin: 2rem auto 0;
  }
  .client-story__step {
    --fill: 0;
    --tip: 0;
    position: relative;
    padding-top: .9rem;
    color: #8498ae;
    font-size: .72rem;
    transition: color .35s ease, transform .2s ease;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .client-story__step:hover {
    color: #c7ebff;
  }
  .client-story__step:focus-visible {
    color: #e9f8ff;
    outline: none;
  }
  .client-story__step:focus-visible::before {
    box-shadow: 0 0 0 1px rgba(120, 210, 255, .55);
  }
  .client-story__step::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    border-radius: 999px;
    background: rgba(111, 165, 210, .22);
  }
  .client-story__step::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: calc(var(--fill) * 100%);
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(41, 143, 214, .35), #59c8ff 72%, #d7f4ff);
    box-shadow: 0 0 .55rem rgba(89, 200, 255, .55);
    pointer-events: none;
  }
  .client-story__step .client-story__tip {
    position: absolute;
    top: 1px;
    left: calc(var(--fill) * 100%);
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: #e9f8ff;
    box-shadow: 0 0 .55rem rgba(140, 220, 255, .95), 0 0 1.1rem rgba(89, 200, 255, .7);
    opacity: var(--tip);
    transform: translate(-50%, -50%);
    pointer-events: none;
  }
  .client-story__step.is-active { color: #aee7ff; }
}
