/* ============ TECH STACK (#stack) ============ */

/* ── Section shell ──────────────────────────────────── */
#stack {
  background: var(--bg-1);
  overflow: hidden;
  isolation: isolate;
}

/* ── Ambient glows ─────────────────────────────────── */
#stack .stack__glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(90px);
  opacity: 0.38;
}
#stack .stack__glow--a {
  width: clamp(280px, 45vw, 600px);
  aspect-ratio: 1;
  top: -10%;
  right: -8%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
}
#stack .stack__glow--b {
  width: clamp(200px, 32vw, 440px);
  aspect-ratio: 1;
  bottom: 0%;
  left: -6%;
  background: radial-gradient(circle, var(--violet-glow) 0%, transparent 70%);
  opacity: 0.28;
}

/* ── Dot-grid backdrop ─────────────────────────────── */
#stack .stack__dots {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(circle, var(--line-strong) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 60% 40%, #000 0%, transparent 72%);
  mask-image: radial-gradient(ellipse 80% 60% at 60% 40%, #000 0%, transparent 72%);
  opacity: 0.45;
  pointer-events: none;
}

/* ── Section header ────────────────────────────────── */
#stack .stack__heading {
  font-size: var(--fs-h2);
  line-height: 1.08;
  margin-top: var(--space-5);
  margin-bottom: var(--space-5);
  color: var(--text);
}

#stack .stack__lead {
  font-size: var(--fs-lead);
  color: var(--text-dim);
  max-width: 54ch;
  line-height: 1.6;
}

/* Container relative for z layering */
#stack .container {
  position: relative;
  z-index: 1;
}

/* ── Groups grid ────────────────────────────────────── */
#stack .stack__groups {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-7) var(--space-8);
  margin-top: clamp(2rem, 4vw, 3.5rem);
}

@media (min-width: 1024px) {
  #stack .stack__groups {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-8) var(--space-6);
  }
}

@media (max-width: 599px) {
  #stack .stack__groups {
    grid-template-columns: 1fr;
    gap: var(--space-7);
  }
}

/* ── Group block ────────────────────────────────────── */
#stack .stack__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ── Group label ────────────────────────────────────── */
#stack .stack__group-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
  /* override global p color */
  color: var(--text-faint);
}

#stack .stack__group-num {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--accent-bright);
  letter-spacing: 0.05em;
  opacity: 0.8;
}

/* ── Tiles list ─────────────────────────────────────── */
#stack .stack__tiles {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ── Individual tile ────────────────────────────────── */
#stack .stack__tile {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: default;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background   var(--dur-fast) var(--ease-out),
    transform    var(--dur-fast) var(--ease-out),
    box-shadow   var(--dur-fast) var(--ease-out);
  will-change: transform;
  /* min tap target */
  min-height: 52px;
  position: relative;
  overflow: hidden;
}

/* Sheen line on left edge */
#stack .stack__tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  opacity: 0;
  transform: scaleY(0.4);
  transform-origin: center;
  transition:
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

/* hover / focus-within states */
#stack .stack__tile:hover,
#stack .stack__tile:focus-within {
  border-color: var(--accent-line);
  background: var(--surface-2);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--accent-line);
}

#stack .stack__tile:hover::before,
#stack .stack__tile:focus-within::before {
  opacity: 1;
  transform: scaleY(1);
}

#stack .stack__tile:hover .stack__tile-mark,
#stack .stack__tile:focus-within .stack__tile-mark {
  color: var(--accent-bright);
}

#stack .stack__tile:active {
  transform: translateY(-1px);
}

/* ── Tile mark (SVG container) ───────────────────────── */
#stack .stack__tile-mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  background: var(--surface-3);
  border-radius: var(--r-sm);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

#stack .stack__tile:hover .stack__tile-mark,
#stack .stack__tile:focus-within .stack__tile-mark {
  background: var(--accent-soft);
  color: var(--accent-bright);
}

#stack .stack__tile-mark svg {
  display: block;
  width: 20px;
  height: 20px;
}

/* ── Tile name ──────────────────────────────────────── */
#stack .stack__tile-name {
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.2;
  flex: 1;
  transition: color var(--dur-fast) var(--ease-out);
}

#stack .stack__tile:hover .stack__tile-name {
  color: var(--text);
}

/* ── Bottom strip ───────────────────────────────────── */
#stack .stack__strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-4) var(--space-5);
  margin-top: clamp(3rem, 6vw, 5rem);
  padding-top: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
}

#stack .stack__strip-word {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(0.9rem, 1.6vw, 1.25rem);
  color: var(--text-faint);
  letter-spacing: 0.06em;
  opacity: 0.6;
  transition: color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}

#stack .stack__strip-word:hover {
  color: var(--text-dim);
  opacity: 1;
}

#stack .stack__strip-dot {
  color: var(--accent);
  font-size: 0.7em;
  opacity: 0.7;
}

/* ── Responsive adjustments ─────────────────────────── */
@media (max-width: 767px) {
  #stack .stack__heading br {
    display: none;
  }

  #stack .stack__groups {
    gap: var(--space-6);
  }

  #stack .stack__strip {
    gap: var(--space-3) var(--space-4);
  }

  #stack .stack__strip-word {
    font-size: 0.8rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  /* 2-col on tablet is fine; tighten group gap */
  #stack .stack__groups {
    gap: var(--space-6) var(--space-7);
  }
}

/* ── Reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #stack .stack__tile,
  #stack .stack__tile::before,
  #stack .stack__tile-mark,
  #stack .stack__tile-name {
    transition: none !important;
  }
  #stack .stack__tile:hover {
    transform: none;
  }
}
