/* ------------------------------------------------------------------
   Materials — four layers, inverted on hover/focus
------------------------------------------------------------------- */
.materials {
  padding: calc(var(--hud) + 8vh) var(--gutter) 12vh;
  display: grid; align-content: center; gap: 28px;
  overflow-x: clip; /* the panels slide in from beyond the edges */
}
.mat-heading {
  max-width: 22ch; font: 300 clamp(36px, 4.6vw, 80px)/1.02 var(--f-display); letter-spacing: -.04em;
}
.mat-heading b { font-weight: 800; }

.mat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 3vh; }
.mat-panel {
  position: relative; overflow: clip; min-height: clamp(300px, 46vh, 440px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  padding: 22px; border: 1px solid var(--fg-16); border-radius: 10px;
  transition: background-color .45s var(--ease-osmo), color .45s var(--ease-osmo), border-color .45s var(--ease-osmo);
  cursor: default;
}
.mat-num { color: var(--fg-72); transition: color .45s var(--ease-osmo); }
.mat-name { font: 800 clamp(40px, 3.8vw, 64px)/.9 var(--f-display); letter-spacing: -.05em; text-transform: uppercase; }
.tools { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tools li { font-size: 13px; line-height: 1; padding: 7px 11px; border-radius: 999px; border: 1px solid currentColor; }

.mat-panel:hover, .mat-panel:focus-visible, .mat-panel:focus {
  background: var(--paper); color: var(--ink); border-color: var(--paper); outline: none;
}
.mat-panel:hover .mat-num, .mat-panel:focus .mat-num { color: color-mix(in srgb, var(--ink) 72%, transparent); }
.mat-panel:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg); }

/* the pop card */
.mat-pop {
  position: absolute; right: -14px; top: 56px; width: min(78%, 260px);
  border-radius: 8px; overflow: hidden; box-shadow: 0 24px 48px -16px rgb(0 0 0 / .55);
  transform: translate(24px, 12px) rotate(10deg); opacity: 0; visibility: hidden;
  transition: transform .6s var(--ease-expo), opacity .4s var(--ease-osmo), visibility 0s .4s;
}
.mat-pop img { aspect-ratio: 16 / 10; width: 100%; object-fit: cover; object-position: top; }
.mat-pop pre {
  margin: 0; padding: 14px 16px; background: #141418; color: #e4e2dc;
  font: 400 11px/1.6 var(--f-mono); white-space: pre; overflow: hidden;
}
.mat-panel:hover .mat-pop, .mat-panel:focus .mat-pop {
  transform: rotate(6deg); opacity: 1; visibility: visible;
  transition: transform .6s var(--ease-expo), opacity .4s var(--ease-osmo), visibility 0s;
}

@media (max-width: 899px) {
  .mat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .mat-grid { grid-template-columns: minmax(0, 1fr); }
  .mat-panel { min-height: 240px; }
}
