/* ---------- Material–Process matrix diagram ---------- */

.matrix-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.matrix-diagram {
  position: relative;
  width: 100%;
  min-width: 680px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 56px 40px;
}

.matrix-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.matrix-lines path {
  fill: none;
  stroke: rgba(17, 17, 17, 0.14);
  stroke-width: 1;
  transition: stroke 0.3s ease, stroke-width 0.3s ease;
}

.matrix-lines path.is-active {
  stroke: rgba(17, 17, 17, 0.65);
  stroke-width: 1.25;
}

.matrix-lines path.is-dim {
  stroke: rgba(17, 17, 17, 0.045);
}

.matrix-columns {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 48px;
}

.matrix-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 130px;
}

.matrix-column-header {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 30px;
  white-space: nowrap;
}

.matrix-term-list {
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
}

.matrix-term {
  background: #ffffff;
  border: none;
  padding: 2px 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.01em;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: font-weight 0.15s ease, color 0.15s ease;
}

.matrix-term:hover {
  color: var(--ink-soft);
}

.matrix-term.is-selected {
  font-weight: 600;
}

/* ---------- Project preview popup ---------- */

.popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.popup-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.popup-window {
  width: min(880px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(17, 17, 17, 0.14), 0 4px 14px rgba(17, 17, 17, 0.06);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1);
}

.popup-backdrop.is-open .popup-window {
  transform: scale(1) translateY(0);
}

.popup-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  flex: 0 0 auto;
}

.popup-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  padding: 0;
}

.popup-dot-red { background: #ff5f57; cursor: pointer; }
.popup-dot-yellow { background: #febc2e; }
.popup-dot-green { background: #28c840; }

.popup-content {
  display: flex;
  gap: 32px;
  padding: 28px 32px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.popup-text {
  flex: 1 1 45%;
  min-width: 0;
}

.popup-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.popup-description {
  margin: 0;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.75;
  color: var(--ink-soft);
}

.popup-media {
  flex: 1 1 55%;
  min-width: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #f2f2f2;
  min-height: 220px;
}

.popup-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.popup-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px 24px;
  border-top: 1px solid var(--hairline);
  flex: 0 0 auto;
}

.popup-nav-spacer {
  width: 64px;
  flex: 0 0 auto;
}

.popup-tags {
  flex: 1 1 auto;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.popup-nav {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  width: 64px;
  justify-content: flex-end;
}

.popup-nav button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: #ffffff;
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.popup-nav button:hover {
  border-color: var(--ink);
}

@media (max-width: 720px) {
  .popup-content {
    flex-direction: column;
  }
  .popup-media {
    min-height: 200px;
  }
  .popup-footer {
    flex-wrap: wrap;
    justify-content: center;
  }
  .popup-nav-spacer {
    display: none;
  }
}
