/* Tools: one screen. A mottled sage wall with the heading and every tool hung on it; along the bottom, a purple
   Persian rug the three cats walk across as you scroll (scripts/scenes/tools.js). */

.tools {
  --sage: #b9cbb1;
  --sage-deep: #9fb596;
  --plum: #3a1f5c;
  --ink: #23271f;
  position: relative;
  background: var(--sage);
  color: var(--ink);
}

.tools__walk { position: relative; height: 240svh; }

.tools__stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
  /* The wall: soft, uneven washes of sage, like the painted wall in the picture. */
  background:
    radial-gradient(40% 30% at 18% 22%, rgba(255, 255, 255, 0.18), transparent 70%),
    radial-gradient(35% 40% at 80% 30%, rgba(120, 150, 110, 0.22), transparent 70%),
    radial-gradient(50% 35% at 60% 75%, rgba(255, 255, 255, 0.14), transparent 70%),
    radial-gradient(30% 30% at 30% 70%, rgba(110, 140, 100, 0.18), transparent 70%),
    var(--sage);
}

/* ── The wall ── */

.tools__wall {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(28px, 5svh, 56px);
  padding: clamp(28px, 6svh, 72px) max(20px, 6vw) clamp(20px, 4svh, 40px);
}

.tools__head { text-align: center; }

.tools__kicker {
  margin: 0 0 0.5em;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(35, 39, 31, 0.6);
}

.tools__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 380;
  font-style: normal;
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0;
  letter-spacing: -0.015em;
  text-transform: none;
  font-size: clamp(3rem, 1.8rem + 4.5vw, 6rem);
  line-height: 0.95;
  color: var(--plum);
}

.tools__intro {
  margin: 0.8em 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.1rem);
  color: rgba(35, 39, 31, 0.75);
}

/* The tools: small frames hung in even rows, a name beneath each. */
.tools__list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(20px, 3.4svh, 36px) clamp(20px, 3vw, 44px);
  width: min(100%, 980px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tool {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.tool__frame {
  display: grid;
  place-items: center;
  width: clamp(56px, min(9vw, 11svh), 104px);
  aspect-ratio: 1;
  padding: 16%;
  border-radius: 22%;
  background: #f4f1e8;
  box-shadow:
    0 0 0 1px rgba(58, 31, 92, 0.08),
    0 10px 18px -10px rgba(40, 50, 30, 0.45);
  transition: translate 0.4s var(--ease-out), box-shadow 0.4s;
}

.tool__frame img { width: 100%; height: 100%; object-fit: contain; }

.tool:hover .tool__frame { translate: 0 -4px; box-shadow: 0 0 0 1px rgba(58, 31, 92, 0.12), 0 16px 22px -12px rgba(40, 50, 30, 0.5); }

.tool__ph {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(35, 39, 31, 0.4);
}

.tool__name {
  font-family: 'Figtree', var(--font-ui);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  text-transform: lowercase;
}

/* ── The rug, and the cats walking on it ── */

.rug {
  position: relative;
  height: clamp(130px, 24svh, 240px);
  background: var(--rug, #3a1f5c) 0 0 / auto 100% repeat-x;
  box-shadow: 0 -2px 0 #1e1030, 0 -14px 24px -10px rgba(30, 40, 20, 0.35);
}

.troupe {
  --ch: min(27svh, 25vw);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22%;
  height: var(--ch);
}

.cat {
  position: absolute;
  bottom: 0;
  left: 0;
  width: calc(var(--ch) * 0.8);
  height: var(--ch);
  will-change: transform;
}

.cat img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  opacity: 0;
  transition: opacity 0.09s linear;
}

.cat img.is-on { opacity: 1; }

.cat__shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -4%;
  height: 10%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(15, 5, 25, 0.6), rgba(15, 5, 25, 0));
}

.tools [data-reveal] { opacity: 0; transform: translateY(12px); transition: opacity 0.8s var(--ease-out), transform 1s var(--ease-out); transition-delay: calc(var(--i, 0) * 0.04s); }
.tools [data-reveal].is-in { opacity: 1; transform: none; }

@media (max-width: 900px) { .tools__list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

@media (max-width: 520px) {
  .tools__list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 14px; }
  .tool__frame { width: 58px; }
  .tool__name { font-size: 0.72rem; }
  .rug { height: 120px; }
  .troupe { --ch: 128px; }
}

@media (prefers-reduced-motion: reduce) {
  .tools__walk { height: auto; }
  .tools__stage { position: relative; }
  .tools [data-reveal] { opacity: 1; transform: none; }
}
