/* Stack & craft — the conjurer's orb.
   A dark, cinematic stage in both themes. Skills orbit the orb held in the
   figure's palm: the back half of every orbit passes behind the figure and
   the orb, the front half sweeps across in front of it. */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#stack {
  overflow-x: clip;
}

.stack-stage {
  --ink: #eef5ef;
  --ink-2: #c3d2c6;
  --ink-3: #8aa08f;
  --line: rgba(160, 255, 190, 0.12);
  --line-2: rgba(160, 255, 190, 0.24);
  --em: #6dff8f;
  --em-2: #c9ffd3;
  --em-dim: rgba(80, 255, 130, 0.14);

  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(22px, 4vw, 52px);
  border: 1px solid var(--line);
  border-radius: clamp(22px, 3vw, 36px);
  color: var(--ink);
  background:
    radial-gradient(900px 560px at 72% 46%, rgba(30, 160, 80, 0.2), transparent 62%),
    radial-gradient(700px 400px at 0% 0%, rgba(20, 90, 50, 0.28), transparent 60%),
    linear-gradient(180deg, #06100b, #030705 70%);
  box-shadow:
    0 40px 90px -40px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(200, 255, 220, 0.08);
}

/* fine film grain + vignette */
.stack-stage::before,
.stack-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.stack-stage::before {
  background-image: radial-gradient(rgba(190, 255, 210, 0.07) 1px, transparent 1.2px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at 70% 50%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 50%, #000, transparent 75%);
}

.stack-stage::after {
  background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55));
}

.stack-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(8px, 2vw, 28px);
  align-items: center;
}

.stack-copy {
  position: relative;
  z-index: 3;
}

.stack-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--em);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stack-eyebrow span {
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--em));
  box-shadow: 0 0 10px var(--em);
}

.stack-grid h2 {
  max-width: 11ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 5.6vw, 5rem);
  font-weight: 500;
  line-height: 0.92;
  color: var(--ink);
}

.stack-grid h2 em {
  display: block;
  color: transparent;
  font-style: italic;
  background: linear-gradient(100deg, #7dffa0 10%, #e3ffd0 50%, #4fe37f 90%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 22px rgba(80, 255, 130, 0.35));
}

.stack-lead {
  max-width: 44ch;
  margin-top: 20px;
  color: var(--ink-2);
}

.stack-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.stack-key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(120, 255, 170, 0.04);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 0.25s, background 0.25s, color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.stack-key:hover,
.stack-key:focus-visible {
  border-color: var(--dot);
  background: color-mix(in srgb, var(--dot) 14%, transparent);
  color: #fff;
  box-shadow: 0 0 22px -4px var(--dot);
  transform: translateY(-1px);
  outline: none;
}

.stack-key i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 10px var(--dot);
}

.group-core { --dot: #f2d38a; }
.group-cloud { --dot: #7fbcff; }
.group-security { --dot: #ff8f7c; }
.group-data { --dot: #6dff9a; }
.group-tools { --dot: #cfb0ff; }

/* ---------- the scene ---------- */

.orb-wrap {
  position: relative;
  z-index: 1;
  min-width: 0;
  /* the scene bleeds into the card edges on the right */
  margin: calc(clamp(22px, 4vw, 52px) * -1) calc(clamp(22px, 4vw, 52px) * -1) 0 0;
}

.conjure {
  position: relative;
  height: clamp(560px, 58vw, 760px);
  overflow: hidden;
  touch-action: pan-y; /* touch: swipe sideways to spin, up/down still scrolls the page */
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  /* fade the scene into the card instead of a hard edge */
  mask-image: linear-gradient(90deg, transparent 0, #000 9%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 9%);
}

@media (pointer: fine) {
  .conjure { touch-action: none; }
}


.cj-haze {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(34% 36% at 50% 50%, rgba(90, 255, 120, 0.3), transparent 70%),
    radial-gradient(64% 60% at 50% 50%, rgba(30, 180, 80, 0.18), transparent 72%);
  animation: cj-breathe 5s ease-in-out infinite;
}

.cj-fx,
.cj-chips,
.cj-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cj-figure { z-index: 2; }
.cj-back {
  z-index: 3;
  /* silhouette cut-out of the figure: orbit lines and chips vanish behind it */
  -webkit-mask-image: url("../assets/images/stack-conjurer-mask.png");
  mask-image: url("../assets/images/stack-conjurer-mask.png");
  -webkit-mask-size: auto 100%;
  mask-size: auto 100%;
  -webkit-mask-position: center bottom;
  mask-position: center bottom;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.cj-core { z-index: 4; }
.cj-fx--front { z-index: 6; }
.cj-chips--front { z-index: 7; }

/* the photo and the orb glow share the exact same coordinate box */
.cj-box {
  position: absolute;
  bottom: 0;
  left: 50%;
  height: 100%;
  aspect-ratio: 1080 / 1920;
  transform: translateX(-50%);
  pointer-events: none;
}

/* ...and its top edge (a separate mask so the two fades multiply) */
.cj-figure {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14%);
  mask-image: linear-gradient(180deg, transparent 0, #000 14%);
}

.cj-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* melt the photo's side edges into the card */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 24%, #000 76%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 24%, #000 76%, transparent 100%);
  filter: saturate(1.08) contrast(1.04);
}

/* ---------- glow laid over the photo's own orb ---------- */

.cj-orb,
.cj-orb-gl,
.cj-pulse {
  position: absolute;
  left: 50.2%;
  top: 50%;
  width: 40.3%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* the re-projected, turning sphere sits exactly over the photo's own orb */
.cj-orb-gl {
  display: block;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.cj-orb-gl.is-ready {
  opacity: 1;
}

.cj-orb {
  mix-blend-mode: screen;
  box-shadow:
    0 0 40px 8px rgba(120, 255, 110, 0.35),
    0 0 110px 36px rgba(40, 220, 80, 0.28),
    0 0 240px 90px rgba(20, 160, 60, 0.2),
    inset 0 0 40px 6px rgba(150, 255, 130, 0.22);
  animation: cj-glow 4s ease-in-out infinite;
}

.cj-pulse {
  border: 1px solid rgba(160, 255, 170, 0.65);
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  animation: cj-pulse 4.8s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

.cj-pulse--b {
  animation-delay: 2.4s;
}

/* ---------- chips ---------- */

.cj-chip {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 11px;
  border: 1px solid color-mix(in srgb, var(--dot) 45%, rgba(255, 255, 255, 0.12));
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)),
    rgba(6, 18, 11, 0.62);
  color: #f2fff4;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow:
    0 6px 18px -6px rgba(0, 0, 0, 0.8),
    0 0 14px -4px var(--dot),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  will-change: transform, opacity;
  transition: box-shadow 0.3s, border-color 0.3s;
}

.cj-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 9px 1px var(--dot);
}

.cj-chip.is-lit {
  border-color: var(--dot);
  box-shadow:
    0 6px 18px -6px rgba(0, 0, 0, 0.8),
    0 0 26px 0 var(--dot),
    inset 0 0 12px color-mix(in srgb, var(--dot) 40%, transparent);
}

.orb-caption {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  bottom: 14px;
  margin: 0;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0.8;
}

/* ---------- stats ---------- */

.stack-stats {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: clamp(8px, 2vw, 22px);
}

.stack-card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(150, 255, 190, 0.07), rgba(150, 255, 190, 0.015));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.3s, transform 0.3s;
}

.stack-card:hover {
  border-color: var(--line-2);
  transform: translateY(-2px);
}

.stack-card strong {
  display: block;
  color: var(--em-2);
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 500;
  line-height: 1.1;
  text-shadow: 0 0 24px rgba(80, 255, 130, 0.4);
}

.stack-card span {
  color: var(--ink-3);
  font-size: 0.88rem;
}

/* ---------- motion ---------- */

@keyframes cj-breathe {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

@keyframes cj-glow {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

@keyframes cj-pulse {
  0% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3.4); }
}

@media (prefers-reduced-motion: reduce) {
  .cj-haze,
  .cj-orb,
  .cj-pulse { animation: none; }
  .cj-pulse { opacity: 0; }
}

@media (max-width: 980px) {
  .stack-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .orb-wrap {
    margin: 4px calc(clamp(22px, 4vw, 52px) * -1) 0;
  }

  .conjure {
    height: clamp(460px, 96vw, 640px);
    mask-image: none;
    -webkit-mask-image: none;
  }

  .stack-grid h2 {
    max-width: none;
  }

  .stack-stats {
    grid-template-columns: 1fr;
    margin-top: 0;
  }
}

@media (max-width: 560px) {
  .cj-chip {
    padding: 5px 10px 5px 8px;
    font-size: 0.72rem;
  }
}
